Skip to contentSkip to conversation

drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

PATCH In review Jiawei Gu 6 participants 18 messages May 8, 2021 – May 15, 2021

Subsystems (3)
lore
Share & tools
lore

Jiawei Gu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

20 should be serial char size now instead of 16.

---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -1
index 2b487a8d2727..1c20721f90da 100644
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
 	__u8 vbios_pn[64];
 	__u32 version;
 	__u8 date[32];
-	__u8 serial[16];
+	__u8 serial[20];
 	__u32 dev_id;
 	__u32 rev_id;
 	__u32 sub_dev_id;
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw
Quoted 4 lines · Jiawei Gu

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 20 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/uapi/drm/amdgpu_drm.h +1 -2
index 2b487a8d2727..1c20721f90da 100644
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
--

2.17.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: amd-gfx list <[email protected]>; Kees Cook <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 4 lines · Jiawei Gu

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines
---
 include/uapi/drm/amdgpu_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
--

2.17.1

Quoted 10 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJi awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;rese rved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 51 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: amd-gfx list <[email protected]>; Kees Cook <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 5 lines · Jiawei Gu

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 10 lines
Quoted 10 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJi awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;rese rved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
	__u8 name[64];
	__u32 dbdf;
	__u8 vbios_pn[64];
	__u32 version;
	__u8 date[32];
	__u8 serial[16]; // jiawei: shall we delete this
	__u32 dev_id;
	__u32 rev_id;
	__u32 sub_dev_id;
	__u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
	struct drm_device *ddev = dev_get_drvdata(dev);
	struct amdgpu_device *adev = ddev->dev_private;

	return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: Alex Deucher <[email protected]>; amd-gfx list <[email protected]>; Kees Cook <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: amd-gfx list <[email protected]>; Kees Cook <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 5 lines · Jiawei Gu

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________
From: Gu, JiaWei (Will) <[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]>
Cc: Alex Deucher <[email protected]>; amd-gfx list <[email protected]>; Kees Cook <[email protected]>; Deng, Emily <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: Alex Deucher <[email protected]>; amd-gfx list <[email protected]>; Kees Cook <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: amd-gfx list <[email protected]>; Kees Cook <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 5 lines · Jiawei Gu

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Quoted 126 lines

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

------------------------------------------------------------------------
*From:* Gu, JiaWei (Will) <[email protected]>
*Sent:* Monday, May 10, 2021 12:13:07 AM
*To:* Nieto, David M <[email protected]>
*Cc:* Alex Deucher <[email protected]>; amd-gfx list <[email protected]>; Kees Cook <[email protected]>; Deng, Emily <[email protected]> *Subject:* RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios
[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios  copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev, struct device_attribute *attr, char *buf) {
        struct drm_device *ddev = dev_get_drvdata(dev); struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial); }

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: Alex Deucher <[email protected]>; amd-gfx list <[email protected]>; Kees Cook <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 6 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs

serial_number already exposes it.

Quoted 48 lines

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: amd-gfx list <[email protected]>; Kees Cook <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 5 lines · Jiawei Gu

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
         __u8 vbios_pn[64];
         __u32 version;
         __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
         __u32 dev_id;
         __u32 rev_id;
         __u32 sub_dev_id;
--

2.17.1

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis>

Quoted 4 lines
Quoted 4 lines

t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines
Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,
David

From: Christian König <[email protected]>
Date: Monday, May 10, 2021 at 6:48 AM
To: "Nieto, David M" <[email protected]>, "Gu, JiaWei (Will)" <[email protected]>
Cc: Alex Deucher <[email protected]>, "Deng, Emily" <[email protected]>, Kees Cook <[email protected]>, amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.
Am 10.05.21 um 15:42 schrieb Nieto, David M:
Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________
From: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · On May 9, 2021, at 23:33, Gu, JiaWei (Will)…

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in
drm_amdgpu_info_vbios

Quoted 5 lines · On Sat, May 8, 2021 at 2:48 AM Jiawei Gu…

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]<mailto:[email protected]>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#8 lore raw

[AMD Official Use Only - Internal Distribution Only]

Got it. Let's keep them both.

Another idea about drm_amdgpu_info_vbios is
Does it make more sense to fill the "serial info" with uint64_t adev->unique_id, instead of the current char[] in adev->serial?

Sorry about that I was not aware of adev->unique_id exists when I defined drm_amdgpu_info_vbios. I think it's clearer to use original numeric variable than a string to expose serial.

How about that?

Quoted 10 lines

Review

Quoted 10 lines
struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
(quoted diff) +1 -2
-       __u8 serial[16];
+       __u64 serial;
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

Best regards,
Jiawei

From: Nieto, David M <[email protected]>
Sent: Tuesday, May 11, 2021 4:20 AM
To: Christian König <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Cc: Alex Deucher <[email protected]>; Deng, Emily <[email protected]>; Kees Cook <[email protected]>; amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes...

I think there is value in having both tbh.

Regards,
David

From: Christian König <[email protected]<mailto:[email protected]>>
Date: Monday, May 10, 2021 at 6:48 AM
To: "Nieto, David M" <[email protected]<mailto:[email protected]>>, "Gu, JiaWei (Will)" <[email protected]<mailto:[email protected]>>
Cc: Alex Deucher <[email protected]<mailto:[email protected]>>, "Deng, Emily" <[email protected]<mailto:[email protected]>>, Kees Cook <[email protected]<mailto:[email protected]>>, amd-gfx list <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.
Am 10.05.21 um 15:42 schrieb Nieto, David M:
Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________
From: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · On May 9, 2021, at 23:33, Gu, JiaWei (Will)…

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in
drm_amdgpu_info_vbios

Quoted 5 lines · On Sat, May 8, 2021 at 2:48 AM Jiawei Gu…

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]<mailto:[email protected]>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#9 lore raw

[AMD Official Use Only - Internal Distribution Only]

I agree that the serial number should be on number form, but I think we are still missing one field, which is the vbios name, which is located after the P/N, ASIC, PCI and memory type strings (skiping 0xD 0xA

David
________________________________
From: Gu, JiaWei (Will) <[email protected]>
Sent: Monday, May 10, 2021 7:23 PM
To: Nieto, David M <[email protected]>; Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>; Deng, Emily <[email protected]>; Kees Cook <[email protected]>; amd-gfx list <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Got it. Let’s keep them both.

Another idea about drm_amdgpu_info_vbios is

Does it make more sense to fill the “serial info” with uint64_t adev->unique_id, instead of the current char[] in adev->serial?

Sorry about that I was not aware of adev->unique_id exists when I defined drm_amdgpu_info_vbios.

I think it’s clearer to use original numeric variable than a string to expose serial.

How about that?

Quoted 10 lines

Review

Quoted 10 lines
struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
(quoted diff) +1 -2
-       __u8 serial[16];
+       __u64 serial;
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

Best regards,

Jiawei

From: Nieto, David M <[email protected]>
Sent: Tuesday, May 11, 2021 4:20 AM
To: Christian König <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Cc: Alex Deucher <[email protected]>; Deng, Emily <[email protected]>; Kees Cook <[email protected]>; amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,

David

From: Christian König <[email protected]<mailto:[email protected]>>
Date: Monday, May 10, 2021 at 6:48 AM
To: "Nieto, David M" <[email protected]<mailto:[email protected]>>, "Gu, JiaWei (Will)" <[email protected]<mailto:[email protected]>>
Cc: Alex Deucher <[email protected]<mailto:[email protected]>>, "Deng, Emily" <[email protected]<mailto:[email protected]>>, Kees Cook <[email protected]<mailto:[email protected]>>, amd-gfx list <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________

From: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · On May 9, 2021, at 23:33, Gu, JiaWei (Will)…

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in
drm_amdgpu_info_vbios

Quoted 5 lines · On Sat, May 8, 2021 at 2:48 AM Jiawei Gu…

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]<mailto:[email protected]>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#10 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi David,

The snippet of code we posted here is truncated.
Here's the complete current struct:

struct drm_amdgpu_info_vbios {
               __u8 name[64];
               __u32 dbdf;
               __u8 vbios_pn[64];
               __u32 version;
               __u8 date[32];
               __u8 serial[16];
               __u32 dev_id;
               __u32 rev_id;
               __u32 sub_dev_id;
               __u32 sub_ved_id;
};

We included vbios name already.

Best regards,
Jiawei

From: Nieto, David M <[email protected]>
Sent: Tuesday, May 11, 2021 10:52 AM
To: Gu, JiaWei (Will) <[email protected]>; Christian König <[email protected]>
Cc: Alex Deucher <[email protected]>; Deng, Emily <[email protected]>; Kees Cook <[email protected]>; amd-gfx list <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

I agree that the serial number should be on number form, but I think we are still missing one field, which is the vbios name, which is located after the P/N, ASIC, PCI and memory type strings (skiping 0xD 0xA

David
________________________________
From: Gu, JiaWei (Will) <[email protected]<mailto:[email protected]>>
Sent: Monday, May 10, 2021 7:23 PM
To: Nieto, David M <[email protected]<mailto:[email protected]>>; Christian König <[email protected]<mailto:[email protected]>>
Cc: Alex Deucher <[email protected]<mailto:[email protected]>>; Deng, Emily <[email protected]<mailto:[email protected]>>; Kees Cook <[email protected]<mailto:[email protected]>>; amd-gfx list <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Got it. Let's keep them both.

Another idea about drm_amdgpu_info_vbios is

Does it make more sense to fill the "serial info" with uint64_t adev->unique_id, instead of the current char[] in adev->serial?

Sorry about that I was not aware of adev->unique_id exists when I defined drm_amdgpu_info_vbios.

I think it's clearer to use original numeric variable than a string to expose serial.

How about that?

Quoted 10 lines

Review

Quoted 10 lines
struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
(quoted diff) +1 -2
-       __u8 serial[16];
+       __u64 serial;
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

Best regards,

Jiawei

From: Nieto, David M <[email protected]<mailto:[email protected]>>
Sent: Tuesday, May 11, 2021 4:20 AM
To: Christian König <[email protected]<mailto:[email protected]>>; Gu, JiaWei (Will) <[email protected]<mailto:[email protected]>>
Cc: Alex Deucher <[email protected]<mailto:[email protected]>>; Deng, Emily <[email protected]<mailto:[email protected]>>; Kees Cook <[email protected]<mailto:[email protected]>>; amd-gfx list <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes...

I think there is value in having both tbh.

Regards,

David

From: Christian König <[email protected]<mailto:[email protected]>>
Date: Monday, May 10, 2021 at 6:48 AM
To: "Nieto, David M" <[email protected]<mailto:[email protected]>>, "Gu, JiaWei (Will)" <[email protected]<mailto:[email protected]>>
Cc: Alex Deucher <[email protected]<mailto:[email protected]>>, "Deng, Emily" <[email protected]<mailto:[email protected]>>, Kees Cook <[email protected]<mailto:[email protected]>>, amd-gfx list <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________

From: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · On May 9, 2021, at 23:33, Gu, JiaWei (Will)…

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in
drm_amdgpu_info_vbios

Quoted 5 lines · On Sat, May 8, 2021 at 2:48 AM Jiawei Gu…

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]<mailto:[email protected]>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#11 lore raw
In reply to Nieto, David M

Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

Quoted 188 lines

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,

David

