Skip to content

Commit a661043

Browse files
author
Marc Zyngier
committed
KVM: arm64: Handle 32bit CNTPCTSS traps
When CNTPOFF isn't implemented and that we have a non-zero counter offset, CNTPCT and CNTPCTSS are trapped. We properly handle the former, but not the latter, as it is not present in the sysreg table (despite being actually handled in the code). Bummer. Just populate the cp15_64 table with the missing register. Reported-by: Reiji Watanabe <reijiw@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 2fe9e0f commit a661043

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

arch/arm64/include/asm/sysreg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@
403403
#define SYS_AARCH32_CNTP_CTL sys_reg(0, 0, 14, 2, 1)
404404
#define SYS_AARCH32_CNTPCT sys_reg(0, 0, 0, 14, 0)
405405
#define SYS_AARCH32_CNTP_CVAL sys_reg(0, 2, 0, 14, 0)
406+
#define SYS_AARCH32_CNTPCTSS sys_reg(0, 8, 0, 14, 0)
406407

407408
#define __PMEV_op2(n) ((n) & 0x7)
408409
#define __CNTR_CRm(n) (0x8 | (((n) >> 3) & 0x3))

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,6 +2538,7 @@ static const struct sys_reg_desc cp15_64_regs[] = {
25382538
{ Op1( 1), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_ASGI1R */
25392539
{ Op1( 2), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_SGI0R */
25402540
{ SYS_DESC(SYS_AARCH32_CNTP_CVAL), access_arch_timer },
2541+
{ SYS_DESC(SYS_AARCH32_CNTPCTSS), access_arch_timer },
25412542
};
25422543

25432544
static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,

0 commit comments

Comments
 (0)