From: Oded Gabbay <oded.gabbay@amd.com>
To: dri-devel@lists.freedesktop.org, alexdeucher@gmail.com
Subject: [PATCH 5/9] drm/amdkfd: Add new VI-specific queue properties
Date: Thu, 8 Jan 2015 18:15:32 +0200 [thread overview]
Message-ID: <1420733736-13938-6-git-send-email-oded.gabbay@amd.com> (raw)
In-Reply-To: <1420733736-13938-1-git-send-email-oded.gabbay@amd.com>
From: Ben Goz <ben.goz@amd.com>
This patch adds new fields to the queue_properties structure. The new fields
are relevant only for queues running on AMD GPU VI architecture.
The eop_ring_buffer_address and eop_ring_buffer_size describe an
end-of-pipe queue which is assigned to the MQD. In CI, the EOP queue was per
pipeline and in VI it is per queue.
The ctx_save_restore_area_address and ctx_save_restore_area_size describe a
memory area that is designated to allow the CP to do context save/restore in
mid-wave state.
This patch also modifies the set_queue_properties_from_user() (called from
kfd_ioctl_create_queue()) to check and copy those new parameters.
Signed-off-by: Ben Goz <ben.goz@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 31 ++++++++++++++++++++++++++++++-
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 5 +++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 1d9a447..41108dd 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -149,6 +149,8 @@ static long kfd_ioctl_get_version(struct file *filep, struct kfd_process *p,
static int set_queue_properties_from_user(struct queue_properties *q_properties,
struct kfd_ioctl_create_queue_args *args)
{
+ void *tmp;
+
if (args->queue_percentage > KFD_MAX_QUEUE_PERCENTAGE) {
pr_err("kfd: queue percentage must be between 0 to KFD_MAX_QUEUE_PERCENTAGE\n");
return -EINVAL;
@@ -186,6 +188,20 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,
return -EFAULT;
}
+ tmp = (void *)(uintptr_t)args->eop_buffer_address;
+ if (tmp != NULL &&
+ !access_ok(VERIFY_WRITE, tmp, sizeof(uint32_t))) {
+ pr_debug("kfd: can't access eop buffer");
+ return -EFAULT;
+ }
+
+ tmp = (void *)(uintptr_t)args->ctx_save_restore_address;
+ if (tmp != NULL &&
+ !access_ok(VERIFY_WRITE, tmp, sizeof(uint32_t))) {
+ pr_debug("kfd: can't access ctx save restore buffer");
+ return -EFAULT;
+ }
+
q_properties->is_interop = false;
q_properties->queue_percent = args->queue_percentage;
q_properties->priority = args->queue_priority;
@@ -193,6 +209,11 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,
q_properties->queue_size = args->ring_size;
q_properties->read_ptr = (uint32_t *) args->read_pointer_address;
q_properties->write_ptr = (uint32_t *) args->write_pointer_address;
+ q_properties->eop_ring_buffer_address = args->eop_buffer_address;
+ q_properties->eop_ring_buffer_size = args->eop_buffer_size;
+ q_properties->ctx_save_restore_area_address =
+ args->ctx_save_restore_address;
+ q_properties->ctx_save_restore_area_size = args->ctx_save_restore_size;
if (args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE ||
args->queue_type == KFD_IOC_QUEUE_TYPE_COMPUTE_AQL)
q_properties->type = KFD_QUEUE_TYPE_COMPUTE;
@@ -224,6 +245,11 @@ static int set_queue_properties_from_user(struct queue_properties *q_properties,
pr_debug("Queue Format (%d)\n", q_properties->format);
+ pr_debug("Queue EOP (0x%llX)\n", q_properties->eop_ring_buffer_address);
+
+ pr_debug("Queue CTX save arex (0x%llX)\n",
+ q_properties->ctx_save_restore_area_address);
+
return 0;
}
@@ -248,9 +274,12 @@ static long kfd_ioctl_create_queue(struct file *filep, struct kfd_process *p,
if (err)
return err;
+ pr_debug("kfd: looking for gpu id 0x%x\n", args.gpu_id);
dev = kfd_device_by_id(args.gpu_id);
- if (dev == NULL)
+ if (dev == NULL) {
+ pr_debug("kfd: gpu id 0x%x was not found\n", args.gpu_id);
return -EINVAL;
+ }
mutex_lock(&p->mutex);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index a79c217..3ba34b7 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -299,6 +299,11 @@ struct queue_properties {
uint32_t sdma_engine_id;
uint32_t sdma_queue_id;
uint32_t sdma_vm_addr;
+ /* Relevant only for VI */
+ uint64_t eop_ring_buffer_address;
+ uint32_t eop_ring_buffer_size;
+ uint64_t ctx_save_restore_area_address;
+ uint32_t ctx_save_restore_area_size;
};
/**
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-01-08 16:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-08 16:15 [PATCH 0/9] drm/amdkfd: initial support for VI APU Oded Gabbay
2015-01-08 16:15 ` [PATCH 1/9] drm/radeon: Don't use relative paths in #include Oded Gabbay
2015-01-08 16:15 ` [PATCH 2/9] drm/amd: Put cik structures in a common place Oded Gabbay
2015-01-08 16:15 ` [PATCH 3/9] drm/radeon: Use new cik_structs.h file Oded Gabbay
2015-01-08 16:15 ` [PATCH 4/9] drm/amdkfd: Don't include header files from radeon Oded Gabbay
2015-01-08 16:15 ` Oded Gabbay [this message]
2015-01-08 16:15 ` [PATCH 6/9] drm/amdkfd: Make KFD_MQD_TYPE enum types H/W agnostic Oded Gabbay
2015-01-08 16:15 ` [PATCH 7/9] drm/amdkfd: Add asic property to kfd_device_info Oded Gabbay
2015-01-08 16:15 ` [PATCH 8/9] drm/amdkfd: Change MQD manager to be H/W specific Oded Gabbay
2015-01-08 16:15 ` [PATCH 9/9] MAINTAINERS: Update amdkfd files Oded Gabbay
2015-01-12 21:46 ` [PATCH 0/9] drm/amdkfd: initial support for VI APU 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=1420733736-13938-6-git-send-email-oded.gabbay@amd.com \
--to=oded.gabbay@amd.com \
--cc=alexdeucher@gmail.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