[Qemu-devel] [RFC PATCH V4 4/4] vifo: introduce new VFIO ioctl VFIO_IOMMU_GET_DIRTY_BITMAP

2018-04-10 Thread Yulei Zhang
New VFIO ioctl VFIO_IOMMU_GET_DIRTY_BITMAP is used to fetch the bitmap of pinned memory in iommu container, we need copy those memory to the target during the migration as they are dirtied by mdev devices. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/common.c

[Qemu-devel] [RFC PATCH V4 2/4] vfio: Add vm status change callback to stop/restart the mdev device

2018-04-09 Thread Yulei Zhang
-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 20 include/hw/vfio/vfio-common.h | 1 + linux-headers/linux/vfio.h| 6 ++ roms/seabios | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/hw/vfio/p

[Qemu-devel] [RFC PATCH V4 3/4] vfio: Add SaveVMHanlders for VFIO device to support live migration

2018-04-09 Thread Yulei Zhang
bar configuration 2. re-setup the pci device msi configuration 3. restore the pci device status Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 195 +++-- linux-headers/linux/vfio.h | 14 2 files change

[Qemu-devel] [RFC V4 PATCH 0/4] vfio: Introduce live migation capability to

2018-04-09 Thread Yulei Zhang
region. 2. remove unnecessary ioctl, use the first byte of subregion to control the running state of mdev device. 3. for dirty page synchronization, implement the interface with VFIOContainer instead of vfio pci device. Yulei Zhang (4): vfio: introduce a new VFIO subregion for mdev device

[Qemu-devel] [RFC PATCH V4 1/4] vfio: introduce a new VFIO subregion for mdev device migration support

2018-04-09 Thread Yulei Zhang
New VFIO sub region VFIO_REGION_SUBTYPE_DEVICE_STATE is added to fetch and restore the status of mdev device vGPU during the live migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 25 - hw/vfio/pci.h | 2 ++

[Qemu-devel] [PATCH V3 3/4] vfio: Add struct vfio_vmstate_info to introduce put/get callback funtion for vfio device status save/restore

2018-03-04 Thread Yulei Zhang
device status fetch from device driver And on the target side with funtion vfio_device_get to restore the same states 1. re-setup the pci bar configuration 2. re-setup the pci device msi configuration 3. restore the pci device status Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- h

[Qemu-devel] [PATCH V3 4/4] vifo: introduce new VFIO ioctl VFIO_IOMMU_GET_DIRTY_BITMAP

2018-03-04 Thread Yulei Zhang
New VFIO ioctl VFIO_IOMMU_GET_DIRTY_BITMAP is used to fetch the bitmap of pinned memory in iommu container, we need copy those memory to the target during the migration as they are dirtied by mdev devices. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/common.c

[Qemu-devel] [PATCH V3 2/4] vfio: Add vm status change callback to stop/restart the mdev device

2018-03-04 Thread Yulei Zhang
-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 20 include/hw/vfio/vfio-common.h | 1 + linux-headers/linux/vfio.h| 3 +++ 3 files changed, 24 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 2fe20e4..3e2289c 100644 --- a/h

[Qemu-devel] [PATCH V3 1/4] vfio: introduce a new VFIO subregion for mdev device migration support

2018-03-04 Thread Yulei Zhang
New VFIO sub region VFIO_REGION_SUBTYPE_DEVICE_STATE is added to fetch and restore the status of mdev device vGPU during the live migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 14 +- hw/vfio/pci.h | 1 + linux-h

[Qemu-devel] [PATCH V3 0/4] vfio: Introduce Live migration capability to vfio_mdev device

2018-03-04 Thread Yulei Zhang
1. use device subtype region instead of VFIO PCI fixed region. 2. remove unnecessary ioctl, use the first byte of subregion to control the running state of mdev device. 3. for dirty page synchronization, implement the interface with VFIOContainer instead of vfio pci device. Yulei Zhang (4):

[Qemu-devel] [RFC V2 4/4] vifo: introduce new VFIO ioctl VFIO_IOMMU_GET_DIRTY_BITMAP

