From 76824fb602198e6ee349080a638871436c6233ef Mon Sep 17 00:00:00 2001 From: Mihai Parparita Date: Wed, 31 Jul 2024 21:47:03 -0700 Subject: [PATCH] ppcmmu: skip over mode 1 entries when doing PAT flushes Mode 1 contains real addressing mode entries, which by definition cannot be using segment registers. By skipping over them, we can shave off a couple of seconds from the 10.2 boot time. --- cpu/ppc/ppcmmu.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cpu/ppc/ppcmmu.cpp b/cpu/ppc/ppcmmu.cpp index 0e056ef..c9682ce 100644 --- a/cpu/ppc/ppcmmu.cpp +++ b/cpu/ppc/ppcmmu.cpp @@ -797,21 +797,28 @@ static void tlb_flush_entries(std::array &tlb, TLBFlags type) { template void tlb_flush_entries(TLBFlags type) { - //TLBEntry *m1_tlb, *m2_tlb, *m3_tlb; - int i; - + // Mode 1 is real addressing and thus can't contain any PAT entries by definition. + bool flush_mode1 = type != TLBE_FROM_PAT; if (tlb_type == TLBType::ITLB) { - tlb_flush_entries(itlb1_mode1, type); + if (flush_mode1) { + tlb_flush_entries(itlb1_mode1, type); + } tlb_flush_entries(itlb1_mode2, type); tlb_flush_entries(itlb1_mode3, type); - tlb_flush_entries(itlb2_mode1, type); + if (flush_mode1) { + tlb_flush_entries(itlb2_mode1, type); + } tlb_flush_entries(itlb2_mode2, type); tlb_flush_entries(itlb2_mode3, type); } else { - tlb_flush_entries(dtlb1_mode1, type); + if (flush_mode1) { + tlb_flush_entries(dtlb1_mode1, type); + } tlb_flush_entries(dtlb1_mode2, type); tlb_flush_entries(dtlb1_mode3, type); - tlb_flush_entries(dtlb2_mode1, type); + if (flush_mode1) { + tlb_flush_entries(dtlb2_mode1, type); + } tlb_flush_entries(dtlb2_mode2, type); tlb_flush_entries(dtlb2_mode3, type); }