summaryrefslogtreecommitdiff
path: root/drivers/coresight/git@git.tavy.me:linux-stable.git
diff options
context:
space:
mode:
authorTroy Mitchell <troy.mitchell@linux.dev>2026-07-27 01:08:44 -0700
committerPaul Walmsley <pjw@kernel.org>2026-07-29 11:43:50 -0600
commitcfca5a48b03fbd33c8cb84cb73ee2e34467f3a33 (patch)
treef27b46a68347fd770f4925f30bbcd41c4915983b /drivers/coresight/git@git.tavy.me:linux-stable.git
parent9a22a1542ca03381dcbf000d7a264cbee61e7203 (diff)
riscv: mm: fix SWIOTLB initialization for systems with DRAM above 4GB
On RISC-V platforms where the entire physical memory (DRAM) resides above the 32-bit address space (i.e., above dma32_phys_limit), the current SWIOTLB initialization logic fails. This patch addresses two interconnected issues on such platforms: 1. Incorrect 32-bit DMA bounce assumption: The existing condition `max_pfn > PFN_DOWN(dma32_phys_limit)` assumes that a 32-bit DMA bounce buffer is required simply because the maximum PFN exceeds the 32-bit limit. However, if all DRAM starts above 4GB, no memory exists below the limit to satisfy this allocation. Fix this by adding a check to ensure `memblock_start_of_DRAM()` is actually below the 32-bit limit before enforcing 32-bit SWIOTLB. 2. kmalloc() bounce buffer allocation failure on non-coherent systems: For non-coherent DMA, kmalloc() buffers whose sizes are not cache-line-aligned still require bouncing, even if 32-bit DMA bouncing is skipped. Without the `SWIOTLB_ANY` flag, swiotlb_init() defaults to allocating from low memory, which fails completely when DRAM only exists in high memory. By appending `SWIOTLB_ANY` to swiotlb_flags, the allocator is permitted to allocate this bounce buffer from high memory. With this patch, systems with non-coherent DMA and DRAM entirely above 4GB can successfully map the software IO TLB in high memory and boot normally. Tested-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com> Signed-off-by: Troy Mitchell <troy.mitchell@linux.dev> Link: https://patch.msgid.link/20260727-fix-riscv-swiotlb-v3-1-59479b23736c@linux.dev Reviewed-by: Drew Fustini <fustini@kernel.org> Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'drivers/coresight/git@git.tavy.me:linux-stable.git')
0 files changed, 0 insertions, 0 deletions