Commit 6cc7a5c7 authored by John Harrison's avatar John Harrison

drm/i915/guc: Add support for w/a KLVs

To prevent running out of bits, new w/a enable flags are being added
via a KLV system instead of a 32 bit flags word.
Signed-off-by: default avatarJohn Harrison <John.C.Harrison@Intel.com>
Reviewed-by: default avatarVinay Belgaumkar <vinay.belgaumkar@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240223205632.1621019-3-John.C.Harrison@Intel.com
parent f673d59e
...@@ -36,6 +36,7 @@ enum intel_guc_load_status { ...@@ -36,6 +36,7 @@ enum intel_guc_load_status {
INTEL_GUC_LOAD_STATUS_INVALID_INIT_DATA_RANGE_START, INTEL_GUC_LOAD_STATUS_INVALID_INIT_DATA_RANGE_START,
INTEL_GUC_LOAD_STATUS_MPU_DATA_INVALID = 0x73, INTEL_GUC_LOAD_STATUS_MPU_DATA_INVALID = 0x73,
INTEL_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID = 0x74, INTEL_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID = 0x74,
INTEL_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR = 0x75,
INTEL_GUC_LOAD_STATUS_INVALID_INIT_DATA_RANGE_END, INTEL_GUC_LOAD_STATUS_INVALID_INIT_DATA_RANGE_END,
INTEL_GUC_LOAD_STATUS_READY = 0xF0, INTEL_GUC_LOAD_STATUS_READY = 0xF0,
......
...@@ -204,6 +204,8 @@ struct intel_guc { ...@@ -204,6 +204,8 @@ struct intel_guc {
struct guc_mmio_reg *ads_regset; struct guc_mmio_reg *ads_regset;
/** @ads_golden_ctxt_size: size of the golden contexts in the ADS */ /** @ads_golden_ctxt_size: size of the golden contexts in the ADS */
u32 ads_golden_ctxt_size; u32 ads_golden_ctxt_size;
/** @ads_waklv_size: size of workaround KLVs */
u32 ads_waklv_size;
/** @ads_capture_size: size of register lists in the ADS used for error capture */ /** @ads_capture_size: size of register lists in the ADS used for error capture */
u32 ads_capture_size; u32 ads_capture_size;
/** @ads_engine_usage_size: size of engine usage in the ADS */ /** @ads_engine_usage_size: size of engine usage in the ADS */
......
...@@ -46,6 +46,10 @@ ...@@ -46,6 +46,10 @@
* +---------------------------------------+ * +---------------------------------------+
* | padding | * | padding |
* +---------------------------------------+ <== 4K aligned * +---------------------------------------+ <== 4K aligned
* | w/a KLVs |
* +---------------------------------------+
* | padding |
* +---------------------------------------+ <== 4K aligned
* | capture lists | * | capture lists |
* +---------------------------------------+ * +---------------------------------------+
* | padding | * | padding |
...@@ -88,6 +92,11 @@ static u32 guc_ads_golden_ctxt_size(struct intel_guc *guc) ...@@ -88,6 +92,11 @@ static u32 guc_ads_golden_ctxt_size(struct intel_guc *guc)
return PAGE_ALIGN(guc->ads_golden_ctxt_size); return PAGE_ALIGN(guc->ads_golden_ctxt_size);
} }
static u32 guc_ads_waklv_size(struct intel_guc *guc)
{
return PAGE_ALIGN(guc->ads_waklv_size);
}
static u32 guc_ads_capture_size(struct intel_guc *guc) static u32 guc_ads_capture_size(struct intel_guc *guc)
{ {
return PAGE_ALIGN(guc->ads_capture_size); return PAGE_ALIGN(guc->ads_capture_size);
...@@ -113,7 +122,7 @@ static u32 guc_ads_golden_ctxt_offset(struct intel_guc *guc) ...@@ -113,7 +122,7 @@ static u32 guc_ads_golden_ctxt_offset(struct intel_guc *guc)
return PAGE_ALIGN(offset); return PAGE_ALIGN(offset);
} }
static u32 guc_ads_capture_offset(struct intel_guc *guc) static u32 guc_ads_waklv_offset(struct intel_guc *guc)
{ {
u32 offset; u32 offset;
...@@ -123,6 +132,16 @@ static u32 guc_ads_capture_offset(struct intel_guc *guc) ...@@ -123,6 +132,16 @@ static u32 guc_ads_capture_offset(struct intel_guc *guc)
return PAGE_ALIGN(offset); return PAGE_ALIGN(offset);
} }
static u32 guc_ads_capture_offset(struct intel_guc *guc)
{
u32 offset;
offset = guc_ads_waklv_offset(guc) +
guc_ads_waklv_size(guc);
return PAGE_ALIGN(offset);
}
static u32 guc_ads_private_data_offset(struct intel_guc *guc) static u32 guc_ads_private_data_offset(struct intel_guc *guc)
{ {
u32 offset; u32 offset;
...@@ -796,6 +815,49 @@ guc_capture_prep_lists(struct intel_guc *guc) ...@@ -796,6 +815,49 @@ guc_capture_prep_lists(struct intel_guc *guc)
return PAGE_ALIGN(total_size); return PAGE_ALIGN(total_size);
} }
static void guc_waklv_init(struct intel_guc *guc)
{
struct intel_gt *gt = guc_to_gt(guc);
u32 offset, addr_ggtt, remain, size;
if (!intel_uc_uses_guc_submission(&gt->uc))
return;
if (GUC_FIRMWARE_VER(guc) < MAKE_GUC_VER(70, 10, 0))
return;
GEM_BUG_ON(iosys_map_is_null(&guc->ads_map));
offset = guc_ads_waklv_offset(guc);
remain = guc_ads_waklv_size(guc);
/*
* Add workarounds here:
*
* if (want_wa_<name>) {
* size = guc_waklv_<name>(guc, offset, remain);
* offset += size;
* remain -= size;
* }
*/
size = guc_ads_waklv_size(guc) - remain;
if (!size)
return;
offset = guc_ads_waklv_offset(guc);
addr_ggtt = intel_guc_ggtt_offset(guc, guc->ads_vma) + offset;
ads_blob_write(guc, ads.wa_klv_addr_lo, addr_ggtt);
ads_blob_write(guc, ads.wa_klv_addr_hi, 0);
ads_blob_write(guc, ads.wa_klv_size, size);
}
static int guc_prep_waklv(struct intel_guc *guc)
{
/* Fudge something chunky for now: */
return PAGE_SIZE;
}
static void __guc_ads_init(struct intel_guc *guc) static void __guc_ads_init(struct intel_guc *guc)
{ {
struct intel_gt *gt = guc_to_gt(guc); struct intel_gt *gt = guc_to_gt(guc);
...@@ -843,6 +905,9 @@ static void __guc_ads_init(struct intel_guc *guc) ...@@ -843,6 +905,9 @@ static void __guc_ads_init(struct intel_guc *guc)
/* MMIO save/restore list */ /* MMIO save/restore list */
guc_mmio_reg_state_init(guc); guc_mmio_reg_state_init(guc);
/* Workaround KLV list */
guc_waklv_init(guc);
/* Private Data */ /* Private Data */
ads_blob_write(guc, ads.private_data, base + ads_blob_write(guc, ads.private_data, base +
guc_ads_private_data_offset(guc)); guc_ads_private_data_offset(guc));
...@@ -886,6 +951,12 @@ int intel_guc_ads_create(struct intel_guc *guc) ...@@ -886,6 +951,12 @@ int intel_guc_ads_create(struct intel_guc *guc)
return ret; return ret;
guc->ads_capture_size = ret; guc->ads_capture_size = ret;
/* And don't forget the workaround KLVs: */
ret = guc_prep_waklv(guc);
if (ret < 0)
return ret;
guc->ads_waklv_size = ret;
/* Now the total size can be determined: */ /* Now the total size can be determined: */
size = guc_ads_blob_size(guc); size = guc_ads_blob_size(guc);
......
...@@ -115,6 +115,7 @@ static inline bool guc_load_done(struct intel_uncore *uncore, u32 *status, bool ...@@ -115,6 +115,7 @@ static inline bool guc_load_done(struct intel_uncore *uncore, u32 *status, bool
case INTEL_GUC_LOAD_STATUS_INIT_DATA_INVALID: case INTEL_GUC_LOAD_STATUS_INIT_DATA_INVALID:
case INTEL_GUC_LOAD_STATUS_MPU_DATA_INVALID: case INTEL_GUC_LOAD_STATUS_MPU_DATA_INVALID:
case INTEL_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID: case INTEL_GUC_LOAD_STATUS_INIT_MMIO_SAVE_RESTORE_INVALID:
case INTEL_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR:
*success = false; *success = false;
return true; return true;
} }
...@@ -241,6 +242,11 @@ static int guc_wait_ucode(struct intel_guc *guc) ...@@ -241,6 +242,11 @@ static int guc_wait_ucode(struct intel_guc *guc)
ret = -EPERM; ret = -EPERM;
break; break;
case INTEL_GUC_LOAD_STATUS_KLV_WORKAROUND_INIT_ERROR:
guc_info(guc, "invalid w/a KLV entry\n");
ret = -EINVAL;
break;
case INTEL_GUC_LOAD_STATUS_HWCONFIG_START: case INTEL_GUC_LOAD_STATUS_HWCONFIG_START:
guc_info(guc, "still extracting hwconfig table.\n"); guc_info(guc, "still extracting hwconfig table.\n");
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
......
...@@ -431,7 +431,10 @@ struct guc_ads { ...@@ -431,7 +431,10 @@ struct guc_ads {
u32 capture_instance[GUC_CAPTURE_LIST_INDEX_MAX][GUC_MAX_ENGINE_CLASSES]; u32 capture_instance[GUC_CAPTURE_LIST_INDEX_MAX][GUC_MAX_ENGINE_CLASSES];
u32 capture_class[GUC_CAPTURE_LIST_INDEX_MAX][GUC_MAX_ENGINE_CLASSES]; u32 capture_class[GUC_CAPTURE_LIST_INDEX_MAX][GUC_MAX_ENGINE_CLASSES];
u32 capture_global[GUC_CAPTURE_LIST_INDEX_MAX]; u32 capture_global[GUC_CAPTURE_LIST_INDEX_MAX];
u32 reserved[14]; u32 wa_klv_addr_lo;
u32 wa_klv_addr_hi;
u32 wa_klv_size;
u32 reserved[11];
} __packed; } __packed;
/* Engine usage stats */ /* Engine usage stats */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment