From: Leon Romanovsky <leon@kernel•org>
To: Marek Szyprowski <m.szyprowski@samsung•com>,
Robin Murphy <robin.murphy@arm•com>,
Russell King <linux@armlinux•org.uk>,
Juergen Gross <jgross@suse•com>,
Stefano Stabellini <sstabellini@kernel•org>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@epam•com>,
Richard Henderson <richard.henderson@linaro•org>,
Matt Turner <mattst88@gmail•com>,
Thomas Bogendoerfer <tsbogend@alpha•franken.de>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership•com>,
Helge Deller <deller@gmx•de>,
Madhavan Srinivasan <maddy@linux•ibm.com>,
Michael Ellerman <mpe@ellerman•id.au>,
Nicholas Piggin <npiggin@gmail•com>,
Christophe Leroy <christophe.leroy@csgroup•eu>,
Geoff Levand <geoff@infradead•org>,
"David S. Miller" <davem@davemloft•net>,
Andreas Larsson <andreas@gaisler•com>,
Thomas Gleixner <tglx@linutronix•de>,
Ingo Molnar <mingo@redhat•com>, Borislav Petkov <bp@alien8•de>,
Dave Hansen <dave.hansen@linux•intel.com>,
x86@kernel•org, "H. Peter Anvin" <hpa@zytor•com>
Cc: iommu@lists•linux.dev, linux-kernel@vger•kernel.org,
linux-arm-kernel@lists•infradead.org,
xen-devel@lists•xenproject.org, linux-alpha@vger•kernel.org,
linux-mips@vger•kernel.org, linux-parisc@vger•kernel.org,
linuxppc-dev@lists•ozlabs.org, sparclinux@vger•kernel.org,
Jason Gunthorpe <jgg@ziepe•ca>, Jason Gunthorpe <jgg@nvidia•com>
Subject: [PATCH v5 12/14] x86: Use physical address for DMA mapping
Date: Wed, 15 Oct 2025 12:12:58 +0300 [thread overview]
Message-ID: <20251015-remove-map-page-v5-12-3bbfe3a25cdf@kernel.org> (raw)
In-Reply-To: <20251015-remove-map-page-v5-0-3bbfe3a25cdf@kernel.org>
From: Leon Romanovsky <leonro@nvidia•com>
Perform mechanical conversion from DMA .map_page to .map_phys.
Reviewed-by: Jason Gunthorpe <jgg@nvidia•com>
Signed-off-by: Leon Romanovsky <leonro@nvidia•com>
---
arch/x86/kernel/amd_gart_64.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index 3485d419c2f5..93a06307d953 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -222,13 +222,14 @@ static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
}
/* Map a single area into the IOMMU */
-static dma_addr_t gart_map_page(struct device *dev, struct page *page,
- unsigned long offset, size_t size,
- enum dma_data_direction dir,
+static dma_addr_t gart_map_phys(struct device *dev, phys_addr_t paddr,
+ size_t size, enum dma_data_direction dir,
unsigned long attrs)
{
unsigned long bus;
- phys_addr_t paddr = page_to_phys(page) + offset;
+
+ if (unlikely(attrs & DMA_ATTR_MMIO))
+ return DMA_MAPPING_ERROR;
if (!need_iommu(dev, paddr, size))
return paddr;
@@ -242,7 +243,7 @@ static dma_addr_t gart_map_page(struct device *dev, struct page *page,
/*
* Free a DMA mapping.
*/
-static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr,
+static void gart_unmap_phys(struct device *dev, dma_addr_t dma_addr,
size_t size, enum dma_data_direction dir,
unsigned long attrs)
{
@@ -282,7 +283,7 @@ static void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
for_each_sg(sg, s, nents, i) {
if (!s->dma_length || !s->length)
break;
- gart_unmap_page(dev, s->dma_address, s->dma_length, dir, 0);
+ gart_unmap_phys(dev, s->dma_address, s->dma_length, dir, 0);
}
}
@@ -487,7 +488,7 @@ static void
gart_free_coherent(struct device *dev, size_t size, void *vaddr,
dma_addr_t dma_addr, unsigned long attrs)
{
- gart_unmap_page(dev, dma_addr, size, DMA_BIDIRECTIONAL, 0);
+ gart_unmap_phys(dev, dma_addr, size, DMA_BIDIRECTIONAL, 0);
dma_direct_free(dev, size, vaddr, dma_addr, attrs);
}
@@ -668,8 +669,8 @@ static __init int init_amd_gatt(struct agp_kern_info *info)
static const struct dma_map_ops gart_dma_ops = {
.map_sg = gart_map_sg,
.unmap_sg = gart_unmap_sg,
- .map_page = gart_map_page,
- .unmap_page = gart_unmap_page,
+ .map_phys = gart_map_phys,
+ .unmap_phys = gart_unmap_phys,
.alloc = gart_alloc_coherent,
.free = gart_free_coherent,
.mmap = dma_common_mmap,
--
2.51.0
next prev parent reply other threads:[~2025-10-15 9:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20251015091313eucas1p2426ae40b579d7f3b4f29b46e0e788c0d@eucas1p2.samsung.com>
2025-10-15 9:12 ` [PATCH v5 00/14] Remove DMA map_page/map_resource and their unmap callbacks Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 01/14] dma-mapping: prepare dma_map_ops to conversion to physical address Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 02/14] dma-mapping: convert dummy ops to physical address mapping Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 03/14] ARM: dma-mapping: Reduce struct page exposure in arch_sync_dma*() Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 04/14] ARM: dma-mapping: Switch to physical address mapping callbacks Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 05/14] xen: swiotlb: " Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 06/14] dma-mapping: remove unused mapping resource callbacks Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 07/14] alpha: Convert mapping routine to rely on physical address Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 08/14] MIPS/jazzdma: Provide physical address directly Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 09/14] parisc: Convert DMA map_page to map_phys interface Leon Romanovsky
2025-12-17 12:17 ` [PATCH v5 09/14] parisc: Convert DMA map_page to map_phys interface [qemu test failure] Guenter Roeck
2025-12-18 8:40 ` Leon Romanovsky
2025-12-18 12:11 ` Leon Romanovsky
2025-10-15 9:12 ` [PATCH v5 10/14] powerpc: Convert to physical address DMA mapping Leon Romanovsky
2025-11-14 9:02 ` Christophe Leroy
2025-10-15 9:12 ` [PATCH v5 11/14] sparc: Use " Leon Romanovsky
2026-02-17 12:27 ` John Paul Adrian Glaubitz
2026-02-17 12:55 ` Marek Szyprowski
2026-02-17 13:15 ` Leon Romanovsky
2026-02-17 13:57 ` John Paul Adrian Glaubitz
2025-10-15 9:12 ` Leon Romanovsky [this message]
2025-10-15 9:12 ` [PATCH v5 13/14] xen: swiotlb: Convert mapping routine to rely on physical address Leon Romanovsky
2025-10-15 9:13 ` [PATCH v5 14/14] dma-mapping: remove unused map_page callback Leon Romanovsky
2025-10-20 16:27 ` [PATCH v5 00/14] Remove DMA map_page/map_resource and their unmap callbacks Marek Szyprowski
2025-10-26 7:38 ` Leon Romanovsky
2025-10-29 10:00 ` Marek Szyprowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251015-remove-map-page-v5-12-3bbfe3a25cdf@kernel.org \
--to=leon@kernel$(echo .)org \
--cc=James.Bottomley@HansenPartnership$(echo .)com \
--cc=andreas@gaisler$(echo .)com \
--cc=bp@alien8$(echo .)de \
--cc=christophe.leroy@csgroup$(echo .)eu \
--cc=dave.hansen@linux$(echo .)intel.com \
--cc=davem@davemloft$(echo .)net \
--cc=deller@gmx$(echo .)de \
--cc=geoff@infradead$(echo .)org \
--cc=hpa@zytor$(echo .)com \
--cc=iommu@lists$(echo .)linux.dev \
--cc=jgg@nvidia$(echo .)com \
--cc=jgg@ziepe$(echo .)ca \
--cc=jgross@suse$(echo .)com \
--cc=linux-alpha@vger$(echo .)kernel.org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mips@vger$(echo .)kernel.org \
--cc=linux-parisc@vger$(echo .)kernel.org \
--cc=linux@armlinux$(echo .)org.uk \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=m.szyprowski@samsung$(echo .)com \
--cc=maddy@linux$(echo .)ibm.com \
--cc=mattst88@gmail$(echo .)com \
--cc=mingo@redhat$(echo .)com \
--cc=mpe@ellerman$(echo .)id.au \
--cc=npiggin@gmail$(echo .)com \
--cc=oleksandr_tyshchenko@epam$(echo .)com \
--cc=richard.henderson@linaro$(echo .)org \
--cc=robin.murphy@arm$(echo .)com \
--cc=sparclinux@vger$(echo .)kernel.org \
--cc=sstabellini@kernel$(echo .)org \
--cc=tglx@linutronix$(echo .)de \
--cc=tsbogend@alpha$(echo .)franken.de \
--cc=x86@kernel$(echo .)org \
--cc=xen-devel@lists$(echo .)xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox