From patchwork Sat Feb 23 20:28:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyun Kwon X-Patchwork-Id: 10827611 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AFD61399 for ; Sat, 23 Feb 2019 20:30:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 392682C857 for ; Sat, 23 Feb 2019 20:30:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2D4692C878; Sat, 23 Feb 2019 20:30:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAC9F2C85C for ; Sat, 23 Feb 2019 20:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726621AbfBWUah (ORCPT ); Sat, 23 Feb 2019 15:30:37 -0500 Received: from mail-eopbgr720061.outbound.protection.outlook.com ([40.107.72.61]:32662 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726125AbfBWUag (ORCPT ); Sat, 23 Feb 2019 15:30:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gSzeeC+6wwQQir1GUZg/NZYmgto3lAEWG9HR/Yg8dis=; b=5fSDOWAtg2iXyqCc119HCGAiL2KR1VmO2/uRXvKm9b4itckgGkuwIXOqrqvihN6Hf4ttIoUfSZbJBg4BueIodDYJsq3AwrovQmJxFm2iCkJAjPw1f3S3nNhV1dlF5f4XLUEyL3vlYCvQG3XFqRMntLXeHdhKyL+A32kPIGf5S+g= Received: from CY4PR02CA0002.namprd02.prod.outlook.com (2603:10b6:903:18::12) by DM2PR02MB1306.namprd02.prod.outlook.com (2a01:111:e400:50c8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.19; Sat, 23 Feb 2019 20:30:32 +0000 Received: from SN1NAM02FT014.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::200) by CY4PR02CA0002.outlook.office365.com (2603:10b6:903:18::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1643.16 via Frontend Transport; Sat, 23 Feb 2019 20:30:32 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT014.mail.protection.outlook.com (10.152.72.106) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.1643.11 via Frontend Transport; Sat, 23 Feb 2019 20:30:31 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:60973 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1gxdwM-00009p-RR; Sat, 23 Feb 2019 12:30:30 -0800 Received: from [127.0.0.1] (helo=xsj-smtp-dlp2.xlnx.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gxdwH-0002w8-Jz; Sat, 23 Feb 2019 12:30:25 -0800 Received: from xsj-pvapsmtp01 (mailhub.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id x1NKUOmL014447; Sat, 23 Feb 2019 12:30:24 -0800 Received: from [172.19.2.244] (helo=xsjhyunkubuntu) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1gxdwG-0002vl-Ar; Sat, 23 Feb 2019 12:30:24 -0800 Received: by xsjhyunkubuntu (Postfix, from userid 13638) id 75B5C2C7382; Sat, 23 Feb 2019 12:28:41 -0800 (PST) From: Hyun Kwon To: Greg Kroah-Hartman , CC: Michal Simek , , , Cyril Chemparathy , Jiaying Liang , Sonal Santan , Stefano Stabellini , , Sumit Semwal , , Hyun Kwon Subject: [PATCH RFC 0/1] uio: Add dmabuf import ioctl Date: Sat, 23 Feb 2019 12:28:16 -0800 Message-ID: <1550953697-7288-1-git-send-email-hyun.kwon@xilinx.com> X-Mailer: git-send-email 2.7.4 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(136003)(39860400002)(396003)(346002)(376002)(2980300002)(189003)(199004)(6306002)(48376002)(8936002)(36756003)(6266002)(16586007)(5660300002)(52956003)(42186006)(356004)(6666004)(8676002)(54906003)(50226002)(81156014)(107886003)(103686004)(2906002)(14444005)(305945005)(81166006)(316002)(50466002)(110136005)(4326008)(44832011)(426003)(63266004)(90966002)(106002)(966005)(486006)(2616005)(478600001)(476003)(106466001)(51416003)(126002)(26005)(47776003)(186003)(336012)(107986001)(5001870100001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR02MB1306;H:xsj-pvapsmtpgw02;FPR:;SPF:Pass;LANG:en;PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com;MX:1;A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 123df9b8-0c77-4fbb-4315-08d699cdc1b5 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605104)(4608103)(4709054)(2017052603328)(7153060);SRVR:DM2PR02MB1306; X-MS-TrafficTypeDiagnostic: DM2PR02MB1306: X-MS-Exchange-PUrlCount: 1 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Exchange-Diagnostics: 1;DM2PR02MB1306;20:0pHNo50Oo6KfAkpYbknx/HmedrP+yoBjT0ydEMFHVrmDptfdFbTyNF6MnZRMd3D/U58/O0ML2MnghR7Oio4ivXokO3TOVEfeAyycuD/lu4qHLAEIyUIuDUzylz1o7VRPt7esgCbVO6wxKpS9a3cgaUpzCO/NyKN5Kjcw/eD5Sc89Ck0CML1TPRpayQvEU2ECogDkMCGqcpmbGeM/XpEQNl4vtRQLO7AJJVNrpC2aD41Ah9PS6zlLohvHZfYJ9a4n8bTK4tiu+5VU6bnXwl1iiB/87E/y6srK8U7qJKtrCtQBfnIKqreBvrK7Gd8leKAkU1D72jB9kIJfG1f9rjZmFyUYHeBmMrM3M+YL+t8cwhHs55v0h/wet1hpFMVt9vtgxl38TTzGLv3kXlssDXipBjF7TuppSSKjWFpetudOdX7WuOEQREDE1yrBIq9OQBKziosoYf3dhBlZSP1bsLY2CIkeI+2brmGllAtPgls8XgP6w5Vu9hjW7gRIgtu9zpxu X-Microsoft-Antispam-PRVS: X-Forefront-PRVS: 0957AD37A0 X-Microsoft-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GSezJUiNrJdynMfIaUOMaU2CJckWjBJeCFe2fh/M91XDgGy3a8JKIi75aeVJQ+wZn2nPoc/qrK0396OhfFbTAs2lqnQdETs72pVeJMTpukThcztfiyJ4hxa0oEMQUw== X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: M14tFwuAc8GNSQixj+8P1J+H4Scy7fIHDAI7P5TCz0AKCvLIQBSmZGp0RLBYQTPXOihxgXidrhGMfltBwkyXVEACRlY+B10tS6UG+/XkPRdfzwuQkNV/q3wdAjhaSqY78XrKuiLHHAiNqxFQRkoqqSRm2jrVYCB0EnuLJ7fxSrHvtPBrv2Eew0YlVHLf+GckTfc1BqVm6fP8S9f7NxnxTiiGYB6irGzmpG1LoKESgNwa9W81xiQYMhxnl6jAuQOdnpdIsDhfFiMdEfos2etO98c6OuOjgfafiTICMwmlm5aOlGO6giM76fT21jse162kauQGFrH4kOkKizWXotxadWK6+k7E95mAACkFmNsOX+LjCdR2RZMmwMwuvc3rRKPcO901YFma3CHkc/GHhYupETfoELtEosw2HQbjqpeKk1w= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2019 20:30:31.3298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 123df9b8-0c77-4fbb-4315-08d699cdc1b5 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.100];Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR02MB1306 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, I'm looking to enable platform independent device driver stacks on Linux. Currently, I have some driver built on top of Linux UIO [1], and possibly there can be more of such drivers: ex, soft IP drivers programmed on FPGA. Some device includes data movers such as DMA, and that requires some mechanism to import external buffers and program the data movers from user space. Thus this patch set adds a couple of ioctls to import the dmabuf and return required information back to user. This allows the user drivers to use dmabuf compatible external buffers: ex, it's tested with ION allocator. I'd like to understand if this is right approach which can be used to develop the user space software stacks further, especially because - adding new ioctls to generic uio - security concerns from exposing low level information: dma addr For example, vfio isn't option as iommu may not be available for all such devices on all platforms. So any feedback to move forward would be appreciated. Thanks, -hyun [1] https://patchwork.kernel.org/patch/10774761/ Hyun Kwon (1): uio: Add dma-buf import ioctls drivers/uio/Makefile | 2 +- drivers/uio/uio.c | 43 +++++++++ drivers/uio/uio_dmabuf.c | 210 +++++++++++++++++++++++++++++++++++++++++++ drivers/uio/uio_dmabuf.h | 26 ++++++ include/uapi/linux/uio/uio.h | 33 +++++++ 5 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 drivers/uio/uio_dmabuf.c create mode 100644 drivers/uio/uio_dmabuf.h create mode 100644 include/uapi/linux/uio/uio.h