提交 52a5fdce 编写于 作者: A Alexey Skidanov 提交者: Oded Gabbay

amdkfd: Instead of using get function, use container_of

Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: NAlexey Skidanov <Alexey.Skidanov@amd.com>
Signed-off-by: NOded Gabbay <oded.gabbay@amd.com>
上级 9a5634a7
...@@ -67,26 +67,21 @@ static inline unsigned int get_pipes_num_cpsch(void) ...@@ -67,26 +67,21 @@ static inline unsigned int get_pipes_num_cpsch(void)
return PIPE_PER_ME_CP_SCHEDULING; return PIPE_PER_ME_CP_SCHEDULING;
} }
static unsigned int get_sh_mem_bases_nybble_64(struct kfd_process *process, static inline unsigned int
struct kfd_dev *dev) get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd)
{ {
struct kfd_process_device *pdd;
uint32_t nybble; uint32_t nybble;
pdd = kfd_get_process_device_data(dev, process, 1);
nybble = (pdd->lds_base >> 60) & 0x0E; nybble = (pdd->lds_base >> 60) & 0x0E;
return nybble; return nybble;
} }
static unsigned int get_sh_mem_bases_32(struct kfd_process *process, static inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd)
struct kfd_dev *dev)
{ {
struct kfd_process_device *pdd;
unsigned int shared_base; unsigned int shared_base;
pdd = kfd_get_process_device_data(dev, process, 1);
shared_base = (pdd->lds_base >> 16) & 0xFF; shared_base = (pdd->lds_base >> 16) & 0xFF;
return shared_base; return shared_base;
...@@ -96,10 +91,13 @@ static uint32_t compute_sh_mem_bases_64bit(unsigned int top_address_nybble); ...@@ -96,10 +91,13 @@ static uint32_t compute_sh_mem_bases_64bit(unsigned int top_address_nybble);
static void init_process_memory(struct device_queue_manager *dqm, static void init_process_memory(struct device_queue_manager *dqm,
struct qcm_process_device *qpd) struct qcm_process_device *qpd)
{ {
struct kfd_process_device *pdd;
unsigned int temp; unsigned int temp;
BUG_ON(!dqm || !qpd); BUG_ON(!dqm || !qpd);
pdd = qpd_to_pdd(qpd);
/* check if sh_mem_config register already configured */ /* check if sh_mem_config register already configured */
if (qpd->sh_mem_config == 0) { if (qpd->sh_mem_config == 0) {
qpd->sh_mem_config = qpd->sh_mem_config =
...@@ -111,11 +109,11 @@ static void init_process_memory(struct device_queue_manager *dqm, ...@@ -111,11 +109,11 @@ static void init_process_memory(struct device_queue_manager *dqm,
} }
if (qpd->pqm->process->is_32bit_user_mode) { if (qpd->pqm->process->is_32bit_user_mode) {
temp = get_sh_mem_bases_32(qpd->pqm->process, dqm->dev); temp = get_sh_mem_bases_32(pdd);
qpd->sh_mem_bases = SHARED_BASE(temp); qpd->sh_mem_bases = SHARED_BASE(temp);
qpd->sh_mem_config |= PTR32; qpd->sh_mem_config |= PTR32;
} else { } else {
temp = get_sh_mem_bases_nybble_64(qpd->pqm->process, dqm->dev); temp = get_sh_mem_bases_nybble_64(pdd);
qpd->sh_mem_bases = compute_sh_mem_bases_64bit(temp); qpd->sh_mem_bases = compute_sh_mem_bases_64bit(temp);
} }
...@@ -707,8 +705,7 @@ static int stop_cpsch(struct device_queue_manager *dqm) ...@@ -707,8 +705,7 @@ static int stop_cpsch(struct device_queue_manager *dqm)
destroy_queues_cpsch(dqm, true); destroy_queues_cpsch(dqm, true);
list_for_each_entry(node, &dqm->queues, list) { list_for_each_entry(node, &dqm->queues, list) {
pdd = kfd_get_process_device_data(dqm->dev, pdd = qpd_to_pdd(node->qpd);
node->qpd->pqm->process, 1);
pdd->bound = false; pdd->bound = false;
} }
kfd2kgd->free_mem(dqm->dev->kgd, kfd2kgd->free_mem(dqm->dev->kgd,
......
...@@ -414,6 +414,8 @@ struct kfd_process_device { ...@@ -414,6 +414,8 @@ struct kfd_process_device {
bool bound; bool bound;
}; };
#define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd)
/* Process data */ /* Process data */
struct kfd_process { struct kfd_process {
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册