*From: *Christian König <[email protected]>
*Date: *Monday, May 10, 2021 at 6:48 AM
*To: *"Nieto, David M" <[email protected]>, "Gu, JiaWei (Will)" <[email protected]>
*Cc: *Alex Deucher <[email protected]>, "Deng, Emily" <[email protected]>, Kees Cook <[email protected]>, amd-gfx list <[email protected]> *Subject: *Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

    Then the application would need to issue the ioctl and then open a
    sysfs file to get all the information it needs. It makes little
    sense from a programming perspective to add an incomplete
    interface in my opinion

    ------------------------------------------------------------------------

    *From:*Gu, JiaWei (Will) <[email protected]>
    <mailto:[email protected]>
    *Sent:* Monday, May 10, 2021 12:13:07 AM
    *To:* Nieto, David M <[email protected]>
    <mailto:[email protected]>
    *Cc:* Alex Deucher <[email protected]>
    <mailto:[email protected]>; amd-gfx list
    <[email protected]>
    <mailto:[email protected]>; Kees Cook
    <[email protected]> <mailto:[email protected]>; Deng,
    Emily <[email protected]> <mailto:[email protected]>
    *Subject:* RE: [PATCH] drm/amdgpu: Align serial size in
    drm_amdgpu_info_vbios

    [AMD Official Use Only - Internal Distribution Only]

    Hi David,

    What I meant is to ONLY delete the serial[16] from
    drm_amdgpu_info_vbios, not the whole struct.

    struct drm_amdgpu_info_vbios {
            __u8 name[64];
            __u32 dbdf;
            __u8 vbios_pn[64];
            __u32 version;
            __u8 date[32];
            __u8 serial[16]; // jiawei: shall we delete this
            __u32 dev_id;
            __u32 rev_id;
            __u32 sub_dev_id;
            __u32 sub_ved_id;
    };

    serial[16] in drm_amdgpu_info_vbios  copied from adev->serial, but
    there's already a sysfs named serial_number, which exposes it already.

    static ssize_t amdgpu_device_get_serial_number(struct device *dev,
                    struct device_attribute *attr, char *buf)
    {
            struct drm_device *ddev = dev_get_drvdata(dev);
            struct amdgpu_device *adev = ddev->dev_private;

            return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
    }

    Thanks,
    Jiawei


    -----Original Message-----
    From: Nieto, David M <[email protected]>
    <mailto:[email protected]>
    Sent: Monday, May 10, 2021 2:53 PM
    To: Gu, JiaWei (Will) <[email protected]> <mailto:[email protected]>
    Cc: Alex Deucher <[email protected]>
    <mailto:[email protected]>; amd-gfx list
    <[email protected]>
    <mailto:[email protected]>; Kees Cook
    <[email protected]> <mailto:[email protected]>; Deng,
    Emily <[email protected]> <mailto:[email protected]>
    Subject: Re: [PATCH] drm/amdgpu: Align serial size in
    drm_amdgpu_info_vbios

    No, this structure contains all the details of the vbios: date,
    serial number, name, etc.

    The sysfs node only contains the vbios name string

    > On May 9, 2021, at 23:33, Gu, JiaWei (Will) <[email protected]>
    <mailto:[email protected]> wrote:
    >
    > [AMD Official Use Only - Internal Distribution Only]
    >
    > With a second thought,
    > __u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant,
    sysfs serial_number already exposes it.
    >
    > Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex
    > Deucher @Nieto, David M
    >
    > Best regards,
    > Jiawei
    >
    > -----Original Message-----
    > From: Alex Deucher <[email protected]>
    <mailto:[email protected]>
    > Sent: Sunday, May 9, 2021 11:59 PM
    > To: Gu, JiaWei (Will) <[email protected]> <mailto:[email protected]>
    > Cc: amd-gfx list <[email protected]>
    <mailto:[email protected]>; Kees Cook
    > <[email protected]> <mailto:[email protected]>
    > Subject: Re: [PATCH] drm/amdgpu: Align serial size in
    > drm_amdgpu_info_vbios
    >
    >> On Sat, May 8, 2021 at 2:48 AM Jiawei Gu <[email protected]>
    <mailto:[email protected]> wrote:
    >>
    >> 20 should be serial char size now instead of 16.
    >>
    >> Signed-off-by: Jiawei Gu <[email protected]>
    <mailto:[email protected]>
    >
    > Please make sure this keeps proper 64 bit alignment in the
    structure.
    >
    > Alex
    >
    >
    >> ---
    >> include/uapi/drm/amdgpu_drm.h | 2 +-
    >> 1 file changed, 1 insertion(+), 1 deletion(-)
    >>
    >> diff --git a/include/uapi/drm/amdgpu_drm.h
    >> b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da
    >> 100644
    >> --- a/include/uapi/drm/amdgpu_drm.h
    >> +++ b/include/uapi/drm/amdgpu_drm.h
    >> @@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
    >>        __u8 vbios_pn[64];
    >>        __u32 version;
    >>        __u8 date[32];
    >> -       __u8 serial[16];
    >> +       __u8 serial[20];
    >>        __u32 dev_id;
    >>        __u32 rev_id;
    >>        __u32 sub_dev_id;
    >> --
    >> 2.17.1
    >>
    >> _______________________________________________
    >> amd-gfx mailing list
    >> [email protected]
    <mailto:[email protected]>
    >>
    https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
    <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis>
    >> t
    >>
    s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ
    >> i
    >>
    awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e
    >> 6
    >>
    08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3
    >> d
    >>
    8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
    >> C
    >>
    1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res
    >> e
    >> rved=0
Quoted 10 lines
    _______________________________________________

    amd-gfx mailing list

    [email protected]  <mailto:[email protected]>

    https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#12 lore raw

Mesa doesn't use sysfs.

Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.

What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?

Marek

Quoted 215 lines · Christian König

Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,

David

*From: *Christian König <[email protected]> <[email protected]>
*Date: *Monday, May 10, 2021 at 6:48 AM
*To: *"Nieto, David M" <[email protected]> <[email protected]>, "Gu, JiaWei (Will)" <[email protected]> <[email protected]>
*Cc: *Alex Deucher <[email protected]> <[email protected]>, "Deng, Emily" <[email protected]> <[email protected]>, Kees Cook <[email protected]> <[email protected]>, amd-gfx list <[email protected]> <[email protected]> *Subject: *Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

------------------------------

*From:* Gu, JiaWei (Will) <[email protected]> <[email protected]> *Sent:* Monday, May 10, 2021 12:13:07 AM
*To:* Nieto, David M <[email protected]> <[email protected]> *Cc:* Alex Deucher <[email protected]> <[email protected]>; amd-gfx list <[email protected]> <[email protected]>; Kees Cook <[email protected]> <[email protected]>; Deng, Emily <[email protected]> <[email protected]>
*Subject:* RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]> <[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]> <[email protected]>
Cc: Alex Deucher <[email protected]> <[email protected]>; amd-gfx list <[email protected]> <[email protected]>; Kees Cook <[email protected]> <[email protected]>; Deng, Emily <[email protected]> <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 1 line

On May 9, 2021, at 23:33, Gu, JiaWei (Will) <[email protected]>

Quoted 5 lines · <[email protected]> wrote:

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs

serial_number already exposes it.

Quoted 4 lines

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Quoted 8 lines

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]> <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]> <[email protected]>
Cc: amd-gfx list <[email protected]>

<[email protected]>; Kees Cook

Quoted 5 lines

<[email protected]> <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 1 line

On Sat, May 8, 2021 at 2:48 AM Jiawei Gu <[email protected]>

Quoted 31 lines · <[email protected]> wrote:
Quoted 4 lines

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]

https://lists.freedesktop.org/mailman/listinfo/amd-gfx <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7C3c0071a8a2a74127027408d913ba53e4%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637562513264718308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=g11aunC78b48N19Q%2FFXJBK%2B2Z0PZBWdqp%2FzhsPiqQ8Q%3D&reserved=0>

Quoted 5 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#13 lore raw

[AMD Public Use]

It's being used by umr and some other smi tools to provide vbios information for debugging.

Alex

________________________________
From: amd-gfx <[email protected]> on behalf of Marek Olšák <[email protected]>
Sent: Tuesday, May 11, 2021 4:18 AM
To: Christian König <[email protected]>
Cc: Kees Cook <[email protected]>; Gu, JiaWei (Will) <[email protected]>; amd-gfx list <[email protected]>; Deng, Emily <[email protected]>; Alex Deucher <[email protected]>; Nieto, David M <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Mesa doesn't use sysfs.

Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.

What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?

Marek

On Tue, May 11, 2021 at 3:51 AM Christian König <[email protected]<mailto:[email protected]>> wrote:
Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,

David

From: Christian König <[email protected]><mailto:[email protected]>
Date: Monday, May 10, 2021 at 6:48 AM
To: "Nieto, David M" <[email protected]><mailto:[email protected]>, "Gu, JiaWei (Will)" <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>, "Deng, Emily" <[email protected]><mailto:[email protected]>, Kees Cook <[email protected]><mailto:[email protected]>, amd-gfx list <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________

