Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "José Roberto de Souza" <jose.souza@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	John Harrison <John.C.Harrison@intel.com>,
	Francois Dugast <francois.dugast@intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH v2 2/2] drm/xe: Extend uAPI to query HuC micro-controler firmware version
Date: Tue, 13 Feb 2024 16:28:55 -0500	[thread overview]
Message-ID: <ZcvfF5lxLmF7BlVK@intel.com> (raw)
In-Reply-To: <20240208183539.185095-2-jose.souza@intel.com>

On Thu, Feb 08, 2024 at 10:35:39AM -0800, José Roberto de Souza wrote:
> From: Francois Dugast <francois.dugast@intel.com>
> 
> 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.
> 
> 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: Francois Dugast <francois.dugast@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>

to merge this we need to wait for the media to be ready and using this.
But for the patch itself:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_query.c | 38 +++++++++++++++++++++++++++++++----
>  include/uapi/drm/xe_drm.h     |  1 +
>  2 files changed, 35 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_query.c b/drivers/gpu/drm/xe/xe_query.c
> index 92bb06c0586eb..7855d04e032f2 100644
> --- a/drivers/gpu/drm/xe/xe_query.c
> +++ b/drivers/gpu/drm/xe/xe_query.c
> @@ -544,14 +544,44 @@ query_uc_fw_version(struct xe_device *xe, struct drm_xe_device_query *query)
>  		version = &guc->fw.versions.found[XE_UC_FW_VER_COMPATIBILITY];
>  		break;
>  	}
> +	case XE_QUERY_UC_TYPE_HUC: {
> +		struct xe_gt *media_gt = NULL;
> +		struct xe_huc *huc;
> +
> +		if (MEDIA_VER(xe) >= 13) {
> +			struct xe_tile *tile;
> +			u8 gt_id;
> +
> +			for_each_tile(tile, xe, gt_id) {
> +				if (tile->media_gt) {
> +					media_gt = tile->media_gt;
> +					break;
> +				}
> +			}
> +		} else {
> +			media_gt = xe->tiles[0].primary_gt;
> +		}
> +
> +		if (!media_gt)
> +			break;
> +
> +		huc = &media_gt->uc.huc;
> +		if (huc->fw.status == XE_UC_FIRMWARE_RUNNING)
> +			version = &huc->fw.versions.found[XE_UC_FW_VER_RELEASE];
> +		break;
> +	}
>  	default:
>  		return -EINVAL;
>  	}
>  
> -	resp.branch_ver = 0;
> -	resp.major_ver = version->major;
> -	resp.minor_ver = version->minor;
> -	resp.patch_ver = version->patch;
> +	if (version) {
> +		resp.branch_ver = 0;
> +		resp.major_ver = version->major;
> +		resp.minor_ver = version->minor;
> +		resp.patch_ver = version->patch;
> +	} else {
> +		return -ENODEV;
> +	}
>  
>  	if (copy_to_user(query_ptr, &resp, size))
>  		return -EFAULT;
> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h
> index 0819959a52227..03d12b8f33744 100644
> --- a/include/uapi/drm/xe_drm.h
> +++ b/include/uapi/drm/xe_drm.h
> @@ -583,6 +583,7 @@ struct drm_xe_query_engine_cycles {
>  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
> +#define XE_QUERY_UC_TYPE_HUC 1
>  	__u16 uc_type;
>  
>  	/** @pad: MBZ */
> -- 
> 2.43.0
> 

  reply	other threads:[~2024-02-13 21:29 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 [this message]
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

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=ZcvfF5lxLmF7BlVK@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=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