Skip to content

Commit 9080774

Browse files
brooniectmarinas
authored andcommitted
KVM: arm64: Hide SME system registers from guests
For the time being we do not support use of SME by KVM guests, support for this will be enabled in future. In order to prevent any side effects or side channels via the new system registers, including the EL0 read/write register TPIDR2, explicitly undefine all the system registers added by SME and mask out the SME bitfield in SYS_ID_AA64PFR1. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent e0838f6 commit 9080774

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,8 @@ static u64 read_id_reg(const struct kvm_vcpu *vcpu,
11321132
case SYS_ID_AA64PFR1_EL1:
11331133
if (!kvm_has_mte(vcpu->kvm))
11341134
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_MTE);
1135+
1136+
val &= ~ARM64_FEATURE_MASK(ID_AA64PFR1_SME);
11351137
break;
11361138
case SYS_ID_AA64ISAR1_EL1:
11371139
if (!vcpu_has_ptrauth(vcpu))
@@ -1553,7 +1555,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
15531555
ID_UNALLOCATED(4,2),
15541556
ID_UNALLOCATED(4,3),
15551557
ID_SANITISED(ID_AA64ZFR0_EL1),
1556-
ID_UNALLOCATED(4,5),
1558+
ID_HIDDEN(ID_AA64SMFR0_EL1),
15571559
ID_UNALLOCATED(4,6),
15581560
ID_UNALLOCATED(4,7),
15591561

@@ -1596,6 +1598,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
15961598

15971599
{ SYS_DESC(SYS_ZCR_EL1), NULL, reset_val, ZCR_EL1, 0, .visibility = sve_visibility },
15981600
{ SYS_DESC(SYS_TRFCR_EL1), undef_access },
1601+
{ SYS_DESC(SYS_SMPRI_EL1), undef_access },
1602+
{ SYS_DESC(SYS_SMCR_EL1), undef_access },
15991603
{ SYS_DESC(SYS_TTBR0_EL1), access_vm_reg, reset_unknown, TTBR0_EL1 },
16001604
{ SYS_DESC(SYS_TTBR1_EL1), access_vm_reg, reset_unknown, TTBR1_EL1 },
16011605
{ SYS_DESC(SYS_TCR_EL1), access_vm_reg, reset_val, TCR_EL1, 0 },
@@ -1678,8 +1682,10 @@ static const struct sys_reg_desc sys_reg_descs[] = {
16781682

16791683
{ SYS_DESC(SYS_CCSIDR_EL1), access_ccsidr },
16801684
{ SYS_DESC(SYS_CLIDR_EL1), access_clidr },
1685+
{ SYS_DESC(SYS_SMIDR_EL1), undef_access },
16811686
{ SYS_DESC(SYS_CSSELR_EL1), access_csselr, reset_unknown, CSSELR_EL1 },
16821687
{ SYS_DESC(SYS_CTR_EL0), access_ctr },
1688+
{ SYS_DESC(SYS_SVCR_EL0), undef_access },
16831689

16841690
{ PMU_SYS_REG(SYS_PMCR_EL0), .access = access_pmcr,
16851691
.reset = reset_pmcr, .reg = PMCR_EL0 },
@@ -1719,6 +1725,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
17191725

17201726
{ SYS_DESC(SYS_TPIDR_EL0), NULL, reset_unknown, TPIDR_EL0 },
17211727
{ SYS_DESC(SYS_TPIDRRO_EL0), NULL, reset_unknown, TPIDRRO_EL0 },
1728+
{ SYS_DESC(SYS_TPIDR2_EL0), undef_access },
17221729

17231730
{ SYS_DESC(SYS_SCXTNUM_EL0), undef_access },
17241731

0 commit comments

Comments
 (0)