From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [RFC PATCH 3/5] powerpc/64s: add CONFIG_PPC_NMMU for nest MMU support
Date: Sun, 20 Dec 2020 09:48:11 +1000 [thread overview]
Message-ID: <20201219234813.830747-4-npiggin@gmail.com> (raw)
In-Reply-To: <20201219234813.830747-1-npiggin@gmail.com>
This allows some nest MMU features to be compiled away if coprocessor
support is not selected.
Signed-off-by: Nicholas Piggin <npiggin@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
next prev parent reply other threads:[~2020-12-19 23:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-19 23:48 [RFC PATCH 0/5] powerpc/64s/radix: Use non-atomic ops for PTE Nicholas Piggin
2020-12-19 23:48 ` [RFC PATCH 1/5] powerpc/64s: update_mmu_cache inline the radix test Nicholas Piggin
2020-12-20 11:37 ` Christophe Leroy
2020-12-22 3:32 ` Nicholas Piggin
2020-12-19 23:48 ` [RFC PATCH 2/5] powerpc/64s: implement mm_nmmu_has_tlbs Nicholas Piggin
2020-12-19 23:48 ` Nicholas Piggin [this message]
2020-12-20 11:43 ` [RFC PATCH 3/5] powerpc/64s: add CONFIG_PPC_NMMU for nest MMU support Christophe Leroy
2020-12-22 3:37 ` Nicholas Piggin
2020-12-19 23:48 ` [RFC PATCH 4/5] powerpc/64s/radix: implement complete radix__ptep_get_and_clear_full Nicholas Piggin
2020-12-19 23:48 ` [RFC PATCH 5/5] powerpc/64s/radix: Use non-atomic PTE updates if the MMU does not modify the PTE Nicholas Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201219234813.830747-4-npiggin@gmail.com \
--to=npiggin@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).