drm/amdgpu:free CSA in unified place
authorMonk Liu <Monk.Liu@amd.com>
Tue, 14 Nov 2017 08:52:14 +0000 (16:52 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Dec 2017 17:47:51 +0000 (12:47 -0500)
instead of doing it in each GFX ip's sw_fini

Signed-off-by: Monk Liu <Monk.Liu@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_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

index 29c81c3874201c5efe21e3a8c39e0c499f341779..fdce06b5b2b8c2da6d95f8baaadf9ee457d9e439 100644 (file)
@@ -1893,6 +1893,7 @@ static int amdgpu_fini(struct amdgpu_device *adev)
                if (!adev->ip_blocks[i].status.hw)
                        continue;
                if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
+                       amdgpu_free_static_csa(adev);
                        amdgpu_wb_fini(adev);
                        amdgpu_vram_scratch_fini(adev);
                }
index 0769cb935318d22a42b646cd97d9a37e49345048..e7dfb7b44b4b42e9ae6f5a82bbdb72850badd03a 100644 (file)
@@ -47,6 +47,12 @@ int amdgpu_allocate_static_csa(struct amdgpu_device *adev)
        return 0;
 }
 
+void amdgpu_free_static_csa(struct amdgpu_device *adev) {
+       amdgpu_bo_free_kernel(&adev->virt.csa_obj,
+                                               &adev->virt.csa_vmid0_addr,
+                                               NULL);
+}
+
 /*
  * amdgpu_map_static_csa should be called during amdgpu_vm_init
  * it maps virtual address "AMDGPU_VA_RESERVED_SIZE - AMDGPU_CSA_SIZE"
index f77d116c7a1cf4a1c98f8c94c362f5abf07f30fc..6a83425aa9ed9416e5e3ade8de219962dd3f4a3e 100644 (file)
@@ -283,6 +283,7 @@ bool amdgpu_virt_mmio_blocked(struct amdgpu_device *adev);
 int amdgpu_allocate_static_csa(struct amdgpu_device *adev);
 int amdgpu_map_static_csa(struct amdgpu_device *adev, struct amdgpu_vm *vm,
                          struct amdgpu_bo_va **bo_va);
+void amdgpu_free_static_csa(struct amdgpu_device *adev);
 void amdgpu_virt_init_setting(struct amdgpu_device *adev);
 uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg);
 void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v);
index ee77c949bf874f07c124e74e6040cfc60a92b9a2..d02493cf91759a9e497454dde0dc7a811aebe041 100644 (file)
@@ -2114,7 +2114,6 @@ static int gfx_v8_0_sw_fini(void *handle)
        amdgpu_gfx_compute_mqd_sw_fini(adev);
        amdgpu_gfx_kiq_free_ring(&adev->gfx.kiq.ring, &adev->gfx.kiq.irq);
        amdgpu_gfx_kiq_fini(adev);
-       amdgpu_bo_free_kernel(&adev->virt.csa_obj, &adev->virt.csa_vmid0_addr, NULL);
 
        gfx_v8_0_mec_fini(adev);
        gfx_v8_0_rlc_fini(adev);
index 5ba24792f80153890212e44db8e31af93605c0d6..560d8e76d14cc75c659cf133544cd49ff4f5e604 100644 (file)
@@ -1464,7 +1464,6 @@ static int gfx_v9_0_sw_fini(void *handle)
        amdgpu_gfx_compute_mqd_sw_fini(adev);
        amdgpu_gfx_kiq_free_ring(&adev->gfx.kiq.ring, &adev->gfx.kiq.irq);
        amdgpu_gfx_kiq_fini(adev);
-       amdgpu_bo_free_kernel(&adev->virt.csa_obj, &adev->virt.csa_vmid0_addr, NULL);
 
        gfx_v9_0_mec_fini(adev);
        gfx_v9_0_ngg_fini(adev);