Skip to content

Commit 8810d7f

Browse files
Niklas Casselpalmer-dabbelt
authored andcommitted
riscv: Don't output a bogus mmu-type on a no MMU kernel
Currently on a 64-bit kernel built without CONFIG_MMU, /proc/cpuinfo will show the current MMU mode as sv57. While the device tree property "mmu-type" does have a value "riscv,none" to describe a CPU without a MMU, since commit 73c7c8f ("riscv: Use pgtable_l4_enabled to output mmu_type in cpuinfo"), we no longer rely on device tree to output the MMU mode. (Not even for CONFIG_32BIT.) Therefore, instead of readding code to look at the "mmu-type" device tree property, let's continue with the existing convention to use fixed values for configurations where we don't determine the MMU mode at runtime. Add a new fixed value for !CONFIG_MMU in order to output the correct MMU mode in cpuinfo. Signed-off-by: Niklas Cassel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 4420658 commit 8810d7f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/riscv/kernel/cpu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static void print_mmu(struct seq_file *f)
139139
{
140140
char sv_type[16];
141141

142+
#ifdef CONFIG_MMU
142143
#if defined(CONFIG_32BIT)
143144
strncpy(sv_type, "sv32", 5);
144145
#elif defined(CONFIG_64BIT)
@@ -149,6 +150,9 @@ static void print_mmu(struct seq_file *f)
149150
else
150151
strncpy(sv_type, "sv39", 5);
151152
#endif
153+
#else
154+
strncpy(sv_type, "none", 5);
155+
#endif /* CONFIG_MMU */
152156
seq_printf(f, "mmu\t\t: %s\n", sv_type);
153157
}
154158

0 commit comments

Comments
 (0)