From: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · On May 9, 2021, at 23:33, Gu, JiaWei (Will)…

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in
drm_amdgpu_info_vbios

Quoted 5 lines · On Sat, May 8, 2021 at 2:48 AM Jiawei Gu…

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.freedesktop.org%2F&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729003008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5c730zpnFFOm3EgabDFoiYlsl2tsaxImaTlVfap%2BfHQ%3D&reserved=0>%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2F40amd.com%2F&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729003008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=FzFHfe095%2FDzOYR%2BZ3tAzlF2wDRYsD5kOt%2Bf37nNVP4%3D&reserved=0>%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]<mailto:[email protected]>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729012969%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GA4tfIXNrbU98WUMQl%2Bkd28DyNgqjlZcIAryQtVIn%2Bw%3D&reserved=0>

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729012969%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GA4tfIXNrbU98WUMQl%2Bkd28DyNgqjlZcIAryQtVIn%2Bw%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#14 lore raw

Yeah, but umr is making strong use of sysfs as well.

The only justification of this interface would be if we want to use it in Mesa.

And I agree with Marek that looks redundant with the device structure to me as well.

Christian.

Am 11.05.21 um 16:04 schrieb Deucher, Alexander:

Quoted 258 lines

[AMD Public Use]

It's being used by umr and some other smi tools to provide vbios information for debugging.

Alex

------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> on behalf of Marek Olšák <[email protected]>
*Sent:* Tuesday, May 11, 2021 4:18 AM
*To:* Christian König <[email protected]>
*Cc:* Kees Cook <[email protected]>; Gu, JiaWei (Will) <[email protected]>; amd-gfx list <[email protected]>; Deng, Emily <[email protected]>; Alex Deucher <[email protected]>; Nieto, David M <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios
Mesa doesn't use sysfs.

Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.

What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?

Marek

On Tue, May 11, 2021 at 3:51 AM Christian König <[email protected] <mailto:[email protected]>> wrote:

Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

Quoted 210 lines
    One of the primary usecases is to add this information to the
    renderer string, I am not sure if there are other cases of UMD
    drivers accessing sysfs nodes, but I think if we think
    permissions, if a client is authenticated and opens the render
    device then it can use the IOCTL, it is unclear to me we can make
    a such an assumption for sysfs nodes…

    I think there is value in having both tbh.

    Regards,

    David

    *From: *Christian König <[email protected]>
    <mailto:[email protected]>
    *Date: *Monday, May 10, 2021 at 6:48 AM
    *To: *"Nieto, David M" <[email protected]>
    <mailto:[email protected]>, "Gu, JiaWei (Will)"
    <[email protected]> <mailto:[email protected]>
    *Cc: *Alex Deucher <[email protected]>
    <mailto:[email protected]>, "Deng, Emily"
    <[email protected]> <mailto:[email protected]>, Kees Cook
    <[email protected]> <mailto:[email protected]>, amd-gfx
    list <[email protected]>
    <mailto:[email protected]>
    *Subject: *Re: [PATCH] drm/amdgpu: Align serial size in
    drm_amdgpu_info_vbios

    Well we could add both as sysfs file(s).

    Question here is rather what is the primary use case of this and
    if the application has the necessary access permissions to the
    sysfs files?

    Regards,
    Christian.

    Am 10.05.21 um 15:42 schrieb Nieto, David M:

        Then the application would need to issue the ioctl and then
        open a sysfs file to get all the information it needs. It
        makes little sense from a programming perspective to add an
        incomplete interface in my opinion

        ------------------------------------------------------------------------

        *From:*Gu, JiaWei (Will) <[email protected]>
        <mailto:[email protected]>
        *Sent:* Monday, May 10, 2021 12:13:07 AM
        *To:* Nieto, David M <[email protected]>
        <mailto:[email protected]>
        *Cc:* Alex Deucher <[email protected]>
        <mailto:[email protected]>; amd-gfx list
        <[email protected]>
        <mailto:[email protected]>; Kees Cook
        <[email protected]> <mailto:[email protected]>; Deng,
        Emily <[email protected]> <mailto:[email protected]>
        *Subject:* RE: [PATCH] drm/amdgpu: Align serial size in
        drm_amdgpu_info_vbios

        [AMD Official Use Only - Internal Distribution Only]

        Hi David,

        What I meant is to ONLY delete the serial[16] from
        drm_amdgpu_info_vbios, not the whole struct.

        struct drm_amdgpu_info_vbios {
                __u8 name[64];
                __u32 dbdf;
                __u8 vbios_pn[64];
                __u32 version;
                __u8 date[32];
                __u8 serial[16]; // jiawei: shall we delete this
                __u32 dev_id;
                __u32 rev_id;
                __u32 sub_dev_id;
                __u32 sub_ved_id;
        };

        serial[16] in drm_amdgpu_info_vbios  copied from
        adev->serial, but there's already a sysfs named
        serial_number, which exposes it already.

        static ssize_t amdgpu_device_get_serial_number(struct device
        *dev,
                        struct device_attribute *attr, char *buf)
        {
                struct drm_device *ddev = dev_get_drvdata(dev);
                struct amdgpu_device *adev = ddev->dev_private;

                return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
        }

        Thanks,
        Jiawei


        -----Original Message-----
        From: Nieto, David M <[email protected]>
        <mailto:[email protected]>
        Sent: Monday, May 10, 2021 2:53 PM
        To: Gu, JiaWei (Will) <[email protected]>
        <mailto:[email protected]>
        Cc: Alex Deucher <[email protected]>
        <mailto:[email protected]>; amd-gfx list
        <[email protected]>
        <mailto:[email protected]>; Kees Cook
        <[email protected]> <mailto:[email protected]>; Deng,
        Emily <[email protected]> <mailto:[email protected]>
        Subject: Re: [PATCH] drm/amdgpu: Align serial size in
        drm_amdgpu_info_vbios

        No, this structure contains all the details of the vbios:
        date, serial number, name, etc.

        The sysfs node only contains the vbios name string

        > On May 9, 2021, at 23:33, Gu, JiaWei (Will)
        <[email protected]> <mailto:[email protected]> wrote:
        >
        > [AMD Official Use Only - Internal Distribution Only]
        >
        > With a second thought,
        > __u8 serial[16] in drm_amdgpu_info_vbios is a bit
        redundant, sysfs serial_number already exposes it.
        >
        > Is it fine to abandon it from drm_amdgpu_info_vbios struct?
        @Alex
        > Deucher @Nieto, David M
        >
        > Best regards,
        > Jiawei
        >
        > -----Original Message-----
        > From: Alex Deucher <[email protected]>
        <mailto:[email protected]>
        > Sent: Sunday, May 9, 2021 11:59 PM
        > To: Gu, JiaWei (Will) <[email protected]>
        <mailto:[email protected]>
        > Cc: amd-gfx list <[email protected]>
        <mailto:[email protected]>; Kees Cook
        > <[email protected]> <mailto:[email protected]>
        > Subject: Re: [PATCH] drm/amdgpu: Align serial size in
        > drm_amdgpu_info_vbios
        >
        >> On Sat, May 8, 2021 at 2:48 AM Jiawei Gu
        <[email protected]> <mailto:[email protected]> wrote:
        >>
        >> 20 should be serial char size now instead of 16.
        >>
        >> Signed-off-by: Jiawei Gu <[email protected]>
        <mailto:[email protected]>
        >
        > Please make sure this keeps proper 64 bit alignment in the
        structure.
        >
        > Alex
        >
        >
        >> ---
        >> include/uapi/drm/amdgpu_drm.h | 2 +-
        >> 1 file changed, 1 insertion(+), 1 deletion(-)
        >>
        >> diff --git a/include/uapi/drm/amdgpu_drm.h
        >> b/include/uapi/drm/amdgpu_drm.h index
        2b487a8d2727..1c20721f90da
        >> 100644
        >> --- a/include/uapi/drm/amdgpu_drm.h
        >> +++ b/include/uapi/drm/amdgpu_drm.h
        >> @@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
        >>        __u8 vbios_pn[64];
        >>        __u32 version;
        >>        __u8 date[32];
        >> -       __u8 serial[16];
        >> +       __u8 serial[20];
        >>        __u32 dev_id;
        >>        __u32 rev_id;
        >>        __u32 sub_dev_id;
        >> --
        >> 2.17.1
        >>
        >> _______________________________________________
        >> amd-gfx mailing list
        >> [email protected]
        <mailto:[email protected]>
        >>
        https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
        <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis>
        >> t
        >> s.freedesktop.org
        <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.freedesktop.org%2F&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729003008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=5c730zpnFFOm3EgabDFoiYlsl2tsaxImaTlVfap%2BfHQ%3D&reserved=0>%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ
        >> i
        >> awei.Gu%40amd.com
        <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2F40amd.com%2F&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729003008%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=FzFHfe095%2FDzOYR%2BZ3tAzlF2wDRYsD5kOt%2Bf37nNVP4%3D&reserved=0>%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e
        >> 6
        >>
        08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3
        >> d
        >>
        8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
        >> C
        >>
        1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res
        >> e
        >> rved=0
