]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
arm: KVM: Disable virtual timer even if the guest is not using it
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 16 Sep 2015 15:18:59 +0000 (16:18 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 6 Oct 2015 10:52:29 +0000 (11:52 +0100)
commit 688bc577ac42ae3d07c889a1f0a72f0b23763d58 upstream.

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.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
arch/arm/kvm/interrupts_head.S

index 2973b2d342faf5b3e458f613449a0ae3fd1538f5..cb1d567ada5eb3c94f8b7a57df7b642ef00e4ef2 100644 (file)
@@ -502,8 +502,7 @@ vcpu        .req    r0              @ vcpu pointer always in r0
 
        mrc     p15, 0, r2, c14, c3, 1  @ CNTV_CTL
        str     r2, [vcpu, #VCPU_TIMER_CNTV_CTL]
-       bic     r2, #1                  @ Clear ENABLE
-       mcr     p15, 0, r2, c14, c3, 1  @ CNTV_CTL
+
        isb
 
        mrrc    p15, 3, r2, r3, c14     @ CNTV_CVAL
@@ -516,6 +515,9 @@ vcpu        .req    r0              @ vcpu pointer always in r0
        mcrr    p15, 4, r2, r2, c14     @ CNTVOFF
 
 1:
+       mov     r2, #0                  @ Clear ENABLE
+       mcr     p15, 0, r2, c14, c3, 1  @ CNTV_CTL
+
 #endif
        @ Allow physical timer/counter access for the host
        mrc     p15, 4, r2, c14, c1, 0  @ CNTHCTL