git: 3ca70c59b847 - main - powerpc/pmap: Add a minimum TID width

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Sat, 12 Sep 2026 15:04:37 UTC
The branch main has been updated by jhibbits:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ca70c59b8472134e61849478ef15202e2ea1116

commit 3ca70c59b8472134e61849478ef15202e2ea1116
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2026-07-04 04:34:08 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2026-09-12 15:04:22 +0000

    powerpc/pmap: Add a minimum TID width
    
    QEMU doesn't appear to emulate the MMUCFG register for Book-E CPUs, so
    give a sane small default of 7, for an 8 bit PID register.
---
 sys/powerpc/booke/pmap.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c
index 0b9eef628368..304e677cd49e 100644
--- a/sys/powerpc/booke/pmap.c
+++ b/sys/powerpc/booke/pmap.c
@@ -676,6 +676,8 @@ mmu_booke_bootstrap(vm_offset_t start, vm_offset_t kernelend)
 	 * tunable.  The tunable should be a power of 2.
 	 */
 	tid_bits = ((mfspr(SPR_MMUCFG) & MMUCFG_PIDSIZE_M) >> MMUCFG_PIDSIZE_S);
+	if (tid_bits == 0)
+		tid_bits = 7;
 	TUNABLE_INT_FETCH("machdep.tid_max", &tid_max);
 	if (tid_max <= 0)
 		tid_max = INT_MAX;