Skip to contentSkip to conversation

drm/amdgpu: add amdgpu_device_is_headless() func

PATCH In review Feifei Xu 3 participants 5 messages Mar 10, 2021

Subsystems (2)
lore
Share & tools
lore

Feifei Xu

author
#0 lore raw

PATCH 1/2 drm/amdgpu: add amdgpu_device_is_headless() func

Add headless check function for NV and afterwards.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++++++++
 drivers/gpu/drm/amd/amdgpu/nv.c            | 2 +-
 drivers/gpu/drm/amd/amdgpu/nv.h            | 1 +
 4 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 7e1f66120c50..5a4c6405e0d8 100644
@@ -1292,6 +1292,7 @@ bool amdgpu_device_is_peer_accessible(struct amdgpu_device *adev,
 				      struct amdgpu_device *peer_adev);
 int amdgpu_device_baco_enter(struct drm_device *dev);
 int amdgpu_device_baco_exit(struct drm_device *dev);
+bool amdgpu_device_is_headless(struct amdgpu_device *adev);
 
 /* atpx handler */
 #if defined(CONFIG_VGA_SWITCHEROO)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -0
index 49ca317718dd..4074de941d2d 100644
@@ -5328,4 +5328,12 @@ bool amdgpu_device_load_pci_state(struct pci_dev *pdev)
 	return true;
 }
 
