Last active
June 28, 2022 22:01
-
-
Save gnattu/c114091013cac6a6c36394c7a572281c to your computer and use it in GitHub Desktop.
Remove ID_AA64ISAR2_EL1 support from Linux 5.17 for VMware Fusion on Apple Silicon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 82436c04ef3f9cacf1d19b2634d6bb50a27607ed Mon Sep 17 00:00:00 2001 | |
From: gnattu <[email protected]> | |
Date: Tue, 12 Apr 2022 16:08:12 +0800 | |
Subject: [PATCH 1/3] Revert "arm64: add ID_AA64ISAR2_EL1 sys register" | |
This reverts commit 9e45365f1469ef2b934f9d035975dbc9ad352116. | |
--- | |
arch/arm64/include/asm/cpu.h | 1 - | |
arch/arm64/include/asm/sysreg.h | 16 ---------------- | |
arch/arm64/kernel/cpufeature.c | 11 ----------- | |
arch/arm64/kernel/cpuinfo.c | 1 - | |
arch/arm64/kvm/sys_regs.c | 2 +- | |
5 files changed, 1 insertion(+), 30 deletions(-) | |
diff --git a/arch/arm64/include/asm/cpu.h b/arch/arm64/include/asm/cpu.h | |
index a58e366f0b07..0f6d16faa540 100644 | |
--- a/arch/arm64/include/asm/cpu.h | |
+++ b/arch/arm64/include/asm/cpu.h | |
@@ -51,7 +51,6 @@ struct cpuinfo_arm64 { | |
u64 reg_id_aa64dfr1; | |
u64 reg_id_aa64isar0; | |
u64 reg_id_aa64isar1; | |
- u64 reg_id_aa64isar2; | |
u64 reg_id_aa64mmfr0; | |
u64 reg_id_aa64mmfr1; | |
u64 reg_id_aa64mmfr2; | |
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h | |
index 932d45b17877..db481c991ffe 100644 | |
--- a/arch/arm64/include/asm/sysreg.h | |
+++ b/arch/arm64/include/asm/sysreg.h | |
@@ -182,7 +182,6 @@ | |
#define SYS_ID_AA64ISAR0_EL1 sys_reg(3, 0, 0, 6, 0) | |
#define SYS_ID_AA64ISAR1_EL1 sys_reg(3, 0, 0, 6, 1) | |
-#define SYS_ID_AA64ISAR2_EL1 sys_reg(3, 0, 0, 6, 2) | |
#define SYS_ID_AA64MMFR0_EL1 sys_reg(3, 0, 0, 7, 0) | |
#define SYS_ID_AA64MMFR1_EL1 sys_reg(3, 0, 0, 7, 1) | |
@@ -772,21 +771,6 @@ | |
#define ID_AA64ISAR1_GPI_NI 0x0 | |
#define ID_AA64ISAR1_GPI_IMP_DEF 0x1 | |
-/* id_aa64isar2 */ | |
-#define ID_AA64ISAR2_CLEARBHB_SHIFT 28 | |
-#define ID_AA64ISAR2_RPRES_SHIFT 4 | |
-#define ID_AA64ISAR2_WFXT_SHIFT 0 | |
- | |
-#define ID_AA64ISAR2_RPRES_8BIT 0x0 | |
-#define ID_AA64ISAR2_RPRES_12BIT 0x1 | |
-/* | |
- * Value 0x1 has been removed from the architecture, and is | |
- * reserved, but has not yet been removed from the ARM ARM | |
- * as of ARM DDI 0487G.b. | |
- */ | |
-#define ID_AA64ISAR2_WFXT_NI 0x0 | |
-#define ID_AA64ISAR2_WFXT_SUPPORTED 0x2 | |
- | |
/* id_aa64pfr0 */ | |
#define ID_AA64PFR0_CSV3_SHIFT 60 | |
#define ID_AA64PFR0_CSV2_SHIFT 56 | |
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c | |
index d33687673f6b..3f25f45a21ec 100644 | |
--- a/arch/arm64/kernel/cpufeature.c | |
+++ b/arch/arm64/kernel/cpufeature.c | |
@@ -230,12 +230,6 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { | |
ARM64_FTR_END, | |
}; | |
-static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { | |
- ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_HIGHER_SAFE, ID_AA64ISAR2_CLEARBHB_SHIFT, 4, 0), | |
- ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_RPRES_SHIFT, 4, 0), | |
- ARM64_FTR_END, | |
-}; | |
- | |
static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { | |
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_CSV3_SHIFT, 4, 0), | |
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_CSV2_SHIFT, 4, 0), | |
@@ -649,7 +643,6 @@ static const struct __ftr_reg_entry { | |
ARM64_FTR_REG(SYS_ID_AA64ISAR0_EL1, ftr_id_aa64isar0), | |
ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR1_EL1, ftr_id_aa64isar1, | |
&id_aa64isar1_override), | |
- ARM64_FTR_REG(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2), | |
/* Op1 = 0, CRn = 0, CRm = 7 */ | |
ARM64_FTR_REG(SYS_ID_AA64MMFR0_EL1, ftr_id_aa64mmfr0), | |
@@ -946,7 +939,6 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info) | |
init_cpu_ftr_reg(SYS_ID_AA64DFR1_EL1, info->reg_id_aa64dfr1); | |
init_cpu_ftr_reg(SYS_ID_AA64ISAR0_EL1, info->reg_id_aa64isar0); | |
init_cpu_ftr_reg(SYS_ID_AA64ISAR1_EL1, info->reg_id_aa64isar1); | |
- init_cpu_ftr_reg(SYS_ID_AA64ISAR2_EL1, info->reg_id_aa64isar2); | |
init_cpu_ftr_reg(SYS_ID_AA64MMFR0_EL1, info->reg_id_aa64mmfr0); | |
init_cpu_ftr_reg(SYS_ID_AA64MMFR1_EL1, info->reg_id_aa64mmfr1); | |
init_cpu_ftr_reg(SYS_ID_AA64MMFR2_EL1, info->reg_id_aa64mmfr2); | |
@@ -1165,8 +1157,6 @@ void update_cpu_features(int cpu, | |
info->reg_id_aa64isar0, boot->reg_id_aa64isar0); | |
taint |= check_update_ftr_reg(SYS_ID_AA64ISAR1_EL1, cpu, | |
info->reg_id_aa64isar1, boot->reg_id_aa64isar1); | |
- taint |= check_update_ftr_reg(SYS_ID_AA64ISAR2_EL1, cpu, | |
- info->reg_id_aa64isar2, boot->reg_id_aa64isar2); | |
/* | |
* Differing PARange support is fine as long as all peripherals and | |
@@ -1288,7 +1278,6 @@ u64 __read_sysreg_by_encoding(u32 sys_id) | |
read_sysreg_case(SYS_ID_AA64MMFR2_EL1); | |
read_sysreg_case(SYS_ID_AA64ISAR0_EL1); | |
read_sysreg_case(SYS_ID_AA64ISAR1_EL1); | |
- read_sysreg_case(SYS_ID_AA64ISAR2_EL1); | |
read_sysreg_case(SYS_CNTFRQ_EL0); | |
read_sysreg_case(SYS_CTR_EL0); | |
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c | |
index 591c18a889a5..7aafd72a18ff 100644 | |
--- a/arch/arm64/kernel/cpuinfo.c | |
+++ b/arch/arm64/kernel/cpuinfo.c | |
@@ -393,7 +393,6 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) | |
info->reg_id_aa64dfr1 = read_cpuid(ID_AA64DFR1_EL1); | |
info->reg_id_aa64isar0 = read_cpuid(ID_AA64ISAR0_EL1); | |
info->reg_id_aa64isar1 = read_cpuid(ID_AA64ISAR1_EL1); | |
- info->reg_id_aa64isar2 = read_cpuid(ID_AA64ISAR2_EL1); | |
info->reg_id_aa64mmfr0 = read_cpuid(ID_AA64MMFR0_EL1); | |
info->reg_id_aa64mmfr1 = read_cpuid(ID_AA64MMFR1_EL1); | |
info->reg_id_aa64mmfr2 = read_cpuid(ID_AA64MMFR2_EL1); | |
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c | |
index 4dc2fba316ff..e3ec1a44f94d 100644 | |
--- a/arch/arm64/kvm/sys_regs.c | |
+++ b/arch/arm64/kvm/sys_regs.c | |
@@ -1525,7 +1525,7 @@ static const struct sys_reg_desc sys_reg_descs[] = { | |
/* CRm=6 */ | |
ID_SANITISED(ID_AA64ISAR0_EL1), | |
ID_SANITISED(ID_AA64ISAR1_EL1), | |
- ID_SANITISED(ID_AA64ISAR2_EL1), | |
+ ID_UNALLOCATED(6,2), | |
ID_UNALLOCATED(6,3), | |
ID_UNALLOCATED(6,4), | |
ID_UNALLOCATED(6,5), | |
-- | |
2.32.0 (Apple Git-132) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 9d99dcdd767f25d79e2dddcd082f0b172412aaa7 Mon Sep 17 00:00:00 2001 | |
From: gnattu <[email protected]> | |
Date: Tue, 12 Apr 2022 16:28:32 +0800 | |
Subject: [PATCH 2/3] arm64: use dummy function to mock unsupported register | |
--- | |
arch/arm64/include/asm/cpufeature.h | 10 +--------- | |
1 file changed, 1 insertion(+), 9 deletions(-) | |
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h | |
index a77b5f49b3a6..d7afee3ab8fe 100644 | |
--- a/arch/arm64/include/asm/cpufeature.h | |
+++ b/arch/arm64/include/asm/cpufeature.h | |
@@ -655,15 +655,7 @@ static inline bool supports_csv2p3(int scope) | |
static inline bool supports_clearbhb(int scope) | |
{ | |
- u64 isar2; | |
- | |
- if (scope == SCOPE_LOCAL_CPU) | |
- isar2 = read_sysreg_s(SYS_ID_AA64ISAR2_EL1); | |
- else | |
- isar2 = read_sanitised_ftr_reg(SYS_ID_AA64ISAR2_EL1); | |
- | |
- return cpuid_feature_extract_unsigned_field(isar2, | |
- ID_AA64ISAR2_CLEARBHB_SHIFT); | |
+ return false; | |
} | |
const struct cpumask *system_32bit_el0_cpumask(void); | |
-- | |
2.32.0 (Apple Git-132) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat 0003-remove-unsupported-registers.patch | |
From 73311980efd7c56016f86cda67c2319005a9ede5 Mon Sep 17 00:00:00 2001 | |
From: gnattu <[email protected]> | |
Date: Tue, 12 Apr 2022 16:35:26 +0800 | |
Subject: [PATCH 3/3] arm64: remove unsupported registers | |
--- | |
arch/arm64/kernel/cpufeature.c | 1 - | |
1 file changed, 1 deletion(-) | |
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c | |
index 3f25f45a21ec..fe14019730cd 100644 | |
--- a/arch/arm64/kernel/cpufeature.c | |
+++ b/arch/arm64/kernel/cpufeature.c | |
@@ -2492,7 +2492,6 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = { | |
#endif /* CONFIG_ARM64_MTE */ | |
HWCAP_CAP(SYS_ID_AA64MMFR0_EL1, ID_AA64MMFR0_ECV_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ECV), | |
HWCAP_CAP(SYS_ID_AA64MMFR1_EL1, ID_AA64MMFR1_AFP_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_AFP), | |
- HWCAP_CAP(SYS_ID_AA64ISAR2_EL1, ID_AA64ISAR2_RPRES_SHIFT, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_RPRES), | |
{}, | |
}; | |
-- | |
2.32.0 (Apple Git-132) |
This patch is working fine on as of 5.17.3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recent Linux kernel adds support to read
ID_AA64ISAR2_EL1
register with traps into the hypervisor, treating it as faults on M1, making the VM not bootable. QEMU and Parallels already applied patches to fix this, but VMware is not updating. This gist is for people that:This patch set has very dirty workarounds, so use it at your own risk.
This works for me to boot 5.17 on VMware Fusion.