[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: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot |
Date: |
Fri, 14 Oct 2016 12:43:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
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).
Paolo
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/14
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Alex Williamson, 2016/10/14
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Alex Williamson, 2016/10/14
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Neo Jia, 2016/10/14
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Alex Williamson, 2016/10/14
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Neo Jia, 2016/10/14
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Alex Williamson, 2016/10/17
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/18
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Alex Williamson, 2016/10/18
- Re: [Qemu-devel] [PATCH 1/2] KVM: page track: add a new notifier type: track_flush_slot, Jike Song, 2016/10/18