From patchwork Tue Mar 14 10:52:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 13174047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34F42C6FD1D for ; Tue, 14 Mar 2023 10:53:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3480310E772; Tue, 14 Mar 2023 10:53:15 +0000 (UTC) Received: from aposti.net (aposti.net [89.234.176.197]) by gabe.freedesktop.org (Postfix) with ESMTPS id B85D210E771 for ; Tue, 14 Mar 2023 10:53:13 +0000 (UTC) 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 To: Greg Kroah-Hartman , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= 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 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Cercueil , michael.hennerich@analog.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, nuno.sa@analog.com, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-)