Skip to contentSkip to conversation

drm/amdgpu: do not disable SMU on vm reboot

PATCH In review Nirmoy Das 4 participants 7 messages Jul 10, 2020 – Jul 23, 2020

Subsystems (2)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/amdgpu: do not disable SMU on vm reboot

For passthrough device, we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
 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 d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
 	 * unfortunately we can't detect certain
 	 * hypervisors so just do this all the time.
 	 */
-	adev->mp1_state = PP_MP1_STATE_UNLOAD;
+	if (!amdgpu_passthrough(adev))
+		adev->mp1_state = PP_MP1_STATE_UNLOAD;
 	amdgpu_device_ip_suspend(adev);
 	adev->mp1_state = PP_MP1_STATE_NONE;
 }
Signature · 6 lines
2.27.0

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

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: Nirmoy Das <[email protected]>
Sent: Friday, July 10, 2020 10:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH] drm/amdgpu: do not disable SMU on vm reboot

For passthrough device, we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
 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 d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
  * unfortunately we can't detect certain
  * hypervisors so just do this all the time.
  */
-adev->mp1_state = PP_MP1_STATE_UNLOAD;
+if (!amdgpu_passthrough(adev))
+adev->mp1_state = PP_MP1_STATE_UNLOAD;
 amdgpu_device_ip_suspend(adev);
 adev->mp1_state = PP_MP1_STATE_NONE;
 }

--
2.27.0

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

#2 lore raw

Can you check and make sure this doesn't break polaris or some other generation?

Alex

Quoted 38 lines · Evan

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: Nirmoy Das <[email protected]>
Sent: Friday, July 10, 2020 10:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH] drm/amdgpu: do not disable SMU on vm reboot

For passthrough device, we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
 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 -2
index d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
  * unfortunately we can't detect certain
  * hypervisors so just do this all the time.
  */
-adev->mp1_state = PP_MP1_STATE_UNLOAD;
+if (!amdgpu_passthrough(adev))
+adev->mp1_state = PP_MP1_STATE_UNLOAD;
 amdgpu_device_ip_suspend(adev);
 adev->mp1_state = PP_MP1_STATE_NONE;
 }
--

2.27.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

#3 lore raw

Hi Alex,

Quoted 1 line · Alex Deucher

Can you check and make sure this doesn't break polaris or some other generation?

Do you mean breaking device passthrough or normal operation ? I have a rx 570,

I can test on that.

Regards,

Nirmoy

Quoted 41 lines

Alex

Quoted 37 lines · Evan

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: Nirmoy Das <[email protected]>
Sent: Friday, July 10, 2020 10:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH] drm/amdgpu: do not disable SMU on vm reboot

For passthrough device, we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
  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 -2
index d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
   * unfortunately we can't detect certain
   * hypervisors so just do this all the time.
   */
-adev->mp1_state = PP_MP1_STATE_UNLOAD;
+if (!amdgpu_passthrough(adev))
+adev->mp1_state = PP_MP1_STATE_UNLOAD;
  amdgpu_device_ip_suspend(adev);
  adev->mp1_state = PP_MP1_STATE_NONE;
  }
--

2.27.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CNirmoy.Das%40amd.com%7Cf4018ca31bdf481e0bba08d82f1096b8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637311095591342103&amp;sdata=PvRVEMzHPeQnQC%2Bf7DI1Y3vnEZLnp9Af%2F07KAIQjKsM%3D&amp;reserved=0

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

#4 lore raw

Passthrough.

Thanks,

Alex

Quoted 59 lines · Nirmoy

Hi Alex,

Quoted 1 line · Alex Deucher

Can you check and make sure this doesn't break polaris or some other generation?

Do you mean breaking device passthrough or normal operation ? I have a rx 570,

I can test on that.

Regards,

Nirmoy

Quoted 41 lines

Alex

Quoted 37 lines · Evan

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: Nirmoy Das <[email protected]>
Sent: Friday, July 10, 2020 10:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH] drm/amdgpu: do not disable SMU on vm reboot

For passthrough device, we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
  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 -2
index d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
   * unfortunately we can't detect certain
   * hypervisors so just do this all the time.
   */
-adev->mp1_state = PP_MP1_STATE_UNLOAD;
+if (!amdgpu_passthrough(adev))
+adev->mp1_state = PP_MP1_STATE_UNLOAD;
  amdgpu_device_ip_suspend(adev);
  adev->mp1_state = PP_MP1_STATE_NONE;
  }
--

2.27.0

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CNirmoy.Das%40amd.com%7Cf4018ca31bdf481e0bba08d82f1096b8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637311095591342103&amp;sdata=PvRVEMzHPeQnQC%2Bf7DI1Y3vnEZLnp9Af%2F07KAIQjKsM%3D&amp;reserved=0

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

#5 lore raw
In reply to Nirmoy

Tested Device passthrough with polaris(rx 570), the patch had no effect.

With or without the patch I could only do passthrough 3 times before the host throws

IOMMU error.

[ 210.762150] vfio-pci 0000:01:00.1: can't change power state from D0 to D3hot (config space inaccessible)
[ 210.762732] vfio-pci 0000:01:00.0: can't change power state from D0 to D3hot (config space inaccessible)
[ 210.899735] AMD-Vi: Completion-Wait loop timed out
[ 211.022824] AMD-Vi: Completion-Wait loop timed out
[ 211.145434] AMD-Vi: Completion-Wait loop timed out
[ 211.268250] AMD-Vi: Completion-Wait loop timed out
[ 211.778593] iommu ivhd0: AMD-Vi: Event logged [IOTLB_INV_TIMEOUT device=01:00.0 address=0x107d5fb50]
[ 212.780494] iommu ivhd0: AMD-Vi: Event logged [IOTLB_INV_TIMEOUT device=01:00.0 address=0x107d5fb90]
[ 212.781060] iommu ivhd0: AMD-Vi: Event logged [IOTLB_INV_TIMEOUT device=01:00.0 address=0x107d5fbb0]

Regards,

Nirmoy

Quoted 57 lines · Nirmoy

Hi Alex,

Quoted 1 line · Alex Deucher

Can you check and make sure this doesn't break polaris or some other generation?

Do you mean breaking device passthrough or normal operation ? I have a rx 570,

I can test on that.

Regards,

Nirmoy

Quoted 41 lines

Alex

Quoted 37 lines · Evan

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: Nirmoy Das <[email protected]>
Sent: Friday, July 10, 2020 10:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH] drm/amdgpu: do not disable SMU on vm reboot

For passthrough device,  we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
  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 d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
    * unfortunately we can't detect certain
    * hypervisors so just do this all the time.
    */
-adev->mp1_state = PP_MP1_STATE_UNLOAD;
+if (!amdgpu_passthrough(adev))
+adev->mp1_state = PP_MP1_STATE_UNLOAD;
   amdgpu_device_ip_suspend(adev);
   adev->mp1_state = PP_MP1_STATE_NONE;
   }
Signature · 1 line
2.27.0
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CNirmoy.Das%40amd.com%7Cf4018ca31bdf481e0bba08d82f1096b8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637311095591342103&amp;sdata=PvRVEMzHPeQnQC%2Bf7DI1Y3vnEZLnp9Af%2F07KAIQjKsM%3D&amp;reserved=0

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

#6 lore raw

Great. Thanks for checking.

Alex

Quoted 99 lines · Nirmoy

Tested Device passthrough with polaris(rx 570), the patch had no effect.

With or without the patch I could only do passthrough 3 times before the host throws

IOMMU error.

[ 210.762150] vfio-pci 0000:01:00.1: can't change power state from D0 to

D3hot (config space inaccessible)

[ 210.762732] vfio-pci 0000:01:00.0: can't change power state from D0 to

D3hot (config space inaccessible)

[ 210.899735] AMD-Vi: Completion-Wait loop timed out
[ 211.022824] AMD-Vi: Completion-Wait loop timed out
[ 211.145434] AMD-Vi: Completion-Wait loop timed out
[ 211.268250] AMD-Vi: Completion-Wait loop timed out
[ 211.778593] iommu ivhd0: AMD-Vi: Event logged [IOTLB_INV_TIMEOUT

device=01:00.0 address=0x107d5fb50]

[ 212.780494] iommu ivhd0: AMD-Vi: Event logged [IOTLB_INV_TIMEOUT

device=01:00.0 address=0x107d5fb90]

[ 212.781060] iommu ivhd0: AMD-Vi: Event logged [IOTLB_INV_TIMEOUT

device=01:00.0 address=0x107d5fbb0]

Regards,

Nirmoy

Quoted 61 lines · Nirmoy

Hi Alex,

Quoted 2 lines · Alex Deucher

Can you check and make sure this doesn't break polaris or some other generation?

Do you mean breaking device passthrough or normal operation ? I have a rx 570,

I can test on that.

Regards,

Nirmoy

Quoted 43 lines

Alex

Quoted 39 lines · Evan

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: Nirmoy Das <[email protected]>
Sent: Friday, July 10, 2020 10:51 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>; Das, Nirmoy <[email protected]>
Subject: [PATCH] drm/amdgpu: do not disable SMU on vm reboot

For passthrough device, we do baco reset after 1st vm boot so if we disable SMU on 1st VM shutdown baco reset will fail for 2nd vm boot.

---
  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 -2
index d1adbc45d37b..07be61ce969a 100644
@@ -1178,7 +1178,8 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)
   * unfortunately we can't detect certain
   * hypervisors so just do this all the time.
   */
-adev->mp1_state = PP_MP1_STATE_UNLOAD;
+if (!amdgpu_passthrough(adev))
+adev->mp1_state = PP_MP1_STATE_UNLOAD;
  amdgpu_device_ip_suspend(adev);
  adev->mp1_state = PP_MP1_STATE_NONE;
  }
--

2.27.0

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CNirmoy.Das%40amd.com%7Cf4018ca31bdf481e0bba08d82f1096b8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637311095591342103&amp;sdata=PvRVEMzHPeQnQC%2Bf7DI1Y3vnEZLnp9Af%2F07KAIQjKsM%3D&amp;reserved=0

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