linux-stable/arch/arm64
Will Deacon 3eb9cdffb3 Partially revert "arm64/mm: drop HAVE_ARCH_PFN_VALID"
This partially reverts commit 16c9afc776.

Alex Bee reports a regression in 5.14 on their RK3328 SoC when
configuring the PL330 DMA controller:

 | ------------[ cut here ]------------
 | WARNING: CPU: 2 PID: 373 at kernel/dma/mapping.c:235 dma_map_resource+0x68/0xc0
 | Modules linked in: spi_rockchip(+) fuse
 | CPU: 2 PID: 373 Comm: systemd-udevd Not tainted 5.14.0-rc7 #1
 | Hardware name: Pine64 Rock64 (DT)
 | pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
 | pc : dma_map_resource+0x68/0xc0
 | lr : pl330_prep_slave_fifo+0x78/0xd0

This appears to be because dma_map_resource() is being called for a
physical address which does not correspond to a memory address yet does
have a valid 'struct page' due to the way in which the vmemmap is
constructed.

Prior to 16c9afc776 ("arm64/mm: drop HAVE_ARCH_PFN_VALID"), the arm64
implementation of pfn_valid() called memblock_is_memory() to return
'false' for such regions and the DMA mapping request would proceed.
However, now that we are using the generic implementation where only the
presence of the memory map entry is considered, we return 'true' and
erroneously fail with DMA_MAPPING_ERROR because we identify the region
as DRAM.

Although fixing this in the DMA mapping code is arguably the right fix,
it is a risky, cross-architecture change at this stage in the cycle. So
just revert arm64 back to its old pfn_valid() implementation for v5.14.
The change to the generic pfn_valid() code is preserved from the original
patch, so as to avoid impacting other architectures.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Christoph Hellwig <hch@lst.de>
Reported-by: Alex Bee <knaerzche@gmail.com>
Link: https://lore.kernel.org/r/d3a3c828-b777-faf8-e901-904995688437@gmail.com
Signed-off-by: Will Deacon <will@kernel.org>
2021-08-25 11:33:24 +01:00
..
boot ARM: Devicetree material for 5.14 2021-07-10 09:33:54 -07:00
configs Additional Qualcomm ARM64 defconfig udpate for v5.14 2021-06-23 19:01:58 -07:00
crypto crypto: arm64 - use a pattern rule for generating *.S files 2021-05-14 19:07:54 +08:00
include Partially revert "arm64/mm: drop HAVE_ARCH_PFN_VALID" 2021-08-25 11:33:24 +01:00
kernel arm64: stacktrace: avoid tracing arch_stack_walk() 2021-08-03 10:39:35 +01:00
kvm Merge branch 'akpm' (patches from Andrew) 2021-07-02 12:08:10 -07:00
lib arm64: Avoid premature usercopy failure 2021-07-15 17:29:14 +01:00
mm Partially revert "arm64/mm: drop HAVE_ARCH_PFN_VALID" 2021-08-25 11:33:24 +01:00
net Networking changes for 5.14. 2021-06-30 15:51:09 -07:00
tools arm64: Allow mismatched 32-bit EL0 support 2021-06-11 13:25:40 +01:00
xen
Kbuild bpf: Fix BPF_JIT kconfig symbol dependency 2021-05-20 23:48:37 +02:00
Kconfig Partially revert "arm64/mm: drop HAVE_ARCH_PFN_VALID" 2021-08-25 11:33:24 +01:00
Kconfig.debug
Kconfig.platforms Merge branch 'arm/fixes' into arm/soc 2021-07-09 10:46:02 -07:00
Makefile arm64: clean vdso & vdso32 files 2021-08-11 11:04:55 +01:00