drm/amdgpu: fix the gart table cleared issue for S3
authorHuang Rui <ray.huang@amd.com>
Wed, 31 May 2017 02:35:42 +0000 (10:35 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Jun 2017 20:59:30 +0000 (16:59 -0400)
Something writes over the first 8 MB so reserve this
on vega10 until we root cause it.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

index 96cbe028d537cb31e06b8d57c1aa41385bce0a98..ef34ff2140832e652226f6d0cd3f75f050cac188 100644 (file)
@@ -607,6 +607,7 @@ struct amdgpu_mc {
        uint32_t                srbm_soft_reset;
        struct amdgpu_mode_mc_save save;
        bool                    prt_warning;
+       uint64_t                stolen_size;
        /* apertures */
        u64                                     shared_aperture_start;
        u64                                     shared_aperture_end;
index 8526a02222684fc87406e65ba54e9cd12d08902b..2ba54e2f5e5288ed0f206305c04ae7a507642ba4 100644 (file)
@@ -1121,7 +1121,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
        /* Change the size here instead of the init above so only lpfn is affected */
        amdgpu_ttm_set_active_vram_size(adev, adev->mc.visible_vram_size);
 
-       r = amdgpu_bo_create(adev, 256 * 1024, PAGE_SIZE, true,
+       r = amdgpu_bo_create(adev, adev->mc.stolen_size, PAGE_SIZE, true,
                             AMDGPU_GEM_DOMAIN_VRAM,
                             AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
                             AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS,
index 569828ced31d25cc9113e2d83aa6b361fb4aa07e..a33ba60f64a2970848f30b0bcaef10a52cd562a4 100644 (file)
@@ -834,6 +834,8 @@ static int gmc_v6_0_sw_init(void *handle)
 
        adev->mc.mc_mask = 0xffffffffffULL;
 
+       adev->mc.stolen_size = 256 * 1024;
+
        adev->need_dma32 = false;
        dma_bits = adev->need_dma32 ? 32 : 40;
        r = pci_set_dma_mask(adev->pdev, DMA_BIT_MASK(dma_bits));
index 8b39d9a4f801ee304a7693bc0d63041d15ba9b86..1326c1f2d15aee742b1526e12cd22214e7b5c4b7 100644 (file)
@@ -970,6 +970,8 @@ static int gmc_v7_0_sw_init(void *handle)
         */
        adev->mc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
 
+       adev->mc.stolen_size = 256 * 1024;
+
        /* set DMA mask + need_dma32 flags.
         * PCIE - can handle 40-bits.
         * IGP - can handle 40-bits
index 73a9653b4e60843027c8658c46a7b9c96b66f221..42e5b55d011303adf6bbc17985a940175c073303 100644 (file)
@@ -1054,6 +1054,8 @@ static int gmc_v8_0_sw_init(void *handle)
         */
        adev->mc.mc_mask = 0xffffffffffULL; /* 40 bit MC */
 
+       adev->mc.stolen_size = 256 * 1024;
+
        /* set DMA mask + need_dma32 flags.
         * PCIE - can handle 40-bits.
         * IGP - can handle 40-bits
index 4ab8338befd5294fcdddc6e0f74dff9098f70c5e..6b1fb7dcfce6e4939e11d8ef8ea98306e5949198 100644 (file)
@@ -572,6 +572,12 @@ static int gmc_v9_0_sw_init(void *handle)
         */
        adev->mc.mc_mask = 0xffffffffffffULL; /* 48 bit MC */
 
+       /*
+        * It needs to reserve 8M stolen memory for vega10
+        * TODO: Figure out how to avoid that...
+        */
+       adev->mc.stolen_size = 8 * 1024 * 1024;
+
        /* set DMA mask + need_dma32 flags.
         * PCIE - can handle 44-bits.
         * IGP - can handle 44-bits