From: Anshul Dalal <anshuld@ti.com>
To: Mark Kettenis <kettenis@openbsd.org>, <u-boot@lists.denx.de>
Cc: <trini@konsulko.com>, <ilias.apalodimas@linaro.org>,
<anshuld@ti.com>, <d-gole@ti.com>, <casey.connolly@linaro.org>
Subject: Re: [PATCH] arm: armv8: Flush TLB before enabling MMU
Date: Mon, 12 Jan 2026 10:02:27 +0530 [thread overview]
Message-ID: <DFMBVIC7MI1V.2FQICY0TGLT2L@ti.com> (raw)
In-Reply-To: <20260110195610.42068-1-kettenis@openbsd.org>
On Sun Jan 11, 2026 at 1:26 AM IST, Mark Kettenis wrote:
> Commit 9ebdbbc43e5f ("arm: armv8: invalidate dcache entries on
> dcache_enable") broke Apple Silicon machines in certain scenarios.
> If the MMU is currently not enabled we need to flush the TLB
> before we enable it to prevent stale TLB entries from becoming
> active again. So move the __asm_invalidate_tlb_all() back
> immediately before the mmu_setup() call.
>
> Fixes: 9ebdbbc43e5f ("arm: armv8: invalidate dcache entries on dcache_enable")
> Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
> ---
> arch/arm/cpu/armv8/cache_v8.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
> index 0309da6d397..39479df7b21 100644
> --- a/arch/arm/cpu/armv8/cache_v8.c
> +++ b/arch/arm/cpu/armv8/cache_v8.c
> @@ -878,15 +878,16 @@ void flush_dcache_range(unsigned long start, unsigned long stop)
> void dcache_enable(void)
> {
> /* The data cache is not active unless the mmu is enabled */
> - if (!mmu_status())
> + if (!mmu_status()) {
> + __asm_invalidate_tlb_all();
> mmu_setup();
So, if I understand correctly the problem is that the TLB is enabled by
mmu_setup which happened before we invalidated the existing TLB entries?
> + }
>
> /* Set up page tables only once (it is done also by mmu_setup()) */
> if (!gd->arch.tlb_fillptr)
> setup_all_pgtables();
>
> invalidate_dcache_all();
> - __asm_invalidate_tlb_all();
> set_sctlr(get_sctlr() | CR_C);
> }
>
next prev parent reply other threads:[~2026-01-12 4:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-10 19:56 [PATCH] arm: armv8: Flush TLB before enabling MMU Mark Kettenis
2026-01-12 4:32 ` Anshul Dalal [this message]
2026-01-20 11:01 ` Ilias Apalodimas
2026-02-23 21:23 ` Mark Kettenis
2026-02-24 10:18 ` Ilias Apalodimas
2026-02-24 20:02 ` Tom Rini
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=DFMBVIC7MI1V.2FQICY0TGLT2L@ti.com \
--to=anshuld@ti.com \
--cc=casey.connolly@linaro.org \
--cc=d-gole@ti.com \
--cc=ilias.apalodimas@linaro.org \
--cc=kettenis@openbsd.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.