Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 209ee27e authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher
Browse files

drm/amd/powerplay: added grbm_idx_mutex lock/unlock to cgs v2



  - v2: rename param 'en' as 'lock'

Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c62a59d0
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -614,6 +614,17 @@ static int amdgpu_cgs_enter_safe_mode(struct cgs_device *cgs_device,
	return 0;
	return 0;
}
}


static void amdgpu_cgs_lock_grbm_idx(struct cgs_device *cgs_device,
					bool lock)
{
	CGS_FUNC_ADEV;

	if (lock)
		mutex_lock(&adev->grbm_idx_mutex);
	else
		mutex_unlock(&adev->grbm_idx_mutex);
}

static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
static int amdgpu_cgs_get_firmware_info(struct cgs_device *cgs_device,
					enum cgs_ucode_id type,
					enum cgs_ucode_id type,
					struct cgs_firmware_info *info)
					struct cgs_firmware_info *info)
@@ -1127,6 +1138,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
	.query_system_info = amdgpu_cgs_query_system_info,
	.query_system_info = amdgpu_cgs_query_system_info,
	.is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled,
	.is_virtualization_enabled = amdgpu_cgs_is_virtualization_enabled,
	.enter_safe_mode = amdgpu_cgs_enter_safe_mode,
	.enter_safe_mode = amdgpu_cgs_enter_safe_mode,
	.lock_grbm_idx = amdgpu_cgs_lock_grbm_idx,
};
};


static const struct cgs_os_ops amdgpu_cgs_os_ops = {
static const struct cgs_os_ops amdgpu_cgs_os_ops = {
+5 −0
Original line number Original line Diff line number Diff line
@@ -407,6 +407,8 @@ typedef int (*cgs_is_virtualization_enabled_t)(void *cgs_device);


typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);
typedef int (*cgs_enter_safe_mode)(struct cgs_device *cgs_device, bool en);


typedef void (*cgs_lock_grbm_idx)(struct cgs_device *cgs_device, bool lock);

struct cgs_ops {
struct cgs_ops {
	/* memory management calls (similar to KFD interface) */
	/* memory management calls (similar to KFD interface) */
	cgs_alloc_gpu_mem_t alloc_gpu_mem;
	cgs_alloc_gpu_mem_t alloc_gpu_mem;
@@ -442,6 +444,7 @@ struct cgs_ops {
	cgs_query_system_info query_system_info;
	cgs_query_system_info query_system_info;
	cgs_is_virtualization_enabled_t is_virtualization_enabled;
	cgs_is_virtualization_enabled_t is_virtualization_enabled;
	cgs_enter_safe_mode enter_safe_mode;
	cgs_enter_safe_mode enter_safe_mode;
	cgs_lock_grbm_idx lock_grbm_idx;
};
};


struct cgs_os_ops; /* To be define in OS-specific CGS header */
struct cgs_os_ops; /* To be define in OS-specific CGS header */
@@ -518,4 +521,6 @@ struct cgs_device
#define cgs_enter_safe_mode(cgs_device, en) \
#define cgs_enter_safe_mode(cgs_device, en) \
		CGS_CALL(enter_safe_mode, cgs_device, en)
		CGS_CALL(enter_safe_mode, cgs_device, en)


#define cgs_lock_grbm_idx(cgs_device, lock) \
		CGS_CALL(lock_grbm_idx, cgs_device, lock)
#endif /* _CGS_COMMON_H */
#endif /* _CGS_COMMON_H */