All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Add vbios version string
@ 2021-05-17 10:21 Jiawei Gu
  2021-05-17 10:28 ` Gu, JiaWei (Will)
  0 siblings, 1 reply; 3+ messages in thread
From: Jiawei Gu @ 2021-05-17 10:21 UTC (permalink / raw)
  To: amd-gfx, christian.koenig, david.nieto, maraeo, alexander.deucher
  Cc: emily.deng, Jiawei Gu

Expose XXX.XXX.XXX.XXX.XXXXXX vbios version string in
AMDGPU_INFO_VBIOS_INFO ioctl

Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    |  2 ++
 drivers/gpu/drm/amd/amdgpu/atom.c          | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/atom.h          |  1 +
 drivers/gpu/drm/amd/include/atomfirmware.h |  1 +
 include/uapi/drm/amdgpu_drm.h              |  1 +
 5 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index e1008a79b441..30e4fed3de22 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -870,6 +870,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			vbios_info.dbdf = PCI_DEVID(adev->pdev->bus->number, adev->pdev->devfn);
 			memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
 			vbios_info.version = atom_context->version;
+			memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
+						sizeof(atom_context->vbios_ver_str));
 			memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
 			vbios_info.serial = adev->unique_id;
 			vbios_info.dev_id = adev->pdev->device;
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 0e2f0ea13b40..542b2c2414e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -1438,6 +1438,21 @@ static void atom_get_vbios_pn(struct atom_context *ctx)
 	}
 }
 
+static void atom_get_vbios_version(struct atom_context *ctx)
+{
+	unsigned char *vbios_ver;
+
+	/* find anchor ATOMBIOSBK-AMD */
+	vbios_ver = atom_find_str_in_rom(ctx, BIOS_VERSION_PREFIX, 3, 1024, 64);
+	if (vbios_ver != NULL) {
+		/* skip ATOMBIOSBK-AMD VER */
+		vbios_ver += 18;
+		memcpy(ctx->vbios_ver_str, vbios_ver, STRLEN_NORMAL);
+	} else {
+		ctx->vbios_ver_str[0] = '\0';
+	}
+}
+
 struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
 {
 	int base;
@@ -1511,6 +1526,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
 	atom_get_vbios_name(ctx);
 	atom_get_vbios_pn(ctx);
 	atom_get_vbios_date(ctx);
+	atom_get_vbios_version(ctx);
 
 	return ctx;
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.h b/drivers/gpu/drm/amd/amdgpu/atom.h
index c729f7ceba4f..6463ce6e756d 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.h
+++ b/drivers/gpu/drm/amd/amdgpu/atom.h
@@ -148,6 +148,7 @@ struct atom_context {
 	uint8_t name[STRLEN_LONG];
 	uint8_t vbios_pn[STRLEN_LONG];
 	uint32_t version;
+	uint8_t vbios_ver_str[STRLEN_NORMAL];
 	uint8_t date[STRLEN_NORMAL];
 	uint32_t sub_dev_id;
 	uint32_t sub_ved_id;
diff --git a/drivers/gpu/drm/amd/include/atomfirmware.h b/drivers/gpu/drm/amd/include/atomfirmware.h
index 14d0d7d58255..28deecc2f990 100644
--- a/drivers/gpu/drm/amd/include/atomfirmware.h
+++ b/drivers/gpu/drm/amd/include/atomfirmware.h
@@ -198,6 +198,7 @@ enum atom_dp_vs_preemph_def{
 };
 
 #define BIOS_ATOM_PREFIX   "ATOMBIOS"
+#define BIOS_VERSION_PREFIX  "ATOMBIOSBK-AMD"
 #define BIOS_STRING_LENGTH 43
 
 /*
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
index 2d9e84658bbc..e0f98ca9a755 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -956,6 +956,7 @@ struct drm_amdgpu_info_vbios {
 	__u32 dbdf;
 	__u8 vbios_pn[64];
 	__u32 version;
+	__u8 vbios_ver_str[32];
 	__u8 date[32];
 	__u64 serial;
 	__u32 dev_id;
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: Add vbios version string
  2021-05-17 10:21 [PATCH] drm/amdgpu: Add vbios version string Jiawei Gu
@ 2021-05-17 10:28 ` Gu, JiaWei (Will)
  2021-05-17 10:40   ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Gu, JiaWei (Will) @ 2021-05-17 10:28 UTC (permalink / raw)
  To: Gu, JiaWei (Will),
	amd-gfx, Koenig, Christian, Nieto, David M, maraeo, Deucher,
	Alexander
  Cc: Deng, Emily

