Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2701978ybt; Mon, 22 Jun 2020 05:05:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2MZ+RLmjg7FFZPSTVEWnV0jI20xztkaSO+8KcRg+ZXF1py/XToLF/462C10F9ElBHik4Z X-Received: by 2002:a17:906:365a:: with SMTP id r26mr15199526ejb.466.1592827545600; Mon, 22 Jun 2020 05:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592827545; cv=none; d=google.com; s=arc-20160816; b=bcQnrMbRm40SnvKelIkoQ2/Mok6HshaNAQmLCs2J0p8JkVuOAP8d5QrcDxGsNa0tlH 1yk5GhmsvHHrpt0FBueBDFQo3U6wP7I6IFm1VTKdhN+Le4HsOfGG83Lx6UBjBe7MiKuQ p+S/C24mtvvhf+B0X2OTTMz6wMjsF9e3FRjBR9LZjJbEhEvQiW3J6ZkS2da3MMSqvHYb uE+YGHuZAAudBZ9nqFeI6q1UoJEblgcUTHt67SoUhzSb1Z+VJPZJLiScIheWSEm0pedO 1m9DrRVH0qnpbWe8yc4xX7ITGnHbYYPa0jOFv4/kPjhmA/DWGWOGVarrOXfx8tZSG8u4 IzYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to :reply-to:from:date; bh=pxeRWJigxhTrdhDvfBqqkojoAIdiK09R4mVXR6TetC4=; b=GIcGbYHIWqujeJrxW9rnZy9rlpXyOLF2FLT8fpbIEKhU3ljA9i1pWYsSw4bLfSb9nq Qd+AzOYELjNOMiDB3uXRvCC20y21yuLuumXG8+F9MXwMpgMhn3yNsD2RHhv4Nd6c38Ce JHmYt/dSzp0MPfjTTF72dgOop5/5ViBnxrZjOgdyWO1g3VCGsol7ALBukXoIdyqKCu2o 8xy0FG2pEGWxELbgvfAyeBfHpqUVDWxs+Paht1D5bVAJAyDVgUy3WFmdXhQkif5EYcn8 r+mMmqL1Xo0leQvDnt+mWEWtQTMaB2g3tzpVMr1GE8pEgZsrSr2vOZP8xHRSSchwimMv kR2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb26si9376852edb.29.2020.06.22.05.05.22; Mon, 22 Jun 2020 05:05:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbgFVMBW (ORCPT + 99 others); Mon, 22 Jun 2020 08:01:22 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:44191 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727901AbgFVMBV (ORCPT ); Mon, 22 Jun 2020 08:01:21 -0400 Received: from oxbsgw05.schlund.de ([172.19.248.8]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1M1YpJ-1jqMCo0ArD-0033vK; Mon, 22 Jun 2020 14:01:13 +0200 Date: Mon, 22 Jun 2020 14:01:12 +0200 (CEST) From: Thomas Ruf Reply-To: Thomas Ruf To: Vinod Koul , Federico Vaga Cc: Dave Jiang , Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <419762761.402939.1592827272368@mailbusiness.ionos.de> In-Reply-To: <20200622044733.GB2324254@vkoul-mobl> References: <5614531.lOV4Wx5bFT@harkonnen> <20200621072457.GA2324254@vkoul-mobl> <20200621203634.y3tejmh6j4knf5iz@cwe-513-vol689.cern.ch> <20200622044733.GB2324254@vkoul-mobl> Subject: Re: DMA Engine: Transfer From Userspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Mailer: Open-Xchange Mailer v7.10.1-Rev31 X-Originating-Client: open-xchange-appsuite X-Provags-ID: V03:K1:vqrA2vYCx1uDKgThEtFbc6VetceM3TsFmqGIYceaPIpVSI5rnwV jzWDzPXiDwgkQcxT8pv7GNOBsNYxsO/aTbTl5MNduvTJdzN9E6ySMEGq9oulNx6DLewTTcv IbU4Es9KWA2nfkMVzCo7BgUNM53vUPbRVBWn7phzqGV5XbJ5InGXp3ohszv7FweaB3T5dOO f+WHDbV6ksaSSCy2OFiOQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:lTMpz7zt9FY=:e3CrO0pQcDG1ENDm9Agbim LwkiEWdidKgMtWnZDC8zwqgwno/NN/u8G3gEE20lZ5xSADOOVvtmlERnTktRfO5tyTYSmh8n7 Ci/bOL3IPq6DsCeABXLzgZmgztWYL4eweH5DAooRRW6OsJ3wRuaeoEUfkYW1ui1A/GTLBZODp Jx7u/j22nPeBWtglUP1HIpR8+a4EFa1/XNsoaH08duAM9TJPdMbuNRuHRKlMHK6zydC7pSBC+ rZQlQoCaBAmW3ssdjmE19Wm/34T83NC2B5klDwiyectWnyd8ePvTMi4TOxiEDo3QWopZB0P7j nhxRXY51XylKbKU2/97HJcNZFszNsZiX8Sf4asmlAY7eZLbAms/DPibtm/MnK4dHiacP3uPDY T28T6jQI3bL6c1fK40b732tQVaKVPgNIW2erI6FQb9jYN/EdAu1LhEej5ZjtXOHah7nYECNnH y/w0sJOyHKExCrLGfoa8cnYEsLRhVpDx5WwMG9N64aAjE8X3WUFgIABV41qfsPiHLeNSvLNs0 nln7TCGJaBomeqtuvUVU4DO4TRGzRBvrYK1JGwyv0ia21roRhM0AzEB9x0NVgklAy2PkOBTsz Pz5IDdqG4rTp1Ug4UImXvTwN9UL4J/7JB7YHryyuK30/yliYD9vNqnqPDE/aRFGoVjt1BJneS CRCHRXwb5aVF0B1w9JnBF49oiuc2wLveoUu15sNWEPzWAl86c8vN1a8SpZP2p8/ZfE/b+zgBt 4xbMXbOpOjgyQobS/RxjY8tXSBdJ5PY1jyz99Se/+HbRnUsgKQ3XYUZMm6bCa7P7Rr4xV/eQ+ HM4o8+RoiCUpmz+eX6bc97AQn4xtRY4jyu2Htz2tlcQUpPa7zM= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 22 June 2020 at 06:47 Vinod Koul wrote: > > On 21-06-20, 22:36, Federico Vaga wrote: > > On Sun, Jun 21, 2020 at 12:54:57PM +0530, Vinod Koul wrote: > > > On 19-06-20, 16:31, Dave Jiang wrote: > > > > > > > > > > > > On 6/19/2020 3:47 PM, Federico Vaga wrote: > > > > > Hello, > > > > > > > > > > is there the possibility of using a DMA engine channel from userspace? > > > > > > > > > > Something like: > > > > > - configure DMA using ioctl() (or whatever configuration mechanism) > > > > > - read() or write() to trigger the transfer > > > > > > > > > > > > > I may have supposedly promised Vinod to look into possibly providing > > > > something like this in the future. But I have not gotten around to do that > > > > yet. Currently, no such support. > > > > > > And I do still have serious reservations about this topic :) Opening up > > > userspace access to DMA does not sound very great from security point of > > > view. > > > > I was thinking about a dedicated module, and not something that the DMA engine > > offers directly. You load the module only if you need it (like the test module) > > But loading that module would expose dma to userspace. > > > > > Federico, what use case do you have in mind? > > > > Userspace drivers > > more the reason not do do so, why cant a kernel driver be added for your > usage? by chance i have written a driver allowing dma from user space using a memcpy like interface ;-) now i am trying to get this code upstream but was hit by the fact that DMA_SG is gone since Aug 2017 :-( just let me introduce myself and the project: - coding in C since '91 - coding in C++ since '98 - a lot of stuff not relevant for this ;-) - working as a freelancer since Nov '19 - implemented a "dma-sg-proxy" driver for my client in Mar/Apr '20 to copy camera frames from uncached memory to cached memory using a second dma on a Zynq platform - last week we figured out that we can not upgrade from "Xilinx 2019.2" (kernel 4.19.x) to "2020.1" (kernel 5.4.x) because the DMA_SG interface is gone - subscribed to dmaengine on friday, saw the start of this discussion on saturday - talked to my client today if it is ok to try to revive DMA_SG and get our driver upstream to avoid such problems in future here the struct for the ioctl: typedef struct { unsigned int struct_size; const void *src_user_ptr; void *dst_user_ptr; unsigned long length; unsigned int timeout_in_ms; } dma_sg_proxy_arg_t; best regards, Thomas