Skip to content

Commit

Permalink
arm64: KVM: Disable virtual timer even if the guest is not using it
Browse files Browse the repository at this point in the history
When running a guest with the architected timer disabled (with QEMU and
the kernel_irqchip=off option, for example), it is important to make
sure the timer gets turned off. Otherwise, the guest may try to
enable it anyway, leading to a screaming HW interrupt.

The fix is to unconditionally turn off the virtual timer on guest
exit.

Cc: [email protected]
Reviewed-by: Christoffer Dall <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
  • Loading branch information
Marc Zyngier committed Sep 17, 2015
1 parent c2f5851 commit c4cbba9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/arm64/kvm/hyp.S
Original file line number Diff line number Diff line change
Expand Up @@ -562,15 +562,16 @@
mrs x3, cntv_ctl_el0
and x3, x3, #3
str w3, [x0, #VCPU_TIMER_CNTV_CTL]
bic x3, x3, #1 // Clear Enable
msr cntv_ctl_el0, x3

isb

mrs x3, cntv_cval_el0
str x3, [x0, #VCPU_TIMER_CNTV_CVAL]

1:
// Disable the virtual timer
msr cntv_ctl_el0, xzr

// Allow physical timer/counter access for the host
mrs x2, cnthctl_el2
orr x2, x2, #3
Expand Down

0 comments on commit c4cbba9

Please sign in to comment.