From: Mike Rapoport <rppt@kernel.org>
To: linux-arm-kernel@lists.infradead.org
Cc: Alex Bee <knaerzche@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Christoph Hellwig <hch@lst.de>,
David Hildenbrand <david@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Mike Rapoport <rppt@kernel.org>,
Mike Rapoport <rppt@linux.ibm.com>,
Robin Murphy <robin.murphy@arm.com>,
Will Deacon <will@kernel.org>,
iommu@lists.linux-foundation.org
Subject: [PATCH 1/2] dma-mapping: remove bogus test for pfn_valid from dma_map_resource
Date: Thu, 30 Sep 2021 04:30:38 +0300 [thread overview]
Message-ID: <20210930013039.11260-2-rppt@kernel.org> (raw)
In-Reply-To: <20210930013039.11260-1-rppt@kernel.org>
From: Mike Rapoport <rppt@linux.ibm.com>
dma_map_resource() uses pfn_valid() to ensure the range is not RAM.
However, pfn_valid() only checks for availability of the memory map for a
PFN but it does not ensure that the PFN is actually backed by RAM.
As dma_map_resource() is the only method in DMA mapping APIs that has this
check, simply drop the pfn_valid() test from dma_map_resource().
Link: https://lore.kernel.org/all/20210824173741.GC623@arm.com/
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
kernel/dma/mapping.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c
index 06fec5547e7c..dda8d8b84a55 100644
--- a/kernel/dma/mapping.c
+++ b/kernel/dma/mapping.c
@@ -296,10 +296,6 @@ dma_addr_t dma_map_resource(struct device *dev, phys_addr_t phys_addr,
if (WARN_ON_ONCE(!dev->dma_mask))
return DMA_MAPPING_ERROR;
- /* Don't allow RAM to be mapped */
- if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
- return DMA_MAPPING_ERROR;
-
if (dma_map_direct(dev, ops))
addr = dma_direct_map_resource(dev, phys_addr, size, dir, attrs);
else if (ops->map_resource)
--
2.28.0
next prev parent reply other threads:[~2021-09-30 1:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 1:30 [PATCH 0/2] arm64: retry dropping HAVE_ARCH_PFN_VALID Mike Rapoport
2021-09-30 1:30 ` Mike Rapoport [this message]
2021-09-30 5:46 ` [PATCH 1/2] dma-mapping: remove bogus test for pfn_valid from dma_map_resource Christoph Hellwig
2021-09-30 7:27 ` David Hildenbrand
2021-09-30 1:30 ` [PATCH 2/2] arm64/mm: drop HAVE_ARCH_PFN_VALID Mike Rapoport
2021-10-01 14:01 ` [PATCH 0/2] arm64: retry dropping HAVE_ARCH_PFN_VALID Will Deacon
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=20210930013039.11260-2-rppt@kernel.org \
--to=rppt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=david@redhat.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=knaerzche@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.com \
--cc=rppt@linux.ibm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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