2017-04-26 17:21+0200, David Hildenbrand: > On 26.04.2017 16:27, Radim Krčmář wrote: > > 2017-04-26 10:40+0200, David Hildenbrand: > >> On 25.04.2017 21:59, Radim Krčmář wrote: > >>> 2017-04-25 21:03+0200, David Hildenbrand: > >>>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > >>>> @@ -504,6 +504,7 @@ void vcpu_put(struct kvm_vcpu *vcpu); > >>>> #ifdef __KVM_HAVE_IOAPIC > >>>> void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm); > >>>> void kvm_arch_post_irq_routing_update(struct kvm *kvm); > >>>> +bool kvm_arch_can_set_irq_routing(struct kvm *kvm); > >>> > >>> (A nitpick: it might be useful even without __KVM_HAVE_IOAPIC so weak > >>> linking would probably be cleaner for a slow path.) > >>> > >>>> #else > >>>> static inline void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm) > >>>> { > >>>> @@ -511,6 +512,10 @@ static inline void kvm_arch_post_irq_ack_notifier_list_update(struct kvm *kvm) > >>>> static inline void kvm_arch_post_irq_routing_update(struct kvm *kvm) > >>>> { > >>>> } > >>>> +static bool kvm_arch_can_set_irq_routing(struct kvm *kvm) > >>>> +{ > >>>> + return true; > >>>> +} > >>>> #endif > >>>> > >> > >> Makes sense, shall I resend or can you fix that up when applying? > > > > Please send a v2, it's going to be automatically compile-tested on all > > arches that way. :) > > > > Using a weak symbol for the first time... Is the following what you had in mind? > > ---- snip ---- > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 397b7b5..b725d4e 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -1009,6 +1009,7 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq) > #define KVM_MAX_IRQ_ROUTES 1024 > #endif > > +bool kvm_arch_can_set_irq_routing(struct kvm *kvm); > int kvm_set_irq_routing(struct kvm *kvm, > const struct kvm_irq_routing_entry *entries, > unsigned nr, > diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c > index cc30d01..a080659 100644 > --- a/virt/kvm/irqchip.c > +++ b/virt/kvm/irqchip.c > @@ -172,6 +172,11 @@ void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm) > { > } > > +bool __attribute__((weak)) kvm_arch_can_set_irq_routing(struct kvm *kvm) Yes, exactly what I had in mind. (I'd just write "__weak" to make it shorter. :]) > +{ > + return true; > +} > + > int kvm_set_irq_routing(struct kvm *kvm, > const struct kvm_irq_routing_entry *ue, > unsigned nr, > ---- snip ---- > > -- > > Thanks, > > David