diff options
author | Monk Liu <Monk.Liu@amd.com> | 2017-10-17 03:11:12 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-04 16:41:31 -0500 |
commit | 13a752e3a246493bfaba0cf0e0f376672ebb734c (patch) | |
tree | e5ccbb7c947c16d6614bc40081a021173c956787 /drivers/gpu/drm/amd | |
parent | 5740682e66cef57626a328d237698cad329c0449 (diff) |
drm/amdgpu:cleanup in_sriov_reset and lock_reset
since now gpu reset is unified with gpu_recover
for both bare-metal and SR-IOV:
1)rename in_sriov_reset to in_gpu_reset
2)move lock_reset from adev->virt to adev
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>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 6 |
8 files changed, 15 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 5714b7e8cb09..f25d246395a1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -1643,7 +1643,8 @@ struct amdgpu_device { | |||
1643 | 1643 | ||
1644 | /* record last mm index being written through WREG32*/ | 1644 | /* record last mm index being written through WREG32*/ |
1645 | unsigned long last_mm_index; | 1645 | unsigned long last_mm_index; |
1646 | bool in_sriov_reset; | 1646 | bool in_gpu_reset; |
1647 | struct mutex lock_reset; | ||
1647 | }; | 1648 | }; |
1648 | 1649 | ||
1649 | static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev) | 1650 | static inline struct amdgpu_device *amdgpu_ttm_adev(struct ttm_bo_device *bdev) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index e287eeda2dab..9d4e0b88b101 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -2163,6 +2163,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
2163 | mutex_init(&adev->mn_lock); | 2163 | mutex_init(&adev->mn_lock); |
2164 | mutex_init(&adev->virt.vf_errors.lock); | 2164 | mutex_init(&adev->virt.vf_errors.lock); |
2165 | hash_init(adev->mn_hash); | 2165 | hash_init(adev->mn_hash); |
2166 | mutex_init(&adev->lock_reset); | ||
2166 | 2167 | ||
2167 | amdgpu_check_arguments(adev); | 2168 | amdgpu_check_arguments(adev); |
2168 | 2169 | ||
@@ -2990,9 +2991,9 @@ int amdgpu_gpu_recover(struct amdgpu_device *adev, struct amdgpu_job *job) | |||
2990 | 2991 | ||
2991 | dev_info(adev->dev, "GPU reset begin!\n"); | 2992 | dev_info(adev->dev, "GPU reset begin!\n"); |
2992 | 2993 | ||
2993 | mutex_lock(&adev->virt.lock_reset); | 2994 | mutex_lock(&adev->lock_reset); |
2994 | atomic_inc(&adev->gpu_reset_counter); | 2995 | atomic_inc(&adev->gpu_reset_counter); |
2995 | adev->in_sriov_reset = 1; | 2996 | adev->in_gpu_reset = 1; |
2996 | 2997 | ||
2997 | /* block TTM */ | 2998 | /* block TTM */ |
2998 | resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev); | 2999 | resched = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev); |
@@ -3102,8 +3103,8 @@ int amdgpu_gpu_recover(struct amdgpu_device *adev, struct amdgpu_job *job) | |||
3102 | } | 3103 | } |
3103 | 3104 | ||
3104 | amdgpu_vf_error_trans_all(adev); | 3105 | amdgpu_vf_error_trans_all(adev); |
3105 | adev->in_sriov_reset = 0; | 3106 | adev->in_gpu_reset = 0; |
3106 | mutex_unlock(&adev->virt.lock_reset); | 3107 | mutex_unlock(&adev->lock_reset); |
3107 | return r; | 3108 | return r; |
3108 | } | 3109 | } |
3109 | 3110 | ||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 447d446b5015..76f531b8e97b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | |||
@@ -264,7 +264,7 @@ static int psp_hw_start(struct psp_context *psp) | |||
264 | struct amdgpu_device *adev = psp->adev; | 264 | struct amdgpu_device *adev = psp->adev; |
265 | int ret; | 265 | int ret; |
266 | 266 | ||
267 | if (!amdgpu_sriov_vf(adev) || !adev->in_sriov_reset) { | 267 | if (!amdgpu_sriov_vf(adev) || !adev->in_gpu_reset) { |
268 | ret = psp_bootloader_load_sysdrv(psp); | 268 | ret = psp_bootloader_load_sysdrv(psp); |
269 | if (ret) | 269 | if (ret) |
270 | return ret; | 270 | return ret; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c index 65649026b836..edc37cc80644 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | |||
@@ -370,7 +370,7 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev) | |||
370 | return 0; | 370 | return 0; |
371 | } | 371 | } |
372 | 372 | ||
373 | if (!amdgpu_sriov_vf(adev) || !adev->in_sriov_reset) { | 373 | if (!amdgpu_sriov_vf(adev) || !adev->in_gpu_reset) { |
374 | err = amdgpu_bo_create(adev, adev->firmware.fw_size, PAGE_SIZE, true, | 374 | err = amdgpu_bo_create(adev, adev->firmware.fw_size, PAGE_SIZE, true, |
375 | amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT, | 375 | amdgpu_sriov_vf(adev) ? AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT, |
376 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, | 376 | AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS, |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index b7510bf6bc0f..733c64cbd1c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | |||
@@ -115,8 +115,6 @@ void amdgpu_virt_init_setting(struct amdgpu_device *adev) | |||
115 | adev->enable_virtual_display = true; | 115 | adev->enable_virtual_display = true; |
116 | adev->cg_flags = 0; | 116 | adev->cg_flags = 0; |
117 | adev->pg_flags = 0; | 117 | adev->pg_flags = 0; |
118 | |||
119 | mutex_init(&adev->virt.lock_reset); | ||
120 | } | 118 | } |
121 | 119 | ||
122 | uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) | 120 | uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h index 20bdb8fb0b8c..e3f78f5edc00 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | |||
@@ -239,7 +239,6 @@ struct amdgpu_virt { | |||
239 | uint64_t csa_vmid0_addr; | 239 | uint64_t csa_vmid0_addr; |
240 | bool chained_ib_support; | 240 | bool chained_ib_support; |
241 | uint32_t reg_val_offs; | 241 | uint32_t reg_val_offs; |
242 | struct mutex lock_reset; | ||
243 | struct amdgpu_irq_src ack_irq; | 242 | struct amdgpu_irq_src ack_irq; |
244 | struct amdgpu_irq_src rcv_irq; | 243 | struct amdgpu_irq_src rcv_irq; |
245 | struct work_struct flr_work; | 244 | struct work_struct flr_work; |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 46ee74393454..2ddf126614da 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | |||
@@ -4824,7 +4824,7 @@ static int gfx_v8_0_kiq_init_queue(struct amdgpu_ring *ring) | |||
4824 | 4824 | ||
4825 | gfx_v8_0_kiq_setting(ring); | 4825 | gfx_v8_0_kiq_setting(ring); |
4826 | 4826 | ||
4827 | if (adev->in_sriov_reset) { /* for GPU_RESET case */ | 4827 | if (adev->in_gpu_reset) { /* for GPU_RESET case */ |
4828 | /* reset MQD to a clean status */ | 4828 | /* reset MQD to a clean status */ |
4829 | if (adev->gfx.mec.mqd_backup[mqd_idx]) | 4829 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
4830 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation)); | 4830 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation)); |
@@ -4861,7 +4861,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
4861 | struct vi_mqd *mqd = ring->mqd_ptr; | 4861 | struct vi_mqd *mqd = ring->mqd_ptr; |
4862 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; | 4862 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; |
4863 | 4863 | ||
4864 | if (!adev->in_sriov_reset && !adev->gfx.in_suspend) { | 4864 | if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { |
4865 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); | 4865 | memset((void *)mqd, 0, sizeof(struct vi_mqd_allocation)); |
4866 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; | 4866 | ((struct vi_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
4867 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; | 4867 | ((struct vi_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
@@ -4873,7 +4873,7 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
4873 | 4873 | ||
4874 | if (adev->gfx.mec.mqd_backup[mqd_idx]) | 4874 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
4875 | memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct vi_mqd_allocation)); | 4875 | memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct vi_mqd_allocation)); |
4876 | } else if (adev->in_sriov_reset) { /* for GPU_RESET case */ | 4876 | } else if (adev->in_gpu_reset) { /* for GPU_RESET case */ |
4877 | /* reset MQD to a clean status */ | 4877 | /* reset MQD to a clean status */ |
4878 | if (adev->gfx.mec.mqd_backup[mqd_idx]) | 4878 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
4879 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation)); | 4879 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct vi_mqd_allocation)); |
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 46a0d3ef773f..19a619f759f6 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | |||
@@ -2757,7 +2757,7 @@ static int gfx_v9_0_kiq_init_queue(struct amdgpu_ring *ring) | |||
2757 | 2757 | ||
2758 | gfx_v9_0_kiq_setting(ring); | 2758 | gfx_v9_0_kiq_setting(ring); |
2759 | 2759 | ||
2760 | if (adev->in_sriov_reset) { /* for GPU_RESET case */ | 2760 | if (adev->in_gpu_reset) { /* for GPU_RESET case */ |
2761 | /* reset MQD to a clean status */ | 2761 | /* reset MQD to a clean status */ |
2762 | if (adev->gfx.mec.mqd_backup[mqd_idx]) | 2762 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
2763 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation)); | 2763 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation)); |
@@ -2795,7 +2795,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
2795 | struct v9_mqd *mqd = ring->mqd_ptr; | 2795 | struct v9_mqd *mqd = ring->mqd_ptr; |
2796 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; | 2796 | int mqd_idx = ring - &adev->gfx.compute_ring[0]; |
2797 | 2797 | ||
2798 | if (!adev->in_sriov_reset && !adev->gfx.in_suspend) { | 2798 | if (!adev->in_gpu_reset && !adev->gfx.in_suspend) { |
2799 | memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation)); | 2799 | memset((void *)mqd, 0, sizeof(struct v9_mqd_allocation)); |
2800 | ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; | 2800 | ((struct v9_mqd_allocation *)mqd)->dynamic_cu_mask = 0xFFFFFFFF; |
2801 | ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; | 2801 | ((struct v9_mqd_allocation *)mqd)->dynamic_rb_mask = 0xFFFFFFFF; |
@@ -2807,7 +2807,7 @@ static int gfx_v9_0_kcq_init_queue(struct amdgpu_ring *ring) | |||
2807 | 2807 | ||
2808 | if (adev->gfx.mec.mqd_backup[mqd_idx]) | 2808 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
2809 | memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct v9_mqd_allocation)); | 2809 | memcpy(adev->gfx.mec.mqd_backup[mqd_idx], mqd, sizeof(struct v9_mqd_allocation)); |
2810 | } else if (adev->in_sriov_reset) { /* for GPU_RESET case */ | 2810 | } else if (adev->in_gpu_reset) { /* for GPU_RESET case */ |
2811 | /* reset MQD to a clean status */ | 2811 | /* reset MQD to a clean status */ |
2812 | if (adev->gfx.mec.mqd_backup[mqd_idx]) | 2812 | if (adev->gfx.mec.mqd_backup[mqd_idx]) |
2813 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation)); | 2813 | memcpy(mqd, adev->gfx.mec.mqd_backup[mqd_idx], sizeof(struct v9_mqd_allocation)); |