mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Renaud Barbier <Renaud.Barbier@ametek.com>,
	Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] ppc: fix missing cache maintenance before mapping uncached
Date: Wed,  2 Jul 2025 14:03:41 +0200	[thread overview]
Message-ID: <20250702120341.2389232-1-a.fatoum@pengutronix.de> (raw)

flags is the generic map type (e.g. MAP_CACHED), while MAS2_I is a bit
only relevant to PowerPC. Checking for MAS2_I in flags is thus never
true and means we skipped cache maintenance so far when remapping a
region as uncached.

We actually have a test that caught similar issues on ARM, but we don't
have a Labgrid config for CI to test on PowerPC unfortunately.

Interestingly, the fixed behavior had only been in barebox for a year,
before it was subtly broken for 10 years...

Fixes: b792124a7dd3 ("rework remap_range")
Cc: Renaud Barbier <Renaud.Barbier@ametek.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/powerpc/cpu-85xx/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/cpu-85xx/mmu.c b/arch/powerpc/cpu-85xx/mmu.c
index b484acbf8043..3bd75281eb98 100644
--- a/arch/powerpc/cpu-85xx/mmu.c
+++ b/arch/powerpc/cpu-85xx/mmu.c
@@ -47,7 +47,7 @@ int arch_remap_range(void *virt_addr, phys_addr_t phys_addr, size_t size, unsign
 			break;
 		e500_read_tlbcam_entry(esel, &valid, &tsize, &epn,
 				&rpn);
-		if (flags & MAS2_I) {
+		if (pte_flags & MAS2_I) {
 			flush_dcache();
 			invalidate_icache();
 		}
-- 
2.39.5




                 reply	other threads:[~2025-07-02 12:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250702120341.2389232-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=Renaud.Barbier@ametek.com \
    --cc=barebox@lists.infradead.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