Skip to content

Commit 16c200e

Browse files
committed
Merge branch 'for-next/pfn-valid' into for-next/core
* for-next/pfn-valid: arm64/mm: drop HAVE_ARCH_PFN_VALID dma-mapping: remove bogus test for pfn_valid from dma_map_resource
2 parents bd334dd + 3de360c commit 16c200e

File tree

4 files changed

+0
-43
lines changed

4 files changed

+0
-43
lines changed

arch/arm64/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ config ARM64
154154
select HAVE_ARCH_KGDB
155155
select HAVE_ARCH_MMAP_RND_BITS
156156
select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
157-
select HAVE_ARCH_PFN_VALID
158157
select HAVE_ARCH_PREL32_RELOCATIONS
159158
select HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
160159
select HAVE_ARCH_SECCOMP_FILTER

arch/arm64/include/asm/page.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ void tag_clear_highpage(struct page *to);
4141

4242
typedef struct page *pgtable_t;
4343

44-
int pfn_valid(unsigned long pfn);
4544
int pfn_is_map_memory(unsigned long pfn);
4645

4746
#include <asm/memory.h>

arch/arm64/mm/init.c

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -160,43 +160,6 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
160160
free_area_init(max_zone_pfns);
161161
}
162162

163-
int pfn_valid(unsigned long pfn)
164-
{
165-
phys_addr_t addr = PFN_PHYS(pfn);
166-
struct mem_section *ms;
167-
168-
/*
169-
* Ensure the upper PAGE_SHIFT bits are clear in the
170-
* pfn. Else it might lead to false positives when
171-
* some of the upper bits are set, but the lower bits
172-
* match a valid pfn.
173-
*/
174-
if (PHYS_PFN(addr) != pfn)
175-
return 0;
176-
177-
if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
178-
return 0;
179-
180-
ms = __pfn_to_section(pfn);
181-
if (!valid_section(ms))
182-
return 0;
183-
184-
/*
185-
* ZONE_DEVICE memory does not have the memblock entries.
186-
* memblock_is_map_memory() check for ZONE_DEVICE based
187-
* addresses will always fail. Even the normal hotplugged
188-
* memory will never have MEMBLOCK_NOMAP flag set in their
189-
* memblock entries. Skip memblock search for all non early
190-
* memory sections covering all of hotplug memory including
191-
* both normal and ZONE_DEVICE based.
192-
*/
193-
if (!early_section(ms))
194-
return pfn_section_valid(ms, pfn);
195-
196-
return memblock_is_memory(addr);
197-
}
198-
EXPORT_SYMBOL(pfn_valid);
199-
200163
int pfn_is_map_memory(unsigned long pfn)
201164
{
202165
phys_addr_t addr = PFN_PHYS(pfn);

kernel/dma/mapping.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,6 @@ dma_addr_t dma_map_resource(struct device *dev, phys_addr_t phys_addr,
296296
if (WARN_ON_ONCE(!dev->dma_mask))
297297
return DMA_MAPPING_ERROR;
298298

299-
/* Don't allow RAM to be mapped */
300-
if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
301-
return DMA_MAPPING_ERROR;
302-
303299
if (dma_map_direct(dev, ops))
304300
addr = dma_direct_map_resource(dev, phys_addr, size, dir, attrs);
305301
else if (ops->map_resource)

0 commit comments

Comments
 (0)