diff options
author | Matt Roper <matthew.d.roper@intel.com> | 2023-03-07 16:55:08 -0800 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-19 18:29:44 -0500 |
commit | 39fd0b4507c3ba86ef04827208dd3aa85d2d796e (patch) | |
tree | a0f8fcfec3c57a620e189e770c62d51d4e704b54 | |
parent | 6db7761bbca649319096431c38670c596107596d (diff) |
drm/xe/guc: Handle regset overflow check for entire GT
Checking whether a single engine's register save/restore entries
overflow the expected/pre-allocated GuC ADS regset area isn't terribly
useful; we actually want to check whether the combined entries from all
engines on the GT overflow the regset space.
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://lore.kernel.org/r/20230308005509.2975663-1-matthew.d.roper@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-rw-r--r-- | drivers/gpu/drm/xe/xe_guc_ads.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c index 7a892ff7aba3..fd9911ffeae4 100644 --- a/drivers/gpu/drm/xe/xe_guc_ads.c +++ b/drivers/gpu/drm/xe/xe_guc_ads.c @@ -482,8 +482,6 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, } } - XE_BUG_ON(ads->regset_size < (count * sizeof(struct guc_mmio_reg))); - return count; } @@ -496,6 +494,7 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads) u32 addr = xe_bo_ggtt_addr(ads->bo) + regset_offset; struct iosys_map regset_map = IOSYS_MAP_INIT_OFFSET(ads_to_map(ads), regset_offset); + unsigned int regset_used = 0; for_each_hw_engine(hwe, gt, id) { unsigned int count; @@ -521,7 +520,11 @@ static void guc_mmio_reg_state_init(struct xe_guc_ads *ads) addr += count * sizeof(struct guc_mmio_reg); iosys_map_incr(®set_map, count * sizeof(struct guc_mmio_reg)); + + regset_used += count * sizeof(struct guc_mmio_reg); } + + XE_BUG_ON(regset_used > ads->regset_size); } static void guc_um_init_params(struct xe_guc_ads *ads) |