[RFC PATCH 3/5] powerpc/64s: add CONFIG_PPC_NMMU for nest MMU support
Nicholas Piggin
npiggin at gmail.com
Sun Dec 20 10:48:11 AEDT 2020
This allows some nest MMU features to be compiled away if coprocessor
support is not selected.
Signed-off-by: Nicholas Piggin <npiggin at 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) { }
+static inline bool mm_has_nmmu(struct mm_struct *mm) { return false; }
#endif
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 7a5e8f4541e3..b4b04b3f98d1 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -191,6 +191,9 @@ config PPC_INDIRECT_MMIO
config PPC_IO_WORKAROUNDS
bool
+config PPC_NMMU
+ bool
+
source "drivers/cpufreq/Kconfig"
menu "CPUIdle driver"
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 619b093a0657..145009d74457 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -36,6 +36,7 @@ config PPC_MEMTRACE
config PPC_VAS
bool "IBM Virtual Accelerator Switchboard (VAS)"
depends on PPC_POWERNV && PPC_64K_PAGES
+ select PPC_NMMU
default y
help
This enables support for IBM Virtual Accelerator Switchboard (VAS).
--
2.23.0
More information about the Linuxppc-dev
mailing list