From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.182 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== 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== 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 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 ; Wed, 25 Nov 2026 19:07:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 36837606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=FcYwuSIU Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-94962d80d34so374757385a.2 for ; Wed, 25 Nov 2026 11:07:08 -0800 (PST) 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) 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) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1xWIKf-00000002HLZ-3ZQi; Wed, 25 Nov 2026 15:07:05 -0400 Date: Wed, 25 Nov 2026 15:07:05 -0400 From: Jason Gunthorpe To: Christian =?utf-8?B?S8O2bmln?= Cc: Alistair Popple , Sumit Semwal , Thomas =?utf-8?Q?Hellstr=C3=B6m?= , Simona Vetter , Matthew Brost , Vivek Kasireddy , Dongwon Kim , Kevin Tian , Xu Yilun , Karl Mehltretter , Baolu Lu , Felix Kuehling , Alex Deucher , 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 , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Mina Almasry , netdev@vger.kernel.org, Alexey Kardashevskiy , zhipingz@meta.com, treding@nvidia.com, jhubbard@nvidia.com, chaitanyak@nvidia.com, Leon Romanovsky Subject: Re: [PATCH v3 03/24] dma-buf: Add the SGT DMA mapping type Message-ID: <20261125190705.GN246011@ziepe.ca> References: <7ac7edd0-5c38-440a-b26a-21bcbb6f4702@amd.com> <63eb7b6e-e0a8-4443-a434-0301ed59beae@amd.com> <20261124142032.GN9566@ziepe.ca> <7a5a2d3a-e42e-4dc0-8d22-8dd1bd249501@amd.com> <20261124194618.GC114530@ziepe.ca> <20261125155559.GL246011@ziepe.ca> <5fb8bb60-7d9f-49b1-899c-40a890fdc14b@amd.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5fb8bb60-7d9f-49b1-899c-40a890fdc14b@amd.com> 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