Skip to contentSkip to conversation

drm/amdgpu: Disable GPU reset on SRIOV before remove pci.

PATCH In review Gavin Wan 2 participants 2 messages Oct 24, 2022 – Oct 25, 2022

Subsystems (2)
lore
Share & tools
lore

Gavin Wan

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Disable GPU reset on SRIOV before remove pci.

The change of the commit f5c7e7797060 ("Adjust removal control flow for smu v13_0_2") brought a bug on SRIOV envrionment. It caused unloading amdgpu failed on Guest VM. The reason is that the VF FLR was requested while unloading amdgpu driver, but the VF FLR of SRIOV sequence is wrong while removing PCI device.

Fixes f5c7e7797060 ("drm/amdgpu: Adjust removal control flow
         for smu v13_0_2")
Change-Id I1ff8dcbffd85d7f3d8267d660fd8292423d2f70f
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 16f6a313335e..ab0c856c13b0 100644
@@ -2187,7 +2187,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)
 		pm_runtime_forbid(dev->dev);
 	}
 
-	if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2)) {
+	if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2)) &&
+			!amdgpu_sriov_vf(adev)) {
 		bool need_to_reset_gpu = false;
 
 		if (adev->gmc.xgmi.num_physical_nodes > 1) {
Signature · 1 line
2.34.1
#1 lore raw

Am 24.10.22 um 22:21 schrieb Gavin Wan:

Quoted 8 lines

The change of the commit f5c7e7797060 ("Adjust removal control flow for smu v13_0_2") brought a bug on SRIOV envrionment. It caused unloading amdgpu failed on Guest VM. The reason is that the VF FLR was requested while unloading amdgpu driver, but the VF FLR of SRIOV sequence is wrong while removing PCI device.

Fixes f5c7e7797060 ("drm/amdgpu: Adjust removal control flow
          for smu v13_0_2")

The Fixes line should look like a Signed-off-by or Acked-by line.

Quoted 4 lines
Change-Id I1ff8dcbffd85d7f3d8267d660fd8292423d2f70f

The lines with : are noted in chronological order.

E.g. in this case that should be:

Signed-off-by: ....
Fixes: ...
Acked-by: ...
...

Quoted 9 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 16f6a313335e..ab0c856c13b0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c amdgpu_pci_remove(struct pci_dev *pdev) · line 2190

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
@@ -2187,7 +2187,8 @@ amdgpu_pci_remove(struct pci_dev *pdev)
  		pm_runtime_forbid(dev->dev);
  	}
 
-	if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2)) {
+	if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 2)) &&

Please drop the extra () as long as you don't want to explicitly have an assignment inside an "if", "for" or "while".

Regards,
Christian.

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+			!amdgpu_sriov_vf(adev)) {
  		bool need_to_reset_gpu = false;
 
  		if (adev->gmc.xgmi.num_physical_nodes > 1) {