KVM: arm64: Enable the EL1 physical timer for AArch32 guests
PATCH 1/1 KVM: arm64: Enable the EL1 physical timer for AArch32 guests
Some 32bits guest OS can use the CNTP timer, however KVM does not handle the accesses, injecting a fault instead.
Use the proper handlers to emulate the EL1 Physical Timer (CNTP) register accesses of AArch32 guests.
--- arch/arm64/kvm/sys_regs.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/kvm/sys_regs.c +6 -0
@@ -1545,6 +1545,11 @@ static const struct sys_reg_desc cp15_regs[] = { { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, +/* CNTP_TVAL */ + { Op1( 0), CRn(14), CRm( 2), Op2( 0), access_cntp_tval }, +/* CNTP_CTL */ + { Op1( 0), CRn(14), CRm( 2), Op2( 1), access_cntp_ctl }, +/* PMEVCNTRn */ PMU_PMEVCNTR (0 ), PMU_PMEVCNTR(1),
@@ -1618,6 +1623,7 @@ static const struct sys_reg_desc cp15_64_regs[] = { { Op1( 0), CRn( 0), CRm( 9), Op2( 0), access_pmu_evcntr }, { Op1( 0), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, { Op1( 1), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR1 }, + { Op1( 2), CRn( 0), CRm(14), Op2( 0), access_cntp_cval }, };/* Target specific emulation tables */
Signature · 1 line
2.7.4
Quoted 30 lines · Jérémy Fanguède
Some 32bits guest OS can use the CNTP timer, however KVM does not handle the accesses, injecting a fault instead.
Use the proper handlers to emulate the EL1 Physical Timer (CNTP) register accesses of AArch32 guests.
Signed-off-by Jérémy Fanguède <[email protected]>Signed-off-by Alvise Rigo <[email protected]>--- arch/arm64/kvm/sys_regs.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/kvm/sys_regs.c +5
-0@@ -1545,6 +1545,11 @@ static const struct sys_reg_desc cp15_regs[] = { { Op1( 0), CRn(13), CRm( 0), Op2( 1), access_vm_reg, NULL, c13_CID }, +/* CNTP_TVAL */ + { Op1( 0), CRn(14), CRm( 2), Op2( 0), access_cntp_tval }, +/* CNTP_CTL */ + { Op1( 0), CRn(14), CRm( 2), Op2( 1), access_cntp_ctl }, +/* PMEVCNTRn */ PMU_PMEVCNTR (0 ), PMU_PMEVCNTR(1),
arch/arm64/kvm/sys_regs.c static const struct sys_reg_desc cp15_64_regs[] = { · line 1629
Quoted 7 lines
arch/arm64/kvm/sys_regs.c +1
-0@@ -1618,6 +1623,7 @@ static const struct sys_reg_desc cp15_64_regs[] = { { Op1( 0), CRn( 0), CRm( 9), Op2( 0), access_pmu_evcntr }, { Op1( 0), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, { Op1( 1), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL, c2_TTBR1 }, + { Op1( 2), CRn( 0), CRm(14), Op2( 0), access_cntp_cval }, };/* Target specific emulation tables */
Seems OK to me. Can you please update the corresponding 32bit code while you're at it?
Thanks,
M.
Signature · 6 lines
Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Marc,
Quoted 35 lines · Marc Zyngier
Quoted 17 lines · Jérémy Fanguède
Some 32bits guest OS can use the CNTP timer, however KVM does not handle the accesses, injecting a fault instead.
Use the proper handlers to emulate the EL1 Physical Timer (CNTP) register accesses of AArch32 guests.
Signed-off-by Jérémy Fanguède <[email protected]>Signed-off-by Alvise Rigo <[email protected]>--- arch/arm64/kvm/sys_regs.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm64/kvm/sys_regs.c +0
-0arch/arm64/kvm/sys_regs.c static const struct sys_reg_desc cp15_regs[] = { · line 1546
Quoted 2 lines
arch/arm64/kvm/sys_regs.c +0
-0@@ -1545,6 +1545,11 @@ static const struct sys_reg_desc cp15_regs[] = { {Op1 (0 ),CRn (13 ),CRm (0 ),Op2 (1 ), access_vm_reg,NULL , c13_CID},
arch/arm64/kvm/sys_regs.c static const struct sys_reg_desc cp15_64_regs[] = { · line 1625
Quoted 13 lines
arch/arm64/kvm/sys_regs.c +5
-0+/* CNTP_TVAL */ + { Op1( 0), CRn(14), CRm( 2), Op2( 0), access_cntp_tval }, +/* CNTP_CTL */ + { Op1( 0), CRn(14), CRm( 2), Op2( 1), access_cntp_ctl }, +/* PMEVCNTRn */ PMU_PMEVCNTR (0 ), PMU_PMEVCNTR(1),@@ -1618,6 +1623,7 @@ static const struct sys_reg_desc cp15_64_regs[] = { { Op1( 0), CRn( 0), CRm( 9), Op2( 0), access_pmu_evcntr }, { Op1( 0), CRn( 0), CRm(12), Op2( 0), access_gic_sgi }, { Op1( 1), CRn( 0), CRm( 2), Op2( 0), access_vm_reg, NULL,
c2_TTBR1},
Quoted 9 lines
arch/arm64/kvm/sys_regs.c static const struct sys_reg_desc cp15_64_regs[] = { · line 1629
Quoted 5 lines
arch/arm64/kvm/sys_regs.c +1
-0+ { Op1( 2), CRn( 0), CRm(14), Op2( 0), access_cntp_cval }, };/* Target specific emulation tables */ Seems OK to me. Can you please update the corresponding 32bit code while you're at it?
I'm working on it, I'll send soon the arm 32bit version, once tested.
Jeremy
Quoted 7 lines
Thanks,
M.--
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm