From: Christoffer Dall <christoffer.dall@linaro.org>
Date: Wed, 29 Nov 2017 17:05:16 +0100
Subject: KVM: arm/arm64: Avoid attempting to load timer vgic state without a
vgic
Patch-mainline: v4.15-rc3
Git-commit: 22601127c0faa5db70ab88f23af11cb23c8f6cdf
References: bsc#1077761
The timer optimization patches inadvertendly changed the logic to always
load the timer state as if we have a vgic, even if we don't have a vgic.
Fix this by doing the usual irqchip_in_kernel() check and call the
appropriate load function.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Alexander Graf <agraf@suse.de>
---
virt/kvm/arm/arch_timer.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -835,7 +835,10 @@
no_vgic:
preempt_disable();
timer->enabled = 1;
- kvm_timer_vcpu_load_vgic(vcpu);
+ if (!irqchip_in_kernel(vcpu->kvm))
+ kvm_timer_vcpu_load_user(vcpu);
+ else
+ kvm_timer_vcpu_load_vgic(vcpu);
preempt_enable();
return 0;