Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2428399rwl; Sat, 1 Apr 2023 07:37:08 -0700 (PDT) X-Google-Smtp-Source: AKy350bO+47+inBAfBwhm0DNMFW5Khn70VQuClEvWAwE9tx4keAjGxFoyySJ6gGAhi2ZpNDL8JUX X-Received: by 2002:a17:902:ea0a:b0:19d:1a8e:836f with SMTP id s10-20020a170902ea0a00b0019d1a8e836fmr40717517plg.27.1680359828569; Sat, 01 Apr 2023 07:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680359828; cv=none; d=google.com; s=arc-20160816; b=dHhIKocAFlETj3UqQmu9vTRwKWj1OB2Q2rbG3PWxOrPHVT3uPn3BBJ8bkuAqfxWer6 ejNGTjDx/SlSLsYyUoPFcgRZANxZa/b6SM7YnYGx70kQmq5mdeoM58RcE2z+S3Klw6DZ 12Q2hsev0g047Q1SY07wNPA1dqVynk2+qm/GydNpsJu72NWnOV4HkHAw1SfcEvfqf1zn uTLrKztD9KJMeaUHWgMbYYPrP5XGkVpc9ndnbr1r4C4xoiIGclYz77BxI7RGMSSjoQfE 1KH+XsDzucWf2ObEBNQsAgAP3xunYM1sxtcmDQQZgWLSWd8UJI7SSjW3/7SECIpSmuuw Ag6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=hMrbsGp2VbSuKBP42mT23UvlOXpqHOgBiKJ7nTY4v2c=; b=VIqXdsm0YTWHSDs70ROQDt/GdrHZj8O7I0QHtCziNSmz4lZznvF8NTtjLst/qJh5rN v6GdAqY6AZTlXT/KVEBRPr4HtYN8n3dpnJpQWQepo9/UxwwdWNvL2lxnmFWQkg72xOVd JuMlFoDVJStrd5Le9jCTMHTbjSQafRtBDDreJVUYZ44udViRwsfl6eHVW25vQDmnkGB1 z2ZsxdSg92nadoQKtvusB0QIxcTj4sfG6qP6pC8DJD5NIhxYJrOJ3/bXJprTdMxSQZM+ v19S0UZvnydCAfygbng9Pfxzbyrktjoz4LwbipsZyoArFZso6hrIc100m1blzGUE2srg bt0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=GrRe12vS; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 207-20020a6307d8000000b0050bd9c7bc1bsi4786243pgh.30.2023.04.01.07.36.56; Sat, 01 Apr 2023 07:37:08 -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=GrRe12vS; 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 S229998AbjDAObt (ORCPT + 99 others); Sat, 1 Apr 2023 10:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjDAObs (ORCPT ); Sat, 1 Apr 2023 10:31:48 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C511AD27; Sat, 1 Apr 2023 07:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1680359504; 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: in-reply-to:in-reply-to:references:references; bh=hMrbsGp2VbSuKBP42mT23UvlOXpqHOgBiKJ7nTY4v2c=; b=GrRe12vSlJYlfUja0UIhZA/bhg+HyUD+h3ORFit2lWeN8k0evumUNlAmn/of32pQZkb8Iq OFFx6AUYaqh4qspAh+JrJ++/6jOjfefooPQ+0c+1fXJ+ftGKRMGaA4Ly24MPkHBZRk0V7j szECRpOr+X05RzncynymXdY1baUJAiU= Message-ID: <425c1b8ea20002c6344a574cd094b4c715c67ba6.camel@crapouillou.net> Subject: Re: [PATCH v2 0/3] usb: gadget: functionfs: DMABUF import interface From: Paul Cercueil To: Andrzej Pietrasiewicz , Greg Kroah-Hartman , Sumit Semwal , Christian =?ISO-8859-1?Q?K=F6nig?= 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 Date: Sat, 01 Apr 2023 16:31:42 +0200 In-Reply-To: References: <20230322092118.9213-1-paul@crapouillou.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andrzej, Le vendredi 31 mars 2023 =C3=A0 11:40 +0200, Andrzej Pietrasiewicz a =C3=A9= crit=C2=A0: > Hi Paul, >=20 > W dniu 22.03.2023 o=C2=A010:21, Paul Cercueil pisze: > > Hi, > >=20 > > This small patchset adds three new IOCTLs that can be used to > > attach, > > detach, or transfer from/to a DMABUF object. > >=20 > > Changes since v1: > > - patch [2/3] is new. I had to reuse a piece of code that was > > already > > =C2=A0=C2=A0 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 > > =C2=A0=C2=A0 eps_lock spinlock. The transfer function starts with the > > spinlock > > =C2=A0=C2=A0 unlocked, then locks it before allocating and queueing the= USB > > =C2=A0=C2=A0 transfer. > >=20 >=20 > 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/dd348137ce37153= 2fd952a2b249cfd96afaef7d1 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