Skip to content

Commit ed4ffaf

Browse files
author
Marc Zyngier
committed
KVM: arm64: Handle SCXTNUM_ELx traps
As the kernel never sets HCR_EL2.EnSCXT, accesses to SCXTNUM_ELx will trap to EL2. Let's handle that as gracefully as possible by injecting an UNDEF exception into the guest. This is consistent with the guest's view of ID_AA64PFR0_EL1.CSV2 being at most 1. Signed-off-by: Marc Zyngier <[email protected]> Acked-by: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 338b179 commit ed4ffaf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@
372372
#define SYS_CONTEXTIDR_EL1 sys_reg(3, 0, 13, 0, 1)
373373
#define SYS_TPIDR_EL1 sys_reg(3, 0, 13, 0, 4)
374374

375+
#define SYS_SCXTNUM_EL1 sys_reg(3, 0, 13, 0, 7)
376+
375377
#define SYS_CNTKCTL_EL1 sys_reg(3, 0, 14, 1, 0)
376378

377379
#define SYS_CCSIDR_EL1 sys_reg(3, 1, 0, 0, 0)
@@ -404,6 +406,8 @@
404406
#define SYS_TPIDR_EL0 sys_reg(3, 3, 13, 0, 2)
405407
#define SYS_TPIDRRO_EL0 sys_reg(3, 3, 13, 0, 3)
406408

409+
#define SYS_SCXTNUM_EL0 sys_reg(3, 3, 13, 0, 7)
410+
407411
/* Definitions for system register interface to AMU for ARMv8.4 onwards */
408412
#define SYS_AM_EL0(crm, op2) sys_reg(3, 3, 13, (crm), (op2))
409413
#define SYS_AMCR_EL0 SYS_AM_EL0(2, 0)

arch/arm64/kvm/sys_regs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,6 +1598,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
15981598
{ SYS_DESC(SYS_CONTEXTIDR_EL1), access_vm_reg, reset_val, CONTEXTIDR_EL1, 0 },
15991599
{ SYS_DESC(SYS_TPIDR_EL1), NULL, reset_unknown, TPIDR_EL1 },
16001600

1601+
{ SYS_DESC(SYS_SCXTNUM_EL1), undef_access },
1602+
16011603
{ SYS_DESC(SYS_CNTKCTL_EL1), NULL, reset_val, CNTKCTL_EL1, 0},
16021604

16031605
{ SYS_DESC(SYS_CCSIDR_EL1), access_ccsidr },
@@ -1626,6 +1628,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
16261628
{ SYS_DESC(SYS_TPIDR_EL0), NULL, reset_unknown, TPIDR_EL0 },
16271629
{ SYS_DESC(SYS_TPIDRRO_EL0), NULL, reset_unknown, TPIDRRO_EL0 },
16281630

1631+
{ SYS_DESC(SYS_SCXTNUM_EL0), undef_access },
1632+
16291633
{ SYS_DESC(SYS_AMCR_EL0), undef_access },
16301634
{ SYS_DESC(SYS_AMCFGR_EL0), undef_access },
16311635
{ SYS_DESC(SYS_AMCGCR_EL0), undef_access },

0 commit comments

Comments
 (0)