[PATCH] drm/xe/xe_guc_ads: Add whitelist registers to write list
John Harrison
john.c.harrison at intel.com
Fri Nov 1 18:45:49 UTC 2024
On 11/1/2024 11:04, Jonathan Cavitt wrote:
> When performing a guc_mmio_regset_write, we add all the registers in the
> reg_sr list to the save/restore list, but do not do the same for the
> whitelist registers. Add them in.
>
> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/issues/2249
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> CC: Lucas de Marchi <lucas.demarchi at intel.com>
> CC: Matt Roper <matthew.d.roper at intel.com>
> CC: John Harrison <john.c.harrison at intel.com>
> CC: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
> CC: Ashutosh Dixit <ashutosh.dixit at intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_ads.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c
> index 943146e5b460..2fc6b1ccc8fc 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ads.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ads.c
> @@ -239,9 +239,12 @@ static size_t calculate_regset_size(struct xe_gt *gt)
> enum xe_hw_engine_id id;
> unsigned int count = 0;
>
> - for_each_hw_engine(hwe, gt, id)
> + for_each_hw_engine(hwe, gt, id) {
> xa_for_each(&hwe->reg_sr.xa, sr_idx, sr_entry)
> count++;
> + xa_for_each(&hwe->reg_whitelist.xa, sr_idx, sr_entry)
> + count++;
> + }
>
> count += ADS_REGSET_EXTRA_MAX * XE_NUM_HW_ENGINES;
>
> @@ -727,6 +730,12 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads,
> xa_for_each(&hwe->reg_sr.xa, idx, entry)
> guc_mmio_regset_write_one(ads, regset_map, entry->reg, count++);
>
> + i = 0;
> + xa_for_each(&hwe->reg_whitelist.xa, idx, entry)
> + guc_mmio_regset_write_one(ads, regset_map,
> + RING_FORCE_TO_NONPRIV(hwe->mmio_base, i++),
> + count++);
> +
The code that actually writes to the NONPRIV registers
(xe_reg_sr_apply_whitelist() in xe_reg_src.c) explicitly clears all the
unused registers with a comment of "clear the rest in case of garbage".
If we don't trust the reset state to be valid then we need to ensure all
of them are saved/restored across a reset. Otherwise, that garbage can
come back and cause problems.
John.
> for (e = extra_regs; e < extra_regs + ARRAY_SIZE(extra_regs); e++) {
> if (e->skip)
> continue;
More information about the Intel-xe
mailing list