From patchwork Thu Jul 10 21:54:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 4528681 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85D29BEEAA for ; Thu, 10 Jul 2014 23:34:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 558ED201D5 for ; Thu, 10 Jul 2014 23:34:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 10A52201F7 for ; Thu, 10 Jul 2014 23:34:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7D926E7B7; Thu, 10 Jul 2014 16:33:25 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com [74.125.82.49]) by gabe.freedesktop.org (Postfix) with ESMTP id B111E6E01B for ; Thu, 10 Jul 2014 14:56:27 -0700 (PDT) Received: by mail-wg0-f49.google.com with SMTP id a1so191923wgh.20 for ; Thu, 10 Jul 2014 14:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=buh9OO8Y0gC3nmNL1SDDx0KKy/3+6V3R0FqPdONR6nA=; b=U9GIPCsjRphZXJYP4qI5MTJ1ClGJu+JT5vUexhqCtoc3Ho3id0TkqVRVFhwHWNxoQ8 +0xJIU/HDwtxAfIiD1DJMCenDgUq1kTfUERwx8a5ksBxnnf/PqVEcuDupybAFtzyRnJ/ e/IdCDpdTre8d4RMqpTZjLqxk/JS8+MF8WghcECODx6b64WG4kP94j6bYfNkdl1CqIkC 6HuFeGYB9lXrlUXVx6JqJf5Bm2ZW4CGCN44aGBoDcDqc9/vScNU7iuiWWSXCgmXOoFxV rpPNU2WirNxVh15FqdNL2GA2LqcDc8M6fkwLkuzFi5+t6j2PNJTbGtTV0Uaqg/LOhssr kkaw== X-Received: by 10.194.161.136 with SMTP id xs8mr57774694wjb.31.1405029385586; Thu, 10 Jul 2014 14:56:25 -0700 (PDT) Received: from localhost.localdomain ([77.127.59.49]) by mx.google.com with ESMTPSA id pq9sm831097wjc.35.2014.07.10.14.56.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 14:56:25 -0700 (PDT) From: Oded Gabbay X-Google-Original-From: Oded Gabbay To: David Airlie , Alex Deucher , Jerome Glisse Subject: [PATCH 55/83] hsa/radeon: Add IOCTL for update queue Date: Fri, 11 Jul 2014 00:54:11 +0300 Message-Id: <1405029279-6894-27-git-send-email-oded.gabbay@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com> References: <1405029279-6894-1-git-send-email-oded.gabbay@amd.com> X-Mailman-Approved-At: Thu, 10 Jul 2014 16:33:12 -0700 Cc: Andrew Lewycky , Ben Goz , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Evgeny Pinchuk , Alexey Skidanov , linux-api@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Goz This patch adds a new IOCTL that enables the user to perform update to an HSA queue. Signed-off-by: Ben Goz Signed-off-by: Oded Gabbay --- drivers/gpu/hsa/radeon/cik_mqds.h | 1 - drivers/gpu/hsa/radeon/kfd_chardev.c | 29 ++++++++++++++++++++++ drivers/gpu/hsa/radeon/kfd_device_queue_manager.c | 1 - drivers/gpu/hsa/radeon/kfd_device_queue_manager.h | 1 - drivers/gpu/hsa/radeon/kfd_hw_pointer_store.c | 1 - drivers/gpu/hsa/radeon/kfd_hw_pointer_store.h | 1 - drivers/gpu/hsa/radeon/kfd_kernel_queue.c | 1 - drivers/gpu/hsa/radeon/kfd_kernel_queue.h | 1 - drivers/gpu/hsa/radeon/kfd_mqd_manager.c | 1 - drivers/gpu/hsa/radeon/kfd_mqd_manager.h | 1 - drivers/gpu/hsa/radeon/kfd_packet_manager.c | 23 ++++++++++++++--- drivers/gpu/hsa/radeon/kfd_process_queue_manager.c | 1 - drivers/gpu/hsa/radeon/kfd_queue.c | 1 - include/uapi/linux/kfd_ioctl.h | 9 +++++++ 14 files changed, 58 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/hsa/radeon/cik_mqds.h b/drivers/gpu/hsa/radeon/cik_mqds.h index 58945c8..35a35b4 100644 --- a/drivers/gpu/hsa/radeon/cik_mqds.h +++ b/drivers/gpu/hsa/radeon/cik_mqds.h @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #ifndef CIK_MQDS_H_ diff --git a/drivers/gpu/hsa/radeon/kfd_chardev.c b/drivers/gpu/hsa/radeon/kfd_chardev.c index bb2ef02..9a77332 100644 --- a/drivers/gpu/hsa/radeon/kfd_chardev.c +++ b/drivers/gpu/hsa/radeon/kfd_chardev.c @@ -230,6 +230,31 @@ kfd_ioctl_destroy_queue(struct file *filp, struct kfd_process *p, void __user *a return retval; } +static int +kfd_ioctl_update_queue(struct file *filp, struct kfd_process *p, void __user *arg) +{ + int retval; + struct kfd_ioctl_update_queue_args args; + struct queue_properties properties; + + if (copy_from_user(&args, arg, sizeof(args))) + return -EFAULT; + + properties.queue_address = args.ring_base_address; + properties.queue_size = args.ring_size; + properties.queue_percent = args.queue_percentage; + properties.priority = args.queue_priority; + + pr_debug("kfd: updating queue id %d for PASID %d\n", args.queue_id, p->pasid); + + mutex_lock(&p->mutex); + + retval = pqm_update_queue(&p->pqm, args.queue_id, &properties); + + mutex_unlock(&p->mutex); + + return retval; +} static long kfd_ioctl_set_memory_policy(struct file *filep, struct kfd_process *p, void __user *arg) @@ -398,6 +423,10 @@ kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg) err = kfd_ioctl_get_process_apertures(filep, process, (void __user *)arg); break; + case KFD_IOC_UPDATE_QUEUE: + err = kfd_ioctl_update_queue(filep, process, (void __user *)arg); + break; + default: dev_err(kfd_device, "unknown ioctl cmd 0x%x, arg 0x%lx)\n", diff --git a/drivers/gpu/hsa/radeon/kfd_device_queue_manager.c b/drivers/gpu/hsa/radeon/kfd_device_queue_manager.c index 9e21074..c2d91c9 100644 --- a/drivers/gpu/hsa/radeon/kfd_device_queue_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_device_queue_manager.c @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #include diff --git a/drivers/gpu/hsa/radeon/kfd_device_queue_manager.h b/drivers/gpu/hsa/radeon/kfd_device_queue_manager.h index 0529a96..fe9ef10 100644 --- a/drivers/gpu/hsa/radeon/kfd_device_queue_manager.h +++ b/drivers/gpu/hsa/radeon/kfd_device_queue_manager.h @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #ifndef DEVICE_QUEUE_MANAGER_H_ diff --git a/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.c b/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.c index 1372fb2..4e71f7d 100644 --- a/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.c +++ b/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.c @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #include diff --git a/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.h b/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.h index be1d6cb..f384b7f 100644 --- a/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.h +++ b/drivers/gpu/hsa/radeon/kfd_hw_pointer_store.h @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #ifndef HW_POINTER_STORE_H_ diff --git a/drivers/gpu/hsa/radeon/kfd_kernel_queue.c b/drivers/gpu/hsa/radeon/kfd_kernel_queue.c index 61f420f..aa64693e 100644 --- a/drivers/gpu/hsa/radeon/kfd_kernel_queue.c +++ b/drivers/gpu/hsa/radeon/kfd_kernel_queue.c @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #include diff --git a/drivers/gpu/hsa/radeon/kfd_kernel_queue.h b/drivers/gpu/hsa/radeon/kfd_kernel_queue.h index 339376c..963e861 100644 --- a/drivers/gpu/hsa/radeon/kfd_kernel_queue.h +++ b/drivers/gpu/hsa/radeon/kfd_kernel_queue.h @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #ifndef KERNEL_QUEUE_H_ diff --git a/drivers/gpu/hsa/radeon/kfd_mqd_manager.c b/drivers/gpu/hsa/radeon/kfd_mqd_manager.c index 14b248f..a3e9f7c 100644 --- a/drivers/gpu/hsa/radeon/kfd_mqd_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_mqd_manager.c @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #include diff --git a/drivers/gpu/hsa/radeon/kfd_mqd_manager.h b/drivers/gpu/hsa/radeon/kfd_mqd_manager.h index e7b39ee..8e7a5fd 100644 --- a/drivers/gpu/hsa/radeon/kfd_mqd_manager.h +++ b/drivers/gpu/hsa/radeon/kfd_mqd_manager.h @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #ifndef MQD_MANAGER_H_ diff --git a/drivers/gpu/hsa/radeon/kfd_packet_manager.c b/drivers/gpu/hsa/radeon/kfd_packet_manager.c index 4967b7c..3fc8c34 100644 --- a/drivers/gpu/hsa/radeon/kfd_packet_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_packet_manager.c @@ -1,9 +1,26 @@ /* - * packet_manager.c + * Copyright 2014 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Created on: Mar 16, 2014 - * Author: ben */ + #include #include #include "kfd_device_queue_manager.h" diff --git a/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c b/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c index 6e38ca4..fe74dd7 100644 --- a/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c +++ b/drivers/gpu/hsa/radeon/kfd_process_queue_manager.c @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #include diff --git a/drivers/gpu/hsa/radeon/kfd_queue.c b/drivers/gpu/hsa/radeon/kfd_queue.c index 78fe180..2d22cc1 100644 --- a/drivers/gpu/hsa/radeon/kfd_queue.c +++ b/drivers/gpu/hsa/radeon/kfd_queue.c @@ -19,7 +19,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * Author: Ben Goz */ #include diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h index 5134880..d58231d 100644 --- a/include/uapi/linux/kfd_ioctl.h +++ b/include/uapi/linux/kfd_ioctl.h @@ -58,6 +58,14 @@ struct kfd_ioctl_destroy_queue_args { uint32_t queue_id; /* to KFD */ }; +struct kfd_ioctl_update_queue_args { + uint32_t queue_id; /* to KFD */ + uint64_t ring_base_address; /* to KFD */ + uint32_t ring_size; /* to KFD */ + uint32_t queue_percentage; /* to KFD */ + uint32_t queue_priority; /* to KFD */ +}; + /* For kfd_ioctl_set_memory_policy_args.default_policy and alternate_policy */ #define KFD_IOC_CACHE_POLICY_COHERENT 0 #define KFD_IOC_CACHE_POLICY_NONCOHERENT 1 @@ -103,6 +111,7 @@ struct kfd_ioctl_get_process_apertures_args { #define KFD_IOC_SET_MEMORY_POLICY _IOW(KFD_IOC_MAGIC, 4, struct kfd_ioctl_set_memory_policy_args) #define KFD_IOC_GET_CLOCK_COUNTERS _IOWR(KFD_IOC_MAGIC, 5, struct kfd_ioctl_get_clock_counters_args) #define KFD_IOC_GET_PROCESS_APERTURES _IOR(KFD_IOC_MAGIC, 6, struct kfd_ioctl_get_process_apertures_args) +#define KFD_IOC_UPDATE_QUEUE _IOW(KFD_IOC_MAGIC, 7, struct kfd_ioctl_update_queue_args) #pragma pack(pop)