diff options
author | pding <Pixel.Ding@amd.com> | 2017-10-23 21:51:04 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-04 16:33:13 -0500 |
commit | b636176efdf0e365a69613f03f6ecbf6fd0408cb (patch) | |
tree | c8aa6361e2719540a7b2c3d060388c084334266f | |
parent | a16f8f11c599cdec16e77020d56d230fedabe922 (diff) |
drm/amdgpu/virt: add wait_reset virt ops
Driver can use this interface to check if there's a function level
reset done in hypervisor. It's helpful when IRQ handler for reset
is not ready, or special handling is required.
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: pding <Pixel.Ding@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c index 0f227cf7a67c..b7510bf6bc0f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | |||
@@ -236,6 +236,22 @@ int amdgpu_virt_reset_gpu(struct amdgpu_device *adev) | |||
236 | } | 236 | } |
237 | 237 | ||
238 | /** | 238 | /** |
239 | * amdgpu_virt_wait_reset() - wait for reset gpu completed | ||
240 | * @amdgpu: amdgpu device. | ||
241 | * Wait for GPU reset completed. | ||
242 | * Return: Zero if reset success, otherwise will return error. | ||
243 | */ | ||
244 | int amdgpu_virt_wait_reset(struct amdgpu_device *adev) | ||
245 | { | ||
246 | struct amdgpu_virt *virt = &adev->virt; | ||
247 | |||
248 | if (!virt->ops || !virt->ops->wait_reset) | ||
249 | return -EINVAL; | ||
250 | |||
251 | return virt->ops->wait_reset(adev); | ||
252 | } | ||
253 | |||
254 | /** | ||
239 | * amdgpu_virt_alloc_mm_table() - alloc memory for mm table | 255 | * amdgpu_virt_alloc_mm_table() - alloc memory for mm table |
240 | * @amdgpu: amdgpu device. | 256 | * @amdgpu: amdgpu device. |
241 | * MM table is used by UVD and VCE for its initialization | 257 | * MM table is used by UVD and VCE for its initialization |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h index 81efb9d291c4..d149aca71a44 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | |||
@@ -55,6 +55,7 @@ struct amdgpu_virt_ops { | |||
55 | int (*req_full_gpu)(struct amdgpu_device *adev, bool init); | 55 | int (*req_full_gpu)(struct amdgpu_device *adev, bool init); |
56 | int (*rel_full_gpu)(struct amdgpu_device *adev, bool init); | 56 | int (*rel_full_gpu)(struct amdgpu_device *adev, bool init); |
57 | int (*reset_gpu)(struct amdgpu_device *adev); | 57 | int (*reset_gpu)(struct amdgpu_device *adev); |
58 | int (*wait_reset)(struct amdgpu_device *adev); | ||
58 | void (*trans_msg)(struct amdgpu_device *adev, u32 req, u32 data1, u32 data2, u32 data3); | 59 | void (*trans_msg)(struct amdgpu_device *adev, u32 req, u32 data1, u32 data2, u32 data3); |
59 | }; | 60 | }; |
60 | 61 | ||
@@ -286,6 +287,7 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v); | |||
286 | int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init); | 287 | int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init); |
287 | int amdgpu_virt_release_full_gpu(struct amdgpu_device *adev, bool init); | 288 | int amdgpu_virt_release_full_gpu(struct amdgpu_device *adev, bool init); |
288 | int amdgpu_virt_reset_gpu(struct amdgpu_device *adev); | 289 | int amdgpu_virt_reset_gpu(struct amdgpu_device *adev); |
290 | int amdgpu_virt_wait_reset(struct amdgpu_device *adev); | ||
289 | int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job); | 291 | int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job); |
290 | int amdgpu_virt_alloc_mm_table(struct amdgpu_device *adev); | 292 | int amdgpu_virt_alloc_mm_table(struct amdgpu_device *adev); |
291 | void amdgpu_virt_free_mm_table(struct amdgpu_device *adev); | 293 | void amdgpu_virt_free_mm_table(struct amdgpu_device *adev); |