[PATCH] drm/amdgpu: Do not program VF copy regs in mmhub v1.8 under SRIOV

Dhume, Samir Samir.Dhume at amd.com
Fri Nov 10 21:25:18 UTC 2023


[AMD Official Use Only - General]

It makes more sense to put the check for sriov in the beginning of the function rather than inside the for-loop.

Thanks,
Samir

-----Original Message-----
From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Victor Lu
Sent: Tuesday, November 7, 2023 2:31 PM
To: amd-gfx at lists.freedesktop.org
Cc: Dhume, Samir <Samir.Dhume at amd.com>; Lu, Victor Cheng Chi (Victor) <VictorChengChi.Lu at amd.com>
Subject: [PATCH] drm/amdgpu: Do not program VF copy regs in mmhub v1.8 under SRIOV

MC_VM_AGP_* registers should not be programmed by guest driver.

Signed-off-by: Victor Lu <victorchengchi.lu at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
index ea142611be1c..125917c3cba1 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c
@@ -132,6 +132,9 @@ static void mmhub_v1_8_init_system_aperture_regs(struct amdgpu_device *adev)

        inst_mask = adev->aid_mask;
        for_each_inst(i, inst_mask) {
+               if (amdgpu_sriov_vf(adev))
+                       return;
+
                /* Program the AGP BAR */
                WREG32_SOC15(MMHUB, i, regMC_VM_AGP_BASE, 0);
                WREG32_SOC15(MMHUB, i, regMC_VM_AGP_BOT, @@ -139,9 +142,6 @@ static void mmhub_v1_8_init_system_aperture_regs(struct amdgpu_device *adev)
                WREG32_SOC15(MMHUB, i, regMC_VM_AGP_TOP,
                             adev->gmc.agp_end >> 24);

-               if (amdgpu_sriov_vf(adev))
-                       return;
-
                /* Program the system aperture low logical page number. */
                WREG32_SOC15(MMHUB, i, regMC_VM_SYSTEM_APERTURE_LOW_ADDR,
                        min(adev->gmc.fb_start, adev->gmc.agp_start) >> 18);
--
2.34.1



More information about the amd-gfx mailing list