Message ID | 20230324051754.1346390-2-lucas.demarchi@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/xe: Update GuC/HuC firmware autoselection | expand |
On Thu, Mar 23, 2023 at 10:17:52PM -0700, Lucas De Marchi wrote: > The rev field is always 0 so it ends up never used. In i915 it was > introduced because of CML: up to rev 5 it reuses the guc and huc > firmware blobs from KBL. After that there is a specific firmware for > that platform. This can be reintroduced later if ever needed. I doubt we'd ever need the revid again; more likely we'd want a way to select different firmwares for a given subplatform (which is something I think we need to add anyway for ADL-N). Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Matt > > With the removal of revid the packed attribute in > uc_fw_platform_requirement, which is there only for reducing the space > these tables take, can also be removed since it has even more limited > usefulness: currently there's only padding of 2 bytes. Remove the > attribute to avoid the unaligned access. > > $ pahole -C uc_fw_platform_requirement build64/drivers/gpu/drm/xe/xe_uc_fw.o > struct uc_fw_platform_requirement { > enum xe_platform p; /* 0 4 */ > const struct uc_fw_blob blob; /* 4 10 */ > > /* size: 16, cachelines: 1, members: 2 */ > /* padding: 2 */ > /* last cacheline: 16 bytes */ > }; > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> > --- > drivers/gpu/drm/xe/xe_uc_fw.c | 33 +++++++++++++++------------------ > 1 file changed, 15 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/xe/xe_uc_fw.c b/drivers/gpu/drm/xe/xe_uc_fw.c > index e9b30e620fd9..e2c982b37e87 100644 > --- a/drivers/gpu/drm/xe/xe_uc_fw.c > +++ b/drivers/gpu/drm/xe/xe_uc_fw.c > @@ -39,21 +39,21 @@ static struct xe_device *uc_fw_to_xe(struct xe_uc_fw *uc_fw) > > /* > * List of required GuC and HuC binaries per-platform. > - * Must be ordered based on platform + revid, from newer to older. > + * Must be ordered based on platform, from newer to older. > */ > #define XE_GUC_FIRMWARE_DEFS(fw_def, guc_def) \ > - fw_def(METEORLAKE, 0, guc_def(mtl, 70, 5, 2)) \ > - fw_def(ALDERLAKE_P, 0, guc_def(adlp, 70, 5, 2)) \ > - fw_def(ALDERLAKE_S, 0, guc_def(tgl, 70, 5, 2)) \ > - fw_def(PVC, 0, guc_def(pvc, 70, 5, 2)) \ > - fw_def(DG2, 0, guc_def(dg2, 70, 5, 2)) \ > - fw_def(DG1, 0, guc_def(dg1, 70, 5, 2)) \ > - fw_def(TIGERLAKE, 0, guc_def(tgl, 70, 5, 2)) > + fw_def(METEORLAKE, guc_def(mtl, 70, 5, 2)) \ > + fw_def(ALDERLAKE_P, guc_def(adlp, 70, 5, 2)) \ > + fw_def(ALDERLAKE_S, guc_def(tgl, 70, 5, 2)) \ > + fw_def(PVC, guc_def(pvc, 70, 5, 2)) \ > + fw_def(DG2, guc_def(dg2, 70, 5, 2)) \ > + fw_def(DG1, guc_def(dg1, 70, 5, 2)) \ > + fw_def(TIGERLAKE, guc_def(tgl, 70, 5, 2)) > > #define XE_HUC_FIRMWARE_DEFS(fw_def, huc_def, huc_ver) \ > - fw_def(ALDERLAKE_S, 0, huc_def(tgl)) \ > - fw_def(DG1, 0, huc_def(dg1)) \ > - fw_def(TIGERLAKE, 0, huc_def(tgl)) > + fw_def(ALDERLAKE_S, huc_def(tgl)) \ > + fw_def(DG1, huc_def(dg1)) \ > + fw_def(TIGERLAKE, huc_def(tgl)) > > #define __MAKE_HUC_FW_PATH(prefix_, name_) \ > "i915/" \ > @@ -82,7 +82,7 @@ static struct xe_device *uc_fw_to_xe(struct xe_uc_fw *uc_fw) > > > /* All blobs need to be declared via MODULE_FIRMWARE() */ > -#define XE_UC_MODULE_FW(platform_, revid_, uc_) \ > +#define XE_UC_MODULE_FW(platform_, uc_) \ > MODULE_FIRMWARE(uc_); > > XE_GUC_FIRMWARE_DEFS(XE_UC_MODULE_FW, MAKE_GUC_FW_PATH) > @@ -109,16 +109,14 @@ struct __packed uc_fw_blob { > UC_FW_BLOB(major_, minor_, \ > MAKE_HUC_FW_PATH_FULL_VER(prefix_, major_, minor_, bld_num_)) > > -struct __packed uc_fw_platform_requirement { > +struct uc_fw_platform_requirement { > enum xe_platform p; > - u8 rev; /* first platform rev using this FW */ > const struct uc_fw_blob blob; > }; > > -#define MAKE_FW_LIST(platform_, revid_, uc_) \ > +#define MAKE_FW_LIST(platform_, uc_) \ > { \ > .p = XE_##platform_, \ > - .rev = revid_, \ > .blob = uc_, \ > }, > > @@ -143,7 +141,6 @@ uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw) > static const struct uc_fw_platform_requirement *fw_blobs; > enum xe_platform p = xe->info.platform; > u32 fw_count; > - u8 rev = xe->info.revid; > int i; > > XE_BUG_ON(uc_fw->type >= ARRAY_SIZE(blobs_all)); > @@ -151,7 +148,7 @@ uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw) > fw_count = blobs_all[uc_fw->type].count; > > for (i = 0; i < fw_count && p <= fw_blobs[i].p; i++) { > - if (p == fw_blobs[i].p && rev >= fw_blobs[i].rev) { > + if (p == fw_blobs[i].p) { > const struct uc_fw_blob *blob = &fw_blobs[i].blob; > > uc_fw->path = blob->path; > -- > 2.39.0 >
On Mon, Mar 27, 2023 at 09:59:55AM -0700, Matt Roper wrote: >On Thu, Mar 23, 2023 at 10:17:52PM -0700, Lucas De Marchi wrote: >> The rev field is always 0 so it ends up never used. In i915 it was >> introduced because of CML: up to rev 5 it reuses the guc and huc >> firmware blobs from KBL. After that there is a specific firmware for >> that platform. This can be reintroduced later if ever needed. > >I doubt we'd ever need the revid again; more likely we'd want a way to >select different firmwares for a given subplatform (which is something I >think we need to add anyway for ADL-N). > >Reviewed-by: Matt Roper <matthew.d.roper@intel.com> thanks, applied this first patch. Lucas De Marchi
diff --git a/drivers/gpu/drm/xe/xe_uc_fw.c b/drivers/gpu/drm/xe/xe_uc_fw.c index e9b30e620fd9..e2c982b37e87 100644 --- a/drivers/gpu/drm/xe/xe_uc_fw.c +++ b/drivers/gpu/drm/xe/xe_uc_fw.c @@ -39,21 +39,21 @@ static struct xe_device *uc_fw_to_xe(struct xe_uc_fw *uc_fw) /* * List of required GuC and HuC binaries per-platform. - * Must be ordered based on platform + revid, from newer to older. + * Must be ordered based on platform, from newer to older. */ #define XE_GUC_FIRMWARE_DEFS(fw_def, guc_def) \ - fw_def(METEORLAKE, 0, guc_def(mtl, 70, 5, 2)) \ - fw_def(ALDERLAKE_P, 0, guc_def(adlp, 70, 5, 2)) \ - fw_def(ALDERLAKE_S, 0, guc_def(tgl, 70, 5, 2)) \ - fw_def(PVC, 0, guc_def(pvc, 70, 5, 2)) \ - fw_def(DG2, 0, guc_def(dg2, 70, 5, 2)) \ - fw_def(DG1, 0, guc_def(dg1, 70, 5, 2)) \ - fw_def(TIGERLAKE, 0, guc_def(tgl, 70, 5, 2)) + fw_def(METEORLAKE, guc_def(mtl, 70, 5, 2)) \ + fw_def(ALDERLAKE_P, guc_def(adlp, 70, 5, 2)) \ + fw_def(ALDERLAKE_S, guc_def(tgl, 70, 5, 2)) \ + fw_def(PVC, guc_def(pvc, 70, 5, 2)) \ + fw_def(DG2, guc_def(dg2, 70, 5, 2)) \ + fw_def(DG1, guc_def(dg1, 70, 5, 2)) \ + fw_def(TIGERLAKE, guc_def(tgl, 70, 5, 2)) #define XE_HUC_FIRMWARE_DEFS(fw_def, huc_def, huc_ver) \ - fw_def(ALDERLAKE_S, 0, huc_def(tgl)) \ - fw_def(DG1, 0, huc_def(dg1)) \ - fw_def(TIGERLAKE, 0, huc_def(tgl)) + fw_def(ALDERLAKE_S, huc_def(tgl)) \ + fw_def(DG1, huc_def(dg1)) \ + fw_def(TIGERLAKE, huc_def(tgl)) #define __MAKE_HUC_FW_PATH(prefix_, name_) \ "i915/" \ @@ -82,7 +82,7 @@ static struct xe_device *uc_fw_to_xe(struct xe_uc_fw *uc_fw) /* All blobs need to be declared via MODULE_FIRMWARE() */ -#define XE_UC_MODULE_FW(platform_, revid_, uc_) \ +#define XE_UC_MODULE_FW(platform_, uc_) \ MODULE_FIRMWARE(uc_); XE_GUC_FIRMWARE_DEFS(XE_UC_MODULE_FW, MAKE_GUC_FW_PATH) @@ -109,16 +109,14 @@ struct __packed uc_fw_blob { UC_FW_BLOB(major_, minor_, \ MAKE_HUC_FW_PATH_FULL_VER(prefix_, major_, minor_, bld_num_)) -struct __packed uc_fw_platform_requirement { +struct uc_fw_platform_requirement { enum xe_platform p; - u8 rev; /* first platform rev using this FW */ const struct uc_fw_blob blob; }; -#define MAKE_FW_LIST(platform_, revid_, uc_) \ +#define MAKE_FW_LIST(platform_, uc_) \ { \ .p = XE_##platform_, \ - .rev = revid_, \ .blob = uc_, \ }, @@ -143,7 +141,6 @@ uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw) static const struct uc_fw_platform_requirement *fw_blobs; enum xe_platform p = xe->info.platform; u32 fw_count; - u8 rev = xe->info.revid; int i; XE_BUG_ON(uc_fw->type >= ARRAY_SIZE(blobs_all)); @@ -151,7 +148,7 @@ uc_fw_auto_select(struct xe_device *xe, struct xe_uc_fw *uc_fw) fw_count = blobs_all[uc_fw->type].count; for (i = 0; i < fw_count && p <= fw_blobs[i].p; i++) { - if (p == fw_blobs[i].p && rev >= fw_blobs[i].rev) { + if (p == fw_blobs[i].p) { const struct uc_fw_blob *blob = &fw_blobs[i].blob; uc_fw->path = blob->path;
The rev field is always 0 so it ends up never used. In i915 it was introduced because of CML: up to rev 5 it reuses the guc and huc firmware blobs from KBL. After that there is a specific firmware for that platform. This can be reintroduced later if ever needed. With the removal of revid the packed attribute in uc_fw_platform_requirement, which is there only for reducing the space these tables take, can also be removed since it has even more limited usefulness: currently there's only padding of 2 bytes. Remove the attribute to avoid the unaligned access. $ pahole -C uc_fw_platform_requirement build64/drivers/gpu/drm/xe/xe_uc_fw.o struct uc_fw_platform_requirement { enum xe_platform p; /* 0 4 */ const struct uc_fw_blob blob; /* 4 10 */ /* size: 16, cachelines: 1, members: 2 */ /* padding: 2 */ /* last cacheline: 16 bytes */ }; Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> --- drivers/gpu/drm/xe/xe_uc_fw.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)