summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_guc.c
diff options
context:
space:
mode:
authorFrancois Dugast <francois.dugast@intel.com>2023-09-12 08:36:35 +0000
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 11:41:08 -0500
commitc73acc1eeba5e380a367087cb7b933b946613ee7 (patch)
tree7f4df12ec4221d5ffefc92fbbbb813d5874f7c96 /drivers/gpu/drm/xe/xe_guc.c
parent1975b5917a94429096f6a2cccc97ed91e0425708 (diff)
drm/xe: Use Xe assert macros instead of XE_WARN_ON macro
The XE_WARN_ON macro maps to WARN_ON which is not justified in many cases where only a simple debug check is needed. Replace the use of the XE_WARN_ON macro with the new xe_assert macros which relies on drm_*. This takes a struct drm_device argument, which is one of the main changes in this commit. The other main change is that the condition is reversed, as with XE_WARN_ON a message is displayed if the condition is true, whereas with xe_assert it is if the condition is false. v2: - Rebase - Keep WARN splats in xe_wopcm.c (Matt Roper) v3: - Rebase Signed-off-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_guc.c')
-rw-r--r--drivers/gpu/drm/xe/xe_guc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
index 5d32bcee28b6..134019fdda7e 100644
--- a/drivers/gpu/drm/xe/xe_guc.c
+++ b/drivers/gpu/drm/xe/xe_guc.c
@@ -44,11 +44,12 @@ guc_to_xe(struct xe_guc *guc)
static u32 guc_bo_ggtt_addr(struct xe_guc *guc,
struct xe_bo *bo)
{
+ struct xe_device *xe = guc_to_xe(guc);
u32 addr = xe_bo_ggtt_addr(bo);
- XE_WARN_ON(addr < xe_wopcm_size(guc_to_xe(guc)));
- XE_WARN_ON(addr >= GUC_GGTT_TOP);
- XE_WARN_ON(bo->size > GUC_GGTT_TOP - addr);
+ xe_assert(xe, addr >= xe_wopcm_size(guc_to_xe(guc)));
+ xe_assert(xe, addr < GUC_GGTT_TOP);
+ xe_assert(xe, bo->size <= GUC_GGTT_TOP - addr);
return addr;
}
@@ -629,13 +630,13 @@ int xe_guc_mmio_send_recv(struct xe_guc *guc, const u32 *request,
BUILD_BUG_ON(VF_SW_FLAG_COUNT != MED_VF_SW_FLAG_COUNT);
- XE_WARN_ON(guc->ct.enabled);
- XE_WARN_ON(!len);
- XE_WARN_ON(len > VF_SW_FLAG_COUNT);
- XE_WARN_ON(len > MED_VF_SW_FLAG_COUNT);
- XE_WARN_ON(FIELD_GET(GUC_HXG_MSG_0_ORIGIN, request[0]) !=
+ xe_assert(xe, !guc->ct.enabled);
+ xe_assert(xe, len);
+ xe_assert(xe, len <= VF_SW_FLAG_COUNT);
+ xe_assert(xe, len <= MED_VF_SW_FLAG_COUNT);
+ xe_assert(xe, FIELD_GET(GUC_HXG_MSG_0_ORIGIN, request[0]) ==
GUC_HXG_ORIGIN_HOST);
- XE_WARN_ON(FIELD_GET(GUC_HXG_MSG_0_TYPE, request[0]) !=
+ xe_assert(xe, FIELD_GET(GUC_HXG_MSG_0_TYPE, request[0]) ==
GUC_HXG_TYPE_REQUEST);
retry:
@@ -727,6 +728,7 @@ int xe_guc_mmio_send(struct xe_guc *guc, const u32 *request, u32 len)
static int guc_self_cfg(struct xe_guc *guc, u16 key, u16 len, u64 val)
{
+ struct xe_device *xe = guc_to_xe(guc);
u32 request[HOST2GUC_SELF_CFG_REQUEST_MSG_LEN] = {
FIELD_PREP(GUC_HXG_MSG_0_ORIGIN, GUC_HXG_ORIGIN_HOST) |
FIELD_PREP(GUC_HXG_MSG_0_TYPE, GUC_HXG_TYPE_REQUEST) |
@@ -741,8 +743,8 @@ static int guc_self_cfg(struct xe_guc *guc, u16 key, u16 len, u64 val)
};
int ret;
- XE_WARN_ON(len > 2);
- XE_WARN_ON(len == 1 && upper_32_bits(val));
+ xe_assert(xe, len <= 2);
+ xe_assert(xe, len != 1 || !upper_32_bits(val));
/* Self config must go over MMIO */
ret = xe_guc_mmio_send(guc, request, ARRAY_SIZE(request));