mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>,
	ogabbay@kernel.org, quic_jhugo@quicinc.com,
	dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, min.ma@amd.com, max.zhen@amd.com,
	sonal.santan@amd.com, king.tam@amd.com
Subject: Re: [PATCH V1 5/7] accel/amdxdna: Add query firmware version
Date: Wed, 4 Dec 2024 16:24:02 -0600	[thread overview]
Message-ID: <4f233efa-8269-4f6f-bd22-0dcf2810c4ab@amd.com> (raw)
In-Reply-To: <20241204213729.3113941-6-lizhi.hou@amd.com>

On 12/4/2024 15:37, Lizhi Hou wrote:
> Enhance GET_INFO ioctl to support retrieving firmware version.
> 
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
>   drivers/accel/amdxdna/aie2_pci.c | 20 ++++++++++++++++++++
>   include/uapi/drm/amdxdna_accel.h | 19 +++++++++++++++++++
>   2 files changed, 39 insertions(+)
> 
> diff --git a/drivers/accel/amdxdna/aie2_pci.c b/drivers/accel/amdxdna/aie2_pci.c
> index 1c8170325837..83abd16ade11 100644
> --- a/drivers/accel/amdxdna/aie2_pci.c
> +++ b/drivers/accel/amdxdna/aie2_pci.c
> @@ -640,6 +640,23 @@ static int aie2_get_aie_version(struct amdxdna_client *client,
>   	return 0;
>   }
>   
> +static int aie2_get_firmware_version(struct amdxdna_client *client,
> +				     struct amdxdna_drm_get_info *args)
> +{
> +	struct amdxdna_drm_query_firmware_version version;
> +	struct amdxdna_dev *xdna = client->xdna;
> +
> +	version.major = xdna->fw_ver.major;
> +	version.minor = xdna->fw_ver.minor;
> +	version.patch = xdna->fw_ver.sub;
> +	version.build = xdna->fw_ver.build;
> +
> +	if (copy_to_user(u64_to_user_ptr(args->buffer), &version, sizeof(version)))
> +		return -EFAULT;
> +
> +	return 0;
> +}
> +
>   static int aie2_get_clock_metadata(struct amdxdna_client *client,
>   				   struct amdxdna_drm_get_info *args)
>   {
> @@ -752,6 +769,9 @@ static int aie2_get_info(struct amdxdna_client *client, struct amdxdna_drm_get_i
>   	case DRM_AMDXDNA_QUERY_HW_CONTEXTS:
>   		ret = aie2_get_hwctx_status(client, args);
>   		break;
> +	case DRM_AMDXDNA_QUERY_FIRMWARE_VERSION:
> +		ret = aie2_get_firmware_version(client, args);
> +		break;
>   	default:
>   		XDNA_ERR(xdna, "Not supported request parameter %u", args->param);
>   		ret = -EOPNOTSUPP;
> diff --git a/include/uapi/drm/amdxdna_accel.h b/include/uapi/drm/amdxdna_accel.h
> index af12af8bd699..ea86c57beb92 100644
> --- a/include/uapi/drm/amdxdna_accel.h
> +++ b/include/uapi/drm/amdxdna_accel.h
> @@ -375,6 +375,20 @@ struct amdxdna_drm_query_hwctx {
>   	__u64 errors;
>   };
>   
> +/**
> + * struct amdxdna_drm_query_firmware_version - Query the firmware version
> + * @major: The major version number
> + * @minor: The minor version number
> + * @patch: The patch level version number
> + * @build: The build ID
> + */
> +struct amdxdna_drm_query_firmware_version {
> +	__u32 major; /* out */
> +	__u32 minor; /* out */
> +	__u32 patch; /* out */
> +	__u32 build; /* out */
> +};
> +
>   enum amdxdna_drm_get_param {
>   	DRM_AMDXDNA_QUERY_AIE_STATUS,
>   	DRM_AMDXDNA_QUERY_AIE_METADATA,
> @@ -382,6 +396,11 @@ enum amdxdna_drm_get_param {
>   	DRM_AMDXDNA_QUERY_CLOCK_METADATA,
>   	DRM_AMDXDNA_QUERY_SENSORS,
>   	DRM_AMDXDNA_QUERY_HW_CONTEXTS,
> +	DRM_AMDXDNA_READ_AIE_MEM,
> +	DRM_AMDXDNA_READ_AIE_REG,
> +	DRM_AMDXDNA_QUERY_FIRMWARE_VERSION,
> +	DRM_AMDXDNA_GET_POWER_MODE,
> +	DRM_AMDXDNA_QUERY_TELEMETRY,

This is more than DRM_AMDXDNA_QUERY_FIRMWARE_VERSION.

The other ones should go with other patches.
Like DRM_AMDXDNA_GET_POWER_MODE should be in patch 6.

I didn't see DRM_AMDXDNA_READ_AIE_MEM, DRM_AMDXDNA_READ_AIE_REG, or
DRM_AMDXDNA_QUERY_TELEMETRY used in this series, are they just 
placeholders?  Maybe a different patch for the placeholders?


>   	DRM_AMDXDNA_NUM_GET_PARAM,
>   };
>   


  reply	other threads:[~2024-12-04 22:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 21:37 [PATCH V1 0/7] AMD NPU driver improvements Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 1/7] accel/amdxdna: Add device status for aie2 devices Lizhi Hou
2024-12-04 22:26   ` Mario Limonciello
2024-12-05  5:15     ` Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 2/7] accel/amdxdna: Replace mmput with mmput_async to avoid dead lock Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 3/7] accel/amdxdna: Add RyzenAI-npu6 support Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 4/7] accel/amdxdna: Replace idr api with xarray Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 5/7] accel/amdxdna: Add query firmware version Lizhi Hou
2024-12-04 22:24   ` Mario Limonciello [this message]
2024-12-05  5:14     ` Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 6/7] accel/amdxdna: Enhance power management settings Lizhi Hou
2024-12-05  3:52   ` Mario Limonciello
2024-12-06  1:13     ` Lizhi Hou
2024-12-04 21:37 ` [PATCH V1 7/7] accel/amdxdna: Read firmware interface version from registers Lizhi Hou

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=4f233efa-8269-4f6f-bd22-0dcf2810c4ab@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=king.tam@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.hou@amd.com \
    --cc=max.zhen@amd.com \
    --cc=min.ma@amd.com \
    --cc=ogabbay@kernel.org \
    --cc=quic_jhugo@quicinc.com \
    --cc=sonal.santan@amd.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

all inboxes | Powered by JetHome®