Article View: linux.kernel.netdev
Article #22713Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type
From: Jason Gunthorpe
Date: Wed, 25 Nov 2026 19:07
Date: Wed, 25 Nov 2026 19:07
86 lines
16047 bytes
16047 bytes
On Wed, Nov 25, 2026 at 07:17:51PM +0100, Christian König wrote: > On 11/25/26 16:55, Jason Gunthorpe wrote: > > On Wed, Nov 25, 2026 at 12:19:08PM +0100, Christian König wrote: > >> The low level API which talks for example to the IOMMU driver for > >> creating the information how to access the buffer is simply not the > >> task at hand for that framework. The stuff we already handle is more > >> than complicated enough. > > > > No matter what name you give it we need something in the middle that > > can see the phys_addr_t and the iommu_domain.. > > No, absolutely not. That should be given to the exporter so that the > exporter can call the DMA API to create the DMA addresses for the > importer. I think I've said it many times, and I thought you agreed: NAK to giving GPU exporter drivers an iommu domain. > The idea here is that the importer give all the information to the > exporter so that the exporter can do the mapping on behalves of the > importer. No GPU driver must touch these internal details, they must only use standard abstracted APIs that prevent them from abusing things. My fear of DRM drivers abusing the DMA process is equal and possibly greater than your fear of phys_addr_t :P We are not giving DRM a nightmare API to continue to shoot us in the foot with. > > The primary issue here is the exporter *direct* call to the DMA API! > > Why? Because we need things to be mapped in ways the DMA API will never support. DMA API will never support something like dma_buf_iommu_map(). I have no idea at all how you expect to build this if exporters are directly calling DMA API. It is not possible. > > We cannot disconnect this from the DMA API, ie to use an iommu domain > > or ualink, if exporting drivers are hardwiring calls into it. > > Well the plan is to not disconnect it at all. The exporting drivers > just says to the underlying API here is my buffer please map that > for this importer and that result is then given back to the importer > through the DMA API again. DMA API will only do basic PCI DMA mappings into dma_addr_t. It will never handle iommu_domain, it will never handle ualink/etc. Give us a plan for those if you don't like any of these ideas. > > Fundamentally the need is for the driver to get the phys_addr list, > > exactly like today, and then pass it to an op which formats that into > > the right data structure for the importer. Be it dma_addr[], > > iommu_domain, or some ualink_addr[] - or whatever. > > No, the phys_addr type should only ever been seen by the DMA API and > not by DMA-buf. Again, I don't care how you label things or what "library" they live in, I can't tell if we are nitpicking names or what. But there needs to be some kind of abstraction that takes in phys_addr_t and makes sgt, dma_addr_t, or iommu_domain depending on what the importer needs. Exporters must not open code that. Obviously DMABUF is involved here *somehow* since it is the only thing that knows an importer even exists. Would you be happy if we made a 'dma mapping for dmabuf' library that did all of this and DMABUF just passes its type opaquely and drivers just call its tightly abstracted functions? That is the component Alistair is proposing, he just prefixed it with dmabuf_* as the namespace because, lets be honest, only dmabuf needs this weird looking thing. Jason
Technical Details
Message-ID:
<20261125190705.GN246011@ziepe.ca>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371601-linux-kernel-netdev=dewy.ruReferences:
<7ac7edd0-5c38-440a-b26a-21bcbb6f4702@amd.com> <awT8prWsj11TBdmP@nvdebian.thelocal> <63eb7b6e-e0a8-4443-a434-0301ed59beae@amd.com> <20261124142032.GN9566@ziepe.ca> <7a5a2d3a-e42e-4dc0-8d22-8dd1bd249501@amd.com> <20261124194618.GC114530@ziepe.ca> <awZ_Os1pXelOGaFP@nvdebian.thelocal> <fb9a6b12-c134-4e40-86a5-dbcb59c0b91b@amd.com> <20261125155559.GL246011@ziepe.ca> <5fb8bb60-7d9f-49b1-899c-40a890fdc14b@amd.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371601-linux-kernel-netdev=dewy.ru
From: jgg@ziepe.ca (Jason Gunthorpe)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type
Date: Wed, 25 Nov 2026 15:07:05 -0400
Organization: Usenet Network
Message-ID: <20261125190705.GN246011@ziepe.ca>
References: <7ac7edd0-5c38-440a-b26a-21bcbb6f4702@amd.com>
<awT8prWsj11TBdmP@nvdebian.thelocal>
<63eb7b6e-e0a8-4443-a434-0301ed59beae@amd.com>
<20261124142032.GN9566@ziepe.ca>
<7a5a2d3a-e42e-4dc0-8d22-8dd1bd249501@amd.com>
<20261124194618.GC114530@ziepe.ca>
<awZ_Os1pXelOGaFP@nvdebian.thelocal>
<fb9a6b12-c134-4e40-86a5-dbcb59c0b91b@amd.com>
<20261125155559.GL246011@ziepe.ca>
<5fb8bb60-7d9f-49b1-899c-40a890fdc14b@amd.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="281587"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:goxVKRnud728cUwW4z6Y6HR3Tew= sha256:G/aEbHkUAhpVdD9uR+jlWbnXPWURtXG7y6TLhTriXAM=
sha1:tspdAnJ12KG3fieFMGNnBiZYQSw= sha256:Dd1wE3TcjGP/jKyBrE4KdSDOvUi5mu49rwg7hsYh6mA=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 8570A125E95; Wed, 25 Nov 2026 22:07:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.95
X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=ziepe.ca
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id ygbTW9hZHuSc;
Wed, 25 Nov 2026 22:07:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371601-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=ziepe.ca
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id E80E8125E8F; Wed, 25 Nov 2026 22:07:17 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id BD36A65A2E; Wed, 25 Nov 2026 19:07:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795633634;
b=YcuvHbFhXteaI9VseoyyM8olyke6/SuZ32Fk0h358PPSWWXA+T3IJH3L5zTSXnqBoCz6
YozPG1vVf1RQLYh6WDxCIicz3mYCA7CWgVPLiJKqhndVzyRKEN8FG7HF8IlrCUHTamBDN
cX1VXygjo06QvR6rPBxQzM1KuhVGrlG8XpdqkzO8RauOdu/wbZLRHa83pKpFwQflmvcMn
PbFq6Os+UNmgqKelnRIn6kqStUFOg7zPmlGJnSWWpVOTG1LWDHA2XtQlpU3dD1UfPUyQD
+ZeRyC++F2YeF6uynCmoFxhbmilX0172pgYyNzblzDpDS2sHL+kKFPIsafhr6DGhBvQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795633634;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Received:Date:From:To:Cc:Subject:
Message-ID:References:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Type:Content-Disposition:Content-Transfer-Encoding:
In-Reply-To;
bh=JisVSgs385NGuntA6erRX4QYHX+VR40SrOV715tgnK0=;
b=NPIOGJ2wKm1ob5TpwXoHDLai0bbS6kgbCeq8Y6C4gA6jNlMYUrODbDvc0lLeQo9W9oyW
QG97wuXeJxYLgm2bNSTsYw9S5leUuGb/0dtBHlddYv6I0VyZjW51zJdMB3eUOKCRXwMlQ
SOpfZuQeNnaYUn6kTrXHf3fmkvQgdNoIAI4WEegDckifoOtTxwbs4FVqEmX9NuUIM/qlf
+DAXXwsTEMlSa+3vedUtDnrrthj7lkP8iGSKp08uZexAX1ukSFqKUgxa+AWL7m7GN9XEl
eJv2h1QyeWe2M1XUTEAIaA2zFscHHq5hI0W6UkOvL6BXMpadhrXnyPdm4TlTxqJIoag==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=FcYwuSIU;
dmarc=none header.from=ziepe.ca;
spf=pass smtp.mailfrom=ziepe.ca;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 78214606A330;
Wed, 25 Nov 2026 19:07:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=FcYwuSIU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.182
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795633628;
b=AIZ0bo5PYYYyuAsDGy2+VGQ8xF8TKYj+HjnkI10ZfA2pyPrnXbXrCxjFyzcM9G+i05Gy
TPlAVMOJ4yBM41AmmnwJyc4K8Dx/bQgYW+GytY3QTI9dUUqVptT93A59ppCj2HyRnPekD
ei8iDWm8fEbK9u13b+gZIpxwPMYOUV4Q15/3nGMyvfO/ptnwyTy1YruxRoFMwBJrrbo7H
efsSf+u7oruRKmZquYSSbhZRUccGAWRAZTGrtEOaDeP704D2m3wRB0Cdvn6TYOtL4r2cH
R2cFxd2WAn0GOyOEcSveSjBr82ooJw3ZamoVXlmH0l0UihRP35Lj1/MZ9ZGzSR3xAwQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795633628;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:
Content-Type:Content-Disposition:Content-Transfer-Encoding:
In-Reply-To;
bh=JisVSgs385NGuntA6erRX4QYHX+VR40SrOV715tgnK0=;
b=M4juxZEO6clFTWZ1eN/lY4g3sK/oZjatLRZcMz0JWn0N8cuhv+icRjMQ8nSJ9iAhLcGf
dRpfWbzQzPY6tpYpcXCHp5cVpk9aGdVIwF5UqXrkWyBHTBcte4uJ72MBHxqfBgWK+tsQe
LyIOnvoEFr1qqx3ajhzQHVpsycElacOCFmO9ZITUNtiC3etMhM0lEgjDNTStZJDcVMs+H
4iRgokdBCvX4sR9k7fQSWDswmHwBTb7VvIrzMHY0j6EuBnoxzOZ0k470CoyKkOFBjiT7+
/L8oGb9d5gdxh5LCiIAl+Nu+BvKSmFa9qH5Ds/4r0q+/W7SfYP5o8t7wA9vRU7FXWBQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=ziepe.ca;
spf=pass smtp.mailfrom=ziepe.ca;
dkim=pass header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=FcYwuSIU;
arc=none smtp.remote-ip=209.85.222.182
X-Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36837606A321
for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 19:07:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36837606A321
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca
X-Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-94962d80d34so374757385a.2
for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 11:07:08 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=ziepe.ca; s=google; t=1795633627; x=1796238427; darn=vger.kernel.org;
h=in-reply-to:content-transfer-encoding:content-disposition
:content-type:mime-version:references:message-id:subject:cc:to:from
:date:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=JisVSgs385NGuntA6erRX4QYHX+VR40SrOV715tgnK0=;
b=FcYwuSIUDw5OYWXKXjcI6QMvdjmCHVjCuBBGlVf+WjZpNlD0CSOQhxBMr8usmyz0ed
rvtoMbTF2eX4vk9Y9h9Nl4g3xiltHQiqgKO2s4RackGmi+H09P7UFu7jXDEMWAJch8Lu
Bez5vSdqY2qlX/U/yq0a0mho64/iizuPGyUtu1j22nAqTe87sbuUkE5K3s0Y4oVoD3Q2
3aZUQ7ci3LolsgjUbNvUcckL1dOvbbGYesd0YLqXsnjyEO32+hlSIJbbGPaLcKvqzKfe
drPhJMtyWdGvDZ8ppj9FApzJK+zHEu9C8REXRTErfSS3i04bujQ5JM7rKTqiYFVsn08k
dQzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795633627; x=1796238427;
h=in-reply-to:content-transfer-encoding:content-disposition
:content-type:mime-version:references:message-id:subject:cc:to:from
:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=JisVSgs385NGuntA6erRX4QYHX+VR40SrOV715tgnK0=;
b=tUI8MohC3Zr56ZNcAtT2WBKv+bwneW2qQzy5M+C1N9g7PxC4kHaNzcUddxn1Md2pxU
HADdPErYM+DtilaryiozbrROPbTvoUc1qaXwyy1hVyzuPXWrLO73G0XacWs8FyEwFqNk
O96HFk4yUV0NQPSmM3vpcARAt4S4XOWKc9yy/dJ1LxDAeJ8alY0LnvWjG5UtuBuCMU6S
4pGfeB9JNn65qHRfSy/zbq93tGFa4NJJyddrAS51/EQreQtXqTtEGdXzrhcc726SKilN
8U/ezfxdG2irBpjqx7nRPe01r0Oy+ay3d5LvRqh3ovIMTVTTlTljPcGbiBmwIY+zDaVW
O1Kw==
X-Forwarded-Encrypted: i=1; AL+hErHOHTcseRE2uSy25djc6Izu7bp5KS8sIy4BSoZ6edbp1S7mKRFzFTqCP90QET6ulTh/MPi11eQ=@vger.kernel.org
X-Gm-Message-State: APuU4Z8upgMeB+60GdbDu/EfOxygPdMaVziF9jnt720ndBRD+KK1VId7
xaVhh0bh9xYKdlNpahfto8IoASFhy3cz8pVrI/EGCYuPtXrJEFMRfLVna7/XBeDWEjU=
X-Gm-Gg: AZFdTZfQAOczijFo2CTZV7tmLzG3zHYmnKSKQI9Unx04lIugHKosdDEY6wlqUDekBXQ
5kPbNfxqDh8IDdii0qYrxhWBg3YZjUaSE+vNVPgONX7hulhp9Iz3ZSq7N28g/cwU2j5CPn8pQM5
ElbAnOTkVxiqjx42ScfF0rrl43kzEQEKG6W/Pdo4T3lOgBjYuVDtqNasArw4yTpogZPRsS0DdC1
1dOIJGxB4PjUM8xC8GdcSUUaK0PI8zFKF8Ozy7cr7fOPlrrpZFYrmNSxzwAhNF3H/Fk7pr6kPik
SOAWRwGKTyTDe0ars44IGLUV+o7XAL7iVhmgACkJjMlv+gnlFffDCD2x1Yq7qwLV1s/ljrUC37B
p8a8R5Yyw4x65eUCF1eaB6bHxZ3Wxdatkpv692JSZVtaDzdTNqSxU+51XnmMp0ZUOfkwFS98ihH
WrLHB1NOTsVha5GW/OjYCP3NkpAkVLWFWjaaoYj946g7aFeEWP5176seU8m2Rg0I0NldcBisId0
ksmgk8Edm0VIm7A2+1yR1dikrubs+CGtCN9JrP4Ze1SrhzwSPmC/0tcKXUPYzcxwlxcYaN0huzr
qoWJ0CM=
X-Received: by 2002:a05:620a:4543:b0:949:65fe:b727 with SMTP id af79cd13be357-949ba9b99a7mr3433826285a.26.1795633626929;
Wed, 25 Nov 2026 11:07:06 -0800 (PST)
X-Received: from ziepe.ca ([142.177.118.84])
by smtp.gmail.com with ESMTPSA id af79cd13be357-94a017cfb46sm339501085a.28.2026.11.25.11.07.06
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 25 Nov 2026 11:07:06 -0800 (PST)
X-Received: from jgg by wakko with local (Exim 4.97)
(envelope-from <jgg@ziepe.ca>)
id 1xWIKf-00000002HLZ-3ZQi;
Wed, 25 Nov 2026 15:07:05 -0400
X-Cc: Alistair Popple <apopple@nvidia.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Thomas Hellström <thomas.hellstrom@linux.intel.com>,
Simona Vetter <simona.vetter@ffwll.ch>,
Matthew Brost <matthew.brost@intel.com>,
Vivek Kasireddy <vivek.kasireddy@intel.com>,
Dongwon Kim <dongwon.kim@intel.com>,
Kevin Tian <kevin.tian@intel.com>,
Xu Yilun <yilun.xu@linux.intel.com>,
Karl Mehltretter <kmehltretter@gmail.com>,
Baolu Lu <baolu.lu@linux.intel.com>,
Felix Kuehling <felix.kuehling@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
linux-rdma@vger.kernel.org, iommu@lists.linux.dev,
Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Mina Almasry <almasrymina@google.com>, netdev@vger.kernel.org,
Alexey Kardashevskiy <aik@amd.com>, zhipingz@meta.com,
treding@nvidia.com, jhubbard@nvidia.com, chaitanyak@nvidia.com,
Leon Romanovsky <leon@kernel.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <5fb8bb60-7d9f-49b1-899c-40a890fdc14b@amd.com>