From: John Harrison <john.c.harrison@intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>,
intel-xe@lists.freedesktop.org
Cc: Francois Dugast <francois.dugast@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH v2 1/2] drm/xe: Add uAPI to query GuC firmware submission version
Date: Tue, 13 Feb 2024 18:19:46 -0800 [thread overview]
Message-ID: <a97bec64-28dd-421e-a54d-71bb2aabcf33@intel.com> (raw)
In-Reply-To: <20240208183539.185095-1-jose.souza@intel.com>
On 2/8/2024 10:35, José Roberto de Souza wrote:
> Due to a bug in GuC firmware, Mesa can't enable by default the usage of
> compute engines in DG2 and newer.
>
> A new GuC firmware fixed the issue but until now there was no way
> for Mesa to know if KMD was running with the fixed GuC version or not,
> so this uAPI is required.
>
> It may be expanded in future to query other firmware versions too.
>
> This is querying XE_UC_FW_VER_COMPATIBILITY/submission version because
> that is also supported by VFs, while XE_UC_FW_VER_RELEASE don't.
>
> i915 uAPI: https://patchwork.freedesktop.org/series/129627/
> Mesa usage: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25233
>
> v2:
> - fixed drm_xe_query_uc_fw_version documentation
> - moved branch_ver as the first version number
>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: Francois Dugast <francois.dugast@intel.com>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
> ---
> drivers/gpu/drm/xe/xe_query.c | 44 +++++++++++++++++++++++++++++++++++
> include/uapi/drm/xe_drm.h | 31 ++++++++++++++++++++++++
> 2 files changed, 75 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 4f1ab91dbec58..92bb06c0586eb 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -516,6 +516,49 @@ static int query_gt_topology(struct xe_device *xe,
> return 0;
> }
>
> +static int
> +query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
> +{
> + struct drm_xe_query_uc_fw_version __user *query_ptr = u64_to_user_ptr(query->data);
> + size_t size = sizeof(struct drm_xe_query_uc_fw_version);
> + struct drm_xe_query_uc_fw_version resp;
> + struct xe_uc_fw_version *version = NULL;
> +
> + if (query->size == 0) {
> + query->size = size;
> + return 0;
> + } else if (XE_IOCTL_DBG(xe, query->size != size)) {
> + return -EINVAL;
> + }
> +
> + if (copy_from_user(&resp, query_ptr, size))
> + return -EFAULT;
> +
> + if (XE_IOCTL_DBG(xe, resp.pad || resp.pad2 || resp.reserved))
> + return -EINVAL;
> +
> + switch (resp.uc_type) {
> + case XE_QUERY_UC_TYPE_GUC_SUBMISSION: {
> + struct xe_guc *guc = &xe->tiles[0].primary_gt->uc.guc;
> +
> + version = &guc->fw.versions.found[XE_UC_FW_VER_COMPATIBILITY];
> + break;
> + }
> + default:
> + return -EINVAL;
> + }
> +
> + resp.branch_ver = 0;
> + resp.major_ver = version->major;
> + resp.minor_ver = version->minor;
> + resp.patch_ver = version->patch;
> +
> + if (copy_to_user(query_ptr, &resp, size))
> + return -EFAULT;
> +
> + return 0;
> +}
> +
> static int (* const xe_query_funcs[])(struct xe_device *xe,
> struct drm_xe_device_query *query) = {
> query_engines,
> @@ -525,6 +568,7 @@ static int (* const xe_query_funcs[])(struct xe_device *xe,
> query_hwconfig,
> query_gt_topology,
> query_engine_cycles,
> + query_uc_fw_version,
> };
>
> int xe_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 50bbea0992d9c..0819959a52227 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -574,6 +574,36 @@ struct drm_xe_query_engine_cycles {
> __u64 cpu_delta;
> };
>
> +/**
> + * struct drm_xe_query_uc_fw_version - query a micro-controller firmware version
> + *
> + * Given a uc_type this will return the branch, major, minor and patch version
> + * of the micro-controller firmware.
> + */
> +struct drm_xe_query_uc_fw_version {
> + /** @uc_type: The micro-controller type to query firmware version */
> +#define XE_QUERY_UC_TYPE_GUC_SUBMISSION 0
> + __u16 uc_type;
> +
> + /** @pad: MBZ */
> + __u16 pad;
> +
> + /** @branch_ver: branch uc fw version */
> + __u32 branch_ver;
> + /** @major_ver: major uc fw version */
> + __u32 major_ver;
> + /** @minor_ver: minor uc fw version */
> + __u32 minor_ver;
> + /** @patch_ver: patch uc fw version */
> + __u32 patch_ver;
> +
> + /** @pad2: MBZ */
> + __u32 pad2;
> +
> + /** @reserved: Reserved */
> + __u64 reserved;
> +};
> +
> /**
> * struct drm_xe_device_query - Input of &DRM_IOCTL_XE_DEVICE_QUERY - main
> * structure to query device information
> @@ -643,6 +673,7 @@ struct drm_xe_device_query {
> #define DRM_XE_DEVICE_QUERY_HWCONFIG 4
> #define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5
> #define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6
> +#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7
> /** @query: The type of data to query */
> __u32 query;
>
prev parent reply other threads:[~2024-02-14 2:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 18:35 [PATCH v2 1/2] drm/xe: Add uAPI to query GuC firmware submission version José Roberto de Souza
2024-02-08 18:35 ` [PATCH v2 2/2] drm/xe: Extend uAPI to query HuC micro-controler firmware version José Roberto de Souza
2024-02-13 21:28 ` Rodrigo Vivi
2024-02-14 2:20 ` John Harrison
2024-02-08 21:12 ` ✓ CI.Patch_applied: success for series starting with [v2,1/2] drm/xe: Add uAPI to query GuC firmware submission version Patchwork
2024-02-08 21:12 ` ✓ CI.checkpatch: " Patchwork
2024-02-08 21:13 ` ✓ CI.KUnit: " Patchwork
2024-02-08 21:24 ` ✓ CI.Build: " Patchwork
2024-02-08 21:24 ` ✓ CI.Hooks: " Patchwork
2024-02-08 21:26 ` ✓ CI.checksparse: " Patchwork
2024-02-08 22:03 ` ✓ CI.BAT: " Patchwork
2024-02-13 21:28 ` [PATCH v2 1/2] " Rodrigo Vivi
2024-02-14 2:19 ` John Harrison [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a97bec64-28dd-421e-a54d-71bb2aabcf33@intel.com \
--to=john.c.harrison@intel.com \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=jose.souza@intel.com \
--cc=lucas.demarchi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox