summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/xe/xe_guc_ads.c
diff options
context:
space:
mode:
authorFrancois Dugast <francois.dugast@intel.com>2023-09-12 10:36:35 +0200
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 17:41:08 +0100
commitc73acc1eeba5e380a367087cb7b933b946613ee7 (patch)
tree7f4df12ec4221d5ffefc92fbbbb813d5874f7c96 /drivers/gpu/drm/xe/xe_guc_ads.c
parentdrm/xe: Introduce Xe assert macros (diff)
downloadlinux-c73acc1eeba5e380a367087cb7b933b946613ee7.tar.xz
linux-c73acc1eeba5e380a367087cb7b933b946613ee7.zip
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_ads.c')
-rw-r--r--drivers/gpu/drm/xe/xe_guc_ads.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c
index 5edee24b97c9..efa4d25424b8 100644
--- a/drivers/gpu/drm/xe/xe_guc_ads.c
+++ b/drivers/gpu/drm/xe/xe_guc_ads.c
@@ -118,7 +118,9 @@ struct __guc_ads_blob {
static size_t guc_ads_regset_size(struct xe_guc_ads *ads)
{
- XE_WARN_ON(!ads->regset_size);
+ struct xe_device *xe = ads_to_xe(ads);
+
+ xe_assert(xe, ads->regset_size);
return ads->regset_size;
}
@@ -309,14 +311,14 @@ int xe_guc_ads_init_post_hwconfig(struct xe_guc_ads *ads)
struct xe_gt *gt = ads_to_gt(ads);
u32 prev_regset_size = ads->regset_size;
- XE_WARN_ON(!ads->bo);
+ xe_gt_assert(gt, ads->bo);
ads->golden_lrc_size = calculate_golden_lrc_size(ads);
ads->regset_size = calculate_regset_size(gt);
- XE_WARN_ON(ads->golden_lrc_size +
- (ads->regset_size - prev_regset_size) >
- MAX_GOLDEN_LRC_SIZE);
+ xe_gt_assert(gt, ads->golden_lrc_size +
+ (ads->regset_size - prev_regset_size) <=
+ MAX_GOLDEN_LRC_SIZE);
return 0;
}
@@ -517,7 +519,7 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads)
regset_used += count * sizeof(struct guc_mmio_reg);
}
- XE_WARN_ON(regset_used > ads->regset_size);
+ xe_gt_assert(gt, regset_used <= ads->regset_size);
}
static void guc_um_init_params(struct xe_guc_ads *ads)
@@ -572,7 +574,7 @@ void xe_guc_ads_populate_minimal(struct xe_guc_ads *ads)
offsetof(struct __guc_ads_blob, system_info));
u32 base = xe_bo_ggtt_addr(ads->bo);
- XE_WARN_ON(!ads->bo);
+ xe_gt_assert(gt, ads->bo);
xe_map_memset(ads_to_xe(ads), ads_to_map(ads), 0, 0, ads->bo->size);
guc_policies_init(ads);
@@ -596,7 +598,7 @@ void xe_guc_ads_populate(struct xe_guc_ads *ads)
offsetof(struct __guc_ads_blob, system_info));
u32 base = xe_bo_ggtt_addr(ads->bo);
- XE_WARN_ON(!ads->bo);
+ xe_gt_assert(gt, ads->bo);
xe_map_memset(ads_to_xe(ads), ads_to_map(ads), 0, 0, ads->bo->size);
guc_policies_init(ads);
@@ -643,7 +645,7 @@ static void guc_populate_golden_lrc(struct xe_guc_ads *ads)
engine_enabled_masks[guc_class]))
continue;
- XE_WARN_ON(!gt->default_lrc[class]);
+ xe_gt_assert(gt, gt->default_lrc[class]);
real_size = xe_lrc_size(xe, class);
alloc_size = PAGE_ALIGN(real_size);
@@ -672,7 +674,7 @@ static void guc_populate_golden_lrc(struct xe_guc_ads *ads)
offset += alloc_size;
}
- XE_WARN_ON(total_size != ads->golden_lrc_size);
+ xe_gt_assert(gt, total_size == ads->golden_lrc_size);
}
void xe_guc_ads_populate_post_load(struct xe_guc_ads *ads)