[AMD Official Use Only - Internal Distribution Only]

Hi all,

I know the vbios ioctl discussion is not settled down yet.
Please just regard this patch as a proposal to include vbios version string info into discussion.

Best regards,
Jiawei

-----Original Message-----
From: Jiawei Gu <Jiawei.Gu@amd.com> 
Sent: Monday, May 17, 2021 6:22 PM
To: amd-gfx@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>; Nieto, David M <David.Nieto@amd.com>; maraeo@gmail.com; Deucher, Alexander <Alexander.Deucher@amd.com>
Cc: Deng, Emily <Emily.Deng@amd.com>; Gu, JiaWei (Will) <JiaWei.Gu@amd.com>
Subject: [PATCH] drm/amdgpu: Add vbios version string

Expose XXX.XXX.XXX.XXX.XXXXXX vbios version string in AMDGPU_INFO_VBIOS_INFO ioctl

Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    |  2 ++
 drivers/gpu/drm/amd/amdgpu/atom.c          | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/atom.h          |  1 +
 drivers/gpu/drm/amd/include/atomfirmware.h |  1 +
 include/uapi/drm/amdgpu_drm.h              |  1 +
 5 files changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index e1008a79b441..30e4fed3de22 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -870,6 +870,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 			vbios_info.dbdf = PCI_DEVID(adev->pdev->bus->number, adev->pdev->devfn);
 			memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
 			vbios_info.version = atom_context->version;
+			memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
+						sizeof(atom_context->vbios_ver_str));
 			memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
 			vbios_info.serial = adev->unique_id;
 			vbios_info.dev_id = adev->pdev->device; diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
index 0e2f0ea13b40..542b2c2414e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.c
+++ b/drivers/gpu/drm/amd/amdgpu/atom.c
@@ -1438,6 +1438,21 @@ static void atom_get_vbios_pn(struct atom_context *ctx)
 	}
 }
 
+static void atom_get_vbios_version(struct atom_context *ctx) {
+	unsigned char *vbios_ver;
+
+	/* find anchor ATOMBIOSBK-AMD */
+	vbios_ver = atom_find_str_in_rom(ctx, BIOS_VERSION_PREFIX, 3, 1024, 64);
+	if (vbios_ver != NULL) {
+		/* skip ATOMBIOSBK-AMD VER */
+		vbios_ver += 18;
+		memcpy(ctx->vbios_ver_str, vbios_ver, STRLEN_NORMAL);
+	} else {
+		ctx->vbios_ver_str[0] = '\0';
+	}
+}
+
 struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)  {
 	int base;
@@ -1511,6 +1526,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
 	atom_get_vbios_name(ctx);
 	atom_get_vbios_pn(ctx);
 	atom_get_vbios_date(ctx);
+	atom_get_vbios_version(ctx);
 
 	return ctx;
 }
