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>
This commit is contained in:
Marc Zyngier 2017-12-07 11:46:15 +00:00 коммит произвёл Christoffer Dall
Родитель 7839c672e5
Коммит f384dcfe4d
3 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -62,7 +62,7 @@ struct arch_timer_cpu {
bool enabled; bool enabled;
}; };
int kvm_timer_hyp_init(void); int kvm_timer_hyp_init(bool);
int kvm_timer_enable(struct kvm_vcpu *vcpu); int kvm_timer_enable(struct kvm_vcpu *vcpu);
int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu); int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu);
void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu); void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu);

Просмотреть файл

@ -720,7 +720,7 @@ static int kvm_timer_dying_cpu(unsigned int cpu)
return 0; return 0;
} }
int kvm_timer_hyp_init(void) int kvm_timer_hyp_init(bool has_gic)
{ {
struct arch_timer_kvm_info *info; struct arch_timer_kvm_info *info;
int err; int err;
@ -756,10 +756,13 @@ int kvm_timer_hyp_init(void)
return err; return err;
} }
err = irq_set_vcpu_affinity(host_vtimer_irq, kvm_get_running_vcpus()); if (has_gic) {
if (err) { err = irq_set_vcpu_affinity(host_vtimer_irq,
kvm_err("kvm_arch_timer: error setting vcpu affinity\n"); kvm_get_running_vcpus());
goto out_free_irq; if (err) {
kvm_err("kvm_arch_timer: error setting vcpu affinity\n");
goto out_free_irq;
}
} }
kvm_info("virtual timer IRQ%d\n", host_vtimer_irq); kvm_info("virtual timer IRQ%d\n", host_vtimer_irq);

Просмотреть файл

@ -1326,7 +1326,7 @@ static int init_subsystems(void)
/* /*
* Init HYP architected timer support * Init HYP architected timer support
*/ */
err = kvm_timer_hyp_init(); err = kvm_timer_hyp_init(vgic_present);
if (err) if (err)
goto out; goto out;