Messages in this thread |  | | Date | Sun, 12 Jul 2026 15:33:42 +0000 | | From | Mostafa Saleh <> | | Subject | Re: [PATCH 1/3] arm64/mm: Simplify SWIOTLB setup in arch_mm_preinit() |
| |
On Thu, Jul 09, 2026 at 10:08:19AM +0100, Catalin Marinas wrote: > On Wed, Jun 03, 2026 at 11:05:20AM +0000, Mostafa Saleh wrote: > > At the moment, arch_mm_preinit() checks if the system has limited > > addressing or is running under CCA to enable SWIOTLB, only after to > > be forced to true anyway if it was false due to > > CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC being unconditionally true for > > arm64. > > > > Simplify this logic, by making it clear that SWIOTLB is always used > > but its size depends on the address layout of the system. > > > > Signed-off-by: Mostafa Saleh <smostafa@google.com> > > --- > > arch/arm64/mm/init.c | 11 ++++------- > > 1 file changed, 4 insertions(+), 7 deletions(-) > > > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > > index 97987f850a33..fcc9c05a8fe6 100644 > > --- a/arch/arm64/mm/init.c > > +++ b/arch/arm64/mm/init.c > > @@ -336,25 +336,22 @@ void __init arch_setup_zero_pages(void) > > void __init arch_mm_preinit(void) > > { > > unsigned int flags = SWIOTLB_VERBOSE; > > - bool swiotlb = max_pfn > PFN_DOWN(arm64_dma_phys_limit); > > + bool limited_addressing = max_pfn > PFN_DOWN(arm64_dma_phys_limit); > > > > if (is_realm_world()) { > > - swiotlb = true; > > flags |= SWIOTLB_FORCE; > > - } > > - > > - if (IS_ENABLED(CONFIG_DMA_BOUNCE_UNALIGNED_KMALLOC) && !swiotlb) { > > + } else if (!limited_addressing) { > > I'm fine with implementing Mike's comment on doing the check inline. > > I recall some people still comment out the dma kmalloc bounce option: > > https://github.com/raspberrypi/linux/commit/a07564753639fe5ffb3f59d7364f14e6e68e3e9e > > (there was no way I could convince them it's worse memory wastage > without the option) > > So happy to make it slightly harder for them ;). > > Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Thanks! Would you prefer if I send a new version removing limited_addressing?
Thanks, Mostafa
|  |