Change-Id: I47b132d1ac5ed57f5805f759d5698948c35721ba Signed-off-by: Chunming Zhou <David1.Zhou at amd.com> --- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 24 ++++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 24 ++++++++++++++++++++---- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c index 0b0f086..0771c04 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c @@ -887,11 +887,26 @@ static int gmc_v7_0_early_init(void *handle) static int gmc_v7_0_late_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; + int r; - if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS) - return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0); - else - return 0; + r = amdgpu_gart_late_init(adev); + if (r) + return r; + + if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS) { + r = amdgpu_irq_get(adev, &adev->mc.vm_fault, 0); + if (r) + amdgpu_gart_late_fini(adev); + } + + return r; +} + +static void gmc_v7_0_late_fini(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + amdgpu_gart_late_fini(adev); } static int gmc_v7_0_sw_init(void *handle) @@ -1242,6 +1257,7 @@ const struct amd_ip_funcs gmc_v7_0_ip_funcs = { .name = "gmc_v7_0", .early_init = gmc_v7_0_early_init, .late_init = gmc_v7_0_late_init, + .late_fini = gmc_v7_0_late_fini, .sw_init = gmc_v7_0_sw_init, .sw_fini = gmc_v7_0_sw_fini, .hw_init = gmc_v7_0_hw_init, diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c index 0a23b83..c26bee9 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c @@ -876,11 +876,26 @@ static int gmc_v8_0_early_init(void *handle) static int gmc_v8_0_late_init(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle; + int r; - if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS) - return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0); - else - return 0; + r = amdgpu_gart_late_init(adev); + if (r) + return r; + + if (amdgpu_vm_fault_stop != AMDGPU_VM_FAULT_STOP_ALWAYS) { + r = amdgpu_irq_get(adev, &adev->mc.vm_fault, 0); + if (r) + amdgpu_gart_late_fini(adev); + } + + return r; +} + +static void gmc_v8_0_late_fini(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + amdgpu_gart_late_fini(adev); } #define mmMC_SEQ_MISC0_FIJI 0xA71 @@ -1434,6 +1449,7 @@ const struct amd_ip_funcs gmc_v8_0_ip_funcs = { .name = "gmc_v8_0", .early_init = gmc_v8_0_early_init, .late_init = gmc_v8_0_late_init, + .late_fini = gmc_v8_0_late_fini, .sw_init = gmc_v8_0_sw_init, .sw_fini = gmc_v8_0_sw_fini, .hw_init = gmc_v8_0_hw_init, -- 1.9.1