Quoted 10 lines
        _______________________________________________

        amd-gfx mailing list

        [email protected]  <mailto:[email protected]>

        https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729012969%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GA4tfIXNrbU98WUMQl%2Bkd28DyNgqjlZcIAryQtVIn%2Bw%3D&reserved=0>
Quoted 6 lines
    _______________________________________________
    amd-gfx mailing list
    [email protected] <mailto:[email protected]>
    https://lists.freedesktop.org/mailman/listinfo/amd-gfx
    <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C3503a51f2fa04376040b08d914558033%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563179729012969%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GA4tfIXNrbU98WUMQl%2Bkd28DyNgqjlZcIAryQtVIn%2Bw%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#15 lore raw

[AMD Public Use]

The point of having the device ID in the structure is because we are reading it from the VBIOS header, not the asic registers. They should match, but an user may flash a VBIOS for a different devid and they may not match.

Regarding sysfs vs ioctl I see value in providing it in both ways, Mesa uses IOCTL and other DRM based tools may benefit as well. I recently went through the trouble of having to add sysfs string parsing for some data not available in ioctl, and while not very complicated, it is a programming inconvenience.

I understand that being uapi, changing it is not easy, but this is information extracted from a VBIOS header, something that has been kept stable for many years.

David
________________________________
From: Christian König <[email protected]>
Sent: Tuesday, May 11, 2021 7:07 AM
To: Deucher, Alexander <[email protected]>; Marek Olšák <[email protected]>
Cc: Kees Cook <[email protected]>; Gu, JiaWei (Will) <[email protected]>; amd-gfx list <[email protected]>; Deng, Emily <[email protected]>; Alex Deucher <[email protected]>; Nieto, David M <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Yeah, but umr is making strong use of sysfs as well.

The only justification of this interface would be if we want to use it in Mesa.

And I agree with Marek that looks redundant with the device structure to me as well.

Christian.

Am 11.05.21 um 16:04 schrieb Deucher, Alexander:

[AMD Public Use]

It's being used by umr and some other smi tools to provide vbios information for debugging.

Alex

________________________________
From: amd-gfx <[email protected]><mailto:[email protected]> on behalf of Marek Olšák <[email protected]><mailto:[email protected]>
Sent: Tuesday, May 11, 2021 4:18 AM
To: Christian König <[email protected]><mailto:[email protected]>
Cc: Kees Cook <[email protected]><mailto:[email protected]>; Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>; Alex Deucher <[email protected]><mailto:[email protected]>; Nieto, David M <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Mesa doesn't use sysfs.

Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.

What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?

Marek

On Tue, May 11, 2021 at 3:51 AM Christian König <[email protected]<mailto:[email protected]>> wrote:
Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,

David

From: Christian König <[email protected]><mailto:[email protected]>
Date: Monday, May 10, 2021 at 6:48 AM
To: "Nieto, David M" <[email protected]><mailto:[email protected]>, "Gu, JiaWei (Will)" <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>, "Deng, Emily" <[email protected]><mailto:[email protected]>, Kees Cook <[email protected]><mailto:[email protected]>, amd-gfx list <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

________________________________

From: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 12:13:07 AM
To: Nieto, David M <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]><mailto:[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: Alex Deucher <[email protected]><mailto:[email protected]>; amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 54 lines · On May 9, 2021, at 23:33, Gu, JiaWei (Will)…

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs serial_number already exposes it.

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]><mailto:[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]><mailto:[email protected]>
Cc: amd-gfx list <[email protected]><mailto:[email protected]>; Kees Cook <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in
drm_amdgpu_info_vbios

Quoted 5 lines · On Sat, May 8, 2021 at 2:48 AM Jiawei Gu…

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 16 lines
Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t s.freedesktop.org<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.freedesktop.org%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684906500%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=gKeRCQ485gWespGfo1O01tZz8fDy1zPGHIDEvCqyp1I%3D&reserved=0>%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ i awei.Gu%40amd.com<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2F40amd.com%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684916541%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8pM7WTh9%2F23KCF6DuXOc4%2Fi7rDUSxmH647BdpujXgWo%3D&reserved=0>%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]<mailto:[email protected]>

https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684926488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hdhx2ogsQt2C3OIKNC%2BaswtNkiIWbV6Ot8a%2B3YFqa7w%3D&reserved=0>

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684926488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hdhx2ogsQt2C3OIKNC%2BaswtNkiIWbV6Ot8a%2B3YFqa7w%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#16 lore raw

1) Mesa doesn't plan to use this VBIOS query.