2017-07-31 Thread Yulei Zhang
New VFIO ioctl VFIO_IOMMU_GET_DIRTY_BITMAP is used to fetch the bitmap of pinned memory in iommu container, we need copy those memory to the target during the migration as they are dirtied by mdev devices. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/common.c

[Qemu-devel] [RFC V2 2/4] vfio: Add vm status change callback to stop/restart the mdev device

2017-07-31 Thread Yulei Zhang
-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 19 +++ include/hw/vfio/vfio-common.h | 1 + linux-headers/linux/vfio.h| 3 +++ 3 files changed, 23 insertions(+) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 21a5cef..753da80 100644 --- a/h

[Qemu-devel] [RFC V2 3/4] vfio: Add struct vfio_vmstate_info to introduce put/get callback funtion for vfio device status save/restore

2017-07-31 Thread Yulei Zhang
device status fetch from device driver And on the target side with funtion vfio_device_get to restore the same states 1. re-setup the pci bar configuration 2. re-setup the pci device msi configuration 3. restore the pci device status Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- h

[Qemu-devel] [RFC V2 1/4] vfio: introduce a new VFIO sub region for mdev device migration support

2017-07-31 Thread Yulei Zhang
New VFIO sub region VFIO_REGION_SUBTYPE_INTEL_IGD_DEVICE_STATE is added to fetch and restore the status of mdev device vGPU during the live migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 13 - hw/vfio/pci.h | 1 +

[Qemu-devel] [RFC V2 0/4] vfio: Introduce Live migration capability to vfio_mdev device

2017-07-31 Thread Yulei Zhang
ove unnecessary ioctl, use the first byte of subregion to control the running state of mdev device. 3. for dirty page synchronization, implement the interface with VFIOContainer instead of vfio pci device. Yulei Zhang (4): vfio: introduce a new VFIO sub region for mdev device migrat

[Qemu-devel] [Intel-gfx][RFC 7/9] drm/i915/gvt: Introduce new VFIO ioctl for device status control

2017-06-26 Thread Yulei Zhang
Add handling for new VFIO ioctl VFIO_DEVICE_PCI_STATUS_SET to control the status of mdev device vGPU. vGPU will stop/start rendering according to the command comes along with the ioctl. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i915/gvt/kvmgt.

[Qemu-devel] [Intel-gfx][RFC 5/9] drm/i915/gvt: Align the guest gm aperture start offset for live migration

2017-06-26 Thread Yulei Zhang
As guest gm aperture region start offset is initialized when vGPU created, in order to make sure that start offset is remain the same after migration, align the aperture start offset to 0 for guest. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i915/gvt/kvmgt

[Qemu-devel] [Intel-gfx][RFC 9/9] drm/i915/gvt: Add support to VFIO region VFIO_PCI_DEVICE_STATE_REGION_INDEX

2017-06-26 Thread Yulei Zhang
Add new VFIO region VFIO_PCI_DEVICE_STATE_REGION_INDEX support in vGPU, through this new region it can fetch the status from mdev device for migration, on the target side it can retrieve the device status and reconfigure the device to continue running after resume the guest. Signed-off-by: Yulei

[Qemu-devel] [Intel-gfx][RFC 3/9] drm/i915/gvt: Adjust the gma parameter in gpu commands during command parser

2017-06-26 Thread Yulei Zhang
Adjust the gma parameter in gpu commands according to the shift offset in guests' aperture and hidden gm address, and patch the commands before submit to execute. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i915/gvt/cmd_parser.c | 26 ++

[Qemu-devel] [Intel-gfx][RFC 4/9] drm/i915/gvt: Retrieve the guest gm base address from PVINFO

2017-06-26 Thread Yulei Zhang
As after migration the host gm base address will be changed due to resource re-allocation, in order to make sure the guest gm address doesn't change with that to retrieve the guest gm base address from PVINFO. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i9

[Qemu-devel] [Intel-gfx][RFC 0/9] drm/i915/gvt: Add the live migration support to VFIO mdev deivce - Intel vGPU

2017-06-26 Thread Yulei Zhang
. 3. Implement the function to save/retore the device context, which is accessed through VFIO new region VFIO_PCI_DEVICE_STATE_REGION_INDEX to transfer device status during the migration. Yulei Zhang (9): drm/i915/gvt: Apply g2h adjust for GTT mmio access drm/i915/gvt: Apply g2h