diff --git a/drivers/gpu/drm/amd/amdgpu/atom.h b/drivers/gpu/drm/amd/amdgpu/atom.h
index c729f7ceba4f..6463ce6e756d 100644
--- a/drivers/gpu/drm/amd/amdgpu/atom.h
+++ b/drivers/gpu/drm/amd/amdgpu/atom.h
@@ -148,6 +148,7 @@ struct atom_context {
 	uint8_t name[STRLEN_LONG];
 	uint8_t vbios_pn[STRLEN_LONG];
 	uint32_t version;
+	uint8_t vbios_ver_str[STRLEN_NORMAL];
 	uint8_t date[STRLEN_NORMAL];
 	uint32_t sub_dev_id;
 	uint32_t sub_ved_id;
diff --git a/drivers/gpu/drm/amd/include/atomfirmware.h b/drivers/gpu/drm/amd/include/atomfirmware.h
index 14d0d7d58255..28deecc2f990 100644
--- a/drivers/gpu/drm/amd/include/atomfirmware.h
+++ b/drivers/gpu/drm/amd/include/atomfirmware.h
@@ -198,6 +198,7 @@ enum atom_dp_vs_preemph_def{  };
 
 #define BIOS_ATOM_PREFIX   "ATOMBIOS"
+#define BIOS_VERSION_PREFIX  "ATOMBIOSBK-AMD"
 #define BIOS_STRING_LENGTH 43
 
 /*
diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 2d9e84658bbc..e0f98ca9a755 100644
--- a/include/uapi/drm/amdgpu_drm.h
+++ b/include/uapi/drm/amdgpu_drm.h
@@ -956,6 +956,7 @@ struct drm_amdgpu_info_vbios {
 	__u32 dbdf;
 	__u8 vbios_pn[64];
 	__u32 version;
+	__u8 vbios_ver_str[32];
 	__u8 date[32];
 	__u64 serial;
 	__u32 dev_id;
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: Add vbios version string
  2021-05-17 10:28 ` Gu, JiaWei (Will)
@ 2021-05-17 10:40   ` Christian König
  0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2021-05-17 10:40 UTC (permalink / raw)
  To: Gu, JiaWei (Will),
	amd-gfx, Koenig, Christian, Nieto, David M, maraeo, Deucher,
	Alexander
  Cc: Deng, Emily

Hi Jiawei,

yes agree and additional to that we need to go a step back here.

First of all once uAPI headers are added you are not allowed to change 
them again.

So this iterative approach where more and more fields to the structure 
is really a NO-GO.

Instead please revert all patches already pushed amd-staging-drm-next 
and then squash together all patches and send the result to the mailing 
list for discussion.

This way we can review and verify the uAPI as a whole and not in 
individual steps.

Regards,
Christian.

Am 17.05.21 um 12:28 schrieb Gu, JiaWei (Will):
> [AMD Official Use Only - Internal Distribution Only]
>
> Hi all,
>
> I know the vbios ioctl discussion is not settled down yet.
> Please just regard this patch as a proposal to include vbios version string info into discussion.
>
> Best regards,
> Jiawei
>
> -----Original Message-----
> From: Jiawei Gu <Jiawei.Gu@amd.com>
> Sent: Monday, May 17, 2021 6:22 PM
> To: amd-gfx@lists.freedesktop.org; Koenig, Christian <Christian.Koenig@amd.com>; Nieto, David M <David.Nieto@amd.com>; maraeo@gmail.com; Deucher, Alexander <Alexander.Deucher@amd.com>
> Cc: Deng, Emily <Emily.Deng@amd.com>; Gu, JiaWei (Will) <JiaWei.Gu@amd.com>
> Subject: [PATCH] drm/amdgpu: Add vbios version string
>
> Expose XXX.XXX.XXX.XXX.XXXXXX vbios version string in AMDGPU_INFO_VBIOS_INFO ioctl
>
> Signed-off-by: Jiawei Gu <Jiawei.Gu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    |  2 ++
>   drivers/gpu/drm/amd/amdgpu/atom.c          | 16 ++++++++++++++++
>   drivers/gpu/drm/amd/amdgpu/atom.h          |  1 +
>   drivers/gpu/drm/amd/include/atomfirmware.h |  1 +
>   include/uapi/drm/amdgpu_drm.h              |  1 +
>   5 files changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index e1008a79b441..30e4fed3de22 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -870,6 +870,8 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>   			vbios_info.dbdf = PCI_DEVID(adev->pdev->bus->number, adev->pdev->devfn);
>   			memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
>   			vbios_info.version = atom_context->version;
> +			memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
> +						sizeof(atom_context->vbios_ver_str));
>   			memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
>   			vbios_info.serial = adev->unique_id;
>   			vbios_info.dev_id = adev->pdev->device; diff --git a/drivers/gpu/drm/amd/amdgpu/atom.c b/drivers/gpu/drm/amd/amdgpu/atom.c
> index 0e2f0ea13b40..542b2c2414e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.c
> @@ -1438,6 +1438,21 @@ static void atom_get_vbios_pn(struct atom_context *ctx)
>   	}
>   }
>   
> +static void atom_get_vbios_version(struct atom_context *ctx) {
> +	unsigned char *vbios_ver;
> +
> +	/* find anchor ATOMBIOSBK-AMD */
> +	vbios_ver = atom_find_str_in_rom(ctx, BIOS_VERSION_PREFIX, 3, 1024, 64);
> +	if (vbios_ver != NULL) {
> +		/* skip ATOMBIOSBK-AMD VER */
> +		vbios_ver += 18;
> +		memcpy(ctx->vbios_ver_str, vbios_ver, STRLEN_NORMAL);
> +	} else {
> +		ctx->vbios_ver_str[0] = '\0';
> +	}
> +}
> +
>   struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)  {
>   	int base;
> @@ -1511,6 +1526,7 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios)
>   	atom_get_vbios_name(ctx);
>   	atom_get_vbios_pn(ctx);
>   	atom_get_vbios_date(ctx);
> +	atom_get_vbios_version(ctx);
>   
>   	return ctx;
>   }
> diff --git a/drivers/gpu/drm/amd/amdgpu/atom.h b/drivers/gpu/drm/amd/amdgpu/atom.h
> index c729f7ceba4f..6463ce6e756d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/atom.h
> +++ b/drivers/gpu/drm/amd/amdgpu/atom.h
> @@ -148,6 +148,7 @@ struct atom_context {
>   	uint8_t name[STRLEN_LONG];
>   	uint8_t vbios_pn[STRLEN_LONG];
>   	uint32_t version;
> +	uint8_t vbios_ver_str[STRLEN_NORMAL];
>   	uint8_t date[STRLEN_NORMAL];
>   	uint32_t sub_dev_id;
>   	uint32_t sub_ved_id;
> diff --git a/drivers/gpu/drm/amd/include/atomfirmware.h b/drivers/gpu/drm/amd/include/atomfirmware.h
> index 14d0d7d58255..28deecc2f990 100644
> --- a/drivers/gpu/drm/amd/include/atomfirmware.h
> +++ b/drivers/gpu/drm/amd/include/atomfirmware.h
> @@ -198,6 +198,7 @@ enum atom_dp_vs_preemph_def{  };
>   
>   #define BIOS_ATOM_PREFIX   "ATOMBIOS"
> +#define BIOS_VERSION_PREFIX  "ATOMBIOSBK-AMD"
>   #define BIOS_STRING_LENGTH 43
>   
>   /*
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 2d9e84658bbc..e0f98ca9a755 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -956,6 +956,7 @@ struct drm_amdgpu_info_vbios {
>   	__u32 dbdf;
>   	__u8 vbios_pn[64];
>   	__u32 version;
> +	__u8 vbios_ver_str[32];
>   	__u8 date[32];
>   	__u64 serial;
>   	__u32 dev_id;
> --
> 2.17.1
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-17 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 10:21 [PATCH] drm/amdgpu: Add vbios version string Jiawei Gu
2021-05-17 10:28 ` Gu, JiaWei (Will)
2021-05-17 10:40   ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.