2) The patch is changing uapi, which is forbidden.

Marek

Quoted 298 lines · David M

[AMD Public Use]

The point of having the device ID in the structure is because we are reading it from the VBIOS header, not the asic registers. They should match, but an user may flash a VBIOS for a different devid and they may not match.

Regarding sysfs vs ioctl I see value in providing it in both ways, Mesa uses IOCTL and other DRM based tools may benefit as well. I recently went through the trouble of having to add sysfs string parsing for some data not available in ioctl, and while not very complicated, it is a programming inconvenience.

I understand that being uapi, changing it is not easy, but this is information extracted from a VBIOS header, something that has been kept stable for many years.

David
------------------------------
*From:* Christian König <[email protected]> *Sent:* Tuesday, May 11, 2021 7:07 AM
*To:* Deucher, Alexander <[email protected]>; Marek Olšák < [email protected]>
*Cc:* Kees Cook <[email protected]>; Gu, JiaWei (Will) < [email protected]>; amd-gfx list <[email protected]>; Deng, Emily <[email protected]>; Alex Deucher <[email protected]>; Nieto, David M <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Yeah, but umr is making strong use of sysfs as well.

The only justification of this interface would be if we want to use it in Mesa.

And I agree with Marek that looks redundant with the device structure to me as well.

Christian.

Am 11.05.21 um 16:04 schrieb Deucher, Alexander:

[AMD Public Use]

It's being used by umr and some other smi tools to provide vbios information for debugging.

Alex

------------------------------
*From:* amd-gfx <[email protected]> <[email protected]> on behalf of Marek Olšák <[email protected]> <[email protected]>
*Sent:* Tuesday, May 11, 2021 4:18 AM
*To:* Christian König <[email protected]> <[email protected]>
*Cc:* Kees Cook <[email protected]> <[email protected]>; Gu, JiaWei (Will) <[email protected]> <[email protected]>; amd-gfx list <[email protected]> <[email protected]>; Deng, Emily <[email protected]> <[email protected]>; Alex Deucher <[email protected]> <[email protected]>; Nieto, David M <[email protected]> <[email protected]>
*Subject:* Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Mesa doesn't use sysfs.

Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.

What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?

Marek

On Tue, May 11, 2021 at 3:51 AM Christian König <
[email protected]> wrote:

Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

One of the primary usecases is to add this information to the renderer string, I am not sure if there are other cases of UMD drivers accessing sysfs nodes, but I think if we think permissions, if a client is authenticated and opens the render device then it can use the IOCTL, it is unclear to me we can make a such an assumption for sysfs nodes…

I think there is value in having both tbh.

Regards,

David

*From: *Christian König <[email protected]> <[email protected]>
*Date: *Monday, May 10, 2021 at 6:48 AM
*To: *"Nieto, David M" <[email protected]> <[email protected]>, "Gu, JiaWei (Will)" <[email protected]> <[email protected]>
*Cc: *Alex Deucher <[email protected]> <[email protected]>, "Deng, Emily" <[email protected]> <[email protected]>, Kees Cook <[email protected]> <[email protected]>, amd-gfx list <[email protected]> <[email protected]> *Subject: *Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Well we could add both as sysfs file(s).

Question here is rather what is the primary use case of this and if the application has the necessary access permissions to the sysfs files?

Regards,
Christian.

Am 10.05.21 um 15:42 schrieb Nieto, David M:

Then the application would need to issue the ioctl and then open a sysfs file to get all the information it needs. It makes little sense from a programming perspective to add an incomplete interface in my opinion

------------------------------

*From:* Gu, JiaWei (Will) <[email protected]> <[email protected]> *Sent:* Monday, May 10, 2021 12:13:07 AM
*To:* Nieto, David M <[email protected]> <[email protected]> *Cc:* Alex Deucher <[email protected]> <[email protected]>; amd-gfx list <[email protected]> <[email protected]>; Kees Cook <[email protected]> <[email protected]>; Deng, Emily <[email protected]> <[email protected]>
*Subject:* RE: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

[AMD Official Use Only - Internal Distribution Only]

Hi David,

What I meant is to ONLY delete the serial[16] from drm_amdgpu_info_vbios, not the whole struct.

struct drm_amdgpu_info_vbios {
        __u8 name[64];
        __u32 dbdf;
        __u8 vbios_pn[64];
        __u32 version;
        __u8 date[32];
        __u8 serial[16]; // jiawei: shall we delete this
        __u32 dev_id;
        __u32 rev_id;
        __u32 sub_dev_id;
        __u32 sub_ved_id;
};

serial[16] in drm_amdgpu_info_vbios copied from adev->serial, but there's already a sysfs named serial_number, which exposes it already.

static ssize_t amdgpu_device_get_serial_number(struct device *dev,
struct device_attribute *attr, char *buf)

{
        struct drm_device *ddev = dev_get_drvdata(dev);
        struct amdgpu_device *adev = ddev->dev_private;

        return snprintf(buf, PAGE_SIZE, "%s\n", adev->serial);
}

Thanks,
Jiawei

-----Original Message-----
From: Nieto, David M <[email protected]> <[email protected]>
Sent: Monday, May 10, 2021 2:53 PM
To: Gu, JiaWei (Will) <[email protected]> <[email protected]>
Cc: Alex Deucher <[email protected]> <[email protected]>; amd-gfx list <[email protected]> <[email protected]>; Kees Cook <[email protected]> <[email protected]>; Deng, Emily <[email protected]> <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

No, this structure contains all the details of the vbios: date, serial number, name, etc.

The sysfs node only contains the vbios name string

Quoted 1 line

On May 9, 2021, at 23:33, Gu, JiaWei (Will) <[email protected]>

Quoted 5 lines · <[email protected]> wrote:

[AMD Official Use Only - Internal Distribution Only]

With a second thought,
__u8 serial[16] in drm_amdgpu_info_vbios is a bit redundant, sysfs

serial_number already exposes it.

Quoted 4 lines

Is it fine to abandon it from drm_amdgpu_info_vbios struct? @Alex Deucher @Nieto, David M

Quoted 8 lines

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]> <[email protected]>
Sent: Sunday, May 9, 2021 11:59 PM
To: Gu, JiaWei (Will) <[email protected]> <[email protected]>
Cc: amd-gfx list <[email protected]>

<[email protected]>; Kees Cook

Quoted 5 lines

<[email protected]> <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios

Quoted 1 line

On Sat, May 8, 2021 at 2:48 AM Jiawei Gu <[email protected]>

Quoted 31 lines · <[email protected]> wrote:
Quoted 4 lines

20 should be serial char size now instead of 16.

Please make sure this keeps proper 64 bit alignment in the structure.

Alex

Quoted 21 lines

---
include/uapi/drm/amdgpu_drm.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h index 2b487a8d2727..1c20721f90da 100644

