From patchwork Thu Jul 10 21:53:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 4528571 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B3B69F37C for ; Thu, 10 Jul 2014 23:34:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F233201B4 for ; Thu, 10 Jul 2014 23:34:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 79937201D5 for ; Thu, 10 Jul 2014 23:34:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE90C6E788; Thu, 10 Jul 2014 16:33:24 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by gabe.freedesktop.org (Postfix) with ESMTP id 1D0B36E440 for ; Thu, 10 Jul 2014 14:55:31 -0700 (PDT) Received: by mail-wg0-f50.google.com with SMTP id n12so195225wgh.21 for ; Thu, 10 Jul 2014 14:55:31 -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=ZPwX2DEk4nHK6CIHX5SFgxmabigB8rKmlFgT7vigsnY=; b=DcWYs1lY6oxt34cxQujoMhIZVAwcODg2aSq9UV8ez3OUK20EdG/vB4uMgzeqKvCewm f1tpQs3DJRLfuYR1SpgHTSQRdGO2A4kHl+WLn5QYc/onnPeKNc8Kq6XSetFTn5gjbpR/ gnTOGwwk0cmBOwr+xwa2AdJV/tNWcWllqBAE9/9FlxiVoMkNktyQKSQE0T2LYAWP79Jv 1J6GPtuw81gzIzph2RfQbJdB5dj3snS8LkkBR0TOPpN+GLooBhZ2OpDFX+iiAJ7Q8LK3 5AJHEmtS669ev+4xE6cMb5A20ZZswVf8/CUqNoFWkNPYxhm8P1BdedHEH89yphBuN2uk Z/KQ== X-Received: by 10.180.188.50 with SMTP id fx18mr22683220wic.76.1405029330476; Thu, 10 Jul 2014 14:55:30 -0700 (PDT) Received: from localhost.localdomain ([77.127.59.49]) by mx.google.com with ESMTPSA id pq9sm831097wjc.35.2014.07.10.14.55.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Jul 2014 14:55:29 -0700 (PDT) From: Oded Gabbay X-Google-Original-From: Oded Gabbay To: David Airlie , Alex Deucher , Jerome Glisse Subject: [PATCH 42/83] hsa/radeon: 32-bit processes support Date: Fri, 11 Jul 2014 00:53:58 +0300 Message-Id: <1405029279-6894-14-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: Alexey Skidanov Initializing compat_ioctl properly. All ioctls args are packed. Signed-off-by: Alexey Skidanov Signed-off-by: Oded Gabbay --- drivers/gpu/hsa/radeon/kfd_chardev.c | 7 +++++-- drivers/gpu/hsa/radeon/kfd_priv.h | 4 ++++ include/uapi/linux/kfd_ioctl.h | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/hsa/radeon/kfd_chardev.c b/drivers/gpu/hsa/radeon/kfd_chardev.c index 75fe11f..e95d597 100644 --- a/drivers/gpu/hsa/radeon/kfd_chardev.c +++ b/drivers/gpu/hsa/radeon/kfd_chardev.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "kfd_priv.h" @@ -41,6 +42,7 @@ static const char kfd_dev_name[] = "kfd"; static const struct file_operations kfd_fops = { .owner = THIS_MODULE, .unlocked_ioctl = kfd_ioctl, + .compat_ioctl = kfd_ioctl, .open = kfd_open, .mmap = kfd_mmap, }; @@ -105,8 +107,9 @@ kfd_open(struct inode *inode, struct file *filep) process = radeon_kfd_create_process(current); if (IS_ERR(process)) return PTR_ERR(process); - - pr_debug("\nkfd: process %d opened dev/kfd", process->pasid); + process->is_32bit_user_mode = is_compat_task(); + dev_info(kfd_device, "process %d opened, compat mode (32 bit) - %d\n", + process->pasid, process->is_32bit_user_mode); return 0; } diff --git a/drivers/gpu/hsa/radeon/kfd_priv.h b/drivers/gpu/hsa/radeon/kfd_priv.h index 8b877ca..9d3b1fc 100644 --- a/drivers/gpu/hsa/radeon/kfd_priv.h +++ b/drivers/gpu/hsa/radeon/kfd_priv.h @@ -194,6 +194,10 @@ struct kfd_process { size_t queue_array_size; struct kfd_queue **queues; /* Size is queue_array_size, up to MAX_PROCESS_QUEUES. */ unsigned long allocated_queue_bitmap[DIV_ROUND_UP(MAX_PROCESS_QUEUES, BITS_PER_LONG)]; + + /*Is the user space process 32 bit?*/ + bool is_32bit_user_mode; + }; struct kfd_process *radeon_kfd_create_process(const struct task_struct *); diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h index 5b9517e..a7c3abd 100644 --- a/include/uapi/linux/kfd_ioctl.h +++ b/include/uapi/linux/kfd_ioctl.h @@ -29,7 +29,7 @@ #define KFD_IOCTL_CURRENT_VERSION 1 /* The 64-bit ABI is the authoritative version. */ -#pragma pack(push, 8) +#pragma pack(push, 1) struct kfd_ioctl_get_version_args { uint32_t min_supported_version; /* from KFD */