+bool amdgpu_device_is_headless(struct amdgpu_device *adev)
+{
+	/* If the pcie subclass is not VGA, it is headless */
+	if ((adev->pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+		return true;
 
+	/* If NV's subclass is VGA while VCN is harvest,it is headless*/
+	return nv_is_headless_sku(adev->pdev);
+}
drivers/gpu/drm/amd/amdgpu/nv.c +1 -1
index 5846eac292c3..1e40e36ab038 100644
@@ -696,7 +696,7 @@ void nv_set_virt_ops(struct amdgpu_device *adev)
 	adev->virt.ops = &xgpu_nv_virt_ops;
 }
 
-static bool nv_is_headless_sku(struct pci_dev *pdev)
+bool nv_is_headless_sku(struct pci_dev *pdev)
 {
 	if ((pdev->device == 0x731E &&
 	    (pdev->revision == 0xC6 || pdev->revision == 0xC7)) ||
drivers/gpu/drm/amd/amdgpu/nv.h +1 -0
index 515d67bf249f..450619fe677e 100644
@@ -36,4 +36,5 @@ int navi12_reg_base_init(struct amdgpu_device *adev);
 int sienna_cichlid_reg_base_init(struct amdgpu_device *adev);
 void vangogh_reg_base_init(struct amdgpu_device *adev);
 int dimgrey_cavefish_reg_base_init(struct amdgpu_device *adev);
+bool nv_is_headless_sku(struct pci_dev *pdev);
 #endif
Signature · 6 lines
2.25.1

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

PATCH 2/2 drm/amdgpu: skip query VFCT table for headless ASICs

There will be no GOP driver to copy vbios image to VFCT table for headless ASICs. Thus skip VFCT.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index f454a6bd0ed6..03739774beca 100644
@@ -427,7 +427,7 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
 		goto success;
 	}
 
-	if (amdgpu_acpi_vfct_bios(adev)) {
+	if (!amdgpu_device_is_headless(adev) && amdgpu_acpi_vfct_bios(adev)) {
 		dev_info(adev->dev, "Fetched VBIOS from VFCT\n");
 		goto success;
 	}
Signature · 6 lines
2.25.1

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

Re: [PATCH 2/2] drm/amdgpu: skip query VFCT table for headless ASICs

Quoted 3 lines · Feifei Xu

There will be no GOP driver to copy vbios image to VFCT table for headless ASICs. Thus skip VFCT.

I'm not sure these patches are entirely correct.

Quoted 12 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +0 -0
index f454a6bd0ed6..03739774beca 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c bool amdgpu_get_bios(struct amdgpu_device *adev) · line 430

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
@@ -427,7 +427,7 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
                goto success;
        }
 
-       if (amdgpu_acpi_vfct_bios(adev)) {
+       if (!amdgpu_device_is_headless(adev) && amdgpu_acpi_vfct_bios(adev)) {

I would drop the first patch and just check the pci class directly here, it's more clear what it's checking for, plus I don't know if it's a good idea to mix the nv check in here.

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +0 -1
                dev_info(adev->dev, "Fetched VBIOS from VFCT\n");
                goto success;
        }
--

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

author
#3 lore raw

RE: [PATCH 2/2] drm/amdgpu: skip query VFCT table for headless ASICs

[AMD Official Use Only - Internal Distribution Only]

Hi Alex,
Hi Alex

We have a thread discussed the GOP driver with Xiong on headless SKUs. Just forwarded that to you as well. He has confirmed this on that thread.

There's some NV ASICs which have VCN harvested. Those parts have the VGA class while it is headless.
I am thinking to centralize the non-VGA subclass devices and VGA subclass but headless devices. So added the amdgpu_device_is_headless() function including NV check.

I can drop the amdgpu_device_is_headless(). And check the headless case by checking both VGA subclass and nv_is_headless().

Thanks,
Feifei

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, March 10, 2021 12:50 PM
To: Xu, Feifei <[email protected]>
Cc: amd-gfx list <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: skip query VFCT table for headless ASICs

Quoted 3 lines · Feifei Xu

There will be no GOP driver to copy vbios image to VFCT table for headless ASICs. Thus skip VFCT.

I'm not sure these patches are entirely correct.

Quoted 13 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +0 -0
index f454a6bd0ed6..03739774beca 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c bool amdgpu_get_bios(struct amdgpu_device *adev) · line 431

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +2 -1
@@ -427,7 +427,7 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
                goto success;
        }
 
-       if (amdgpu_acpi_vfct_bios(adev)) {
+       if (!amdgpu_device_is_headless(adev) &&
+ amdgpu_acpi_vfct_bios(adev)) {

I would drop the first patch and just check the pci class directly here, it's more clear what it's checking for, plus I don't know if it's a good idea to mix the nv check in here.

Alex

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +0 -1
                dev_info(adev->dev, "Fetched VBIOS from VFCT\n");
                goto success;
        }
--

2.25.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%7CFe ifei.Xu%40amd.com%7C298d17c750fe4fc8529a08d8e380098f%7C3dd8961fe4884e6 08e11a82d994e183d%7C0%7C0%7C637509486351235872%7CUnknown%7CTWFpbGZsb3d 8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C 1000&amp;sdata=MGfjf7kaF8bILyrllz7Dd9hSiKSMRrbswvDjAB7u%2BN4%3D&amp;re served=0

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

Reviewed-by Reviewed-by on v1 2/2
#4 lore raw

RE: [PATCH 2/2] drm/amdgpu: skip query VFCT table for headless ASICs

In reply to Feifei Xu

[AMD Public Use]

Regards,
Hawking
-----Original Message-----
From: Feifei Xu <[email protected]>
Sent: Wednesday, March 10, 2021 12:38
To: [email protected]
Cc: Xu, Feifei <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: skip query VFCT table for headless ASICs

There will be no GOP driver to copy vbios image to VFCT table for headless ASICs. Thus skip VFCT.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c +1 -1
index f454a6bd0ed6..03739774beca 100644
@@ -427,7 +427,7 @@ bool amdgpu_get_bios(struct amdgpu_device *adev)
 		goto success;
 	}
 
-	if (amdgpu_acpi_vfct_bios(adev)) {
+	if (!amdgpu_device_is_headless(adev) && amdgpu_acpi_vfct_bios(adev)) {
 		dev_info(adev->dev, "Fetched VBIOS from VFCT\n");
 		goto success;
 	}

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