include/uapi/drm/amdgpu_drm.h +1 -2
@@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
       __u8 vbios_pn[64];
       __u32 version;
       __u8 date[32];
-       __u8 serial[16];
+       __u8 serial[20];
       __u32 dev_id;
       __u32 rev_id;
       __u32 sub_dev_id;
--

2.17.1

Quoted 6 lines
Quoted 6 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
t
s.freedesktop.org

<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.freedesktop.org%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684906500%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=gKeRCQ485gWespGfo1O01tZz8fDy1zPGHIDEvCqyp1I%3D&reserved=0>
%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ

Quoted 2 lines
Quoted 2 lines

i
awei.Gu%40amd.com

<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2F40amd.com%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684916541%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8pM7WTh9%2F23KCF6DuXOc4%2Fi7rDUSxmH647BdpujXgWo%3D&reserved=0>
%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e

Quoted 8 lines
Quoted 8 lines

6 08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3 d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7 C 1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res e
rved=0

_______________________________________________

amd-gfx mailing list

[email protected]

https://lists.freedesktop.org/mailman/listinfo/amd-gfx <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684926488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hdhx2ogsQt2C3OIKNC%2BaswtNkiIWbV6Ot8a%2B3YFqa7w%3D&reserved=0>

Quoted 8 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684926488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hdhx2ogsQt2C3OIKNC%2BaswtNkiIWbV6Ot8a%2B3YFqa7w%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#17 lore raw

The uAPI isn't merged upstream yet, so can still be changed.

But I agree that this should be squashed into the original patch while upstreaming.

When this is just for umr as open source client then the question is still on the stable if this really need to be an IOCTL?

Christian.

Am 15.05.21 um 08:40 schrieb Marek Olšák:

Quoted 49 lines

1) Mesa doesn't plan to use this VBIOS query.

2) The patch is changing uapi, which is forbidden.

Marek

On Tue, May 11, 2021 at 12:35 PM Nieto, David M <[email protected] <mailto:[email protected]>> wrote:

[AMD Public Use]

The point of having the device ID in the structure is because we are reading it from the VBIOS header, not the asic registers. They should match, but an user may flash a VBIOS for a different devid and they may not match.

Regarding sysfs vs ioctl I see value in providing it in both ways, Mesa uses IOCTL and other DRM based tools may benefit as well. I recently went through the trouble of having to add sysfs string parsing for some data not available in ioctl, and while not very complicated, it is a programming inconvenience.

I understand that being uapi, changing it is not easy, but this is information extracted from a VBIOS header, something that has been kept stable for many years.

David
------------------------------------------------------------------------
*From:* Christian König <[email protected] <mailto:[email protected]>>
*Sent:* Tuesday, May 11, 2021 7:07 AM
*To:* Deucher, Alexander <[email protected] <mailto:[email protected]>>; Marek Olšák <[email protected] <mailto:[email protected]>>
*Cc:* Kees Cook <[email protected] <mailto:[email protected]>>; Gu, JiaWei (Will) <[email protected] <mailto:[email protected]>>; amd-gfx list <[email protected] <mailto:[email protected]>>; Deng, Emily <[email protected] <mailto:[email protected]>>; Alex Deucher <[email protected] <mailto:[email protected]>>; Nieto, David M <[email protected] <mailto:[email protected]>> *Subject:* Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios
Yeah, but umr is making strong use of sysfs as well.

The only justification of this interface would be if we want to use it in Mesa.

Quoted 290 lines

And I agree with Marek that looks redundant with the device structure to me as well.

Christian.

Am 11.05.21 um 16:04 schrieb Deucher, Alexander:

Quoted 283 lines

[AMD Public Use]

It's being used by umr and some other smi tools to provide vbios information for debugging.

Alex

