Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: John Harrison <john.c.harrison@intel.com>
To: Francois Dugast <francois.dugast@intel.com>,
	<igt-dev@lists.freedesktop.org>
Cc: "José Roberto de Souza" <jose.souza@intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>
Subject: Re: [PATCH i-g-t, v2 2/2] drm-uapi/xe: Add test to query HuC firmware version
Date: Wed, 14 Feb 2024 10:18:56 -0800	[thread overview]
Message-ID: <f4c2d784-6c88-488e-9095-d0a89578ea09@intel.com> (raw)
In-Reply-To: <20240214102435.7-3-francois.dugast@intel.com>

On 2/14/2024 02:24, Francois Dugast wrote:
> This aligns with kernel commit ("drm/xe: Extend uAPI to query HuC
> micro-controler firmware version").
>
> v2:
> - Fix printing branch (Francois Dugast)
> - Make ENODEV the only accepted error (José Roberto de Souza)
>
> Cc: John Harrison <John.C.Harrison@Intel.com>
> Cc: José Roberto de Souza <jose.souza@intel.com>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> ---
>   include/drm-uapi/xe_drm.h |  1 +
>   tests/intel/xe_query.c    | 57 +++++++++++++++++++++++++++++++++++++++
>   2 files changed, 58 insertions(+)
>
> diff --git a/include/drm-uapi/xe_drm.h b/include/drm-uapi/xe_drm.h
> index 3bd795f27..ce4acf9d4 100644
> --- a/include/drm-uapi/xe_drm.h
> +++ b/include/drm-uapi/xe_drm.h
> @@ -583,6 +583,7 @@ struct drm_xe_query_engine_cycles {
>   struct drm_xe_query_uc_fw_version {
>   	/** @uc: 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 */
> diff --git a/tests/intel/xe_query.c b/tests/intel/xe_query.c
> index d51e73ea5..e523c380b 100644
> --- a/tests/intel/xe_query.c
> +++ b/tests/intel/xe_query.c
> @@ -825,6 +825,62 @@ test_query_uc_fw_version_invalid_mbz(int fd)
>   	free(uc_fw_version);
>   }
>   
> +/**
> + * SUBTEST: query-uc-fw-version-huc
> + * Test category: functionality test
> + * Description: Display the HuC firmware version
> + *
> + * SUBTEST: multigpu-query-uc-fw-version-huc
> + * Test category: functionality test
> + * Sub-category: MultiGPU
> + * Description: Display HuC firmware version for all Xe devices.
> + */
> +static void
> +test_query_uc_fw_version_huc(int fd)
> +{
> +	struct drm_xe_query_uc_fw_version *uc_fw_version;
> +	struct drm_xe_device_query query = {
> +		.extensions = 0,
> +		.query = DRM_XE_DEVICE_QUERY_UC_FW_VERSION,
> +		.size = 0,
> +		.data = 0,
> +	};
> +	int ret;
> +
> +	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
> +
> +	uc_fw_version = malloc(query.size);
> +	igt_assert(uc_fw_version);
> +
> +	uc_fw_version->uc_type = XE_QUERY_UC_TYPE_HUC;
> +	uc_fw_version->pad = 0;
> +	uc_fw_version->pad2 = 0;
> +	uc_fw_version->reserved = 0;
> +	query.data = to_user_pointer(uc_fw_version);
> +
> +	ret = igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query);
> +
> +	igt_assert(ret == 0 || errno == ENODEV);
> +
> +	if (ret == 0) {
> +		igt_assert(uc_fw_version->major_ver > 0);
> +
> +		igt_info("XE_QUERY_UC_TYPE_HUC %u.%u.%u.%u\n",
> +			 uc_fw_version->major_ver,
> +			 uc_fw_version->minor_ver,
> +			 uc_fw_version->patch_ver,
> +			 uc_fw_version->branch_ver);
> +	} else {
> +		/*
> +		 * No HuC was found, either because it is not running
> +		 * yet or there is no media IP.
> +		 */
> +		igt_info("XE_QUERY_UC_TYPE_HUC No HuC is running\n");
> +	}
> +
> +	free(uc_fw_version);
Why duplicate this entire function? It could all be common code that 
just takes the firmware type enum as a parameter.

John.

> +}
> +
>   igt_main
>   {
>   	const struct {
> @@ -839,6 +895,7 @@ igt_main
>   		{ "query-topology", test_query_gt_topology },
>   		{ "query-cs-cycles", test_query_engine_cycles },
>   		{ "query-uc-fw-version-guc", test_query_uc_fw_version_guc },
> +		{ "query-uc-fw-version-huc", test_query_uc_fw_version_huc },
>   		{ "query-invalid-cs-cycles", test_engine_cycles_invalid },
>   		{ "query-invalid-query", test_query_invalid_query },
>   		{ "query-invalid-size", test_query_invalid_size },


  parent reply	other threads:[~2024-02-14 18:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-14 10:24 [PATCH i-g-t,v2 0/2] Add tests to query firmware version Francois Dugast
2024-02-14 10:24 ` [PATCH i-g-t, v2 1/2] drm-uapi/xe: Add test to query GuC firmware submission version Francois Dugast
2024-02-14 14:17   ` Souza, Jose
2024-02-14 18:17   ` John Harrison
2024-02-14 10:24 ` [PATCH i-g-t, v2 2/2] drm-uapi/xe: Add test to query HuC firmware version Francois Dugast
2024-02-14 14:19   ` Souza, Jose
2024-02-14 18:18   ` John Harrison [this message]
2024-02-14 11:16 ` ✓ CI.xeBAT: success for Add tests to query firmware version (rev2) Patchwork
2024-02-14 11:27 ` ✓ Fi.CI.BAT: " Patchwork
2024-02-14 15:44 ` ✗ Fi.CI.IGT: failure " Patchwork

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=f4c2d784-6c88-488e-9095-d0a89578ea09@intel.com \
    --to=john.c.harrison@intel.com \
    --cc=francois.dugast@intel.com \
    --cc=igt-dev@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