From: Yang Shi <yang@os.amperecomputing.com>
To: catalin.marinas@arm.com, will@kernel.org
Cc: cl@gentwo.org, scott@os.amperecomputing.com,
yang@os.amperecomputing.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] arm64: cpufeature: workaround AmpereOne FEAT_BBM level 2
Date: Mon, 18 Nov 2024 10:16:10 -0800 [thread overview]
Message-ID: <20241118181711.962576-4-yang@os.amperecomputing.com> (raw)
In-Reply-To: <20241118181711.962576-1-yang@os.amperecomputing.com>
FEAT_BBM level 2 is not advertised on AmpereOne because of a bug when
collapsing stage 2 mappings from smaller to larger translations. That
doesn't impact splitting stage 1 mappings (whether stage 2 is enabled or
not), so workaround it by detecting CPUID.
Signed-off-by: Yang Shi <yang@os.amperecomputing.com>
---
arch/arm64/include/asm/cpufeature.h | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index c7ca5f9f88bb..d9b20eb43d31 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -847,10 +847,19 @@ static inline bool bbmlv2_available(void)
{
u64 mmfr2;
u32 bbm;
+ static const struct midr_range ampereone[] = {
+ MIDR_ALL_VERSIONS(MIDR_AMPERE1),
+ MIDR_ALL_VERSIONS(MIDR_AMPERE1A),
+ {}
+ };
mmfr2 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR2_EL1);
bbm = cpuid_feature_extract_unsigned_field(mmfr2, ID_AA64MMFR2_EL1_BBM_SHIFT);
- return bbm == ID_AA64MMFR2_EL1_BBM_2;
+ if ((bbm == ID_AA64MMFR2_EL1_BBM_2) ||
+ is_midr_in_range_list(read_cpuid_id(), ampereone))
+ return true;
+
+ return false;
}
int do_emulate_mrs(struct pt_regs *regs, u32 sys_reg, u32 rt);
--
2.41.0
next prev parent reply other threads:[~2024-11-18 18:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 18:16 [RFC PATCH 0/3] arm64: support FEAT_BBM level 2 and large block mapping when rodata=full Yang Shi
2024-11-18 18:16 ` [PATCH 1/3] arm64: cpufeature: detect FEAT_BBM level 2 Yang Shi
2024-11-18 18:16 ` [PATCH 2/3] arm64: mm: support large block mapping when rodata=full Yang Shi
2024-11-18 18:16 ` Yang Shi [this message]
2024-11-18 18:33 ` [PATCH 3/3] arm64: cpufeature: workaround AmpereOne FEAT_BBM level 2 Christoph Lameter (Ampere)
2024-12-02 23:39 ` [RFC PATCH 0/3] arm64: support FEAT_BBM level 2 and large block mapping when rodata=full Yang Shi
2024-12-10 11:31 ` Will Deacon
2024-12-10 19:33 ` Yang Shi
2024-12-11 22:30 ` Will Deacon
2024-12-12 0:05 ` Yang Shi
2024-12-11 17:24 ` Christoph Lameter (Ampere)
2025-01-02 12:13 ` Jonathan Cameron
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=20241118181711.962576-4-yang@os.amperecomputing.com \
--to=yang@os.amperecomputing.com \
--cc=catalin.marinas@arm.com \
--cc=cl@gentwo.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=scott@os.amperecomputing.com \
--cc=will@kernel.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).