drm/amdgpu: access stolen VRAM directly on KV/KB (v2)
authorChristian König <christian.koenig@amd.com>
Fri, 4 Nov 2016 12:23:41 +0000 (13:23 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 27 Jan 2017 17:20:44 +0000 (12:20 -0500)
We don't need to use the PCI BAR on APUs. This allows us to access
the full VRAM directly without being limited by the BAR size.

v2: squash in 64bit shift fix

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c

index 273b16fb9459fe17dedd0c3c928a5b4e5edf93e7..8d05e0c4e3d7de526ea2087df6920d78ced4f65e 100644 (file)
@@ -375,9 +375,16 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
        /* size in MB on si */
        adev->mc.mc_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
        adev->mc.real_vram_size = RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
-       adev->mc.visible_vram_size = adev->mc.aper_size;
+
+#ifdef CONFIG_X86_64
+       if (adev->flags & AMD_IS_APU) {
+               adev->mc.aper_base = ((u64)RREG32(mmMC_VM_FB_OFFSET)) << 22;
+               adev->mc.aper_size = adev->mc.real_vram_size;
+       }
+#endif
 
        /* In case the PCI BAR is larger than the actual amount of vram */
+       adev->mc.visible_vram_size = adev->mc.aper_size;
        if (adev->mc.visible_vram_size > adev->mc.real_vram_size)
                adev->mc.visible_vram_size = adev->mc.real_vram_size;