Re: [v4 1/3] vfio: add vfio_group_notify support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/16/2016 07:11 AM, Alex Williamson wrote:
> On Tue, 15 Nov 2016 19:35:45 +0800
> Jike Song <jike.song@xxxxxxxxx> wrote:
> 
>> A vfio_group may be or may not be attached to a KVM instance,
>> if it is, the user of vfio_group might also want to know which
>> KVM instance it is attached to, and when it will detach. In VFIO
>> there are already external APIs for KVM to get/put vfio_group,
>> by providing a similar vfio_group_notify, KVM can notify the
>> vfio_group about attaching events.
>>
>> Cc: Xiao Guangrong <guangrong.xiao@xxxxxxxxxxxxxxx>
>> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
>> Cc: Alex Williamson <alex.williamson@xxxxxxxxxx>
>> Signed-off-by: Jike Song <jike.song@xxxxxxxxx>
>> ---
>>  drivers/vfio/vfio.c  | 30 ++++++++++++++++++++++++++++++
>>  include/linux/vfio.h |  4 ++++
>>  2 files changed, 34 insertions(+)
>>
>> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
>> index 0afb58e..b149ced 100644
>> --- a/drivers/vfio/vfio.c
>> +++ b/drivers/vfio/vfio.c
>> @@ -86,6 +86,8 @@ struct vfio_group {
>>  	struct mutex			unbound_lock;
>>  	atomic_t			opened;
>>  	bool				noiommu;
>> +	struct kvm			*kvm;
>> +	struct blocking_notifier_head	notifier;
>>  };
>>  
>>  struct vfio_device {
>> @@ -1015,6 +1017,34 @@ static long vfio_ioctl_check_extension(struct vfio_container *container,
>>  	return ret;
>>  }
>>  
>> +void vfio_group_notify(struct vfio_group *group, struct kvm *kvm)
>> +{
>> +	group->kvm = kvm;
>> +	blocking_notifier_call_chain(&group->notifier,
>> +				VFIO_GROUP_NOTIFY_SET_KVM, kvm);
>> +}
>> +EXPORT_SYMBOL_GPL(vfio_group_notify);
> 
> This shouldn't be called vfio_group_notify() if it's specific to kvm.
> vfio_group_set_kvm() perhaps.
> 

will change to that. thanks!

--
Thanks,
Jike
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux