qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: t


From: Jike Song
Subject: Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot
Date: Fri, 14 Oct 2016 20:26:25 +0800
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

On 10/14/2016 06:43 PM, Paolo Bonzini wrote:
> 
> 
> On 14/10/2016 12:37, Jike Song wrote:
>> Hi Paolo & Alex,
>>
>> IIUC, passing file descriptors means touching QEMU and the UAPI between
>> QEMU and VFIO. Would you guys have a look at below draft patch? If it's
>> on the correct direction, I'll send the split ones. Thanks!
>>
>> --
>> Thanks,
>> Jike
>>
>>
>> diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
>> index bec694c..f715d37 100644
>> --- a/hw/vfio/pci-quirks.c
>> +++ b/hw/vfio/pci-quirks.c
>> @@ -10,12 +10,14 @@
>>   * the COPYING file in the top-level directory.
>>   */
>>  
>> +#include <sys/ioctl.h>
>>  #include "qemu/osdep.h"
>>  #include "qemu/error-report.h"
>>  #include "qemu/range.h"
>>  #include "qapi/error.h"
>>  #include "hw/nvram/fw_cfg.h"
>>  #include "pci.h"
>> +#include "sysemu/kvm.h"
>>  #include "trace.h"
>>  
>>  /* Use uin32_t for vendor & device so PCI_ANY_ID expands and cannot match 
>> hw */
>> @@ -1844,3 +1846,15 @@ void vfio_setup_resetfn_quirk(VFIOPCIDevice *vdev)
>>          break;
>>      }
>>  }
>> +
>> +void vfio_quirk_kvmgt(VFIOPCIDevice *vdev)
>> +{
>> +    int vmfd;
>> +
>> +    if (!kvm_enabled() || !vdev->kvmgt)
>> +        return;
>> +
>> +    /* Tell the device what KVM it attached */
>> +    vmfd = kvm_get_vmfd(kvm_state);
>> +    ioctl(vdev->vbasedev.fd, VFIO_SET_KVMFD, vmfd);
>> +}
> 
> vfio_kvm_device_add_group is already telling the group id file
> descriptor to KVM.  You can use that existing hook (whose kernel side is
> virt/kvm/vfio.c).

Thanks for quick reply. I'll do some homework and report back :)

--
Thanks,
Jike



reply via email to

[Prev in Thread] Current Thread [Next in Thread]