Commit 420185fd authored by Graham Sider's avatar Graham Sider Committed by Alex Deucher

drm/amdkfd: replace kgd_dev in hqd/mqd kfd2kgd funcs

Modified definitions:

- hqd_load
- hiq_mqd_load
- hqd_sdma_load
- hqd_dump
- hqd_sdma_dump
- hqd_is_occupied
- hqd_destroy
- hqd_sdma_is_occupied
- hqd_sdma_destroy
Signed-off-by: default avatarGraham Sider <Graham.Sider@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c531a58b
...@@ -123,10 +123,9 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev, ...@@ -123,10 +123,9 @@ static uint32_t get_sdma_rlc_reg_offset(struct amdgpu_device *adev,
return sdma_rlc_reg_offset; return sdma_rlc_reg_offset;
} }
int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, int kgd_arcturus_hqd_sdma_load(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm) uint32_t __user *wptr, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_sdma_mqd *m; struct v9_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
unsigned long end_jiffies; unsigned long end_jiffies;
...@@ -193,11 +192,10 @@ int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, ...@@ -193,11 +192,10 @@ int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, int kgd_arcturus_hqd_sdma_dump(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev, uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev,
engine_id, queue_id); engine_id, queue_id);
uint32_t i = 0, reg; uint32_t i = 0, reg;
...@@ -225,9 +223,9 @@ int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, ...@@ -225,9 +223,9 @@ int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) bool kgd_arcturus_hqd_sdma_is_occupied(struct amdgpu_device *adev,
void *mqd)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_sdma_mqd *m; struct v9_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t sdma_rlc_rb_cntl; uint32_t sdma_rlc_rb_cntl;
...@@ -244,10 +242,9 @@ bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) ...@@ -244,10 +242,9 @@ bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)
return false; return false;
} }
int kgd_arcturus_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, int kgd_arcturus_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout) unsigned int utimeout)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_sdma_mqd *m; struct v9_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t temp; uint32_t temp;
......
...@@ -20,11 +20,12 @@ ...@@ -20,11 +20,12 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
int kgd_arcturus_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, int kgd_arcturus_hqd_sdma_load(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm); uint32_t __user *wptr, struct mm_struct *mm);
int kgd_arcturus_hqd_sdma_dump(struct kgd_dev *kgd, int kgd_arcturus_hqd_sdma_dump(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs); uint32_t (**dump)[2], uint32_t *n_regs);
bool kgd_arcturus_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd); bool kgd_arcturus_hqd_sdma_is_occupied(struct amdgpu_device *adev,
int kgd_arcturus_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, void *mqd);
int kgd_arcturus_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout); unsigned int utimeout);
...@@ -212,12 +212,11 @@ static inline struct v10_sdma_mqd *get_sdma_mqd(void *mqd) ...@@ -212,12 +212,11 @@ static inline struct v10_sdma_mqd *get_sdma_mqd(void *mqd)
return (struct v10_sdma_mqd *)mqd; return (struct v10_sdma_mqd *)mqd;
} }
static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, static int kgd_hqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t queue_id, uint32_t __user *wptr, uint32_t pipe_id, uint32_t queue_id,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t __user *wptr, uint32_t wptr_shift,
struct mm_struct *mm) uint32_t wptr_mask, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_compute_mqd *m; struct v10_compute_mqd *m;
uint32_t *mqd_hqd; uint32_t *mqd_hqd;
uint32_t reg, hqd_base, data; uint32_t reg, hqd_base, data;
...@@ -295,11 +294,10 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, ...@@ -295,11 +294,10 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
return 0; return 0;
} }
static int kgd_hiq_mqd_load(struct kgd_dev *kgd, void *mqd, static int kgd_hiq_mqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t doorbell_off) uint32_t doorbell_off)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring;
struct v10_compute_mqd *m; struct v10_compute_mqd *m;
uint32_t mec, pipe; uint32_t mec, pipe;
...@@ -348,11 +346,10 @@ static int kgd_hiq_mqd_load(struct kgd_dev *kgd, void *mqd, ...@@ -348,11 +346,10 @@ static int kgd_hiq_mqd_load(struct kgd_dev *kgd, void *mqd,
return r; return r;
} }
static int kgd_hqd_dump(struct kgd_dev *kgd, static int kgd_hqd_dump(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg; uint32_t i = 0, reg;
#define HQD_N_REGS 56 #define HQD_N_REGS 56
#define DUMP_REG(addr) do { \ #define DUMP_REG(addr) do { \
...@@ -380,10 +377,9 @@ static int kgd_hqd_dump(struct kgd_dev *kgd, ...@@ -380,10 +377,9 @@ static int kgd_hqd_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_load(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm) uint32_t __user *wptr, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_sdma_mqd *m; struct v10_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
unsigned long end_jiffies; unsigned long end_jiffies;
...@@ -450,11 +446,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, ...@@ -450,11 +446,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, static int kgd_hqd_sdma_dump(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev, uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev,
engine_id, queue_id); engine_id, queue_id);
uint32_t i = 0, reg; uint32_t i = 0, reg;
...@@ -482,10 +477,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, ...@@ -482,10 +477,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, static bool kgd_hqd_is_occupied(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id) uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t act; uint32_t act;
bool retval = false; bool retval = false;
uint32_t low, high; uint32_t low, high;
...@@ -504,9 +499,8 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, ...@@ -504,9 +499,8 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
return retval; return retval;
} }
static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) static bool kgd_hqd_sdma_is_occupied(struct amdgpu_device *adev, void *mqd)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_sdma_mqd *m; struct v10_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t sdma_rlc_rb_cntl; uint32_t sdma_rlc_rb_cntl;
...@@ -523,12 +517,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) ...@@ -523,12 +517,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)
return false; return false;
} }
static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_destroy(struct amdgpu_device *adev, void *mqd,
enum kfd_preempt_type reset_type, enum kfd_preempt_type reset_type,
unsigned int utimeout, uint32_t pipe_id, unsigned int utimeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
enum hqd_dequeue_request_type type; enum hqd_dequeue_request_type type;
unsigned long end_jiffies; unsigned long end_jiffies;
uint32_t temp; uint32_t temp;
...@@ -637,10 +630,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -637,10 +630,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout) unsigned int utimeout)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_sdma_mqd *m; struct v10_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t temp; uint32_t temp;
......
...@@ -182,12 +182,11 @@ static inline struct v10_sdma_mqd *get_sdma_mqd(void *mqd) ...@@ -182,12 +182,11 @@ static inline struct v10_sdma_mqd *get_sdma_mqd(void *mqd)
return (struct v10_sdma_mqd *)mqd; return (struct v10_sdma_mqd *)mqd;
} }
static int hqd_load_v10_3(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, static int hqd_load_v10_3(struct amdgpu_device *adev, void *mqd,
uint32_t queue_id, uint32_t __user *wptr, uint32_t pipe_id, uint32_t queue_id,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t __user *wptr, uint32_t wptr_shift,
struct mm_struct *mm) uint32_t wptr_mask, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_compute_mqd *m; struct v10_compute_mqd *m;
uint32_t *mqd_hqd; uint32_t *mqd_hqd;
uint32_t reg, hqd_base, data; uint32_t reg, hqd_base, data;
...@@ -280,11 +279,10 @@ static int hqd_load_v10_3(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, ...@@ -280,11 +279,10 @@ static int hqd_load_v10_3(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
return 0; return 0;
} }
static int hiq_mqd_load_v10_3(struct kgd_dev *kgd, void *mqd, static int hiq_mqd_load_v10_3(struct amdgpu_device *adev, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t doorbell_off) uint32_t doorbell_off)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring;
struct v10_compute_mqd *m; struct v10_compute_mqd *m;
uint32_t mec, pipe; uint32_t mec, pipe;
...@@ -333,11 +331,10 @@ static int hiq_mqd_load_v10_3(struct kgd_dev *kgd, void *mqd, ...@@ -333,11 +331,10 @@ static int hiq_mqd_load_v10_3(struct kgd_dev *kgd, void *mqd,
return r; return r;
} }
static int hqd_dump_v10_3(struct kgd_dev *kgd, static int hqd_dump_v10_3(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg; uint32_t i = 0, reg;
#define HQD_N_REGS 56 #define HQD_N_REGS 56
#define DUMP_REG(addr) do { \ #define DUMP_REG(addr) do { \
...@@ -365,10 +362,9 @@ static int hqd_dump_v10_3(struct kgd_dev *kgd, ...@@ -365,10 +362,9 @@ static int hqd_dump_v10_3(struct kgd_dev *kgd,
return 0; return 0;
} }
static int hqd_sdma_load_v10_3(struct kgd_dev *kgd, void *mqd, static int hqd_sdma_load_v10_3(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm) uint32_t __user *wptr, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_sdma_mqd *m; struct v10_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
unsigned long end_jiffies; unsigned long end_jiffies;
...@@ -435,11 +431,10 @@ static int hqd_sdma_load_v10_3(struct kgd_dev *kgd, void *mqd, ...@@ -435,11 +431,10 @@ static int hqd_sdma_load_v10_3(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int hqd_sdma_dump_v10_3(struct kgd_dev *kgd, static int hqd_sdma_dump_v10_3(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev, uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev,
engine_id, queue_id); engine_id, queue_id);
uint32_t i = 0, reg; uint32_t i = 0, reg;
...@@ -467,10 +462,10 @@ static int hqd_sdma_dump_v10_3(struct kgd_dev *kgd, ...@@ -467,10 +462,10 @@ static int hqd_sdma_dump_v10_3(struct kgd_dev *kgd,
return 0; return 0;
} }
static bool hqd_is_occupied_v10_3(struct kgd_dev *kgd, uint64_t queue_address, static bool hqd_is_occupied_v10_3(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id) uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t act; uint32_t act;
bool retval = false; bool retval = false;
uint32_t low, high; uint32_t low, high;
...@@ -489,9 +484,9 @@ static bool hqd_is_occupied_v10_3(struct kgd_dev *kgd, uint64_t queue_address, ...@@ -489,9 +484,9 @@ static bool hqd_is_occupied_v10_3(struct kgd_dev *kgd, uint64_t queue_address,
return retval; return retval;
} }
static bool hqd_sdma_is_occupied_v10_3(struct kgd_dev *kgd, void *mqd) static bool hqd_sdma_is_occupied_v10_3(struct amdgpu_device *adev,
void *mqd)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_sdma_mqd *m; struct v10_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t sdma_rlc_rb_cntl; uint32_t sdma_rlc_rb_cntl;
...@@ -508,12 +503,11 @@ static bool hqd_sdma_is_occupied_v10_3(struct kgd_dev *kgd, void *mqd) ...@@ -508,12 +503,11 @@ static bool hqd_sdma_is_occupied_v10_3(struct kgd_dev *kgd, void *mqd)
return false; return false;
} }
static int hqd_destroy_v10_3(struct kgd_dev *kgd, void *mqd, static int hqd_destroy_v10_3(struct amdgpu_device *adev, void *mqd,
enum kfd_preempt_type reset_type, enum kfd_preempt_type reset_type,
unsigned int utimeout, uint32_t pipe_id, unsigned int utimeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
enum hqd_dequeue_request_type type; enum hqd_dequeue_request_type type;
unsigned long end_jiffies; unsigned long end_jiffies;
uint32_t temp; uint32_t temp;
...@@ -559,10 +553,9 @@ static int hqd_destroy_v10_3(struct kgd_dev *kgd, void *mqd, ...@@ -559,10 +553,9 @@ static int hqd_destroy_v10_3(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int hqd_sdma_destroy_v10_3(struct kgd_dev *kgd, void *mqd, static int hqd_sdma_destroy_v10_3(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout) unsigned int utimeout)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v10_sdma_mqd *m; struct v10_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t temp; uint32_t temp;
......
...@@ -202,12 +202,11 @@ static inline struct cik_sdma_rlc_registers *get_sdma_mqd(void *mqd) ...@@ -202,12 +202,11 @@ static inline struct cik_sdma_rlc_registers *get_sdma_mqd(void *mqd)
return (struct cik_sdma_rlc_registers *)mqd; return (struct cik_sdma_rlc_registers *)mqd;
} }
static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, static int kgd_hqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t queue_id, uint32_t __user *wptr, uint32_t pipe_id, uint32_t queue_id,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t __user *wptr, uint32_t wptr_shift,
struct mm_struct *mm) uint32_t wptr_mask, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct cik_mqd *m; struct cik_mqd *m;
uint32_t *mqd_hqd; uint32_t *mqd_hqd;
uint32_t reg, wptr_val, data; uint32_t reg, wptr_val, data;
...@@ -248,11 +247,10 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, ...@@ -248,11 +247,10 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
return 0; return 0;
} }
static int kgd_hqd_dump(struct kgd_dev *kgd, static int kgd_hqd_dump(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg; uint32_t i = 0, reg;
#define HQD_N_REGS (35+4) #define HQD_N_REGS (35+4)
#define DUMP_REG(addr) do { \ #define DUMP_REG(addr) do { \
...@@ -284,10 +282,9 @@ static int kgd_hqd_dump(struct kgd_dev *kgd, ...@@ -284,10 +282,9 @@ static int kgd_hqd_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_load(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm) uint32_t __user *wptr, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct cik_sdma_rlc_registers *m; struct cik_sdma_rlc_registers *m;
unsigned long end_jiffies; unsigned long end_jiffies;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
...@@ -340,11 +337,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, ...@@ -340,11 +337,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, static int kgd_hqd_sdma_dump(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t sdma_offset = engine_id * SDMA1_REGISTER_OFFSET + uint32_t sdma_offset = engine_id * SDMA1_REGISTER_OFFSET +
queue_id * KFD_CIK_SDMA_QUEUE_OFFSET; queue_id * KFD_CIK_SDMA_QUEUE_OFFSET;
uint32_t i = 0, reg; uint32_t i = 0, reg;
...@@ -367,10 +363,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, ...@@ -367,10 +363,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, static bool kgd_hqd_is_occupied(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id) uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t act; uint32_t act;
bool retval = false; bool retval = false;
uint32_t low, high; uint32_t low, high;
...@@ -389,9 +385,8 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, ...@@ -389,9 +385,8 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
return retval; return retval;
} }
static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) static bool kgd_hqd_sdma_is_occupied(struct amdgpu_device *adev, void *mqd)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct cik_sdma_rlc_registers *m; struct cik_sdma_rlc_registers *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t sdma_rlc_rb_cntl; uint32_t sdma_rlc_rb_cntl;
...@@ -407,12 +402,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) ...@@ -407,12 +402,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)
return false; return false;
} }
static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_destroy(struct amdgpu_device *adev, void *mqd,
enum kfd_preempt_type reset_type, enum kfd_preempt_type reset_type,
unsigned int utimeout, uint32_t pipe_id, unsigned int utimeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t temp; uint32_t temp;
enum hqd_dequeue_request_type type; enum hqd_dequeue_request_type type;
unsigned long flags, end_jiffies; unsigned long flags, end_jiffies;
...@@ -509,10 +503,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -509,10 +503,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout) unsigned int utimeout)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct cik_sdma_rlc_registers *m; struct cik_sdma_rlc_registers *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t temp; uint32_t temp;
......
...@@ -160,12 +160,11 @@ static inline struct vi_sdma_mqd *get_sdma_mqd(void *mqd) ...@@ -160,12 +160,11 @@ static inline struct vi_sdma_mqd *get_sdma_mqd(void *mqd)
return (struct vi_sdma_mqd *)mqd; return (struct vi_sdma_mqd *)mqd;
} }
static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, static int kgd_hqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t queue_id, uint32_t __user *wptr, uint32_t pipe_id, uint32_t queue_id,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t __user *wptr, uint32_t wptr_shift,
struct mm_struct *mm) uint32_t wptr_mask, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct vi_mqd *m; struct vi_mqd *m;
uint32_t *mqd_hqd; uint32_t *mqd_hqd;
uint32_t reg, wptr_val, data; uint32_t reg, wptr_val, data;
...@@ -201,7 +200,7 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, ...@@ -201,7 +200,7 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
* on ASICs that do not support context-save. * on ASICs that do not support context-save.
* EOP writes/reads can start anywhere in the ring. * EOP writes/reads can start anywhere in the ring.
*/ */
if (get_amdgpu_device(kgd)->asic_type != CHIP_TONGA) { if (adev->asic_type != CHIP_TONGA) {
WREG32(mmCP_HQD_EOP_RPTR, m->cp_hqd_eop_rptr); WREG32(mmCP_HQD_EOP_RPTR, m->cp_hqd_eop_rptr);
WREG32(mmCP_HQD_EOP_WPTR, m->cp_hqd_eop_wptr); WREG32(mmCP_HQD_EOP_WPTR, m->cp_hqd_eop_wptr);
WREG32(mmCP_HQD_EOP_WPTR_MEM, m->cp_hqd_eop_wptr_mem); WREG32(mmCP_HQD_EOP_WPTR_MEM, m->cp_hqd_eop_wptr_mem);
...@@ -235,11 +234,10 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, ...@@ -235,11 +234,10 @@ static int kgd_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
return 0; return 0;
} }
static int kgd_hqd_dump(struct kgd_dev *kgd, static int kgd_hqd_dump(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg; uint32_t i = 0, reg;
#define HQD_N_REGS (54+4) #define HQD_N_REGS (54+4)
#define DUMP_REG(addr) do { \ #define DUMP_REG(addr) do { \
...@@ -271,10 +269,9 @@ static int kgd_hqd_dump(struct kgd_dev *kgd, ...@@ -271,10 +269,9 @@ static int kgd_hqd_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_load(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm) uint32_t __user *wptr, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct vi_sdma_mqd *m; struct vi_sdma_mqd *m;
unsigned long end_jiffies; unsigned long end_jiffies;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
...@@ -326,11 +323,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, ...@@ -326,11 +323,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, static int kgd_hqd_sdma_dump(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t sdma_offset = engine_id * SDMA1_REGISTER_OFFSET + uint32_t sdma_offset = engine_id * SDMA1_REGISTER_OFFSET +
queue_id * KFD_VI_SDMA_QUEUE_OFFSET; queue_id * KFD_VI_SDMA_QUEUE_OFFSET;
uint32_t i = 0, reg; uint32_t i = 0, reg;
...@@ -362,10 +358,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, ...@@ -362,10 +358,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, static bool kgd_hqd_is_occupied(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id) uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t act; uint32_t act;
bool retval = false; bool retval = false;
uint32_t low, high; uint32_t low, high;
...@@ -384,9 +380,8 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, ...@@ -384,9 +380,8 @@ static bool kgd_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
return retval; return retval;
} }
static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) static bool kgd_hqd_sdma_is_occupied(struct amdgpu_device *adev, void *mqd)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct vi_sdma_mqd *m; struct vi_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t sdma_rlc_rb_cntl; uint32_t sdma_rlc_rb_cntl;
...@@ -402,12 +397,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) ...@@ -402,12 +397,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)
return false; return false;
} }
static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_destroy(struct amdgpu_device *adev, void *mqd,
enum kfd_preempt_type reset_type, enum kfd_preempt_type reset_type,
unsigned int utimeout, uint32_t pipe_id, unsigned int utimeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t temp; uint32_t temp;
enum hqd_dequeue_request_type type; enum hqd_dequeue_request_type type;
unsigned long flags, end_jiffies; unsigned long flags, end_jiffies;
...@@ -507,10 +501,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -507,10 +501,9 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout) unsigned int utimeout)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct vi_sdma_mqd *m; struct vi_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t temp; uint32_t temp;
......
...@@ -227,12 +227,11 @@ static inline struct v9_sdma_mqd *get_sdma_mqd(void *mqd) ...@@ -227,12 +227,11 @@ static inline struct v9_sdma_mqd *get_sdma_mqd(void *mqd)
return (struct v9_sdma_mqd *)mqd; return (struct v9_sdma_mqd *)mqd;
} }
int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, int kgd_gfx_v9_hqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t queue_id, uint32_t __user *wptr, uint32_t pipe_id, uint32_t queue_id,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t __user *wptr, uint32_t wptr_shift,
struct mm_struct *mm) uint32_t wptr_mask, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_mqd *m; struct v9_mqd *m;
uint32_t *mqd_hqd; uint32_t *mqd_hqd;
uint32_t reg, hqd_base, data; uint32_t reg, hqd_base, data;
...@@ -307,11 +306,10 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, ...@@ -307,11 +306,10 @@ int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id,
return 0; return 0;
} }
int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd, int kgd_gfx_v9_hiq_mqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t doorbell_off) uint32_t doorbell_off)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring; struct amdgpu_ring *kiq_ring = &adev->gfx.kiq.ring;
struct v9_mqd *m; struct v9_mqd *m;
uint32_t mec, pipe; uint32_t mec, pipe;
...@@ -360,11 +358,10 @@ int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd, ...@@ -360,11 +358,10 @@ int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd,
return r; return r;
} }
int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd, int kgd_gfx_v9_hqd_dump(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t i = 0, reg; uint32_t i = 0, reg;
#define HQD_N_REGS 56 #define HQD_N_REGS 56
#define DUMP_REG(addr) do { \ #define DUMP_REG(addr) do { \
...@@ -392,10 +389,9 @@ int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd, ...@@ -392,10 +389,9 @@ int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_load(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm) uint32_t __user *wptr, struct mm_struct *mm)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_sdma_mqd *m; struct v9_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
unsigned long end_jiffies; unsigned long end_jiffies;
...@@ -462,11 +458,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd, ...@@ -462,11 +458,10 @@ static int kgd_hqd_sdma_load(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, static int kgd_hqd_sdma_dump(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs) uint32_t (**dump)[2], uint32_t *n_regs)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev, uint32_t sdma_rlc_reg_offset = get_sdma_rlc_reg_offset(adev,
engine_id, queue_id); engine_id, queue_id);
uint32_t i = 0, reg; uint32_t i = 0, reg;
...@@ -494,10 +489,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd, ...@@ -494,10 +489,10 @@ static int kgd_hqd_sdma_dump(struct kgd_dev *kgd,
return 0; return 0;
} }
bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, bool kgd_gfx_v9_hqd_is_occupied(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id) uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
uint32_t act; uint32_t act;
bool retval = false; bool retval = false;
uint32_t low, high; uint32_t low, high;
...@@ -516,9 +511,8 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, ...@@ -516,9 +511,8 @@ bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address,
return retval; return retval;
} }
static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) static bool kgd_hqd_sdma_is_occupied(struct amdgpu_device *adev, void *mqd)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_sdma_mqd *m; struct v9_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t sdma_rlc_rb_cntl; uint32_t sdma_rlc_rb_cntl;
...@@ -535,12 +529,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd) ...@@ -535,12 +529,11 @@ static bool kgd_hqd_sdma_is_occupied(struct kgd_dev *kgd, void *mqd)
return false; return false;
} }
int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, int kgd_gfx_v9_hqd_destroy(struct amdgpu_device *adev, void *mqd,
enum kfd_preempt_type reset_type, enum kfd_preempt_type reset_type,
unsigned int utimeout, uint32_t pipe_id, unsigned int utimeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
enum hqd_dequeue_request_type type; enum hqd_dequeue_request_type type;
unsigned long end_jiffies; unsigned long end_jiffies;
uint32_t temp; uint32_t temp;
...@@ -588,10 +581,9 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, ...@@ -588,10 +581,9 @@ int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,
return 0; return 0;
} }
static int kgd_hqd_sdma_destroy(struct kgd_dev *kgd, void *mqd, static int kgd_hqd_sdma_destroy(struct amdgpu_device *adev, void *mqd,
unsigned int utimeout) unsigned int utimeout)
{ {
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct v9_sdma_mqd *m; struct v9_sdma_mqd *m;
uint32_t sdma_rlc_reg_offset; uint32_t sdma_rlc_reg_offset;
uint32_t temp; uint32_t temp;
......
...@@ -29,19 +29,20 @@ void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid, ...@@ -29,19 +29,20 @@ void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, uint32_t vmid,
int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid, int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, u32 pasid,
unsigned int vmid); unsigned int vmid);
int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id); int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id);
int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, int kgd_gfx_v9_hqd_load(struct amdgpu_device *adev, void *mqd, uint32_t pipe_id,
uint32_t queue_id, uint32_t __user *wptr, uint32_t queue_id, uint32_t __user *wptr,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t wptr_shift, uint32_t wptr_mask,
struct mm_struct *mm); struct mm_struct *mm);
int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd, int kgd_gfx_v9_hiq_mqd_load(struct amdgpu_device *adev, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t doorbell_off); uint32_t doorbell_off);
int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd, int kgd_gfx_v9_hqd_dump(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs); uint32_t (**dump)[2], uint32_t *n_regs);
bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t queue_address, bool kgd_gfx_v9_hqd_is_occupied(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id); uint64_t queue_address, uint32_t pipe_id,
int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd, uint32_t queue_id);
int kgd_gfx_v9_hqd_destroy(struct amdgpu_device *adev, void *mqd,
enum kfd_preempt_type reset_type, enum kfd_preempt_type reset_type,
unsigned int utimeout, uint32_t pipe_id, unsigned int utimeout, uint32_t pipe_id,
uint32_t queue_id); uint32_t queue_id);
......
...@@ -2065,7 +2065,7 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data) ...@@ -2065,7 +2065,7 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data)
return 0; return 0;
} }
r = dqm->dev->kfd2kgd->hqd_dump(dqm->dev->kgd, r = dqm->dev->kfd2kgd->hqd_dump(dqm->dev->adev,
KFD_CIK_HIQ_PIPE, KFD_CIK_HIQ_QUEUE, KFD_CIK_HIQ_PIPE, KFD_CIK_HIQ_QUEUE,
&dump, &n_regs); &dump, &n_regs);
if (!r) { if (!r) {
...@@ -2087,7 +2087,7 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data) ...@@ -2087,7 +2087,7 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data)
continue; continue;
r = dqm->dev->kfd2kgd->hqd_dump( r = dqm->dev->kfd2kgd->hqd_dump(
dqm->dev->kgd, pipe, queue, &dump, &n_regs); dqm->dev->adev, pipe, queue, &dump, &n_regs);
if (r) if (r)
break; break;
...@@ -2104,7 +2104,7 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data) ...@@ -2104,7 +2104,7 @@ int dqm_debugfs_hqds(struct seq_file *m, void *data)
queue < dqm->dev->device_info->num_sdma_queues_per_engine; queue < dqm->dev->device_info->num_sdma_queues_per_engine;
queue++) { queue++) {
r = dqm->dev->kfd2kgd->hqd_sdma_dump( r = dqm->dev->kfd2kgd->hqd_sdma_dump(
dqm->dev->kgd, pipe, queue, &dump, &n_regs); dqm->dev->adev, pipe, queue, &dump, &n_regs);
if (r) if (r)
break; break;
......
...@@ -171,7 +171,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd, uint32_t pipe_id, ...@@ -171,7 +171,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd, uint32_t pipe_id,
uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0); uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0);
uint32_t wptr_mask = (uint32_t)((p->queue_size / 4) - 1); uint32_t wptr_mask = (uint32_t)((p->queue_size / 4) - 1);
return mm->dev->kfd2kgd->hqd_load(mm->dev->kgd, mqd, pipe_id, queue_id, return mm->dev->kfd2kgd->hqd_load(mm->dev->adev, mqd, pipe_id, queue_id,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
wptr_shift, wptr_mask, mms); wptr_shift, wptr_mask, mms);
} }
...@@ -180,7 +180,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -180,7 +180,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
struct queue_properties *p, struct mm_struct *mms) struct queue_properties *p, struct mm_struct *mms)
{ {
return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->kgd, mqd, return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->adev, mqd,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
mms); mms);
} }
...@@ -276,7 +276,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd, ...@@ -276,7 +276,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd,
unsigned int timeout, uint32_t pipe_id, unsigned int timeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_destroy(mm->dev->kgd, mqd, type, timeout, return mm->dev->kfd2kgd->hqd_destroy(mm->dev->adev, mqd, type, timeout,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -289,7 +289,7 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -289,7 +289,7 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd,
unsigned int timeout, uint32_t pipe_id, unsigned int timeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->kgd, mqd, timeout); return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->adev, mqd, timeout);
} }
static bool is_occupied(struct mqd_manager *mm, void *mqd, static bool is_occupied(struct mqd_manager *mm, void *mqd,
...@@ -297,7 +297,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd, ...@@ -297,7 +297,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_is_occupied(mm->dev->kgd, queue_address, return mm->dev->kfd2kgd->hqd_is_occupied(mm->dev->adev, queue_address,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -306,7 +306,7 @@ static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd, ...@@ -306,7 +306,7 @@ static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd,
uint64_t queue_address, uint32_t pipe_id, uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->kgd, mqd); return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->adev, mqd);
} }
/* /*
......
...@@ -148,7 +148,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd, ...@@ -148,7 +148,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd,
/* AQL write pointer counts in 64B packets, PM4/CP counts in dwords. */ /* AQL write pointer counts in 64B packets, PM4/CP counts in dwords. */
uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0); uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0);
r = mm->dev->kfd2kgd->hqd_load(mm->dev->kgd, mqd, pipe_id, queue_id, r = mm->dev->kfd2kgd->hqd_load(mm->dev->adev, mqd, pipe_id, queue_id,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
wptr_shift, 0, mms); wptr_shift, 0, mms);
return r; return r;
...@@ -158,7 +158,7 @@ static int hiq_load_mqd_kiq(struct mqd_manager *mm, void *mqd, ...@@ -158,7 +158,7 @@ static int hiq_load_mqd_kiq(struct mqd_manager *mm, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
struct queue_properties *p, struct mm_struct *mms) struct queue_properties *p, struct mm_struct *mms)
{ {
return mm->dev->kfd2kgd->hiq_mqd_load(mm->dev->kgd, mqd, pipe_id, return mm->dev->kfd2kgd->hiq_mqd_load(mm->dev->adev, mqd, pipe_id,
queue_id, p->doorbell_off); queue_id, p->doorbell_off);
} }
...@@ -239,7 +239,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd, ...@@ -239,7 +239,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_destroy return mm->dev->kfd2kgd->hqd_destroy
(mm->dev->kgd, mqd, type, timeout, (mm->dev->adev, mqd, type, timeout,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -254,7 +254,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd, ...@@ -254,7 +254,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_is_occupied( return mm->dev->kfd2kgd->hqd_is_occupied(
mm->dev->kgd, queue_address, mm->dev->adev, queue_address,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -320,7 +320,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -320,7 +320,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
struct queue_properties *p, struct mm_struct *mms) struct queue_properties *p, struct mm_struct *mms)
{ {
return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->kgd, mqd, return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->adev, mqd,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
mms); mms);
} }
...@@ -363,14 +363,14 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -363,14 +363,14 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd,
unsigned int timeout, uint32_t pipe_id, unsigned int timeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->kgd, mqd, timeout); return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->adev, mqd, timeout);
} }
static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd, static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd,
uint64_t queue_address, uint32_t pipe_id, uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->kgd, mqd); return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->adev, mqd);
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
......
...@@ -199,7 +199,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd, ...@@ -199,7 +199,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd,
/* AQL write pointer counts in 64B packets, PM4/CP counts in dwords. */ /* AQL write pointer counts in 64B packets, PM4/CP counts in dwords. */
uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0); uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0);
return mm->dev->kfd2kgd->hqd_load(mm->dev->kgd, mqd, pipe_id, queue_id, return mm->dev->kfd2kgd->hqd_load(mm->dev->adev, mqd, pipe_id, queue_id,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
wptr_shift, 0, mms); wptr_shift, 0, mms);
} }
...@@ -208,7 +208,7 @@ static int hiq_load_mqd_kiq(struct mqd_manager *mm, void *mqd, ...@@ -208,7 +208,7 @@ static int hiq_load_mqd_kiq(struct mqd_manager *mm, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
struct queue_properties *p, struct mm_struct *mms) struct queue_properties *p, struct mm_struct *mms)
{ {
return mm->dev->kfd2kgd->hiq_mqd_load(mm->dev->kgd, mqd, pipe_id, return mm->dev->kfd2kgd->hiq_mqd_load(mm->dev->adev, mqd, pipe_id,
queue_id, p->doorbell_off); queue_id, p->doorbell_off);
} }
...@@ -291,7 +291,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd, ...@@ -291,7 +291,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_destroy return mm->dev->kfd2kgd->hqd_destroy
(mm->dev->kgd, mqd, type, timeout, (mm->dev->adev, mqd, type, timeout,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -313,7 +313,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd, ...@@ -313,7 +313,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_is_occupied( return mm->dev->kfd2kgd->hqd_is_occupied(
mm->dev->kgd, queue_address, mm->dev->adev, queue_address,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -375,7 +375,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -375,7 +375,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
struct queue_properties *p, struct mm_struct *mms) struct queue_properties *p, struct mm_struct *mms)
{ {
return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->kgd, mqd, return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->adev, mqd,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
mms); mms);
} }
...@@ -418,14 +418,14 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -418,14 +418,14 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd,
unsigned int timeout, uint32_t pipe_id, unsigned int timeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->kgd, mqd, timeout); return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->adev, mqd, timeout);
} }
static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd, static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd,
uint64_t queue_address, uint32_t pipe_id, uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->kgd, mqd); return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->adev, mqd);
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
......
...@@ -162,7 +162,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd, ...@@ -162,7 +162,7 @@ static int load_mqd(struct mqd_manager *mm, void *mqd,
uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0); uint32_t wptr_shift = (p->format == KFD_QUEUE_FORMAT_AQL ? 4 : 0);
uint32_t wptr_mask = (uint32_t)((p->queue_size / 4) - 1); uint32_t wptr_mask = (uint32_t)((p->queue_size / 4) - 1);
return mm->dev->kfd2kgd->hqd_load(mm->dev->kgd, mqd, pipe_id, queue_id, return mm->dev->kfd2kgd->hqd_load(mm->dev->adev, mqd, pipe_id, queue_id,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
wptr_shift, wptr_mask, mms); wptr_shift, wptr_mask, mms);
} }
...@@ -265,7 +265,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd, ...@@ -265,7 +265,7 @@ static int destroy_mqd(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_destroy return mm->dev->kfd2kgd->hqd_destroy
(mm->dev->kgd, mqd, type, timeout, (mm->dev->adev, mqd, type, timeout,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -280,7 +280,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd, ...@@ -280,7 +280,7 @@ static bool is_occupied(struct mqd_manager *mm, void *mqd,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_is_occupied( return mm->dev->kfd2kgd->hqd_is_occupied(
mm->dev->kgd, queue_address, mm->dev->adev, queue_address,
pipe_id, queue_id); pipe_id, queue_id);
} }
...@@ -347,7 +347,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -347,7 +347,7 @@ static int load_mqd_sdma(struct mqd_manager *mm, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
struct queue_properties *p, struct mm_struct *mms) struct queue_properties *p, struct mm_struct *mms)
{ {
return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->kgd, mqd, return mm->dev->kfd2kgd->hqd_sdma_load(mm->dev->adev, mqd,
(uint32_t __user *)p->write_ptr, (uint32_t __user *)p->write_ptr,
mms); mms);
} }
...@@ -389,14 +389,14 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd, ...@@ -389,14 +389,14 @@ static int destroy_mqd_sdma(struct mqd_manager *mm, void *mqd,
unsigned int timeout, uint32_t pipe_id, unsigned int timeout, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->kgd, mqd, timeout); return mm->dev->kfd2kgd->hqd_sdma_destroy(mm->dev->adev, mqd, timeout);
} }
static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd, static bool is_occupied_sdma(struct mqd_manager *mm, void *mqd,
uint64_t queue_address, uint32_t pipe_id, uint64_t queue_address, uint32_t pipe_id,
uint32_t queue_id) uint32_t queue_id)
{ {
return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->kgd, mqd); return mm->dev->kfd2kgd->hqd_sdma_is_occupied(mm->dev->adev, mqd);
} }
#if defined(CONFIG_DEBUG_FS) #if defined(CONFIG_DEBUG_FS)
......
...@@ -238,36 +238,37 @@ struct kfd2kgd_calls { ...@@ -238,36 +238,37 @@ struct kfd2kgd_calls {
int (*init_interrupts)(struct kgd_dev *kgd, uint32_t pipe_id); int (*init_interrupts)(struct kgd_dev *kgd, uint32_t pipe_id);
int (*hqd_load)(struct kgd_dev *kgd, void *mqd, uint32_t pipe_id, int (*hqd_load)(struct amdgpu_device *adev, void *mqd, uint32_t pipe_id,
uint32_t queue_id, uint32_t __user *wptr, uint32_t queue_id, uint32_t __user *wptr,
uint32_t wptr_shift, uint32_t wptr_mask, uint32_t wptr_shift, uint32_t wptr_mask,
struct mm_struct *mm); struct mm_struct *mm);
int (*hiq_mqd_load)(struct kgd_dev *kgd, void *mqd, int (*hiq_mqd_load)(struct amdgpu_device *adev, void *mqd,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t doorbell_off); uint32_t doorbell_off);
int (*hqd_sdma_load)(struct kgd_dev *kgd, void *mqd, int (*hqd_sdma_load)(struct amdgpu_device *adev, void *mqd,
uint32_t __user *wptr, struct mm_struct *mm); uint32_t __user *wptr, struct mm_struct *mm);
int (*hqd_dump)(struct kgd_dev *kgd, int (*hqd_dump)(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id, uint32_t pipe_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs); uint32_t (**dump)[2], uint32_t *n_regs);
int (*hqd_sdma_dump)(struct kgd_dev *kgd, int (*hqd_sdma_dump)(struct amdgpu_device *adev,
uint32_t engine_id, uint32_t queue_id, uint32_t engine_id, uint32_t queue_id,
uint32_t (**dump)[2], uint32_t *n_regs); uint32_t (**dump)[2], uint32_t *n_regs);
bool (*hqd_is_occupied)(struct kgd_dev *kgd, uint64_t queue_address, bool (*hqd_is_occupied)(struct amdgpu_device *adev,
uint32_t pipe_id, uint32_t queue_id); uint64_t queue_address, uint32_t pipe_id,
int (*hqd_destroy)(struct kgd_dev *kgd, void *mqd, uint32_t reset_type,
unsigned int timeout, uint32_t pipe_id,
uint32_t queue_id); uint32_t queue_id);
bool (*hqd_sdma_is_occupied)(struct kgd_dev *kgd, void *mqd); int (*hqd_destroy)(struct amdgpu_device *adev, void *mqd,
uint32_t reset_type, unsigned int timeout,
uint32_t pipe_id, uint32_t queue_id);
bool (*hqd_sdma_is_occupied)(struct amdgpu_device *adev, void *mqd);
int (*hqd_sdma_destroy)(struct kgd_dev *kgd, void *mqd, int (*hqd_sdma_destroy)(struct amdgpu_device *adev, void *mqd,
unsigned int timeout); unsigned int timeout);
int (*address_watch_disable)(struct kgd_dev *kgd); int (*address_watch_disable)(struct kgd_dev *kgd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment