Skip to content

Commit 9dfbf78

Browse files
Madhavan Srinivasanmpe
authored andcommitted
powerpc/64s: Default l1d_size to 64K in RFI fallback flush
If there is no d-cache-size property in the device tree, l1d_size could be zero. We don't actually expect that to happen, it's only been seen on mambo (simulator) in some configurations. A zero-size l1d_size leads to the loop in the asm wrapping around to 2^64-1, and then walking off the end of the fallback area and eventually causing a page fault which is fatal. Just default to 64K which is correct on some CPUs, and sane enough to not cause a crash on others. Fixes: aa8a5e0 ('powerpc/64s: Add support for RFI flush of L1-D cache') Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> [mpe: Rewrite comment and change log] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent b885858 commit 9dfbf78

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

arch/powerpc/kernel/setup_64.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,17 @@ static void __ref init_fallback_flush(void)
890890
return;
891891

892892
l1d_size = ppc64_caches.l1d.size;
893+
894+
/*
895+
* If there is no d-cache-size property in the device tree, l1d_size
896+
* could be zero. That leads to the loop in the asm wrapping around to
897+
* 2^64-1, and then walking off the end of the fallback area and
898+
* eventually causing a page fault which is fatal. Just default to
899+
* something vaguely sane.
900+
*/
901+
if (!l1d_size)
902+
l1d_size = (64 * 1024);
903+
893904
limit = min(ppc64_bolted_size(), ppc64_rma_size);
894905

895906
/*

0 commit comments

Comments
 (0)