drm/i915/guc: Update to GuC v49
Subsystems (2)
v3 cover drm/i915/guc: Update to GuC v49
From: John Harrison <[email protected]>
Update to the latest GuC firmware
v2: Rebase to newer tree, updated a commit message (review feedback from Daniele) and dropped the patch to enable GuC/HuC loading by default as apparently this is not allowed.
v3: Rebase to drm-intel-gt-next which is apparently missing the patch to explicitly add Jasperlake FW.
John Harrison (3):
drm/i915/guc: Update to use firmware v49.0.1 drm/i915/guc: Improved reporting when GuC fails to load drm/i915/guc: Clear pointers on free
drivers/gpu/drm/i915/gt/intel_engine_cs.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 18 --- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 132 +++++++++++++++---- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 1 + drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 31 +++-- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 80 +++++------ drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h | 5 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 27 ++-- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 2 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h | 6 +- 10 files changed, 200 insertions(+), 105 deletions(-)
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/3 drm/i915/guc: Update to use firmware v49.0.1
From: John Harrison <[email protected]>
The latest GuC firmware includes a number of interface changes that require driver updates to match.
* Starting from Gen11, the ID to be provided to GuC needs to contain the engine class in bits [0..2] and the instance in bits [3..6].
NOTE: this patch breaks pointer dereferences in some existing GuC functions that use the guc_id to dereference arrays but these functions are not used for now as we have GuC submission disabled and we will update these functions in follow up patch which requires new IDs.
* The new GuC requires the additional data structure (ADS) and associated 'private_data' pointer to be setup. This is basically a scratch area of memory that the GuC owns. The size is read from the CSS header.
* There is now a physical to logical engine mapping table in the ADS which needs to be configured in order for the firmware to load. For now, the table is initialised with a 1 to 1 mapping.
* GUC_CTL_CTXINFO has been removed from the initialization params.
* reg_state_buffer is maintained internally by the GuC as part of the private data.
* The ADS layout has changed significantly. This patch updates the shared structure and also adds better documentation of the layout.
* While i915 does not use GuC doorbells, the firmware now requires that some initialisation is done.
* The number of engine classes and instances supported in the ADS has been increased.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 3 +- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 18 --- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 131 +++++++++++++++---- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 80 +++++------ drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h | 5 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 27 ++-- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 2 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h | 6 +- 8 files changed, 176 insertions(+), 96 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +2 -1
@@ -305,8 +305,9 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id) engine->i915 = i915; engine->gt = gt; engine->uncore = gt->uncore; - engine->hw_id = engine->guc_id = info->hw_id; engine->mmio_base =__engine_mmio_base (i915, info->mmio_bases); + engine->hw_id = info->hw_id; + engine->guc_id =MAKE_GUC_ID (info->class, info->instance); engine->class = info->class; engine->instance = info->instance;
drivers/gpu/drm/i915/gt/uc/intel_guc.c +0 -18
@@ -213,23 +213,6 @@ static u32 guc_ctl_feature_flags(struct intel_guc *guc)return flags; } -static u32 guc_ctl_ctxinfo_flags (struct intel_guc *guc) -{ -u32 flags =0 ; - -if (intel_guc_submission_is_used (guc)) { -u32 ctxnum, base; - - base =intel_guc_ggtt_offset (guc, guc->stage_desc_pool); - ctxnum =GUC_MAX_STAGE_DESCRIPTORS /16 ; - - base >>=PAGE_SHIFT ; - flags |= (base <<GUC_CTL_BASE_ADDR_SHIFT ) | - (ctxnum <<GUC_CTL_CTXNUM_IN16_SHIFT ); - } -return flags; -} -static u32 guc_ctl_log_params_flags (struct intel_guc *guc) {u32 offset =intel_guc_ggtt_offset (guc, guc->log.vma) >>PAGE_SHIFT ;
@@ -291,7 +274,6 @@ static void guc_init_params(struct intel_guc *guc)BUILD_BUG_ON (sizeof (guc->params) !=GUC_CTL_MAX_DWORDS *sizeof (u32)); - params[GUC_CTL_CTXINFO ] =guc_ctl_ctxinfo_flags (guc); params[GUC_CTL_LOG_PARAMS ] =guc_ctl_log_params_flags (guc); params[GUC_CTL_FEATURE ] =guc_ctl_feature_flags (guc); params[GUC_CTL_DEBUG ] =guc_ctl_debug_flags (guc);
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +106 -25
192 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +43 -37
140 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_reg.h +5 -0
@@ -118,6 +118,11 @@ struct guc_doorbell_info {#define GEN8_DRB_VALID (1<<0)#define GEN8_DRBREGU (x) _MMIO(0x1000 + (x) * 8 + 4) +#define GEN12_DIST_DBS_POPULATED _MMIO(0xd08) +#define GEN12_DOORBELLS_PER_SQIDI_SHIFT 16 +#define GEN12_DOORBELLS_PER_SQIDI (0xff) +#define GEN12_SQIDIS_DOORBELL_EXIST (0xffff) +#define DE_GUCRMR _MMIO(0x44054)#define GUC_BCS_RCS_IER _MMIO(0xC550)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +13 -14
@@ -44,23 +44,19 @@ void intel_uc_fw_change_status(struct intel_uc_fw *uc_fw,* List of required GuC and HuC binaries per-platform. * Must be ordered based on platform + revid, from newer to older. * -* TGL 35.2 is interface-compatible with 33.0 for previous Gens. The deltas -* between 33.0 and 35.2 are only related to new additions to support new Gen12 -* features. -* * Note that RKL uses the same firmware as TGL. */ #define INTEL_UC_FIRMWARE_DEFS (fw_def, guc_def, huc_def) \ - fw_def(ROCKETLAKE, 0, guc_def(tgl, 35, 2, 0), huc_def(tgl, 7, 5, 0)) \ - fw_def(TIGERLAKE, 0, guc_def(tgl, 35, 2, 0), huc_def(tgl, 7, 5, 0)) \ - fw_def(ELKHARTLAKE, 0, guc_def(ehl, 33, 0, 4), huc_def(ehl, 9, 0, 0)) \ - fw_def(ICELAKE, 0, guc_def(icl, 33, 0, 0), huc_def(icl, 9, 0, 0)) \ - fw_def(COMETLAKE, 5, guc_def(cml, 33, 0, 0), huc_def(cml, 4, 0, 0)) \ - fw_def(COFFEELAKE, 0, guc_def(kbl, 33, 0, 0), huc_def(kbl, 4, 0, 0)) \ - fw_def(GEMINILAKE, 0, guc_def(glk, 33, 0, 0), huc_def(glk, 4, 0, 0)) \ - fw_def(KABYLAKE, 0, guc_def(kbl, 33, 0, 0), huc_def(kbl, 4, 0, 0)) \ - fw_def(BROXTON, 0, guc_def(bxt, 33, 0, 0), huc_def(bxt, 2, 0, 0)) \ - fw_def(SKYLAKE, 0, guc_def(skl, 33, 0, 0), huc_def(skl, 2, 0, 0)) + fw_def(ROCKETLAKE, 0, guc_def(tgl, 49, 0, 1), huc_def(tgl, 7, 5, 0)) \ + fw_def(TIGERLAKE, 0, guc_def(tgl, 49, 0, 1), huc_def(tgl, 7, 5, 0)) \ + fw_def(ELKHARTLAKE, 0, guc_def(ehl, 49, 0, 1), huc_def(ehl, 9, 0, 0)) \ + fw_def(ICELAKE, 0, guc_def(icl, 49, 0, 1), huc_def(icl, 9, 0, 0)) \ + fw_def(COMETLAKE, 5, guc_def(cml, 49, 0, 1), huc_def(cml, 4, 0, 0)) \ + fw_def(COFFEELAKE, 0, guc_def(kbl, 49, 0, 1), huc_def(kbl, 4, 0, 0)) \ + fw_def(GEMINILAKE, 0, guc_def(glk, 49, 0, 1), huc_def(glk, 4, 0, 0)) \ + fw_def(KABYLAKE, 0, guc_def(kbl, 49, 0, 1), huc_def(kbl, 4, 0, 0)) \ + fw_def(BROXTON, 0, guc_def(bxt, 49, 0, 1), huc_def(bxt, 2, 0, 0)) \ + fw_def(SKYLAKE, 0, guc_def(skl, 49, 0, 1), huc_def(skl, 2, 0, 0))#define __MAKE_UC_FW_PATH (prefix_, name_, major_, minor_, patch_) \ "i915/" \
@@ -371,6 +367,9 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw) } } +if (uc_fw->type ==INTEL_UC_FW_TYPE_GUC ) + uc_fw->private_data_size = css->private_data_size; + obj =i915_gem_object_create_shmem_from_data (i915, fw->data, fw->size);if (IS_ERR (obj)) { err =PTR_ERR (obj);
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +2 -0
@@ -88,6 +88,8 @@ struct intel_uc_fw {u32 rsa_size;u32 ucode_size; + +u32 private_data_size; };#ifdef CONFIG_DRM_I915_DEBUG_GUC
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +5 -1
@@ -69,7 +69,11 @@ struct uc_css_header {#define CSS_SW_VERSION_UC_MAJOR (0xFF << 16)#define CSS_SW_VERSION_UC_MINOR (0xFF << 8)#define CSS_SW_VERSION_UC_PATCH (0xFF << 0) -u32 reserved[14 ]; +u32 reserved0[13 ]; +union { +u32 private_data_size;/* only applies to GuC */ +u32 reserved1; + };u32 header_info; } __packed;static_assert (sizeof (struct uc_css_header ) ==128 );
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 2/3 drm/i915/guc: Improved reporting when GuC fails to load
In reply to [email protected]From: John Harrison <[email protected]>
Rather than just saying 'GuC failed to load: -110', actually print out the GuC status register and break it down into the individual fields.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c | 31 ++++++++++++++++------- 1 file changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_fw.c +22 -9
@@ -76,6 +76,7 @@ static inline bool guc_ready(struct intel_uncore *uncore, u32 *status)static int guc_wait_ucode (struct intel_uncore *uncore) { +struct drm_device *drm = &uncore->i915->drm;u32 status;int ret;
@@ -90,15 +91,27 @@ static int guc_wait_ucode(struct intel_uncore *uncore) ret =wait_for (guc_ready (uncore, &status),100 );DRM_DEBUG_DRIVER ("GuC status %#x\n" , status); -if ((status &GS_BOOTROM_MASK ) ==GS_BOOTROM_RSA_FAILED ) { -DRM_ERROR ("GuC firmware signature verification failed\n" ); - ret = -ENOEXEC ; - } - -if ((status &GS_UKERNEL_MASK ) ==GS_UKERNEL_EXCEPTION ) { -DRM_ERROR ("GuC firmware exception. EIP: %#x\n" , -intel_uncore_read (uncore,SOFT_SCRATCH (13 ))); - ret = -ENXIO ; +if (ret) { +drm_err (drm,"GuC load failed: status = 0x%08X\n" , status); +drm_err (drm,"GuC load failed: status: Reset = %d, " +"BootROM = 0x%02X, UKernel = 0x%02X, " +"MIA = 0x%02X, Auth = 0x%02X\n" , +REG_FIELD_GET (GS_MIA_IN_RESET , status), +REG_FIELD_GET (GS_BOOTROM_MASK , status), +REG_FIELD_GET (GS_UKERNEL_MASK , status), +REG_FIELD_GET (GS_MIA_MASK , status), +REG_FIELD_GET (GS_AUTH_STATUS_MASK , status)); + +if ((status &GS_BOOTROM_MASK ) ==GS_BOOTROM_RSA_FAILED ) { +drm_err (drm,"GuC firmware signature verification failed\n" ); + ret = -ENOEXEC ; + } + +if ((status &GS_UKERNEL_MASK ) ==GS_UKERNEL_EXCEPTION ) { +drm_err (drm,"GuC firmware exception. EIP: %#x\n" , +intel_uncore_read (uncore,SOFT_SCRATCH (13 ))); + ret = -ENXIO ; + } }return ret;
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 3/3 drm/i915/guc: Clear pointers on free
In reply to [email protected]From: John Harrison <[email protected]>
Clear out some pointers when objects have been de-allocated. This makes it much easier to track down use-after-free type issues.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 1 + drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +1 -0
@@ -220,6 +220,7 @@ int intel_guc_ads_create(struct intel_guc *guc)void intel_guc_ads_destroy (struct intel_guc *guc) {i915_vma_unpin_and_release (&guc->ads_vma,I915_VMA_RELEASE_MAP ); + guc->ads_blob =NULL ; }static void guc_ads_private_data_reset (struct intel_guc *guc)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1 -0
@@ -210,6 +210,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct)GEM_BUG_ON (ct->enabled);i915_vma_unpin_and_release (&ct->vma,I915_VMA_RELEASE_MAP ); +memset (ct,0 ,sizeof (*ct)); }/**
Signature · 6 lines
2.25.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/guc: Update to GuC v49
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/i915/guc: Update to GuC v49
URL : https://patchwork.freedesktop.org/series/83157/
State : failure
== Summary ==
Applying: drm/i915/guc: Update to use firmware v49.0.1
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/gt/intel_engine_cs.c
M drivers/gpu/drm/i915/gt/uc/intel_guc.c
M drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c Auto-merging drivers/gpu/drm/i915/gt/uc/intel_guc.c
Auto-merging drivers/gpu/drm/i915/gt/intel_engine_cs.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/guc: Update to use firmware v49.0.1 When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Joonas Lahtinen
maintainerQuoting [email protected] (2020-10-28 16:58:23)
Quoted 10 lines
From: John Harrison <[email protected]>
Update to the latest GuC firmware
v2: Rebase to newer tree, updated a commit message (review feedback from Daniele) and dropped the patch to enable GuC/HuC loading by default as apparently this is not allowed.
v3: Rebase to drm-intel-gt-next which is apparently missing the patch to explicitly add Jasperlake FW.
This was now merged.
Regards, Joonas
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx