Skip to contentSkip to conversation

drm/amdgpu: only register VGA devices with the VGA arbiter

PATCH In review Alex Deucher 3 participants 3 messages Nov 20, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: only register VGA devices with the VGA arbiter

We only need to arbitrate VGA access on VGA compatible devices.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -2
index 2f60b7084f4d..2670fb113ba1 100644
@@ -3346,7 +3346,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 	/* if we have > 1 VGA cards, then disable the amdgpu VGA resources */
 	/* this will fail for cards that aren't VGA class devices, just
 	 * ignore it */
-	vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
+	if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+		vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
 
 	if (amdgpu_device_supports_boco(ddev))
 		boco = true;
@@ -3605,7 +3606,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 		vga_switcheroo_unregister_client(adev->pdev);
 	if (amdgpu_device_supports_boco(adev_to_drm(adev)))
 		vga_switcheroo_fini_domain_pm_ops(adev->dev);
-	vga_client_register(adev->pdev, NULL, NULL, NULL);
+	if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+		vga_client_register(adev->pdev, NULL, NULL, NULL);
 	if (adev->rio_mem)
 		pci_iounmap(adev->pdev, adev->rio_mem);
 	adev->rio_mem = NULL;
Signature · 6 lines
2.25.4

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

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, November 20, 2020 10:55 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: only register VGA devices with the VGA arbiter

We only need to arbitrate VGA access on VGA compatible devices.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -2
index 2f60b7084f4d..2670fb113ba1 100644
@@ -3346,7 +3346,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 /* if we have > 1 VGA cards, then disable the amdgpu VGA resources */
 /* this will fail for cards that aren't VGA class devices, just
  * ignore it */
-vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
+if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
 
 if (amdgpu_device_supports_boco(ddev))
 boco = true;
@@ -3605,7 +3606,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
 vga_switcheroo_unregister_client(adev->pdev);
 if (amdgpu_device_supports_boco(adev_to_drm(adev)))
 vga_switcheroo_fini_domain_pm_ops(adev->dev);
-vga_client_register(adev->pdev, NULL, NULL, NULL);
+if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+vga_client_register(adev->pdev, NULL, NULL, NULL);
 if (adev->rio_mem)
 pci_iounmap(adev->pdev, adev->rio_mem);
 adev->rio_mem = NULL;

--
2.25.4

_______________________________________________
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=04%7C01%7CFeifei.Xu%40amd.com%7C8eac65802c2841a4016408d88d645737%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637414809390017528%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=4YGYTXm%2FY8MAQiqs4QJ1MUIcy2%2F4waucDrIeob63ogk%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#2 lore raw

Am 20.11.20 um 16:04 schrieb Xu, Feifei:

Quoted 45 lines

[AMD Official Use Only - Internal Distribution Only]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, November 20, 2020 10:55 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu: only register VGA devices with the VGA arbiter

We only need to arbitrate VGA access on VGA compatible devices.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -3
index 2f60b7084f4d..2670fb113ba1 100644
@@ -3346,7 +3346,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
  /* if we have > 1 VGA cards, then disable the amdgpu VGA resources */
  /* this will fail for cards that aren't VGA class devices, just
   * ignore it */
-vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
+if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+vga_client_register(adev->pdev, adev, NULL, amdgpu_device_vga_set_decode);
 
  if (amdgpu_device_supports_boco(ddev))
  boco = true;
@@ -3605,7 +3606,8 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
  vga_switcheroo_unregister_client(adev->pdev);
  if (amdgpu_device_supports_boco(adev_to_drm(adev)))
  vga_switcheroo_fini_domain_pm_ops(adev->dev);
-vga_client_register(adev->pdev, NULL, NULL, NULL);
+if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
+vga_client_register(adev->pdev, NULL, NULL, NULL);
  if (adev->rio_mem)
  pci_iounmap(adev->pdev, adev->rio_mem);
  adev->rio_mem = NULL;
--

2.25.4

Quoted 8 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=04%7C01%7CFeifei.Xu%40amd.com%7C8eac65802c2841a4016408d88d645737%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637414809390017528%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=4YGYTXm%2FY8MAQiqs4QJ1MUIcy2%2F4waucDrIeob63ogk%3D&amp;reserved=0
_______________________________________________
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