[PATCH] MIPS: tlb-r4k: Only apply 'ntlb' option to VTLB
From: Rong Zhang
Date: Mon Nov 09 2026 - 22:37:34 EST
FTLB entries cannot be wired and thus are inapplicable to the 'ntlb'
option.
Print a notice message when FTLB is enabled, and ignore any ntlb value
larger than the size of VTLB.
Fixes: 75b5b5e0a262 ("MIPS: Add support for FTLBs")
Signed-off-by: Rong Zhang <rongrong@xxxxxxxxxxxxxxxxx>
---
arch/mips/mm/tlb-r4k.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 78bafa317fa6..288fcfb8990a 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -839,8 +839,17 @@ void tlb_init(void)
r4k_tlb_configure();
if (ntlb) {
- if (ntlb > 1 && ntlb <= current_cpu_data.tlbsize) {
- int wired = current_cpu_data.tlbsize - ntlb;
+ int tlbsize = current_cpu_data.tlbsize;
+
+ /* Disabling FTLB will suppress the message. */
+ if (current_cpu_data.tlbsizeftlbways && current_cpu_data.tlbsizeftlbsets) {
+ pr_notice("FTLB is enabled. The 'ntlb' option will only apply to VTLB\n");
+ pr_notice("Consult 'noftlb' to disable FTLB when desired\n");
+ tlbsize = current_cpu_data.tlbsizevtlb;
+ }
+
+ if (ntlb > 1 && ntlb <= tlbsize) {
+ int wired = tlbsize - ntlb;
write_c0_wired(wired);
write_c0_index(wired-1);
printk("Restricting TLB to %d entries\n", ntlb);
---
base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
change-id: f0ec6aac-mips-ntlb-only-vtlb-e1d248e397f7
Thanks,
Rong