diff options
author | Andrey Grodzovsky <andrey.grodzovsky@amd.com> | 2018-11-29 12:21:53 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-12-03 11:15:08 -0500 |
commit | a82400b57abb6aff068bb3b21d1cccd63acbb863 (patch) | |
tree | 69a85209edb417f47210e3cccde644d0b88a25a4 /drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | |
parent | 38cd8a280d725cd4e0be14b0fbc2797c26cd9de5 (diff) |
drm/amdgpu: Handle xgmi device removal.
XGMI hive has some resources allocted on device init which
needs to be deallocated when the device is unregistered.
v2: Remove creation of dedicated wq for XGMI hive reset.
v3: Use the gmc.xgmi.supported flag
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c index f8c86d0593dd..1b15ff3266b1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | |||
@@ -135,3 +135,23 @@ exit: | |||
135 | mutex_unlock(&xgmi_mutex); | 135 | mutex_unlock(&xgmi_mutex); |
136 | return ret; | 136 | return ret; |
137 | } | 137 | } |
138 | |||
139 | void amdgpu_xgmi_remove_device(struct amdgpu_device *adev) | ||
140 | { | ||
141 | struct amdgpu_hive_info *hive; | ||
142 | |||
143 | if (!adev->gmc.xgmi.supported) | ||
144 | return; | ||
145 | |||
146 | mutex_lock(&xgmi_mutex); | ||
147 | |||
148 | hive = amdgpu_get_xgmi_hive(adev); | ||
149 | if (!hive) | ||
150 | goto exit; | ||
151 | |||
152 | if (!(hive->number_devices--)) | ||
153 | mutex_destroy(&hive->hive_lock); | ||
154 | |||
155 | exit: | ||
156 | mutex_unlock(&xgmi_mutex); | ||
157 | } | ||