[Intel-xe] [PATCH v3 27/30] drm/xe: Extend uAPI to query HuC micro-controler firmware version

Lucas De Marchi lucas.demarchi at intel.com
Tue Oct 10 19:10:17 UTC 2023


On Tue, Sep 26, 2023 at 12:55:37PM +0000, Francois Dugast wrote:
>The infrastructure to query GuC firmware version is already in place. It
>is extended with a new micro-controller type to query the HuC firmware
>version. It can be used from user space to know if HuC is running.
>
>Signed-off-by: Francois Dugast <francois.dugast at intel.com>
>---
> drivers/gpu/drm/xe/xe_query.c | 9 +++++++++
> include/uapi/drm/xe_drm.h     | 1 +
> 2 files changed, 10 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
>index 7a0ffd9a654a..c250ca534bb9 100644
>--- a/drivers/gpu/drm/xe/xe_query.c
>+++ b/drivers/gpu/drm/xe/xe_query.c
>@@ -530,6 +530,15 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
> 		resp.branch_ver = 0;
> 		break;
> 	}
>+	case XE_QUERY_UC_TYPE_HUC: {
>+		struct xe_huc *huc = &xe->tiles[0].primary_gt->uc.huc;

This doesn't look right... on MTL/LNL we are expected to have media
engines only on the media_gt and huc is only loaded there. I think this
could be either of:
	
	a) use media_gt if media_gt is non-NULL
	b) loop through the tiles and use the first gt that has
	   a media engine

Another thing is... does this capture the scenario in which HuC is
selected / loaded , but it's not yet running? Looking at
xe_uc_fw_init() it doesn't seem so because after parsing the header and
printing the version, there are still failure scenarios and we simply
leave the version set.

Maybe we should have a status or a simplified form of it?
 From drivers/gpu/drm/xe/xe_uc_fw_types.h:

enum xe_uc_fw_status {
         XE_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
         XE_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early
         XE_UC_FIRMWARE_DISABLED, /* disabled */
         XE_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
         XE_UC_FIRMWARE_MISSING, /* blob not found on the system */
         XE_UC_FIRMWARE_ERROR, /* invalid format or version */
         XE_UC_FIRMWARE_AVAILABLE, /* blob found and copied in mem */
         XE_UC_FIRMWARE_INIT_FAIL, /* failed to prepare fw objects for load */
         XE_UC_FIRMWARE_LOADABLE, /* all fw-required objects are ready */
         XE_UC_FIRMWARE_LOAD_FAIL, /* failed to xfer or init/auth the fw */
         XE_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
         XE_UC_FIRMWARE_RUNNING /* init/auth done */
};



Lucas De Marchi

>+
>+		resp.major_ver = huc->fw.major_ver_found;
>+		resp.minor_ver = huc->fw.minor_ver_found;
>+		resp.patch_ver = huc->fw.patch_ver_found;
>+		resp.branch_ver = 0;
>+		break;
>+	}
> 	default:
> 		return -EINVAL;
> 	}
>diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
>index 84091860c7d2..fe7e83a5bd3e 100644
>--- a/include/uapi/drm/xe_drm.h
>+++ b/include/uapi/drm/xe_drm.h
>@@ -478,6 +478,7 @@ struct drm_xe_query_topology_mask {
> struct drm_xe_query_uc_fw_version {
> 	/** @uc: The micro-controller type to query firmware version */
> #define XE_QUERY_UC_TYPE_GUC 0
>+#define XE_QUERY_UC_TYPE_HUC 1
> 	__u16 uc_type;
>
> 	/** @pad: MBZ */
>-- 
>2.34.1
>


More information about the Intel-xe mailing list