From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD758F53D9A for ; Mon, 16 Mar 2026 20:39:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4A136B0379; Mon, 16 Mar 2026 16:39:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCD7D6B037A; Mon, 16 Mar 2026 16:39:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD9C76B037B; Mon, 16 Mar 2026 16:39:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id AA23D6B0379 for ; Mon, 16 Mar 2026 16:39:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4CC5E13B2FC for ; Mon, 16 Mar 2026 20:39:37 +0000 (UTC) X-FDA: 84553091994.08.814346B Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf11.hostedemail.com (Postfix) with ESMTP id 8029540008 for ; Mon, 16 Mar 2026 20:39:35 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eGDr2I5J; spf=pass (imf11.hostedemail.com: domain of leon@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=leon@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1773693575; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JL773fp+7I86uFbRtLVl4GoNmlIPg6mffgatF7aX898=; b=4MLMcqkBj5X/2cF/gt58BhHpRzwKEYDIJoKrTWywygxjTAAr/7NR6IlUexhEk2llX0S37r ccy9gY8c561sjb8dhydbdo3LZQ5wFRCsthAO673xu6ujlq5nwuIkU7H7qbPwQdE+aIHDQL mladZiflLmW4lvoWVg2tD5N8z8+UAMc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1773693575; a=rsa-sha256; cv=none; b=xjltZVWydQwuXJzzPYdbrCKm8PHNt0B8xykk14pBFkWbiueludZS6a2OtWXDdHhdHTgCLV L7Lvb/0TTRHgm8N0iVShp1FJRNHDED/jm0oiBXvp6OfoWYSUOK70La6qlmHLPHaUmvrwhH PVZfYbNOqu78NMRdEHhPL6I3IgxGNaM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eGDr2I5J; spf=pass (imf11.hostedemail.com: domain of leon@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=leon@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 4137843B6D; Mon, 16 Mar 2026 20:39:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22662C19421; Mon, 16 Mar 2026 20:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773693574; bh=e3RhwnNiwK1x/eHOGy59Ae3i6XSohKUkLWxBcoMgZBw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eGDr2I5JcvQ6vJ3DIMejIHnlwRwdvsorfSEnknaKSiitD38CtJ6sFxept3ygj/Q7N yAHSy9gmn+44EX68ntr5N7Hr8WQ2uFLRO51rUpGyqrMdxu/Fe06F6gFaFDj/J5gVPD QlxnPuZEhN38bbayFCrU9R8lYGXqH4g8vuJoMzQaxmbWIRSldzdam8TNyC7EY61gKX /h4z5PoRxc3DjADAzngUsqiWDjBq3d754JXL4IcedLvxbST9Jh8bftxXsnWoVqPBfC eMpyvvZ+k4OpKkJ98UuclDiF9VFYue2g6aB34fIZRnu2iZFGKN+7STsAmFTQPQBORG PPVv6vlTlCocw== Date: Mon, 16 Mar 2026 22:39:28 +0200 From: Leon Romanovsky To: Randy Dunlap Cc: Marek Szyprowski , Robin Murphy , "Michael S. Tsirkin" , Petr Tesarik , Jonathan Corbet , Shuah Khan , Jason Wang , Xuan Zhuo , Eugenio =?iso-8859-1?Q?P=E9rez?= , Jason Gunthorpe , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Joerg Roedel , Will Deacon , Andrew Morton , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev, linux-rdma@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 4/8] dma-mapping: Introduce DMA require coherency attribute Message-ID: <20260316203928.GN61385@unreal> References: <20260316-dma-debug-overlap-v3-0-1dde90a7f08b@nvidia.com> <20260316-dma-debug-overlap-v3-4-1dde90a7f08b@nvidia.com> <659bd750-c67a-4290-8c2d-58bc13c9e2a6@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <659bd750-c67a-4290-8c2d-58bc13c9e2a6@infradead.org> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 8029540008 X-Stat-Signature: y9z759i7nbsxiermo7doujuyfzn35xbd X-Rspam-User: X-HE-Tag: 1773693575-668815 X-HE-Meta: U2FsdGVkX18wFZXJXW4MGRAm6iI2pKwsgypIwSKhpph20C64Hn2xr1nwceiLph1XUBugCmXPPlAZrdiC55VUsoEi4dQknuZ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6jW04cNZzelZJlL0xpq1sV5A7gAuOHB/LShep0vZKHjQsSglGkamJjKI0khL1J3v2BmdF2mYB Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Mar 16, 2026 at 12:17:39PM -0700, Randy Dunlap wrote: > > > On 3/16/26 12:06 PM, Leon Romanovsky wrote: > > diff --git a/Documentation/core-api/dma-attributes.rst b/Documentation/core-api/dma-attributes.rst > > index 48cfe86cc06d7..441bdc9d08318 100644 > > --- a/Documentation/core-api/dma-attributes.rst > > +++ b/Documentation/core-api/dma-attributes.rst > > @@ -163,3 +163,19 @@ data corruption. > > > > All mappings that share a cache line must set this attribute to suppress DMA > > debug warnings about overlapping mappings. > > + > > +DMA_ATTR_REQUIRE_COHERENT > > +------------------------- > > + > > +DMA mapping requests with the DMA_ATTR_REQUIRE_COHERENT fail on any > > +system where SWIOTLB or cache management is required. This should only > > +be used to support uAPI designs that require continuous HW DMA > > +coherence with userspace processes, for example RDMA and DRM. At a > > +minimum the memory being mapped must be userspace memory from > > +pin_user_pages() or similar. > > + > > +Drivers should consider using dma_mmap_pages() instead of this > > +interface when building their uAPIs, when possible. > > + > > +It must never be used in an in-kernel driver that only works with > > +kernal memory. > > kernel Thanks, let's hope that it is the only one comment :). > > -- > ~Randy >