From patchwork Tue Jan 30 12:23:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 19668 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1180991dyb; Tue, 30 Jan 2024 04:24:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHs2kHVCt4Wh8l8311aFCTPxOjLnWvAVHjWO4SzbwHigEUUFBu75pU69ZHcDx78JN1kmtKm X-Received: by 2002:a17:906:33d1:b0:a35:a65a:d9da with SMTP id w17-20020a17090633d100b00a35a65ad9damr1380593eja.34.1706617457308; Tue, 30 Jan 2024 04:24:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706617457; cv=pass; d=google.com; s=arc-20160816; b=InQ4Uvrl4nHBb+JszCJIdkTVk/p+aiAAqQl/Ujo4iB84E1Ib6hRnSbc34M8TXdtBPT PQepQTnTEdLhSdu4A110hOhvg6EKi3UD1GahOFndtXFTMmsj5EHGBS8toB51DpD/qg2V xE00hDn58pqrgEY01as16aeR6343cwqamDjYiV70ndgPq4usSM2w/QpMc1fjm5vkEPD7 peYROqy5ExFSTvi/psLXQD3T0ZINBZq+pKW5KbAUa49+/YRwXpfVcVEwnVpn8zPcuTFL m0AWKtOnI6lnZ0EgZ69SFAF1DmNj/8JJcetmE7lM2x4U3K+r5MWYBneLlQU/239+tmrJ XOnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=+n8ItVGKEntF1q4atKJJA2NJbdTS+Zf0wFw3L1mGo3s=; fh=rOwklx3n4HddILOil3p/QTffAKooJ/gOk0lSkLfkcvQ=; b=tUfOJYL8OkOCzzBdBQ0x2jfGxw9ha/oAY7pt/tFITqfp1s5tu4KAoTpDaAUiNlNyZw C6t8ueS6mhSXwLVEdPEUFgcmrgMyoZD2sagTFOnVLI7PcDQjuvPxXmUQYOhW7T0qGJ92 +Pti2YtmA+SPrC5q2dtQ5ZGuQdt9yb9xiklq1W3fJWxI6MJXD30ZzntIIKY1v0DKeCl9 IT2i/+WwaYYEW0f+g4cRzHhK2cxP20+QdKycMyDYBH07pY0arNUnAfNkqij9usUmci5+ WLbdAPEeAxayE1OJyX4HvLy32riKEWCNPKrYE9fH4FbnavHTOZ2St75lU97rQssS4pO1 Wa+g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Lv6jdOaQ; arc=pass (i=1 spf=pass spfdomain=crapouillou.net dkim=pass dkdomain=crapouillou.net dmarc=pass fromdomain=crapouillou.net); spf=pass (google.com: domain of linux-kernel+bounces-44595-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44595-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m25-20020a17090607d900b00a348ae80ad4si4450121ejc.722.2024.01.30.04.24.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:24:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44595-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Lv6jdOaQ; arc=pass (i=1 spf=pass spfdomain=crapouillou.net dkim=pass dkdomain=crapouillou.net dmarc=pass fromdomain=crapouillou.net); spf=pass (google.com: domain of linux-kernel+bounces-44595-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44595-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E75201F20F47 for ; Tue, 30 Jan 2024 12:24:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36E9B6A320; Tue, 30 Jan 2024 12:23:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b="Lv6jdOaQ" Received: from aposti.net (aposti.net [89.234.176.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA9FE67E78; Tue, 30 Jan 2024 12:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.234.176.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706617431; cv=none; b=h6regi1/XPvrPhPPJpCOvturimTqch0OgD64dZykkyufOvGrDtKKLcnzd50ddUkoLparghLcxPt9AGlrlKpW/MHld67h4+fk01QsvjWIhWJFALVIp6YaaVJuNfYMMWLuwWJ+wQPAeA5iB7tpD3dPgHm9nWfMkv4GfU6nm2X7Qdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706617431; c=relaxed/simple; bh=ZDNJjmcuzyAag0Kxso0ulWjGOYHJ6K6MtOrAMvsl3KI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=X8vSA6nCya1w4nZ83U/Hbm1pkgIhacHrWuytUvtt5K/9XGkTuuX0LudEzaR3wm1r7IUZdLRVx8ObQv2cXI56m3S3+NT6jibBQWIMX4jWnNePgsLp24dT3V6K5KHYetdAkniI17IbkQAKD/RWUV3aRbOSfU+C8o/Igi6Qsexx5P8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crapouillou.net; spf=pass smtp.mailfrom=crapouillou.net; dkim=pass (1024-bit key) header.d=crapouillou.net header.i=@crapouillou.net header.b=Lv6jdOaQ; arc=none smtp.client-ip=89.234.176.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=crapouillou.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=crapouillou.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1706617427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=+n8ItVGKEntF1q4atKJJA2NJbdTS+Zf0wFw3L1mGo3s=; b=Lv6jdOaQdchyQWN4DHxAvoCnvj0/mzDrE8k+Dr5pJcsLTiEG+reSL3O6QPCwhLeaDszKCu cRzpOCW4TQFqmEXaAJ1pHsu1AjJNjx6+Ip6LyAVCeCT9jhrt/vkvzf4TFcfPZVANebtntU EjtFP7R0OwxikAVSeQNnRvnGl431PHg= From: Paul Cercueil To: Greg Kroah-Hartman , Jonathan Corbet , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= Cc: =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Michael Hennerich , linux-usb@vger.kernel.org, linux-doc@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 Subject: [PATCH v6 0/4] usb: gadget: functionfs: DMABUF import interface Date: Tue, 30 Jan 2024 13:23:36 +0100 Message-ID: <20240130122340.54813-1-paul@crapouillou.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789518106868987532 X-GMAIL-MSGID: 1789518106868987532 Hi, This is the v6 of my patchset that adds a new DMABUF import interface to FunctionFS. Given that the cache coherency issue that has been discussed after my v5 is a tangential problem and not directly related to this new interface, I decided to drop the dma_buf_begin/end_access() functions for now - but I'm open to the idea of re-introducing them in a subsequent patchset. The patchset was rebased on next-20240129. Cheers, -Paul --- Changelog: * Drop v5's patches [1/6] and [2/6]. * [3/4]: - Drop use of dma_buf_begin/end_access(). We now make the assumption that the devices attached to the DMABUFs must be coherent between themselves. The cache coherency issue is a tangential problem, and those functions can be re-introduced in a subsequent patchset. - Unqueue pending requests on detach. Otherwise, when closing the data endpoint the DMABUF will never be signaled. - Use list_for_each_entry_safe() in ffs_dmabuf_detach(), because there is a list_del() in there. - use pr_vdebug() instead of pr_debug() - Rename ffs_dmabuf_unmap_work() -> ffs_dmabuf_cleanup() --- Paul Cercueil (4): usb: gadget: Support already-mapped DMA SGs usb: gadget: functionfs: Factorize wait-for-endpoint code usb: gadget: functionfs: Add DMABUF import interface Documentation: usb: Document FunctionFS DMABUF API Documentation/usb/functionfs.rst | 36 ++ drivers/usb/gadget/Kconfig | 1 + drivers/usb/gadget/function/f_fs.c | 513 ++++++++++++++++++++++++++-- drivers/usb/gadget/udc/core.c | 7 +- include/linux/usb/gadget.h | 2 + include/uapi/linux/usb/functionfs.h | 41 +++ 6 files changed, 579 insertions(+), 21 deletions(-)