drm/amdgpu: fix the page fault of raven2
authorHuang Rui <ray.huang@amd.com>
Fri, 21 Sep 2018 10:15:01 +0000 (18:15 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 27 Sep 2018 02:09:20 +0000 (21:09 -0500)
While the apg_end address is 0xffffffff, if add 1 with it, the value will be
overflow and roll back to 0. So when 0 is written to
mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR, the system aperture is actually disabled. And
so any access to vram will trigger a page fault.

Raven2's HW issue only need increase the vram end address, and needn't do it on
the agp.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c
drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c

index 65f58ebcf83504c799463b171bfbfe0c284b2f50..ceb7847b504f70fe73435e5b81b4ee4da5588421 100644 (file)
@@ -82,7 +82,8 @@ static void gfxhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
                 * to get rid of the VM fault and hardware hang.
                 */
                WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
-                            (max(adev->gmc.vram_end, adev->gmc.agp_end) >> 18) + 0x1);
+                            max((adev->gmc.vram_end >> 18) + 0x1,
+                                adev->gmc.agp_end >> 18));
        else
                WREG32_SOC15(GC, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
                             max(adev->gmc.vram_end, adev->gmc.agp_end) >> 18);
index 80698b5ffa4a9eec0831ae5cb0ea572855ace9ca..14649f8475f3f68cfe9ebd2a816864cae1318e0f 100644 (file)
@@ -100,7 +100,8 @@ static void mmhub_v1_0_init_system_aperture_regs(struct amdgpu_device *adev)
                 * to get rid of the VM fault and hardware hang.
                 */
                WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
-                            (max(adev->gmc.vram_end, adev->gmc.agp_end) >> 18) + 0x1);
+                            max((adev->gmc.vram_end >> 18) + 0x1,
+                                adev->gmc.agp_end >> 18));
        else
                WREG32_SOC15(MMHUB, 0, mmMC_VM_SYSTEM_APERTURE_HIGH_ADDR,
                             max(adev->gmc.vram_end, adev->gmc.agp_end) >> 18);