Message ID | 20230322092118.9213-1-paul@crapouillou.net |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2248626wrt; Wed, 22 Mar 2023 02:48:18 -0700 (PDT) X-Google-Smtp-Source: AK7set986tMz4n40p7BtBRpUybrN9EU+8uqaqplBXfb015oQjG2DeFwbiYIQ6l1ZuoU0Q8wbpiK9 X-Received: by 2002:a17:906:f101:b0:932:748b:196e with SMTP id gv1-20020a170906f10100b00932748b196emr6341865ejb.45.1679478498129; Wed, 22 Mar 2023 02:48:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478498; cv=none; d=google.com; s=arc-20160816; b=jcYbKK1aOsLqSEVxuaCyouJtYI+uM1I/tiXVfn2nRUlZ4ii5ps58bl7eDW24R6fWVZ LKT+5xbk80OyoMZ6SUAMKJkd7rZ7etmiVdgLEw8YOB4vCuVYdUs2q9zMdkim8FhTXGGw eVrDGuFBuhQEOXat19zxCNUQ7J6BrSDyxfS0Ta1Q9XxkZj175fmlbnWc0FGcP1NbdtFl fcDYe9zuyIMgjJHAdtnN+wZtVn9Vp9cqPTRoGuBa4spG4t74712qdkRA3o4m3Ylk9JIT ioix4uVdc9xas5Llx0155AnToHnvRHhtjwfnTDYjJtlWOQXO5tZzP/DfGtB+0ypJbZYs 2L+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=tmRlYhR2FZnlnQJCWKDJjWOgiCSSl9pc0u4cFJUJ650=; b=DS/Gr68DZUNGT0QrIjKNLWLFhRdV4WxoWuxm269f+5LvLf19wVBaGaGWq1q/9lpcaR YTvnbFgRFj+isQXGMGpvEO2jPxJ33wzYPX79YgTWtDJLvdJH8seOyZj7HgOL2auGtJL9 q310Gi0J6mnWXS9m5iSkSjpbv/LtVEjEB2psdL0lKLAXyT5UaJQSPKx1p8xm69C1/HsV tm0HjhE6I9t8HDssN+TL8te60X21hbQMVmdDtgYeN9NUIgnADXPj/rmcal4R4z58a1j6 VBgwN7YrE1h14bh9UfemPEwuBXVZhWhrRsXaWQoWrL8dwu90PR92Kbs8NmG2+5YFw8If RUFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=N+K9gfMW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wb9-20020a170907d50900b00939393bd26asi5792392ejc.835.2023.03.22.02.47.54; Wed, 22 Mar 2023 02:48:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=N+K9gfMW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230462AbjCVJg0 (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Wed, 22 Mar 2023 05:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbjCVJgX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Mar 2023 05:36:23 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7251E5F529; Wed, 22 Mar 2023 02:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1679476886; 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=tmRlYhR2FZnlnQJCWKDJjWOgiCSSl9pc0u4cFJUJ650=; b=N+K9gfMWBsR4tD4u3Hl8NNLbTta8iPSN0ERcGscwa47kxMOGN0UFmiTqCEo0xcvmKjCd74 5QKS+X1c2izruTxdi+aR2/bxOzM5vWFMvFs5pp/4TwXtEn6OYJKWv7KKZgoXYHILsy+BHa 2AW0NIB2KkWH3t1e96o1srWamY7k2XM= 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 v2 0/3] usb: gadget: functionfs: DMABUF import interface Date: Wed, 22 Mar 2023 10:21:15 +0100 Message-Id: <20230322092118.9213-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761060845815666013?= X-GMAIL-MSGID: =?utf-8?q?1761060845815666013?= |
Series |
usb: gadget: functionfs: DMABUF import interface
|
|
Message
Paul Cercueil
March 22, 2023, 9:21 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. Changes since v1: - patch [2/3] is new. I had to reuse a piece of code that was already duplicated in the driver, so I factorized the code. - Make ffs_dma_resv_lock() static - Add MODULE_IMPORT_NS(DMA_BUF); - The attach/detach functions are now performed without locking the eps_lock spinlock. The transfer function starts with the spinlock unlocked, then locks it before allocating and queueing the USB transfer. Cheers, -Paul Paul Cercueil (3): usb: gadget: Support already-mapped DMA SGs usb: gadget: functionfs: Factorize wait-for-endpoint code usb: gadget: functionfs: Add DMABUF import interface drivers/usb/gadget/function/f_fs.c | 467 ++++++++++++++++++++++++++-- drivers/usb/gadget/udc/core.c | 7 +- include/linux/usb/gadget.h | 2 + include/uapi/linux/usb/functionfs.h | 14 +- 4 files changed, 468 insertions(+), 22 deletions(-)
Comments
Hi Paul, W dniu 22.03.2023 o 10:21, Paul Cercueil pisze: > Hi, > > This small patchset adds three new IOCTLs that can be used to attach, > detach, or transfer from/to a DMABUF object. > > Changes since v1: > - patch [2/3] is new. I had to reuse a piece of code that was already > duplicated in the driver, so I factorized the code. > - Make ffs_dma_resv_lock() static > - Add MODULE_IMPORT_NS(DMA_BUF); > - The attach/detach functions are now performed without locking the > eps_lock spinlock. The transfer function starts with the spinlock > unlocked, then locks it before allocating and queueing the USB > transfer. > Can you share an example use case for these new features? Is there a userspace that excercises the new ioctls? Regards, Andrzej
Hi Andrzej, Le vendredi 31 mars 2023 à 11:40 +0200, Andrzej Pietrasiewicz a écrit : > Hi Paul, > > W dniu 22.03.2023 o 10:21, Paul Cercueil pisze: > > Hi, > > > > This small patchset adds three new IOCTLs that can be used to > > attach, > > detach, or transfer from/to a DMABUF object. > > > > Changes since v1: > > - patch [2/3] is new. I had to reuse a piece of code that was > > already > > duplicated in the driver, so I factorized the code. > > - Make ffs_dma_resv_lock() static > > - Add MODULE_IMPORT_NS(DMA_BUF); > > - The attach/detach functions are now performed without locking the > > eps_lock spinlock. The transfer function starts with the > > spinlock > > unlocked, then locks it before allocating and queueing the USB > > transfer. > > > > Can you share an example use case for these new features? > Is there a userspace that excercises the new ioctls? We use it at Analog Devices to share buffers between the IIO subsystem and the USB stack, which makes it possible to stream data samples between a host computer and high-speed transceivers as fast as possible, in a zero-copy fashion. This will be used by Libiio: https://github.com/analogdevicesinc/libiio/pull/928/commits/dd348137ce371532fd952a2b249cfd96afaef7d1 The code that uses these IOCTLs is not yet merged to the "master" branch, but will be as soon as this patchset is accepted. Cheers, -Paul