[Qemu-devel] [Intel-gfx][RFC 6/9] drm/i915/gvt: Introduce new flag to indicate migration capability

2017-06-26 Thread Yulei Zhang
New device flag VFIO_DEVICE_FLAGS_MIGRATABLE is added for vfio mdev device vGPU to claim the capability for live migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i915/gvt/kvmgt.c | 1 + include/uapi/linux/vfio.h| 1 + 2 files changed, 2 inse

[Qemu-devel] [Intel-gfx][RFC 1/9] drm/i915/gvt: Apply g2h adjust for GTT mmio access

2017-06-26 Thread Yulei Zhang
Apply guest to host gma conversion while guest try to access the GTT mmio registers, as after enable live migration the host gma will be changed due to the resourece re-allocation, but guest gma should be remaining unchanged, thus g2h conversion is request for it. Signed-off-by: Yulei Zhang

[Qemu-devel] [Intel-gfx][RFC 8/9] drm/i915/gvt: Introduce new VFIO ioctl for mdev device dirty page sync

2017-06-26 Thread Yulei Zhang
Add new vfio ioctl VFIO_DEVICE_PCI_GET_DIRTY_BITMAP to fetch the dirty page bitmap from mdev device driver for data sync during live migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i915/gvt/kvmgt.c | 33 + include/uapi

[Qemu-devel] [Intel-gfx][RFC 2/9] drm/i915/gvt: Apply g2h adjustment during fence mmio access

2017-06-26 Thread Yulei Zhang
Apply the guest to host gma conversion while guest config the fence mmio registers due to the host gma change after the migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- drivers/gpu/drm/i915/gvt/aperture_gm.c | 6 -- drivers/gpu/drm/i915/gvt/gvt.h

[Qemu-devel] [RFC 5/5] vifo: introduce new VFIO ioctl VFIO_DEVICE_PCI_GET_DIRTY_BITMAP

2017-06-26 Thread Yulei Zhang
New VFIO ioctl VFIO_DEVICE_PCI_GET_DIRTY_BITMAP is used to sync the pci device dirty pages during the migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 32 hw/vfio/pci.h | 2 ++ linux-headers/linux/

[Qemu-devel] [RFC 4/5] vfio: use vfio_device_put/vfio_device_get for device status save/restore

2017-06-26 Thread Yulei Zhang
to restore the same states 1. re-setup the pci bar configuration 2. re-setup the pci device msi configuration 3. restore the pci device status Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 105 +- 1 file change

[Qemu-devel] [RFC 3/5] vfio: introduce new VFIO ioctl VFIO_DEVICE_PCI_STATUS_SET

2017-06-26 Thread Yulei Zhang
New VFIO ioctl VFIO_DEVICE_PCI_STATUS_SET is added to change the vfio pci device status during the migration, stop the device on the source side before fetch its status and start the deivce on the target side after restore its status. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> -

[Qemu-devel] [RFC 2/5] vfio: Add struct vfio_vmstate_info to introduce vfio device put/get funtion

2017-06-26 Thread Yulei Zhang
Introduce vfio_device_put/vfio_device_get funtion for vfio device state save/restore usage. And vfio device unmigratable flag will be set to false during initialization if device flag VFIO_DEVICE_FLAGS_MIGRATABLE is set. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.

[Qemu-devel] [RFC 1/5] vfio: introduce a new VFIO region for migration support

2017-06-26 Thread Yulei Zhang
New VFIO region VFIO_PCI_DEVICE_STATE_REGION_INDEX is added to fetch and restore the pci device status during the live migration. Signed-off-by: Yulei Zhang <yulei.zh...@intel.com> --- hw/vfio/pci.c | 17 + hw/vfio/pci.h | 1 + linux-headers

[Qemu-devel] [RFC 0/5] vfio: Introduce Live migration capability to vfio_mdev device

2017-06-26 Thread Yulei Zhang
use status set ioctl to start the mdev device to put it in running status | V finish migration Yulei Zhang (5): vfio: introduce a new VFIO region for migration support vfio