[PATCH] drm/xe/ptl: Apply Wa_16026007364
Daniele Ceraolo Spurio
daniele.ceraolospurio at intel.com
Wed Jul 23 20:16:01 UTC 2025
On 7/16/2025 3:16 AM, Sk Anirban wrote:
> As part of this WA GuC will save and restore value of two XE3_Media
> control registers that were not included in the HW power context.
>
> Signed-off-by: Sk Anirban <sk.anirban at intel.com>
> ---
> drivers/gpu/drm/xe/abi/guc_klvs_abi.h | 1 +
> drivers/gpu/drm/xe/xe_guc_ads.c | 35 +++++++++++++++++++++++++++
> drivers/gpu/drm/xe/xe_wa_oob.rules | 1 +
> 3 files changed, 37 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h
> index 0366a9da5977..31dbfeee289e 100644
> --- a/drivers/gpu/drm/xe/abi/guc_klvs_abi.h
> +++ b/drivers/gpu/drm/xe/abi/guc_klvs_abi.h
> @@ -396,6 +396,7 @@ enum xe_guc_klv_ids {
> GUC_WORKAROUND_KLV_ID_BACK_TO_BACK_RCS_ENGINE_RESET = 0x9009,
> GUC_WA_KLV_WAKE_POWER_DOMAINS_FOR_OUTBOUND_MMIO = 0x900a,
> GUC_WA_KLV_RESET_BB_STACK_PTR_ON_VF_SWITCH = 0x900b,
> + GUC_WA_KLV_RESTORE_UNSAVED_MEDIA_CONTROL_REG = 0x900c,
> };
>
> #endif
> diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c b/drivers/gpu/drm/xe/xe_guc_ads.c
> index 131cfc56be00..8ff8626227ae 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ads.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ads.c
> @@ -284,6 +284,35 @@ static size_t calculate_golden_lrc_size(struct xe_guc_ads *ads)
> return total_size;
> }
>
> +static void guc_waklv_enable_two_word(struct xe_guc_ads *ads,
> + enum xe_guc_klv_ids klv_id,
> + u32 value1,
> + u32 value2,
> + u32 *offset, u32 *remain)
> +{
> + u32 size;
> + u32 klv_entry[] = {
> + /* 16:16 key/length */
> + FIELD_PREP(GUC_KLV_0_KEY, klv_id) |
> + FIELD_PREP(GUC_KLV_0_LEN, 2),
> + value1,
> + value2,
> + /* 2 dword data */
> + };
> +
> + size = sizeof(klv_entry);
> +
> + if (*remain < size) {
> + drm_warn(&ads_to_xe(ads)->drm,
> + "w/a klv buffer too small to add klv id %d\n", klv_id);
> + } else {
> + xe_map_memcpy_to(ads_to_xe(ads), ads_to_map(ads), *offset,
> + klv_entry, size);
> + *offset += size;
> + *remain -= size;
> + }
> +}
This is now the 3rd version of this function, with the only difference
being the length of the array. I think it is time to rework this to have
a single function to handle all cases.
Since this is a WA, I don't want to block this getting merged on having
to rework the guc_waklv_enable_* functions, but please follow up with a
cleanup to reduce the code duplication.
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
Daniele
> +
> static void guc_waklv_enable_one_word(struct xe_guc_ads *ads,
> enum xe_guc_klv_ids klv_id,
> u32 value,
> @@ -381,6 +410,12 @@ static void guc_waklv_init(struct xe_guc_ads *ads)
> guc_waklv_enable_simple(ads,
> GUC_WA_KLV_RESET_BB_STACK_PTR_ON_VF_SWITCH,
> &offset, &remain);
> + if (GUC_FIRMWARE_VER(>->uc.guc) >= MAKE_GUC_VER(70, 47, 0) && XE_WA(gt, 16026007364))
> + guc_waklv_enable_two_word(ads,
> + GUC_WA_KLV_RESTORE_UNSAVED_MEDIA_CONTROL_REG,
> + 0x0,
> + 0xF,
> + &offset, &remain);
>
> size = guc_ads_waklv_size(ads) - remain;
> if (!size)
> diff --git a/drivers/gpu/drm/xe/xe_wa_oob.rules b/drivers/gpu/drm/xe/xe_wa_oob.rules
> index e990f20eccfe..46ad72bb1f8d 100644
> --- a/drivers/gpu/drm/xe/xe_wa_oob.rules
> +++ b/drivers/gpu/drm/xe/xe_wa_oob.rules
> @@ -72,3 +72,4 @@ no_media_l3 MEDIA_VERSION(3000)
> 14022085890 GRAPHICS_VERSION(2001)
>
> 15015404425_disable PLATFORM(PANTHERLAKE), MEDIA_STEP(B0, FOREVER)
> +16026007364 MEDIA_VERSION(3000)
More information about the Intel-xe
mailing list