From: Oded Gabbay <oded.gabbay@amd.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 11/12] amdkfd: Instead of using get function, use container_of
Date: Fri, 21 Nov 2014 10:51:59 +0200 [thread overview]
Message-ID: <1416559920-7779-2-git-send-email-oded.gabbay@amd.com> (raw)
In-Reply-To: <1416559920-7779-1-git-send-email-oded.gabbay@amd.com>
From: Alexey Skidanov <Alexey.Skidanov@amd.com>
Signed-off-by: Alexey Skidanov <Alexey.Skidanov@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
---
.../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 21 +++++++++------------
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 ++
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
index bc8961c3..904eb38 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
@@ -67,26 +67,21 @@ static inline unsigned int get_pipes_num_cpsch(void)
return PIPE_PER_ME_CP_SCHEDULING;
}
-static unsigned int get_sh_mem_bases_nybble_64(struct kfd_process *process,
- struct kfd_dev *dev)
+static inline unsigned int
+get_sh_mem_bases_nybble_64(struct kfd_process_device *pdd)
{
- struct kfd_process_device *pdd;
uint32_t nybble;
- pdd = kfd_get_process_device_data(dev, process, 1);
nybble = (pdd->lds_base >> 60) & 0x0E;
return nybble;
}
-static unsigned int get_sh_mem_bases_32(struct kfd_process *process,
- struct kfd_dev *dev)
+static inline unsigned int get_sh_mem_bases_32(struct kfd_process_device *pdd)
{
- struct kfd_process_device *pdd;
unsigned int shared_base;
- pdd = kfd_get_process_device_data(dev, process, 1);
shared_base = (pdd->lds_base >> 16) & 0xFF;
return shared_base;
@@ -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,
struct qcm_process_device *qpd)
{
+ struct kfd_process_device *pdd;
unsigned int temp;
BUG_ON(!dqm || !qpd);
+ pdd = qpd_to_pdd(qpd);
+
/* check if sh_mem_config register already configured */
if (qpd->sh_mem_config == 0) {
qpd->sh_mem_config =
@@ -111,11 +109,11 @@ static void init_process_memory(struct device_queue_manager *dqm,
}
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_config |= PTR32;
} 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);
}
@@ -707,8 +705,7 @@ static int stop_cpsch(struct device_queue_manager *dqm)
destroy_queues_cpsch(dqm, true);
list_for_each_entry(node, &dqm->queues, list) {
- pdd = kfd_get_process_device_data(dqm->dev,
- node->qpd->pqm->process, 1);
+ pdd = qpd_to_pdd(node->qpd);
pdd->bound = false;
}
kfd2kgd->free_mem(dqm->dev->kgd,
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index d0bcafc..f9fb81e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -414,6 +414,8 @@ struct kfd_process_device {
bool bound;
};
+#define qpd_to_pdd(x) container_of(x, struct kfd_process_device, qpd)
+
/* Process data */
struct kfd_process {
/*
--
2.1.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-11-21 8:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-21 8:38 [PATCH 00/12] amdkfd fixes (sparse and some more) Oded Gabbay
2014-11-21 8:43 ` [PATCH 01/12] amdkfd: Fix sparse warnings in kfd_chardev.c Oded Gabbay
2014-11-21 8:43 ` [PATCH 02/12] amdkfd: Fix sparse warnings in kfd_topology.c Oded Gabbay
2014-11-21 8:47 ` [PATCH 03/12] amdkfd: test_kq() can be static Oded Gabbay
2014-11-21 8:47 ` [PATCH 04/12] amdkfd: pqm_get_kernel_queue() " Oded Gabbay
2014-11-21 8:47 ` [PATCH 05/12] amdkfd: Fix sparse warnings in kfd_flat_memory.c Oded Gabbay
2014-11-21 8:47 ` [PATCH 06/12] amdkfd: is_occupied() can be static Oded Gabbay
2014-11-21 8:47 ` [PATCH 07/12] amdkfd: fence_wait_timeout() " Oded Gabbay
2014-11-21 8:47 ` [PATCH 08/12] amdkfd: add __iomem attribute to doorbell_ptr Oded Gabbay
2014-11-21 8:49 ` [PATCH 09/12] amdkfd: Fix memory leak on process deregistration Oded Gabbay
2014-11-21 8:51 ` [PATCH 10/12] amdkfd: use schedule() in sync_with_hw Oded Gabbay
2014-11-21 8:51 ` Oded Gabbay [this message]
2014-11-21 8:52 ` [PATCH 12/12] amdkfd: Clear ctx cb before suspend Oded Gabbay
2014-11-21 15:06 ` [PATCH 00/12] amdkfd fixes (sparse and some more) Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416559920-7779-2-git-send-email-oded.gabbay@amd.com \
--to=oded.gabbay@amd.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox