mirror of
https://github.com/torvalds/linux.git
synced 2026-04-30 04:22:32 -04:00
drm/amdgpu: Keep reset handlers shared
Instead of maintaining a list per device, keep the reset handlers common per ASIC family. A pointer to the list of handlers is maintained in reset control. Signed-off-by: Lijo Lazar <lijo.lazar@amd.com> Reviewed-by: Le Ma <le.ma@amd.com> Reviewed-by: Asad Kamal <asad.kamal@amd.com> Tested-by: Asad Kamal <asad.kamal@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
|
||||
#include "amdgpu.h"
|
||||
|
||||
#define AMDGPU_RESET_MAX_HANDLERS 5
|
||||
|
||||
enum AMDGPU_RESET_FLAGS {
|
||||
|
||||
AMDGPU_NEED_FULL_RESET = 0,
|
||||
@@ -44,7 +46,6 @@ struct amdgpu_reset_context {
|
||||
|
||||
struct amdgpu_reset_handler {
|
||||
enum amd_reset_method reset_method;
|
||||
struct list_head handler_list;
|
||||
int (*prepare_env)(struct amdgpu_reset_control *reset_ctl,
|
||||
struct amdgpu_reset_context *context);
|
||||
int (*prepare_hwcontext)(struct amdgpu_reset_control *reset_ctl,
|
||||
@@ -63,7 +64,8 @@ struct amdgpu_reset_control {
|
||||
void *handle;
|
||||
struct work_struct reset_work;
|
||||
struct mutex reset_lock;
|
||||
struct list_head reset_handlers;
|
||||
struct amdgpu_reset_handler *(
|
||||
*reset_handlers)[AMDGPU_RESET_MAX_HANDLERS];
|
||||
atomic_t in_reset;
|
||||
enum amd_reset_method active_reset;
|
||||
struct amdgpu_reset_handler *(*get_reset_handler)(
|
||||
@@ -97,8 +99,10 @@ int amdgpu_reset_prepare_hwcontext(struct amdgpu_device *adev,
|
||||
int amdgpu_reset_perform_reset(struct amdgpu_device *adev,
|
||||
struct amdgpu_reset_context *reset_context);
|
||||
|
||||
int amdgpu_reset_add_handler(struct amdgpu_reset_control *reset_ctl,
|
||||
struct amdgpu_reset_handler *handler);
|
||||
int amdgpu_reset_prepare_env(struct amdgpu_device *adev,
|
||||
struct amdgpu_reset_context *reset_context);
|
||||
int amdgpu_reset_restore_env(struct amdgpu_device *adev,
|
||||
struct amdgpu_reset_context *reset_context);
|
||||
|
||||
struct amdgpu_reset_domain *amdgpu_reset_create_reset_domain(enum amdgpu_reset_domain_type type,
|
||||
char *wq_name);
|
||||
@@ -126,4 +130,8 @@ void amdgpu_device_lock_reset_domain(struct amdgpu_reset_domain *reset_domain);
|
||||
|
||||
void amdgpu_device_unlock_reset_domain(struct amdgpu_reset_domain *reset_domain);
|
||||
|
||||
#define for_each_handler(i, handler, reset_ctl) \
|
||||
for (i = 0; (i < AMDGPU_RESET_MAX_HANDLERS) && \
|
||||
(handler = (*reset_ctl->reset_handlers)[i]); \
|
||||
++i)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user