Skip to contentSkip to conversation

drm/amdgpu: remove SRIOV VF FB location programming

PATCH In review Zhigang Luo 2 participants 3 messages Jul 6, 2023

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

PATCH 1/2 drm/amdgpu: remove SRIOV VF FB location programming

For SRIOV VF, FB location is programmed by host driver, no need to program it in guest driver.

Change-Id I2a4838f6703e94bb0bcf3a8e923c69466e37803f
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 15 +--------------
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c  | 12 ------------
 2 files changed, 1 insertion(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +1 -14
index 47f95ec218a3..03ae661e3b54 100644
@@ -406,20 +406,6 @@ static int gfxhub_v1_2_xcc_gart_enable(struct amdgpu_device *adev,
 	int i;
 
 	tmp_mask = xcc_mask;
-	/*
-	 * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, because they are
-	 * VF copy registers so vbios post doesn't program them, for
-	 * SRIOV driver need to program them
-	 */
-	if (amdgpu_sriov_vf(adev)) {
-		for_each_inst(i, tmp_mask) {
-			i = ffs(tmp_mask) - 1;
-			WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_BASE,
-				     adev->gmc.vram_start >> 24);
-			WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_TOP,
-				     adev->gmc.vram_end >> 24);
-		}
-	}
 
 	/* GART Enable. */
 	gfxhub_v1_2_xcc_init_gart_aperture_regs(adev, xcc_mask);
@@ -606,6 +592,7 @@ static int gfxhub_v1_2_get_xgmi_info(struct amdgpu_device *adev)
 	max_region =
 		REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, PF_MAX_REGION);
 
+	DRM_INFO("XXXXXX xgmi_lfb_cntl=0x%x seg_size=0x%llx", xgmi_lfb_cntl, seg_size);
 
 
 	max_num_physical_nodes   = 8;
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c +0 -12
index 5e8b493f8699..784c4e077470 100644
@@ -413,18 +413,6 @@ static void mmhub_v1_8_program_invalidation(struct amdgpu_device *adev)
 
 static int mmhub_v1_8_gart_enable(struct amdgpu_device *adev)
 {
-	if (amdgpu_sriov_vf(adev)) {
-		/*
-		 * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are
-		 * VF copy registers so vbios post doesn't program them, for
-		 * SRIOV driver need to program them
-		 */
-		WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE,
-			     adev->gmc.vram_start >> 24);
-		WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP,
-			     adev->gmc.vram_end >> 24);
-	}
-
 	/* GART Enable. */
 	mmhub_v1_8_init_gart_aperture_regs(adev);
 	mmhub_v1_8_init_system_aperture_regs(adev);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 drm/amdgpu: init TA microcode for SRIOV VF when MP0 IP is 13.0.6

Change-Id I71524c69c7137c6db4968b95e480c910aba24703
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
index 21438ff61c6e..de9a2a7f5459 100644
@@ -145,6 +145,7 @@ static int psp_init_sriov_microcode(struct psp_context *psp)
 		break;
 	case IP_VERSION(13, 0, 6):
 		ret = psp_init_cap_microcode(psp, ucode_prefix);
+		ret &= psp_init_ta_microcode(psp, ucode_prefix);
 		break;
 	case IP_VERSION(13, 0, 10):
 		adev->virt.autoload_ucode_id = AMDGPU_UCODE_ID_CP_MES1_DATA;
Signature · 1 line
2.25.1
Acked-by on v1 1/2
#2 lore raw
In reply to Zhigang Luo
Quoted 37 lines · Zhigang Luo

For SRIOV VF, FB location is programmed by host driver, no need to program it in guest driver.

Change-Id I2a4838f6703e94bb0bcf3a8e923c69466e37803f
---
 drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 15 +--------------
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c  | 12 ------------
 2 files changed, 1 insertion(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +0 -14
index 47f95ec218a3..03ae661e3b54 100644
@@ -406,20 +406,6 @@ static int gfxhub_v1_2_xcc_gart_enable(struct amdgpu_device *adev,
        int i;
 
        tmp_mask = xcc_mask;
-       /*
-        * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, because they are
-        * VF copy registers so vbios post doesn't program them, for
-        * SRIOV driver need to program them
-        */
-       if (amdgpu_sriov_vf(adev)) {
-               for_each_inst(i, tmp_mask) {
-                       i = ffs(tmp_mask) - 1;
-                       WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_BASE,
-                                    adev->gmc.vram_start >> 24);
-                       WREG32_SOC15_RLC(GC, GET_INST(GC, i), regMC_VM_FB_LOCATION_TOP,
-                                    adev->gmc.vram_end >> 24);
-               }
-       }
 
        /* GART Enable. */
        gfxhub_v1_2_xcc_init_gart_aperture_regs(adev, xcc_mask);

drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c static int gfxhub_v1_2_get_xgmi_info(struct amdgpu_device *adev) · line 595

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +1 -0
@@ -606,6 +592,7 @@ static int gfxhub_v1_2_get_xgmi_info(struct amdgpu_device *adev)
        max_region =
                REG_GET_FIELD(xgmi_lfb_cntl, MC_VM_XGMI_LFB_CNTL, PF_MAX_REGION);
 
+       DRM_INFO("XXXXXX xgmi_lfb_cntl=0x%x seg_size=0x%llx", xgmi_lfb_cntl, seg_size);

Leftover debugging statement. With that removed, the series is:

Quoted 29 lines
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +0 -0
        max_num_physical_nodes   = 8;
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c +0 -13
index 5e8b493f8699..784c4e077470 100644
@@ -413,18 +413,6 @@ static void mmhub_v1_8_program_invalidation(struct amdgpu_device *adev)
 
 static int mmhub_v1_8_gart_enable(struct amdgpu_device *adev)
 {
-       if (amdgpu_sriov_vf(adev)) {
-               /*
-                * MC_VM_FB_LOCATION_BASE/TOP is NULL for VF, becuase they are
-                * VF copy registers so vbios post doesn't program them, for
-                * SRIOV driver need to program them
-                */
-               WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_BASE,
-                            adev->gmc.vram_start >> 24);
-               WREG32_SOC15(MMHUB, 0, regMC_VM_FB_LOCATION_TOP,
-                            adev->gmc.vram_end >> 24);
-       }
-
        /* GART Enable. */
        mmhub_v1_8_init_gart_aperture_regs(adev);
        mmhub_v1_8_init_system_aperture_regs(adev);
--

2.25.1