Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: arm/arm64: timer: Don't set irq as forwarded if no usable GIC

If we don't have a usable GIC, do not try to set the vcpu affinity
as this is guaranteed to fail.

Reported-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>

authored by

Marc Zyngier and committed by
Christoffer Dall
f384dcfe 7839c672

+10 -7
+1 -1
include/kvm/arm_arch_timer.h
··· 62 62 bool enabled; 63 63 }; 64 64 65 - int kvm_timer_hyp_init(void); 65 + int kvm_timer_hyp_init(bool); 66 66 int kvm_timer_enable(struct kvm_vcpu *vcpu); 67 67 int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); 68 68 void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);
+8 -5
virt/kvm/arm/arch_timer.c
··· 720 720 return 0; 721 721 } 722 722 723 - int kvm_timer_hyp_init(void) 723 + int kvm_timer_hyp_init(bool has_gic) 724 724 { 725 725 struct arch_timer_kvm_info *info; 726 726 int err; ··· 756 756 return err; 757 757 } 758 758 759 - err = irq_set_vcpu_affinity(host_vtimer_irq, kvm_get_running_vcpus()); 760 - if (err) { 761 - kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); 762 - goto out_free_irq; 759 + if (has_gic) { 760 + err = irq_set_vcpu_affinity(host_vtimer_irq, 761 + kvm_get_running_vcpus()); 762 + if (err) { 763 + kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); 764 + goto out_free_irq; 765 + } 763 766 } 764 767 765 768 kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);
+1 -1
virt/kvm/arm/arm.c
··· 1326 1326 /* 1327 1327 * Init HYP architected timer support 1328 1328 */ 1329 - err = kvm_timer_hyp_init(); 1329 + err = kvm_timer_hyp_init(vgic_present); 1330 1330 if (err) 1331 1331 goto out; 1332 1332