------------------------------------------------------------------------
*From:* amd-gfx <[email protected]> <mailto:[email protected]> on behalf of Marek Olšák <[email protected]> <mailto:[email protected]> *Sent:* Tuesday, May 11, 2021 4:18 AM
*To:* Christian König <[email protected]> <mailto:[email protected]>
*Cc:* Kees Cook <[email protected]> <mailto:[email protected]>; Gu, JiaWei (Will) <[email protected]> <mailto:[email protected]>; amd-gfx list <[email protected]> <mailto:[email protected]>; Deng, Emily <[email protected]> <mailto:[email protected]>; Alex Deucher <[email protected]> <mailto:[email protected]>; Nieto, David M <[email protected]> <mailto:[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: Align serial size in drm_amdgpu_info_vbios
Mesa doesn't use sysfs.

Note that this is a uapi, meaning that once it's in the kernel, it can't be changed like that.

What's the use case for this new interface? Isn't it partially redundant with the current device info structure, which seems to have the equivalent of dev_id and rev_id?

Marek

On Tue, May 11, 2021 at 3:51 AM Christian König <[email protected] <mailto:[email protected]>> wrote:

Marek and other userspace folks need to decide that.

Basic question here is if Mesa is already accessing sysfs nodes for OpenGL or RADV. If that is the case then we should probably expose the information there as well.

If that isn't the case (which I think it is) then we should implement it as IOCTL.

Regards,
Christian.

Am 10.05.21 um 22:19 schrieb Nieto, David M:

Quoted 211 lines
        One of the primary usecases is to add this information to
        the renderer string, I am not sure if there are other cases
        of UMD drivers accessing sysfs nodes, but I think if we
        think permissions, if a client is authenticated and opens
        the render device then it can use the IOCTL, it is unclear
        to me we can make a such an assumption for sysfs nodes…

        I think there is value in having both tbh.

        Regards,

        David

        *From: *Christian König <[email protected]>
        <mailto:[email protected]>
        *Date: *Monday, May 10, 2021 at 6:48 AM
        *To: *"Nieto, David M" <[email protected]>
        <mailto:[email protected]>, "Gu, JiaWei (Will)"
        <[email protected]> <mailto:[email protected]>
        *Cc: *Alex Deucher <[email protected]>
        <mailto:[email protected]>, "Deng, Emily"
        <[email protected]> <mailto:[email protected]>, Kees Cook
        <[email protected]> <mailto:[email protected]>,
        amd-gfx list <[email protected]>
        <mailto:[email protected]>
        *Subject: *Re: [PATCH] drm/amdgpu: Align serial size in
        drm_amdgpu_info_vbios

        Well we could add both as sysfs file(s).

        Question here is rather what is the primary use case of this
        and if the application has the necessary access permissions
        to the sysfs files?

        Regards,
        Christian.

        Am 10.05.21 um 15:42 schrieb Nieto, David M:

            Then the application would need to issue the ioctl and
            then open a sysfs file to get all the information it
            needs. It makes little sense from a programming
            perspective to add an incomplete interface in my opinion

            ------------------------------------------------------------------------

            *From:*Gu, JiaWei (Will) <[email protected]>
            <mailto:[email protected]>
            *Sent:* Monday, May 10, 2021 12:13:07 AM
            *To:* Nieto, David M <[email protected]>
            <mailto:[email protected]>
            *Cc:* Alex Deucher <[email protected]>
            <mailto:[email protected]>; amd-gfx list
            <[email protected]>
            <mailto:[email protected]>; Kees Cook
            <[email protected]> <mailto:[email protected]>;
            Deng, Emily <[email protected]> <mailto:[email protected]>
            *Subject:* RE: [PATCH] drm/amdgpu: Align serial size in
            drm_amdgpu_info_vbios

            [AMD Official Use Only - Internal Distribution Only]

            Hi David,

            What I meant is to ONLY delete the serial[16] from
            drm_amdgpu_info_vbios, not the whole struct.

            struct drm_amdgpu_info_vbios {
                    __u8 name[64];
                    __u32 dbdf;
                    __u8 vbios_pn[64];
                    __u32 version;
                    __u8 date[32];
                    __u8 serial[16]; // jiawei: shall we delete this
                    __u32 dev_id;
                    __u32 rev_id;
                    __u32 sub_dev_id;
                    __u32 sub_ved_id;
            };

            serial[16] in drm_amdgpu_info_vbios  copied from
            adev->serial, but there's already a sysfs named
            serial_number, which exposes it already.

            static ssize_t amdgpu_device_get_serial_number(struct
            device *dev,
                            struct device_attribute *attr, char *buf)
            {
                    struct drm_device *ddev = dev_get_drvdata(dev);
                    struct amdgpu_device *adev = ddev->dev_private;

                    return snprintf(buf, PAGE_SIZE, "%s\n",
            adev->serial);
            }

            Thanks,
            Jiawei


            -----Original Message-----
            From: Nieto, David M <[email protected]>
            <mailto:[email protected]>
            Sent: Monday, May 10, 2021 2:53 PM
            To: Gu, JiaWei (Will) <[email protected]>
            <mailto:[email protected]>
            Cc: Alex Deucher <[email protected]>
            <mailto:[email protected]>; amd-gfx list
            <[email protected]>
            <mailto:[email protected]>; Kees Cook
            <[email protected]> <mailto:[email protected]>;
            Deng, Emily <[email protected]> <mailto:[email protected]>
            Subject: Re: [PATCH] drm/amdgpu: Align serial size in
            drm_amdgpu_info_vbios

            No, this structure contains all the details of the
            vbios: date, serial number, name, etc.

            The sysfs node only contains the vbios name string

            > On May 9, 2021, at 23:33, Gu, JiaWei (Will)
            <[email protected]> <mailto:[email protected]> wrote:
            >
            > [AMD Official Use Only - Internal Distribution Only]
            >
            > With a second thought,
            > __u8 serial[16] in drm_amdgpu_info_vbios is a bit
            redundant, sysfs serial_number already exposes it.
            >
            > Is it fine to abandon it from drm_amdgpu_info_vbios
            struct? @Alex
            > Deucher @Nieto, David M
            >
            > Best regards,
            > Jiawei
            >
            > -----Original Message-----
            > From: Alex Deucher <[email protected]>
            <mailto:[email protected]>
            > Sent: Sunday, May 9, 2021 11:59 PM
            > To: Gu, JiaWei (Will) <[email protected]>
            <mailto:[email protected]>
            > Cc: amd-gfx list <[email protected]>
            <mailto:[email protected]>; Kees Cook
            > <[email protected]> <mailto:[email protected]>
            > Subject: Re: [PATCH] drm/amdgpu: Align serial size in
            > drm_amdgpu_info_vbios
            >
            >> On Sat, May 8, 2021 at 2:48 AM Jiawei Gu
            <[email protected]> <mailto:[email protected]> wrote:
            >>
            >> 20 should be serial char size now instead of 16.
            >>
            >> Signed-off-by: Jiawei Gu <[email protected]>
            <mailto:[email protected]>
            >
            > Please make sure this keeps proper 64 bit alignment in
            the structure.
            >
            > Alex
            >
            >
            >> ---
            >> include/uapi/drm/amdgpu_drm.h | 2 +-
            >> 1 file changed, 1 insertion(+), 1 deletion(-)
            >>
            >> diff --git a/include/uapi/drm/amdgpu_drm.h
            >> b/include/uapi/drm/amdgpu_drm.h index
            2b487a8d2727..1c20721f90da
            >> 100644
            >> --- a/include/uapi/drm/amdgpu_drm.h
            >> +++ b/include/uapi/drm/amdgpu_drm.h
            >> @@ -957,7 +957,7 @@ struct drm_amdgpu_info_vbios {
            >>        __u8 vbios_pn[64];
            >>        __u32 version;
            >>        __u8 date[32];
            >> -       __u8 serial[16];
            >> +       __u8 serial[20];
            >>        __u32 dev_id;
            >>        __u32 rev_id;
            >>        __u32 sub_dev_id;
            >> --
            >> 2.17.1
            >>
            >> _______________________________________________
            >> amd-gfx mailing list
            >> [email protected]
            <mailto:[email protected]>
            >>
            https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
            <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis>
            >> t
            >> s.freedesktop.org
            <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fs.freedesktop.org%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684906500%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=gKeRCQ485gWespGfo1O01tZz8fDy1zPGHIDEvCqyp1I%3D&reserved=0>%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CJ
            >> i
            >> awei.Gu%40amd.com
            <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2F40amd.com%2F&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684916541%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=8pM7WTh9%2F23KCF6DuXOc4%2Fi7rDUSxmH647BdpujXgWo%3D&reserved=0>%7Ccea31833184c41e8574508d9130360cc%7C3dd8961fe4884e
            >> 6
            >>
            08e11a82d994e183d%7C0%7C0%7C637561727523880356%7CUnknown%7CTWFpbGZsb3
            >> d
            >>
            8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7
            >> C
            >>
            1000&amp;sdata=kAJiC6WoJUTeExwk6ftrLfMoY2OTAwg9X7mGgJT3kLk%3D&amp;res
            >> e
            >> rved=0
Quoted 10 lines
            _______________________________________________

            amd-gfx mailing list

            [email protected]  <mailto:[email protected]>

            https://lists.freedesktop.org/mailman/listinfo/amd-gfx  <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684926488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hdhx2ogsQt2C3OIKNC%2BaswtNkiIWbV6Ot8a%2B3YFqa7w%3D&reserved=0>
        _______________________________________________
        amd-gfx mailing list
        [email protected]
        <mailto:[email protected]>
        https://lists.freedesktop.org/mailman/listinfo/amd-gfx
        <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CDavid.Nieto%40amd.com%7Cf24b10fbdd964acea32008d914862738%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637563388684926488%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hdhx2ogsQt2C3OIKNC%2BaswtNkiIWbV6Ot8a%2B3YFqa7w%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx