From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <james.hogan@imgtec.com>,
Paul Burton <paul.burton@imgtec.com>,
"Maciej W. Rozycki" <macro@imgtec.com>,
"Joshua Kinard" <kumba@gentoo.org>,
<linux-kernel@vger.kernel.org>,
Markos Chandras <markos.chandras@imgtec.com>
Subject: [PATCH v2 01/13] MIPS: Separate XPA CPU feature into LPA and MVH
Date: Mon, 18 Apr 2016 10:35:21 +0100 [thread overview]
Message-ID: <1460972133-16973-2-git-send-email-paul.burton@imgtec.com> (raw)
In-Reply-To: <1460972133-16973-1-git-send-email-paul.burton@imgtec.com>
From: James Hogan <james.hogan@imgtec.com>
XPA (eXtended Physical Addressing) should be detected as a combination
of two architectural features:
- Large Physical Address (as per Config3.LPA). With XPA this will be set
on MIPS32r5 cores, but it may also be set for MIPS64r2 cores too.
- MTHC0/MFHC0 instructions (as per Config5.MVH). With XPA this will be
set, but it may also be set in VZ guest context even when Config3.LPA
in the guest context has been cleared by the hypervisor.
As such, XPA is only usable if both bits are set. Update CPU features to
separate these two features, with cpu_has_xpa requiring both to be set.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
Changes in v2: None
arch/mips/include/asm/cpu-features.h | 8 +++++++-
arch/mips/include/asm/cpu.h | 3 ++-
arch/mips/kernel/cpu-probe.c | 6 +++---
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index eeec8c8..3993a35 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -142,8 +142,14 @@
# endif
#endif
+#ifndef cpu_has_lpa
+#define cpu_has_lpa (cpu_data[0].options & MIPS_CPU_LPA)
+#endif
+#ifndef cpu_has_mvh
+#define cpu_has_mvh (cpu_data[0].options & MIPS_CPU_MVH)
+#endif
#ifndef cpu_has_xpa
-#define cpu_has_xpa (cpu_data[0].options & MIPS_CPU_XPA)
+#define cpu_has_xpa (cpu_has_lpa && cpu_has_mvh)
#endif
#ifndef cpu_has_vtag_icache
#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index a97ca97..32fa061 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -381,13 +381,14 @@ enum cpu_type_enum {
#define MIPS_CPU_MAAR 0x400000000ull /* MAAR(I) registers are present */
#define MIPS_CPU_FRE 0x800000000ull /* FRE & UFE bits implemented */
#define MIPS_CPU_RW_LLB 0x1000000000ull /* LLADDR/LLB writes are allowed */
-#define MIPS_CPU_XPA 0x2000000000ull /* CPU supports Extended Physical Addressing */
+#define MIPS_CPU_LPA 0x2000000000ull /* CPU supports Large Physical Addressing */
#define MIPS_CPU_CDMM 0x4000000000ull /* CPU has Common Device Memory Map */
#define MIPS_CPU_BP_GHIST 0x8000000000ull /* R12K+ Branch Prediction Global History */
#define MIPS_CPU_SP 0x10000000000ull /* Small (1KB) page support */
#define MIPS_CPU_FTLB 0x20000000000ull /* CPU has Fixed-page-size TLB */
#define MIPS_CPU_NAN_LEGACY 0x40000000000ull /* Legacy NaN implemented */
#define MIPS_CPU_NAN_2008 0x80000000000ull /* 2008 NaN implemented */
+#define MIPS_CPU_MVH 0x100000000000ull /* CPU supports MFHC0/MTHC0 */
/*
* CPU ASE encodings
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index b725b71..da21fbe 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -685,6 +685,8 @@ static inline unsigned int decode_config3(struct cpuinfo_mips *c)
c->options |= MIPS_CPU_VINT;
if (config3 & MIPS_CONF3_VEIC)
c->options |= MIPS_CPU_VEIC;
+ if (config3 & MIPS_CONF3_LPA)
+ c->options |= MIPS_CPU_LPA;
if (config3 & MIPS_CONF3_MT)
c->ases |= MIPS_ASE_MIPSMT;
if (config3 & MIPS_CONF3_ULRI)
@@ -792,10 +794,8 @@ static inline unsigned int decode_config5(struct cpuinfo_mips *c)
c->options |= MIPS_CPU_MAAR;
if (config5 & MIPS_CONF5_LLB)
c->options |= MIPS_CPU_RW_LLB;
-#ifdef CONFIG_XPA
if (config5 & MIPS_CONF5_MVH)
- c->options |= MIPS_CPU_XPA;
-#endif
+ c->options |= MIPS_CPU_MVH;
return config5 & MIPS_CONF_M;
}
--
2.8.0
next parent reply other threads:[~2016-04-18 9:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1460972133-16973-1-git-send-email-paul.burton@imgtec.com>
2016-04-18 9:35 ` Paul Burton [this message]
2016-04-18 9:35 ` [PATCH v2 02/13] MIPS: Fix HTW config on XPA kernel without LPA enabled Paul Burton
2016-04-18 9:35 ` [PATCH v2 03/13] MIPS: Remove redundant asm/pgtable-bits.h inclusions Paul Burton
2016-04-18 12:36 ` Sergei Shtylyov
2016-04-18 9:35 ` [PATCH v2 04/13] MIPS: Use enums to make asm/pgtable-bits.h readable Paul Burton
2016-04-18 9:35 ` [PATCH v2 06/13] MIPS: mm: Unify pte_page definition Paul Burton
2016-04-18 9:35 ` [PATCH v2 08/13] MIPS: mm: Don't clobber $1 on XPA TLB refill Paul Burton
2016-04-18 9:35 ` [PATCH v2 09/13] MIPS: mm: Pass scratch register through to iPTE_SW Paul Burton
2016-04-18 9:35 ` [PATCH v2 10/13] MIPS: mm: Be more explicit about PTE mode bit handling Paul Burton
2016-04-18 9:35 ` [PATCH v2 11/13] MIPS: mm: Simplify build_update_entries Paul Burton
2016-04-18 9:35 ` [PATCH v2 12/13] MIPS: mm: Don't do MTHC0 if XPA not present Paul Burton
2016-04-18 9:35 ` [PATCH v2 13/13] MIPS: mm: Panic if an XPA kernel is run without RIXI Paul Burton
2016-04-18 10:04 ` James Hogan
[not found] ` <1460972133-16973-8-git-send-email-paul.burton@imgtec.com>
2016-04-18 14:34 ` [PATCH v2 07/13] MIPS: mm: Fix MIPS32 36b physical addressing (alchemy, netlogic) Manuel Lauss
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=1460972133-16973-2-git-send-email-paul.burton@imgtec.com \
--to=paul.burton@imgtec.com \
--cc=james.hogan@imgtec.com \
--cc=kumba@gentoo.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=macro@imgtec.com \
--cc=markos.chandras@imgtec.com \
--cc=ralf@linux-mips.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
all inboxes | Powered by JetHome®