mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ppc: fix missing cache maintenance before mapping uncached
@ 2025-07-02 12:03 Ahmad Fatoum
  0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2025-07-02 12:03 UTC (permalink / raw)
  To: barebox; +Cc: Renaud Barbier, Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-02 12:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-02 12:03 [PATCH] ppc: fix missing cache maintenance before mapping uncached Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox