From: Catalin Marinas <catalin.marinas@arm.com>
To: Mostafa Saleh <smostafa@google.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
will@kernel.org, rppt@kernel.org, maz@kernel.org,
aneesh.kumar@kernel.org
Subject: Re: [PATCH 1/3] arm64/mm: Simplify SWIOTLB setup in arch_mm_preinit()
Date: Thu, 9 Jul 2026 10:08:19 +0100 [thread overview]
Message-ID: <ak9lA6dUnBYzwMlI@arm.com> (raw)
In-Reply-To: <20260603110522.3331819-2-smostafa@google.com>
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>
next prev parent reply other threads:[~2026-07-09 9:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 11:05 [PATCH 0/3] arm64/coco: Convert pKVM to a CC platform Mostafa Saleh
2026-06-03 11:05 ` [PATCH 1/3] arm64/mm: Simplify SWIOTLB setup in arch_mm_preinit() Mostafa Saleh
2026-06-03 12:27 ` Mike Rapoport
2026-06-03 13:13 ` Mostafa Saleh
2026-06-04 9:03 ` Aneesh Kumar K.V
2026-06-04 8:55 ` Aneesh Kumar K.V
2026-07-09 9:08 ` Catalin Marinas [this message]
2026-06-03 11:05 ` [PATCH 2/3] drivers/virt: pkvm: Fix end calculation in mmio_guard_ioremap_hook() Mostafa Saleh
2026-07-09 9:08 ` Catalin Marinas
2026-06-03 11:05 ` [PATCH 3/3] arm64/coco: Add pKVM as a CC platform Mostafa Saleh
2026-06-04 8:59 ` Aneesh Kumar K.V
2026-06-12 8:44 ` Mostafa Saleh
2026-06-12 15:07 ` Aneesh Kumar K.V
2026-07-09 9:10 ` Catalin Marinas
2026-07-09 9:11 ` Catalin Marinas
2026-07-07 8:02 ` [PATCH 0/3] arm64/coco: Convert pKVM to " Aneesh Kumar K.V
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=ak9lA6dUnBYzwMlI@arm.com \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=rppt@kernel.org \
--cc=smostafa@google.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