KVM: arm64: Handle 32bit CNTPCTSS traps
authorMarc Zyngier <maz@kernel.org>
Thu, 13 Apr 2023 13:23:42 +0000 (14:23 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 13 Apr 2023 13:23:42 +0000 (14:23 +0100)
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>
arch/arm64/include/asm/sysreg.h
arch/arm64/kvm/sys_regs.c

index f8da9e1b0c1147dabcdbed4d601d0b82fc02873b..a43f21559c3ee5aa2567187a00cbae6346882d6e 100644 (file)
 #define SYS_AARCH32_CNTP_CTL           sys_reg(0, 0, 14, 2, 1)
 #define SYS_AARCH32_CNTPCT             sys_reg(0, 0, 0, 14, 0)
 #define SYS_AARCH32_CNTP_CVAL          sys_reg(0, 2, 0, 14, 0)
+#define SYS_AARCH32_CNTPCTSS           sys_reg(0, 8, 0, 14, 0)
 
 #define __PMEV_op2(n)                  ((n) & 0x7)
 #define __CNTR_CRm(n)                  (0x8 | (((n) >> 3) & 0x3))
index be7c2598e5637eed240a3839585b1f8820ec09c7..feca77083a5c40fedf8535fdac56f6499ff168d4 100644 (file)
@@ -2538,6 +2538,7 @@ static const struct sys_reg_desc cp15_64_regs[] = {
        { Op1( 1), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_ASGI1R */
        { Op1( 2), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, /* ICC_SGI0R */
        { SYS_DESC(SYS_AARCH32_CNTP_CVAL),    access_arch_timer },
+       { SYS_DESC(SYS_AARCH32_CNTPCTSS),     access_arch_timer },
 };
 
 static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n,