Message ID | 20230314105257.17345-1-paul@crapouillou.net (mailing list archive) |
---|---|
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1pc2Ho-00GcuB-ST; Tue, 14 Mar 2023 10:53:45 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbjCNKxl (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 14 Mar 2023 06:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbjCNKxf (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 14 Mar 2023 06:53:35 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A263E625; Tue, 14 Mar 2023 03:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1678791191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lWG+KFc/Ei6/o+9Wu4zuAiJ8/qhoZmSrQx365/6Oshk=; b=fUjwl/GTGcJeOfWYXXFY58YwTQ3Vq4QMsk3coead00trx0lcSAqYvNHlYUHM1jjAik9aEC e41Tc9t2VdvlK6F3/9913vt7NWs9yRmfxb9QXk+Ap583R8pZEVWs7vkah6OnQY1EIdjzFM hnjvZbaZk1hiQncj6By5PKHHSAkrNaE= From: Paul Cercueil <paul@crapouillou.net> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Sumit Semwal <sumit.semwal@linaro.org>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com> Cc: michael.hennerich@analog.com, nuno.sa@analog.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, Paul Cercueil <paul@crapouillou.net> Subject: [PATCH 0/2] usb: gadget: functionfs: DMABUF import interface Date: Tue, 14 Mar 2023 11:52:55 +0100 Message-Id: <20230314105257.17345-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
usb: gadget: functionfs: DMABUF import interface
|
|
Message
Paul Cercueil
March 14, 2023, 10:52 a.m. UTC
Hi, This small patchset adds three new IOCTLs that can be used to attach, detach, or transfer from/to a DMABUF object. This was surprisingly easy to add, as the functionfs code only uses scatterlists for transfers and allows specifying the number of bytes to transfer. The bulk of the code is then for general DMABUF accounting. The patchset isn't tagged RFC but comments are very welcome, there are some things I am not 100% sure about: ffs_dma_resv_lock (with no ww_acquire_ctx), and I'm using pr_debug which feels wrong. Also, I should probably add documentation? The current IOCTLs for functionfs were not documented, as far as I can tell. We use it with DMABUFs created with udmabuf, that we attach to the functionfs interface and to IIO devices (with a DMABUF interface for IIO, on its way to upstream too), to transfer samples from high-speed transceivers to USB in a zero-copy fashion. Cheers, -Paul Paul Cercueil (2): usb: gadget: Support already-mapped DMA SGs usb: gadget: functionfs: Add DMABUF import interface drivers/usb/gadget/function/f_fs.c | 398 ++++++++++++++++++++++++++++ drivers/usb/gadget/udc/core.c | 7 +- include/linux/usb/gadget.h | 2 + include/uapi/linux/usb/functionfs.h | 14 +- 4 files changed, 419 insertions(+), 2 deletions(-)
Comments
Am 14.03.23 um 11:52 schrieb Paul Cercueil: > Hi, > > This small patchset adds three new IOCTLs that can be used to attach, > detach, or transfer from/to a DMABUF object. > > This was surprisingly easy to add, as the functionfs code only uses > scatterlists for transfers and allows specifying the number of bytes to > transfer. The bulk of the code is then for general DMABUF accounting. > > The patchset isn't tagged RFC but comments are very welcome, there are > some things I am not 100% sure about: ffs_dma_resv_lock (with no > ww_acquire_ctx), That is perfectly fine as long as you only want to lock one dma_resv object. I've made a few notes what should be fixed and could potentially be improved, but from the DMA-buf side that looks like it should mostly work. Regards, Christian. > and I'm using pr_debug which feels wrong. Also, I > should probably add documentation? The current IOCTLs for functionfs > were not documented, as far as I can tell. > > We use it with DMABUFs created with udmabuf, that we attach to the > functionfs interface and to IIO devices (with a DMABUF interface for > IIO, on its way to upstream too), to transfer samples from high-speed > transceivers to USB in a zero-copy fashion. > > Cheers, > -Paul > > > Paul Cercueil (2): > usb: gadget: Support already-mapped DMA SGs > usb: gadget: functionfs: Add DMABUF import interface > > drivers/usb/gadget/function/f_fs.c | 398 ++++++++++++++++++++++++++++ > drivers/usb/gadget/udc/core.c | 7 +- > include/linux/usb/gadget.h | 2 + > include/uapi/linux/usb/functionfs.h | 14 +- > 4 files changed, 419 insertions(+), 2 deletions(-) >