Skip to contentSkip to conversation

drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

PATCH In review Jiawei Gu 2 participants 7 messages May 13, 2021 – May 14, 2021

Subsystems (3)
lore
Share & tools
lore

Jiawei Gu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -0
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
 			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
 		adev->virt.reg_access =
 			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all;
+		adev->unique_id =
+			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid;
 
 		break;
 	default:
Signature · 6 lines
2.17.1

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

[AMD Official Use Only - Internal Distribution Only]

Add David.

-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Thursday, May 13, 2021 2:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -0
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
 			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
 		adev->virt.reg_access =
 			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all;
+		adev->unique_id =
+			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid;
 
 		break;
 	default:
Signature · 5 lines
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw

[AMD Official Use Only - Internal Distribution Only]

pinging

-----Original Message-----
From: Gu, JiaWei (Will)
Sent: Thursday, May 13, 2021 7:01 PM
To: Jiawei Gu <[email protected]>; [email protected]; Nieto, David M <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

[AMD Official Use Only - Internal Distribution Only]

Add David.

-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Thursday, May 13, 2021 2:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -0
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
 			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
 		adev->virt.reg_access =
 			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all;
+		adev->unique_id =
+			((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid;
 
 		break;
 	default:
Signature · 5 lines
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

unique_id is normally fetched from the SMU on bare metal. I guess in the SR-IOV case, this would come from the hypervisor since the SMU is not normally handled in the VF. That makes sense for multi-VF, but what about single VF? Are you sure the ordering is correct such that the SMU value won't overwrite this? Maybe that's ok because they would be the same in that case?

Alex

Quoted 44 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

pinging

-----Original Message-----
From: Gu, JiaWei (Will)
Sent: Thursday, May 13, 2021 7:01 PM
To: Jiawei Gu <[email protected]>; [email protected]; Nieto, David M <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

[AMD Official Use Only - Internal Distribution Only]

Add David.

-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Thursday, May 13, 2021 2:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2 -1
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
                        ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
                adev->virt.reg_access =
                        ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->reg_access_flags.all;
+               adev->unique_id =
+                       ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid;
 
                break;
        default:
--
Quoted 5 lines

2.17.1
_______________________________________________
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

#4 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi Alex,

unique_id is fetched from FUSE_DATA on hypervisor.

Under my experiment, both multi-VF & single VF can still read FUSE_DATA to get it. But per David's info, guest shouldn't be able to read it (though it can currently)...

So I guess in design, the unique_id should be only fetched from hypervisor in SRIOV case, and guest should always get it from host.

Hi David,

Please feel free to correct my statement / provide more background.

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 14, 2021 11:33 AM
To: Gu, JiaWei (Will) <[email protected]>
Cc: [email protected]; Nieto, David M <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

unique_id is normally fetched from the SMU on bare metal. I guess in the SR-IOV case, this would come from the hypervisor since the SMU is not normally handled in the VF. That makes sense for multi-VF, but what about single VF? Are you sure the ordering is correct such that the SMU value won't overwrite this? Maybe that's ok because they would be the same in that case?

Alex

Quoted 54 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

pinging

-----Original Message-----
From: Gu, JiaWei (Will)
Sent: Thursday, May 13, 2021 7:01 PM
To: Jiawei Gu <[email protected]>; [email protected]; Nieto, David M <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

[AMD Official Use Only - Internal Distribution Only]

Add David.

-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Thursday, May 13, 2021 2:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -1
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
                        ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
                adev->virt.reg_access =
                        ((struct amd_sriov_msg_pf2vf_info 
 *)pf2vf_info)->reg_access_flags.all;
+               adev->unique_id =
+                       ((struct amd_sriov_msg_pf2vf_info 
+ *)pf2vf_info)->uuid;
 
                break;
        default:
--

2.17.1
_______________________________________________
amd-gfx mailing list

Quoted 8 lines

[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%7C8c5b87447e364531b89008d916890f54%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637565600188355261%7CUnknown%7CTWFpbGZsb3d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 1000&amp;sdata=Go8nw1HMA5I4wLJv2jk9hpSm2%2F0BR9nRzwwdAlJfttc%3D&amp;re served=0

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

#5 lore raw
Quoted 11 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

Hi Alex,

unique_id is fetched from FUSE_DATA on hypervisor.

Under my experiment, both multi-VF & single VF can still read FUSE_DATA to get it. But per David's info, guest shouldn't be able to read it (though it can currently)...

So I guess in design, the unique_id should be only fetched from hypervisor in SRIOV case, and guest should always get it from host.

thanks. so does the patch also need something like this?

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 32dadeee9514..9243e5de5bb7 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -686,7 +686,8 @@ static int smu_late_init(void *handle)
                return ret;
        }
 
-       smu_get_unique_id(smu);
+       if (!amdgpu_sriov_vf(adev))
+               smu_get_unique_id(smu);
 
        smu_get_fan_parameters(smu);
 

otherwise we fetch it twice.

Alex

Quoted 69 lines

Hi David,

Please feel free to correct my statement / provide more background.

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 14, 2021 11:33 AM
To: Gu, JiaWei (Will) <[email protected]>
Cc: [email protected]; Nieto, David M <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

unique_id is normally fetched from the SMU on bare metal. I guess in the SR-IOV case, this would come from the hypervisor since the SMU is not normally handled in the VF. That makes sense for multi-VF, but what about single VF? Are you sure the ordering is correct such that the SMU value won't overwrite this? Maybe that's ok because they would be the same in that case?

Alex

Quoted 48 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

pinging

-----Original Message-----
From: Gu, JiaWei (Will)
Sent: Thursday, May 13, 2021 7:01 PM
To: Jiawei Gu <[email protected]>; [email protected]; Nieto, David M <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

[AMD Official Use Only - Internal Distribution Only]

Add David.

-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Thursday, May 13, 2021 2:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -0
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
                        ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
                adev->virt.reg_access =
                        ((struct amd_sriov_msg_pf2vf_info
 *)pf2vf_info)->reg_access_flags.all;
+               adev->unique_id =
+                       ((struct amd_sriov_msg_pf2vf_info
+ *)pf2vf_info)->uuid;
 
Quoted 14 lines
Quoted 14 lines
                break;
        default:

--
2.17.1
_______________________________________________
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%7C8c5b87447e364531b89008d916890f54%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637565600188355261%7CUnknown%7CTWFpbGZsb3d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 1000&amp;sdata=Go8nw1HMA5I4wLJv2jk9hpSm2%2F0BR9nRzwwdAlJfttc%3D&amp;re served=0

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

#6 lore raw

[AMD Official Use Only - Internal Distribution Only]

Hi David,

Can you help double confirm that in design unique_id should always be fetched by PF2VF under SRIOV? If so we can skip smu_get_unique_id() under SRIOV (though func is empty and nothing really happens) as Alex's suggestion.

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 14, 2021 12:27 PM
To: Gu, JiaWei (Will) <[email protected]>
Cc: [email protected]; Nieto, David M <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Quoted 11 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

Hi Alex,

unique_id is fetched from FUSE_DATA on hypervisor.

Under my experiment, both multi-VF & single VF can still read FUSE_DATA to get it. But per David's info, guest shouldn't be able to read it (though it can currently)...

So I guess in design, the unique_id should be only fetched from hypervisor in SRIOV case, and guest should always get it from host.

thanks. so does the patch also need something like this?

(quoted diff) +0 -0

b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index 32dadeee9514..9243e5de5bb7 100644

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -1
@@ -686,7 +686,8 @@ static int smu_late_init(void *handle)
                return ret;
        }
 
-       smu_get_unique_id(smu);
+       if (!amdgpu_sriov_vf(adev))
+               smu_get_unique_id(smu);
 
        smu_get_fan_parameters(smu);
 

otherwise we fetch it twice.

Alex

Quoted 83 lines

Hi David,

Please feel free to correct my statement / provide more background.

Best regards,
Jiawei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, May 14, 2021 11:33 AM
To: Gu, JiaWei (Will) <[email protected]>
Cc: [email protected]; Nieto, David M <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

unique_id is normally fetched from the SMU on bare metal. I guess in the SR-IOV case, this would come from the hypervisor since the SMU is not normally handled in the VF. That makes sense for multi-VF, but what about single VF? Are you sure the ordering is correct such that the SMU value won't overwrite this? Maybe that's ok because they would be the same in that case?

Alex

Quoted 60 lines · JiaWei (Will)

[AMD Official Use Only - Internal Distribution Only]

pinging

-----Original Message-----
From: Gu, JiaWei (Will)
Sent: Thursday, May 13, 2021 7:01 PM
To: Jiawei Gu <[email protected]>; [email protected]; Nieto, David M <[email protected]>
Cc: Deng, Emily <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

[AMD Official Use Only - Internal Distribution Only]

Add David.

-----Original Message-----
From: Jiawei Gu <[email protected]>
Sent: Thursday, May 13, 2021 2:41 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>; Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Fill adev->unique_id with data from PF2VF msg

Initialize unique_id from PF2VF under virtualization.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -1
index a57842689d42..96e269cbe326 100644
@@ -471,6 +471,8 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)
                        ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->feature_flags.all;
                adev->virt.reg_access =
                        ((struct amd_sriov_msg_pf2vf_info 
 *)pf2vf_info)->reg_access_flags.all;
+               adev->unique_id =
+                       ((struct amd_sriov_msg_pf2vf_info 
+ *)pf2vf_info)->uuid;
 
                break;
        default:
--

2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fli
st s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7C Ji aWei.Gu%40amd.com%7C8c5b87447e364531b89008d916890f54%7C3dd8961fe4884

Quoted 8 lines
Quoted 8 lines

e6 08e11a82d994e183d%7C0%7C0%7C637565600188355261%7CUnknown%7CTWFpbGZsb 3d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D% 7C 1000&amp;sdata=Go8nw1HMA5I4wLJv2jk9hpSm2%2F0BR9nRzwwdAlJfttc%3D&amp; re
served=0

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