On Fri, May 07, 2021 at 10:06:10AM -0300, Marcelo Tosatti wrote: > Add a start_assignment hook to kvm_x86_ops, which is called when > kvm_arch_start_assignment is done. > > The hook is required to update the wakeup vector of a sleeping vCPU > when a device is assigned to the guest. > > Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx> > > Index: kvm/arch/x86/include/asm/kvm_host.h > =================================================================== > --- kvm.orig/arch/x86/include/asm/kvm_host.h > +++ kvm/arch/x86/include/asm/kvm_host.h > @@ -1322,6 +1322,7 @@ struct kvm_x86_ops { > > int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq, > uint32_t guest_irq, bool set); > + void (*start_assignment)(struct kvm *kvm, int device_count); I'm thinking what the hook could do with the device_count besides comparing it against 1... If we can't think of any, perhaps we can directly make it an enablement hook instead (so we avoid calling the hook at all when count>1)? /* Called when the first assignment registers (count from 0 to 1) */ void (*enable_assignment)(struct kvm *kvm); -- Peter Xu