Skip to contentSkip to conversation

drm/amdgpu: add vega20 sriov capability detection

PATCH In review Xiangliang Yu 2 participants 2 messages Sep 18, 2018 1 message not in the archive

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

PATCH 1/2 drm/amdgpu: add vega20 sriov capability detection

From: Frank Min <[email protected]>

Add sriov capability detection for vega20, then can check if device is virtual device.

---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +13 -2
index 2e65447..f8cee95 100644
@@ -205,8 +205,19 @@ static const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg = {
 
 static void nbio_v7_4_detect_hw_virt(struct amdgpu_device *adev)
 {
-	if (is_virtual_machine())	/* passthrough mode exclus sriov mod */
-		adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
+	uint32_t reg;
+
+	reg = RREG32_SOC15(NBIO, 0, mmRCC_IOV_FUNC_IDENTIFIER);
+	if (reg & 1)
+		adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
+
+	if (reg & 0x80000000)
+		adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
+
+	if (!reg) {
+		if (is_virtual_machine())	/* passthrough mode exclus sriov mod */
+			adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
+	}
 }
 
 static void nbio_v7_4_init_registers(struct amdgpu_device *adev)
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1537264563-19653-1-git-send-email-Xiangliang.Yu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Series is:

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Xiangliang Yu <[email protected]>
Sent: Tuesday, September 18, 2018 5:56:03 AM
To: [email protected]
Cc: Yu, Xiangliang; Min, Frank
Subject: [PATCH 1/2] drm/amdgpu: add vega20 sriov capability detection

From: Frank Min <[email protected]>

Add sriov capability detection for vega20, then can check if device is virtual device.

---
 drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +13 -2
index 2e65447..f8cee95 100644
@@ -205,8 +205,19 @@ static const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg = {
 
 static void nbio_v7_4_detect_hw_virt(struct amdgpu_device *adev)
 {
-       if (is_virtual_machine())       /* passthrough mode exclus sriov mod */
-               adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
+       uint32_t reg;
+
+       reg = RREG32_SOC15(NBIO, 0, mmRCC_IOV_FUNC_IDENTIFIER);
+       if (reg & 1)
+               adev->virt.caps |= AMDGPU_SRIOV_CAPS_IS_VF;
+
+       if (reg & 0x80000000)
+               adev->virt.caps |= AMDGPU_SRIOV_CAPS_ENABLE_IOV;
+
+       if (!reg) {
+               if (is_virtual_machine())       /* passthrough mode exclus sriov mod */
+                       adev->virt.caps |= AMDGPU_PASSTHROUGH_MODE;
+       }
 }
 
 static void nbio_v7_4_init_registers(struct amdgpu_device *adev)

--
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives.. Using amd-gfx: To post a message to all the list members, send email to [email protected] You can subscribe to the list, or change your existing subscription, in the sections below.

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