Excerpts from Christophe Leroy's message of December 20, 2020 9:43 pm: > > > Le 20/12/2020 à 00:48, Nicholas Piggin a écrit : >> This allows some nest MMU features to be compiled away if coprocessor >> support is not selected. >> >> Signed-off-by: Nicholas Piggin <npig...@gmail.com> >> --- >> arch/powerpc/Kconfig | 1 + >> arch/powerpc/include/asm/book3s/64/mmu.h | 2 ++ >> arch/powerpc/include/asm/book3s/64/tlbflush.h | 2 ++ >> arch/powerpc/include/asm/mmu_context.h | 5 +++-- >> arch/powerpc/platforms/Kconfig | 3 +++ >> arch/powerpc/platforms/powernv/Kconfig | 1 + >> 6 files changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig >> index ae7391627054..4376bf4c53b4 100644 >> --- a/arch/powerpc/Kconfig >> +++ b/arch/powerpc/Kconfig >> @@ -888,6 +888,7 @@ config PPC_PROT_SAO_LPAR >> >> config PPC_COPRO_BASE >> bool >> + select PPC_NMMU if PPC_BOOK3S_64 >> >> config SCHED_SMT >> bool "SMT (Hyperthreading) scheduler support" >> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h >> b/arch/powerpc/include/asm/book3s/64/mmu.h >> index 995bbcdd0ef8..07850d68a624 100644 >> --- a/arch/powerpc/include/asm/book3s/64/mmu.h >> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h >> @@ -103,8 +103,10 @@ typedef struct { >> /* Number of bits in the mm_cpumask */ >> atomic_t active_cpus; >> >> +#ifdef CONFIG_PPC_NMMU >> /* Number of users of the external (Nest) MMU */ >> atomic_t copros; >> +#endif >> >> /* Number of user space windows opened in process mm_context */ >> atomic_t vas_windows; >> diff --git a/arch/powerpc/include/asm/book3s/64/tlbflush.h >> b/arch/powerpc/include/asm/book3s/64/tlbflush.h >> index 0a7431e954c6..c70a82851f78 100644 >> --- a/arch/powerpc/include/asm/book3s/64/tlbflush.h >> +++ b/arch/powerpc/include/asm/book3s/64/tlbflush.h >> @@ -16,8 +16,10 @@ enum { >> >> static inline bool mm_has_nmmu(struct mm_struct *mm) >> { >> +#ifdef CONFIG_PPC_NMMU >> if (unlikely(atomic_read(&mm->context.copros) > 0)) >> return true; >> +#endif >> return false; >> } >> >> diff --git a/arch/powerpc/include/asm/mmu_context.h >> b/arch/powerpc/include/asm/mmu_context.h >> index d5821834dba9..53eac0cc4929 100644 >> --- a/arch/powerpc/include/asm/mmu_context.h >> +++ b/arch/powerpc/include/asm/mmu_context.h >> @@ -143,6 +143,7 @@ static inline void dec_mm_active_cpus(struct mm_struct >> *mm) >> atomic_dec(&mm->context.active_cpus); >> } >> >> +#ifdef CONFIG_PPC_NMMU >> static inline void mm_context_add_copro(struct mm_struct *mm) >> { >> /* >> @@ -187,6 +188,7 @@ static inline void mm_context_remove_copro(struct >> mm_struct *mm) >> dec_mm_active_cpus(mm); >> } >> } >> +#endif >> >> /* >> * vas_windows counter shows number of open windows in the mm >> @@ -218,8 +220,7 @@ static inline void mm_context_remove_vas_window(struct >> mm_struct *mm) >> #else >> static inline void inc_mm_active_cpus(struct mm_struct *mm) { } >> static inline void dec_mm_active_cpus(struct mm_struct *mm) { } >> -static inline void mm_context_add_copro(struct mm_struct *mm) { } >> -static inline void mm_context_remove_copro(struct mm_struct *mm) { } > > Are you sure you can remove those ? > If so, I think it belongs to another patch, I can't see how the new PPC_NMMU > would allow that by itself.
Yeah possibly a separate patch. Nothing except 64s should compile such code though, I think? Thanks, Nick