Re: [PATCH 4/5] powerpc: Define config option for processors without broadcast TLBIE
From: "Nicholas Piggin" <npiggin@gmail.com>
Date: 2025-01-29 06:14:37
On Wed Jan 29, 2025 at 8:53 AM AEST, Paul Mackerras wrote:
quoted hunk ↗ jump to hunk
Power ISA v3.1 implementations in the Linux Compliancy Subset and lower are not required to implement broadcast TLBIE, and in fact Microwatt doesn't. To avoid the need to specify "disable_tlbie" on the kernel command line on SMP Microwatt systems, this defines a config option that asserts that broadcast TLBIE should never be used (the kernel will instead use IPIs to trigger local TLBIEs on other CPUs when required). Signed-off-by: Paul Mackerras <redacted> --- arch/powerpc/mm/book3s64/pgtable.c | 10 ++++++++-- arch/powerpc/platforms/Kconfig.cputype | 12 ++++++++++++ arch/powerpc/platforms/microwatt/Kconfig | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)diff --git a/arch/powerpc/mm/book3s64/pgtable.c b/arch/powerpc/mm/book3s64/pgtable.c index 374542528080..14ee96e2a581 100644 --- a/arch/powerpc/mm/book3s64/pgtable.c +++ b/arch/powerpc/mm/book3s64/pgtable.c@@ -588,10 +588,16 @@ int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, } #endif +#ifndef CONFIG_PPC_RADIX_NO_BROADCAST_TLBIE
Hate to bikeshed, but would it be annoying to make this an affirmative option?
quoted hunk ↗ jump to hunk
+#define DEFAULT_TLBIE_ENABLE true +#else +#define DEFAULT_TLBIE_ENABLE false +#endif + /* * Does the CPU support tlbie? */ -bool tlbie_capable __read_mostly = true; +bool tlbie_capable __read_mostly = DEFAULT_TLBIE_ENABLE; EXPORT_SYMBOL(tlbie_capable); /*@@ -599,7 +605,7 @@ EXPORT_SYMBOL(tlbie_capable); * address spaces? tlbie may still be used for nMMU accelerators, and for KVM * guest address spaces. */ -bool tlbie_enabled __read_mostly = true; +bool tlbie_enabled __read_mostly = DEFAULT_TLBIE_ENABLE; static int __init setup_disable_tlbie(char *str) {diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index 1453ccc900c4..bd2a4e46ab34 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype@@ -449,6 +449,18 @@ config PPC_RADIX_MMU_DEFAULT If you're unsure, say Y. +config PPC_RADIX_NO_BROADCAST_TLBIE + depends on PPC_RADIX_MMU + help + Power ISA v3.1 implementations in the Linux Compliancy Subset + and lower are not required to implement broadcast TLBIE + instructions, that is, a TLB invalidation instruction + performed on one CPU is not required to operate on the TLBs + in all CPUs in the system. Instead, the kernel does an IPI + to each relevant CPU to get it to do a local TLBIE instruction. + Select this option to force global invalidations to be done via + IPIs unconditionally.
... when using radix MMU. Hash MMU requires broadcast TLBIE. Nitpicks aside, looks okay to me. Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
quoted hunk ↗ jump to hunk
+ config PPC_KERNEL_PREFIXED depends on PPC_HAVE_PREFIXED_SUPPORT depends on CC_HAS_PREFIXEDdiff --git a/arch/powerpc/platforms/microwatt/Kconfig b/arch/powerpc/platforms/microwatt/Kconfig index 5e41adadac1f..1d5cc1ae3636 100644 --- a/arch/powerpc/platforms/microwatt/Kconfig +++ b/arch/powerpc/platforms/microwatt/Kconfig@@ -7,6 +7,7 @@ config PPC_MICROWATT select PPC_ICP_NATIVE select PPC_UDBG_16550 select COMMON_CLK + select PPC_RADIX_NO_BROADCAST_TLBIE help This option enables support for FPGA-based Microwatt implementations.