[PATCH QEMU v23 05/18] vfio: Add migration region initialization and finalize function

2020-05-20 Thread Kirti Wankhede
is supported else migration is blocked. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/Makefile.objs | 2 +- hw/vfio/migration.c | 138 ++ hw/vfio/trace-events | 3 + include/hw/vfio/vfio-common.h | 9 +++ 4 files

[PATCH QEMU v23 03/18] vfio: Add vfio_get_object callback to VFIODeviceOps

2020-05-20 Thread Kirti Wankhede
Hook vfio_get_object callback for PCI devices. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Suggested-by: Cornelia Huck Reviewed-by: Cornelia Huck --- hw/vfio/pci.c | 8 include/hw/vfio/vfio-common.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/vfio

[PATCH QEMU v23 01/18] vfio: KABI for migration interface - Kernel header placeholder

2020-05-20 Thread Kirti Wankhede
Kernel header patches are being reviewed along with kernel side changes. This patch is only for place holder. This patch include all changes in vfio.h from above patch set Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- linux-headers/linux/vfio.h | 318

[PATCH QEMU v23 04/18] vfio: Add save and load functions for VFIO PCI devices

2020-05-20 Thread Kirti Wankhede
These functions save and restore PCI device specific data - config space of PCI device. Tested save and restore with MSI and MSIX type. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/pci.c | 163 ++ include/hw/vfio/vfio

[PATCH QEMU v23 02/18] vfio: Add function to unmap VFIO region

2020-05-20 Thread Kirti Wankhede
This function will be used for migration region. Migration region is mmaped when migration starts and will be unmapped when migration is complete. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Cornelia Huck --- hw/vfio/common.c | 32

[PATCH QEMU v23 00/18] Add migration support for VFIO devices

2020-05-20 Thread Kirti Wankhede
on. - Moved PCI device functions to pci file. - Added iteration to get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (18): vfio: KABI for migration interface - Kernel header placeholder vfio: Add function to unmap VFIO regi

[PATCH Kernel v23 7/8] vfio iommu: Add migration capability to report supported features

2020-05-20 Thread Kirti Wankhede
for ioctls used to get dirty bitmap. Signed-off-by: Kirti Wankhede Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 23 ++- include/uapi/linux/vfio.h | 23 +++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH Kernel v23 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-20 Thread Kirti Wankhede
VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 61 + include/uapi/linux/vfio.h | 11 2 files changed, 61 insertions(+), 11 deletions(-) diff --git

[PATCH Kernel v23 8/8] vfio: Selective dirty page tracking if IOMMU backed device pins pages

2020-05-20 Thread Kirti Wankhede
all of the vfio_groups for each vfio_domain in the domain_list dirty page scope is limited to pinned pages. This flag is updated on first pinned pages request for that IOMMU group and on attaching/detaching group. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio.c |

[PATCH Kernel v23 2/8] vfio iommu: Remove atomicity of ref_count of pinned pages

2020-05-20 Thread Kirti Wankhede
vfio_pfn.ref_count is always updated while holding iommu->lock, using atomic variable is overkill. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 9 + 1 file changed, 5 insertions(+)

[PATCH Kernel v23 4/8] vfio iommu: Add ioctl definition for dirty pages tracking

2020-05-20 Thread Kirti Wankhede
support to start/stop dirtied pages tracking and to get bitmap of all dirtied pages for requested IO virtual address range. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 56 +++ 1 file changed, 56 insertions

[PATCH Kernel v23 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

2020-05-20 Thread Kirti Wankhede
Calculate and cache pgsize_bitmap when iommu->domain_list is updated and iommu->external_domain is set for mdev device. Add iommu->lock protection when cached pgsize_bitmap is accessed. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Cornelia Huck --- dri

[PATCH Kernel v23 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-20 Thread Kirti Wankhede
with the smallest supported page size. Update bitmap from pinning functions when tracking is enabled. When user application queries bitmap, check if requested page size is same as page size used to populated bitmap. If it is equal, copy bitmap, but if not equal, return error. Signed-off-by: Kirti Wankhede

[PATCH Kernel v23 0/8] Add UAPIs to support migration for VFIO devices

2020-05-20 Thread Kirti Wankhede
on of the region. - Moved PCI device functions to pci file. - Added iteration to get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (8): vfio: UAPI for migration interface for device state vfio iommu: Remove atomicity of ref_count of pinne

[PATCH Kernel v23 1/8] vfio: UAPI for migration interface for device state

2020-05-20 Thread Kirti Wankhede
transition details. - Defined sequence to be followed while saving and resuming VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 228 ++ 1 file changed, 228 insertions(+) diff --git a/include/uapi/linux

Re: [PATCH Kernel v22 7/8] vfio iommu: Add migration capability to report supported features

2020-05-20 Thread Kirti Wankhede
On 5/20/2020 4:12 PM, Cornelia Huck wrote: On Mon, 18 May 2020 11:26:36 +0530 Kirti Wankhede wrote: Added migration capability in IOMMU info chain. User application should check IOMMU info chain for migration capability to use dirty page tracking feature provided by kernel module. User

Re: [PATCH Kernel v22 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-20 Thread Kirti Wankhede
On 5/20/2020 3:57 PM, Cornelia Huck wrote: On Tue, 19 May 2020 12:24:13 +0530 Kirti Wankhede wrote: DMA mapped pages, including those pinned by mdev vendor drivers, might get unpinned and unmapped while migration is active and device is still running. For example, in pre-copy phase while

Re: [PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

2020-05-20 Thread Kirti Wankhede
On 5/20/2020 3:38 PM, Cornelia Huck wrote: On Mon, 18 May 2020 11:26:32 +0530 Kirti Wankhede wrote: Calculate and cache pgsize_bitmap when iommu->domain_list is updated and iommu->external_domain is set for mdev device. Add iommu->lock protection when cached pgsize_bitmap is

Re: [PATCH Kernel v22 0/8] Add UAPIs to support migration for VFIO devices

2020-05-20 Thread Kirti Wankhede
On 5/20/2020 8:25 AM, Yan Zhao wrote: On Tue, May 19, 2020 at 10:58:04AM -0600, Alex Williamson wrote: Hi folks, My impression is that we're getting pretty close to a workable implementation here with v22 plus respins of patches 5, 6, and 8. We also have a matching QEMU series and a

[PATCH Kernel v22 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-19 Thread Kirti Wankhede
VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_type1.c | 62 + include/uapi/linux/vfio.h | 10 +++ 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v22 8/8] vfio: Selective dirty page tracking if IOMMU backed device pins pages

2020-05-19 Thread Kirti Wankhede
all of the vfio_groups for each vfio_domain in the domain_list dirty page scope is limited to pinned pages. This flag is updated on first pinned pages request for that IOMMU group and on attaching/detaching group. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio.c |

[PATCH Kernel v22 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-19 Thread Kirti Wankhede
with the smallest supported page size. Update bitmap from pinning functions when tracking is enabled. When user application queries bitmap, check if requested page size is same as page size used to populated bitmap. If it is equal, copy bitmap, but if not equal, return error. Signed-off-by: Kirti Wankhede

Re: [PATCH Kernel v22 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-19 Thread Kirti Wankhede
On 5/19/2020 3:23 AM, Alex Williamson wrote: On Mon, 18 May 2020 11:26:34 +0530 Kirti Wankhede wrote: VFIO_IOMMU_DIRTY_PAGES ioctl performs three operations: - Start dirty pages tracking while migration is active - Stop dirty pages tracking. - Get dirty pages bitmap. Its user space

[PATCH QEMU v22 18/18] qapi: Add VFIO devices migration stats in Migration stats

2020-05-18 Thread Kirti Wankhede
Added amount of bytes transferred to the target VM by all VFIO devices Signed-off-by: Kirti Wankhede --- hw/vfio/common.c| 20 hw/vfio/migration.c | 10 +- include/qemu/vfio-helpers.h | 3 +++ migration/migration.c | 12

[PATCH QEMU v22 17/18] vfio: Make vfio-pci device migration capable

2020-05-18 Thread Kirti Wankhede
and use migration blocker from generic structure of VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/pci.c | 32 +++- hw/vfio/pci.h | 1 - 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index

[PATCH QEMU v22 14/18] vfio: Add function to start and stop dirty pages tracking

2020-05-18 Thread Kirti Wankhede
Call VFIO_IOMMU_DIRTY_PAGES ioctl to start and stop dirty pages tracking for VFIO devices. Signed-off-by: Kirti Wankhede --- hw/vfio/migration.c | 36 1 file changed, 36 insertions(+) diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index b9bbe38e539c

[PATCH QEMU v22 15/18] vfio: Add vfio_listener_log_sync to mark dirty pages

2020-05-18 Thread Kirti Wankhede
vfio_listener_log_sync gets list of dirty pages from container using VFIO_IOMMU_GET_DIRTY_BITMAP ioctl and mark those pages dirty when all devices are stopped and saving state. Return early for the RAM block section of mapped MMIO region. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia

[PATCH QEMU v22 12/18] memory: Set DIRTY_MEMORY_MIGRATION when IOMMU is enabled

2020-05-18 Thread Kirti Wankhede
Signed-off-by: Kirti Wankhede --- memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory.c b/memory.c index 52f1a4cd37f0..5b868fe5eab3 100644 --- a/memory.c +++ b/memory.c @@ -1788,7 +1788,7 @@ bool memory_region_is_ram_device(MemoryRegion *mr) uint8_t

[PATCH QEMU v22 16/18] vfio: Add ioctl to get dirty pages bitmap during dma unmap.

2020-05-18 Thread Kirti Wankhede
to see how I can test this code path. Suggested-by: Alex Williamson Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/common.c | 87 +--- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio

[PATCH QEMU v22 07/18] vfio: Add migration state change notifier

2020-05-18 Thread Kirti Wankhede
Added migration state change notifier to get notification on migration state change. These states are translated to VFIO device state and conveyed to vendor driver. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 30 ++ hw/vfio

[PATCH QEMU v22 13/18] vfio: Get migration capability flags for container

2020-05-18 Thread Kirti Wankhede
Added helper functions to get IOMMU info capability chain. Added function to get migration capability information from that capability chain for IOMMU container. Similar change was proposed earlier: https://lists.gnu.org/archive/html/qemu-devel/2018-05/msg03759.html Signed-off-by: Kirti Wankhede

[PATCH QEMU v22 11/18] iommu: add callback to get address limit IOMMU supports

2020-05-18 Thread Kirti Wankhede
Add optional method to get address limit IOMMU supports Signed-off-by: Kirti Wankhede --- hw/i386/intel_iommu.c | 9 + include/exec/memory.h | 18 ++ memory.c | 11 +++ 3 files changed, 38 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386

[PATCH QEMU v22 10/18] vfio: Add load state functions to SaveVMHandlers

2020-05-18 Thread Kirti Wankhede
is written in staging buffer. For user, data is opaque. User should write data in the same order as received. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 180 +++ hw/vfio/trace-events | 3 + 2 files changed, 183

[PATCH QEMU v22 05/18] vfio: Add migration region initialization and finalize function

2020-05-18 Thread Kirti Wankhede
is supported else migration is blocked. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/Makefile.objs | 2 +- hw/vfio/migration.c | 138 ++ hw/vfio/trace-events | 3 + include/hw/vfio/vfio-common.h | 9 +++ 4 files

[PATCH QEMU v22 09/18] vfio: Add save state functions to SaveVMHandlers

2020-05-18 Thread Kirti Wankhede
data_size before moving to next steps. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 254 +- hw/vfio/trace-events | 6 + include/hw/vfio/vfio-common.h | 1 + 3 files changed, 260 insertions(+), 1 deletion

[PATCH QEMU v22 04/18] vfio: Add save and load functions for VFIO PCI devices

2020-05-18 Thread Kirti Wankhede
These functions save and restore PCI device specific data - config space of PCI device. Tested save and restore with MSI and MSIX type. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/pci.c | 163 ++ include/hw/vfio/vfio

[PATCH QEMU v22 02/18] vfio: Add function to unmap VFIO region

2020-05-18 Thread Kirti Wankhede
This function will be used for migration region. Migration region is mmaped when migration starts and will be unmapped when migration is complete. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Cornelia Huck --- hw/vfio/common.c | 30

[PATCH QEMU v22 08/18] vfio: Register SaveVMHandlers for VFIO device

2020-05-18 Thread Kirti Wankhede
when .save_setup is called, _SAVING | _RUNNING state is set for VFIO device. During save-restore, VM is paused, _SAVING state is set for VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 73 hw/vfio/t

[PATCH QEMU v22 06/18] vfio: Add VM state change handler to know state of VM

2020-05-18 Thread Kirti Wankhede
VM state change handler gets called on change in VM's state. This is used to set VFIO device state to _RUNNING. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 87 +++ hw/vfio/trace-events | 2 + include

[PATCH QEMU v22 03/18] vfio: Add vfio_get_object callback to VFIODeviceOps

2020-05-18 Thread Kirti Wankhede
Hook vfio_get_object callback for PCI devices. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Suggested-by: Cornelia Huck Reviewed-by: Cornelia Huck --- hw/vfio/pci.c | 8 include/hw/vfio/vfio-common.h | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/vfio

[PATCH QEMU v22 00/18] Add migration support for VFIO devices

2020-05-18 Thread Kirti Wankhede
region. - Added both type of access support, trapped or mmapped, for data section of the region. - Moved PCI device functions to pci file. - Added iteration to get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (18): vfio: KABI for migration i

[PATCH QEMU v22 01/18] vfio: KABI for migration interface - Kernel header placeholder

2020-05-18 Thread Kirti Wankhede
Kernel header patches are being reviewed along with kernel side changes. This patch is only for place holder. This patch include all changes in vfio.h from above patch set Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- linux-headers/linux/vfio.h | 318

[PATCH Kernel v22 7/8] vfio iommu: Add migration capability to report supported features

2020-05-18 Thread Kirti Wankhede
for ioctls used to get dirty bitmap. Signed-off-by: Kirti Wankhede --- drivers/vfio/vfio_iommu_type1.c | 23 ++- include/uapi/linux/vfio.h | 22 ++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v22 8/8] vfio: Selective dirty page tracking if IOMMU backed device pins pages

2020-05-18 Thread Kirti Wankhede
all of the vfio_groups for each vfio_domain in the domain_list dirty page scope is limited to pinned pages. This flag is updated on first pinned pages request for that IOMMU group and on attaching/detaching group. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio.c |

[PATCH Kernel v22 4/8] vfio iommu: Add ioctl definition for dirty pages tracking

2020-05-18 Thread Kirti Wankhede
support to start/stop dirtied pages tracking and to get bitmap of all dirtied pages for requested IO virtual address range. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 55 +++ 1 file changed, 55 insertions

[PATCH Kernel v22 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-18 Thread Kirti Wankhede
VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_type1.c | 68 + include/uapi/linux/vfio.h | 10 ++ 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v22 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-18 Thread Kirti Wankhede
with the smallest supported page size. Update bitmap from pinning functions when tracking is enabled. When user application queries bitmap, check if requested page size is same as page size used to populated bitmap. If it is equal, copy bitmap, but if not equal, return error. Signed-off-by: Kirti Wankhede

[PATCH Kernel v22 2/8] vfio iommu: Remove atomicity of ref_count of pinned pages

2020-05-18 Thread Kirti Wankhede
vfio_pfn.ref_count is always updated while holding iommu->lock, using atomic variable is overkill. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 9 + 1 file changed, 5 insertions(+)

[PATCH Kernel v22 0/8] Add UAPIs to support migration for VFIO devices

2020-05-18 Thread Kirti Wankhede
e. - Added iteration to get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (8): vfio: UAPI for migration interface for device state vfio iommu: Remove atomicity of ref_count of pinned pages vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

[PATCH Kernel v22 1/8] vfio: UAPI for migration interface for device state

2020-05-18 Thread Kirti Wankhede
transition details. - Defined sequence to be followed while saving and resuming VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 228 ++ 1 file changed, 228 insertions(+) diff --git a/include/uapi/linux

[PATCH Kernel v22 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

2020-05-18 Thread Kirti Wankhede
Calculate and cache pgsize_bitmap when iommu->domain_list is updated and iommu->external_domain is set for mdev device. Add iommu->lock protection when cached pgsize_bitmap is accessed. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_typ

Re: [PATCH Kernel v21 0/8] Add UAPIs to support migration for VFIO devices

2020-05-17 Thread Kirti Wankhede
side: https://lore.kernel.org/kvm/1588614860-16330-1-git-send-email-kwankh...@nvidia.com/ I'm working on preparing QEMU patches for v21 and will be sending out soon. Thanks, Kirti On 2020/5/16 5:13, Kirti Wankhede wrote: Hi, This patch set adds: * IOCTL VFIO_IOMMU_DIRTY_PAGES to get dirty

Re: [PATCH Kernel v21 0/8] Add UAPIs to support migration for VFIO devices

2020-05-16 Thread Kirti Wankhede
side patches with all review comments on those patches. Still I'll send out QEMU patches which are compatible with v21 and will cover rest of the comments in later revision. Thanks, Kirti Thanks Kevin From: Kirti Wankhede Sent: Saturday, May 16, 2020 5:13 AM Hi, This patch set adds

Re: [PATCH Kernel v21 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-16 Thread Kirti Wankhede
/lra0BpLqY9FQLPkCc2up9t94NJ15nHzMx+poYTeVeomWq x3b9j+KGJesMojeYHF4p02v5kpaquce7dYmP7FjlUMTdEZTgbB46FMu/GynDs3ZPLp 5Jj51SmTeTP/0NR8+K7XjbAFdNc/ux1RzpNITw6FFJ7kmcIImwoKGPat0qKhpN2P6u J2ThfIZtvw0wg== On 5/16/2020 4:03 AM, Alex Williamson wrote: On Sat, 16 May 2020 02:43:20 +0530 Kirti Wankhede

[PATCH Kernel v21 7/8] vfio iommu: Add migration capability to report supported features

2020-05-15 Thread Kirti Wankhede
for ioctls used to get dirty bitmap. Signed-off-by: Kirti Wankhede --- drivers/vfio/vfio_iommu_type1.c | 23 ++- include/uapi/linux/vfio.h | 22 ++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v21 8/8] vfio: Selective dirty page tracking if IOMMU backed device pins pages

2020-05-15 Thread Kirti Wankhede
all of the vfio_groups for each vfio_domain in the domain_list dirty page scope is limited to pinned pages. This flag is updated on first pinned pages request for that IOMMU group and on attaching/detaching group. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio.c |

[PATCH Kernel v21 2/8] vfio iommu: Remove atomicity of ref_count of pinned pages

2020-05-15 Thread Kirti Wankhede
vfio_pfn.ref_count is always updated while holding iommu->lock, using atomic variable is overkill. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 9 + 1 file changed, 5 insertions(+)

[PATCH Kernel v21 1/8] vfio: UAPI for migration interface for device state

2020-05-15 Thread Kirti Wankhede
transition details. - Defined sequence to be followed while saving and resuming VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 228 ++ 1 file changed, 228 insertions(+) diff --git a/include/uapi/linux

[PATCH Kernel v21 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-15 Thread Kirti Wankhede
VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_type1.c | 68 + include/uapi/linux/vfio.h | 10 ++ 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v21 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-15 Thread Kirti Wankhede
with the smallest supported page size. Update bitmap from pinning functions when tracking is enabled. When user application queries bitmap, check if requested page size is same as page size used to populated bitmap. If it is equal, copy bitmap, but if not equal, return error. Signed-off-by: Kirti Wankhede

[PATCH Kernel v21 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

2020-05-15 Thread Kirti Wankhede
Calculate and cache pgsize_bitmap when iommu->domain_list is updated and iommu->external_domain is set for mdev device. Add iommu->lock protection when cached pgsize_bitmap is accessed. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_typ

[PATCH Kernel v21 0/8] Add UAPIs to support migration for VFIO devices

2020-05-15 Thread Kirti Wankhede
l with read/write for trapped part of migration region. - Added both type of access support, trapped or mmapped, for data section of the region. - Moved PCI device functions to pci file. - Added iteration to get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Ki

[PATCH Kernel v21 4/8] vfio iommu: Add ioctl definition for dirty pages tracking

2020-05-15 Thread Kirti Wankhede
support to start/stop dirtied pages tracking and to get bitmap of all dirtied pages for requested IO virtual address range. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 55 +++ 1 file changed, 55 insertions

Re: [PATCH Kernel v20 4/8] vfio iommu: Add ioctl definition for dirty pages tracking

2020-05-15 Thread Kirti Wankhede
On 5/15/2020 4:29 PM, Cornelia Huck wrote: On Fri, 15 May 2020 02:07:43 +0530 Kirti Wankhede wrote: IOMMU container maintains a list of all pages pinned by vfio_pin_pages API. All pages pinned by vendor driver through this API should be considered as dirty during migration. When container

Re: [PATCH Kernel v20 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-15 Thread Kirti Wankhede
On 5/15/2020 8:45 PM, Alex Williamson wrote: On Fri, 15 May 2020 16:44:38 +0530 Kirti Wankhede wrote: On 5/15/2020 3:35 PM, Yan Zhao wrote: On Fri, May 15, 2020 at 02:07:44AM +0530, Kirti Wankhede wrote: VFIO_IOMMU_DIRTY_PAGES ioctl performs three operations: - Start dirty pages tracking

Re: [PATCH Kernel v20 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-15 Thread Kirti Wankhede
On 5/15/2020 7:01 PM, Alex Williamson wrote: On Fri, 15 May 2020 12:17:03 +0530 Kirti Wankhede wrote: On 5/15/2020 11:17 AM, Alex Williamson wrote: On Fri, 15 May 2020 09:46:43 +0530 Kirti Wankhede wrote: On 5/15/2020 8:57 AM, Alex Williamson wrote: On Fri, 15 May 2020 02:07:45

Re: [PATCH Kernel v20 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-15 Thread Kirti Wankhede
On 5/15/2020 3:35 PM, Yan Zhao wrote: On Fri, May 15, 2020 at 02:07:44AM +0530, Kirti Wankhede wrote: VFIO_IOMMU_DIRTY_PAGES ioctl performs three operations: - Start dirty pages tracking while migration is active - Stop dirty pages tracking. - Get dirty pages bitmap. Its user space

Re: [PATCH Kernel v20 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-15 Thread Kirti Wankhede
On 5/15/2020 11:17 AM, Alex Williamson wrote: On Fri, 15 May 2020 09:46:43 +0530 Kirti Wankhede wrote: On 5/15/2020 8:57 AM, Alex Williamson wrote: On Fri, 15 May 2020 02:07:45 +0530 Kirti Wankhede wrote: DMA mapped pages, including those pinned by mdev vendor drivers, might get

Re: [PATCH Kernel v20 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-14 Thread Kirti Wankhede
On 5/15/2020 8:57 AM, Alex Williamson wrote: On Fri, 15 May 2020 02:07:45 +0530 Kirti Wankhede wrote: DMA mapped pages, including those pinned by mdev vendor drivers, might get unpinned and unmapped while migration is active and device is still running. For example, in pre-copy phase while

[PATCH Kernel v20 8/8] vfio: Selective dirty page tracking if IOMMU backed device pins pages

2020-05-14 Thread Kirti Wankhede
all of the vfio_groups for each vfio_domain in the domain_list dirty page scope is limited to pinned pages. This flag is updated on first pinned pages request for that IOMMU group and on attaching/detaching group. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio.c |

[PATCH Kernel v20 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

2020-05-14 Thread Kirti Wankhede
Calculate and cache pgsize_bitmap when iommu->domain_list is updated and iommu->external_domain is set for mdev device. Add iommu->lock protection when cached pgsize_bitmap is accessed. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_typ

[PATCH Kernel v20 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-14 Thread Kirti Wankhede
VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_type1.c | 77 ++--- include/uapi/linux/vfio.h | 10 ++ 2 files changed, 75 insertions(+), 12 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v20 2/8] vfio iommu: Remove atomicity of ref_count of pinned pages

2020-05-14 Thread Kirti Wankhede
vfio_pfn.ref_count is always updated while holding iommu->lock, using atomic variable is overkill. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 9 + 1 file changed, 5 insertions(+)

[PATCH Kernel v20 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-14 Thread Kirti Wankhede
with the smallest supported page size. Update bitmap from pinning functions when tracking is enabled. When user application queries bitmap, check if requested page size is same as page size used to populated bitmap. If it is equal, copy bitmap, but if not equal, return error. Signed-off-by: Kirti Wankhede

[PATCH Kernel v20 4/8] vfio iommu: Add ioctl definition for dirty pages tracking

2020-05-14 Thread Kirti Wankhede
support to start/stop dirtied pages tracking and to get bitmap of all dirtied pages for requested IO virtual address range. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 55 +++ 1 file changed, 55 insertions

[PATCH Kernel v20 7/8] vfio iommu: Add migration capability to report supported features

2020-05-14 Thread Kirti Wankhede
for ioctls used to get dirty bitmap. Signed-off-by: Kirti Wankhede --- drivers/vfio/vfio_iommu_type1.c | 23 ++- include/uapi/linux/vfio.h | 22 ++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v20 0/8] Add UAPIs to support migration for VFIO devices

2020-05-14 Thread Kirti Wankhede
get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (8): vfio: UAPI for migration interface for device state vfio iommu: Remove atomicity of ref_count of pinned pages vfio iommu: Cache pgsize_bitmap in struct vfio_iommu vfio iommu: Add ioctl defi

[PATCH Kernel v20 1/8] vfio: UAPI for migration interface for device state

2020-05-14 Thread Kirti Wankhede
transition details. - Defined sequence to be followed while saving and resuming VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 228 ++ 1 file changed, 228 insertions(+) diff --git a/include/uapi/linux

Re: [PATCH Kernel v19 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-14 Thread Kirti Wankhede
On 5/14/2020 10:32 AM, Alex Williamson wrote: On Thu, 14 May 2020 01:34:36 +0530 Kirti Wankhede wrote: VFIO_IOMMU_DIRTY_PAGES ioctl performs three operations: - Start dirty pages tracking while migration is active - Stop dirty pages tracking. - Get dirty pages bitmap. Its user space

Re: [PATCH Kernel v19 7/8] vfio iommu: Add migration capability to report supported features

2020-05-14 Thread Kirti Wankhede
On 5/14/2020 10:31 AM, Alex Williamson wrote: On Thu, 14 May 2020 01:34:38 +0530 Kirti Wankhede wrote: Added migration capability in IOMMU info chain. User application should check IOMMU info chain for migration capability to use dirty page tracking feature provided by kernel module. User

Re: [PATCH Kernel v19 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-13 Thread Kirti Wankhede
On 5/14/2020 10:37 AM, Alex Williamson wrote: On Thu, 14 May 2020 01:34:37 +0530 Kirti Wankhede wrote: DMA mapped pages, including those pinned by mdev vendor drivers, might get unpinned and unmapped while migration is active and device is still running. For example, in pre-copy phase

[PATCH Kernel v19 8/8] vfio: Selective dirty page tracking if IOMMU backed device pins pages

2020-05-13 Thread Kirti Wankhede
all of the vfio_groups for each vfio_domain in the domain_list dirty page scope is limited to pinned pages. This flag is updated on first pinned pages request for that IOMMU group and on attaching/detaching group. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio.c |

[PATCH Kernel v19 7/8] vfio iommu: Add migration capability to report supported features

2020-05-13 Thread Kirti Wankhede
for ioctls used to get dirty bitmap. Signed-off-by: Kirti Wankhede --- drivers/vfio/vfio_iommu_type1.c | 24 +++- include/uapi/linux/vfio.h | 21 + 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b

[PATCH Kernel v19 6/8] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-13 Thread Kirti Wankhede
. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_type1.c | 102 +++- include/uapi/linux/vfio.h | 10 2 files changed, 99 insertions(+), 13 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio

[PATCH Kernel v19 5/8] vfio iommu: Implementation of ioctl for dirty pages tracking

2020-05-13 Thread Kirti Wankhede
with the smallest supported page size. Update bitmap from pinning functions when tracking is enabled. When user application queries bitmap, check if requested page size is same as page size used to populated bitmap. If it is equal, copy bitmap, but if not equal, return error. Signed-off-by: Kirti Wankhede

[PATCH Kernel v19 3/8] vfio iommu: Cache pgsize_bitmap in struct vfio_iommu

2020-05-13 Thread Kirti Wankhede
Calculate and cache pgsize_bitmap when iommu->domain_list is updated. Add iommu->lock protection when cached pgsize_bitmap is accessed. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- drivers/vfio/vfio_iommu_type1.c | 87 +++-- 1 file chang

[PATCH Kernel v19 2/8] vfio iommu: Remove atomicity of ref_count of pinned pages

2020-05-13 Thread Kirti Wankhede
vfio_pfn.ref_count is always updated while holding iommu->lock, using atomic variable is overkill. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Eric Auger Reviewed-by: Cornelia Huck --- drivers/vfio/vfio_iommu_type1.c | 9 + 1 file changed, 5 insertions(+)

[PATCH Kernel v19 4/8] vfio iommu: Add ioctl definition for dirty pages tracking.

2020-05-13 Thread Kirti Wankhede
support to start/stop dirtied pages tracking and to get bitmap of all dirtied pages for requested IO virtual address range. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 56 +++ 1 file changed, 56 insertions

[PATCH Kernel v19 1/8] vfio: UAPI for migration interface for device state

2020-05-13 Thread Kirti Wankhede
transition details. - Defined sequence to be followed while saving and resuming VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- include/uapi/linux/vfio.h | 228 ++ 1 file changed, 228 insertions(+) diff --git a/include/uapi/linux

[PATCH Kernel v19 0/8] Add UAPIs to support migration for VFIO devices

2020-05-13 Thread Kirti Wankhede
ata section of the region. - Moved PCI device functions to pci file. - Added iteration to get dirty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (8): vfio: UAPI for migration interface for device state vfio iommu: Remove atomicity of ref_count of

Re: [PATCH Kernel v18 4/7] vfio iommu: Implementation of ioctl for dirty pages tracking.

2020-05-13 Thread Kirti Wankhede
On 5/6/2020 4:24 PM, Cornelia Huck wrote: On Mon, 4 May 2020 21:28:56 +0530 Kirti Wankhede wrote: VFIO_IOMMU_DIRTY_PAGES ioctl performs three operations: - Start dirty pages tracking while migration is active - Stop dirty pages tracking. - Get dirty pages bitmap. Its user space

Re: [PATCH Kernel v18 5/7] vfio iommu: Update UNMAP_DMA ioctl to get dirty bitmap before unmap

2020-05-12 Thread Kirti Wankhede
On 5/7/2020 3:55 AM, Alex Williamson wrote: On Mon, 4 May 2020 21:28:57 +0530 Kirti Wankhede wrote: DMA mapped pages, including those pinned by mdev vendor drivers, might get unpinned and unmapped while migration is active and device is still running. For example, in pre-copy phase while

Re: [PATCH v16 QEMU 09/16] vfio: Add save state functions to SaveVMHandlers

2020-05-11 Thread Kirti Wankhede
On 5/9/2020 11:01 AM, Yan Zhao wrote: On Wed, Mar 25, 2020 at 05:09:07AM +0800, Kirti Wankhede wrote: Added .save_live_pending, .save_live_iterate and .save_live_complete_precopy functions. These functions handles pre-copy and stop-and-copy phase. In _SAVING|_RUNNING device state or pre

Re: [PATCH v16 QEMU 09/16] vfio: Add save state functions to SaveVMHandlers

2020-05-11 Thread Kirti Wankhede
On 5/5/2020 10:07 AM, Alex Williamson wrote: On Tue, 5 May 2020 04:48:14 +0530 Kirti Wankhede wrote: On 3/26/2020 3:33 AM, Alex Williamson wrote: On Wed, 25 Mar 2020 02:39:07 +0530 Kirti Wankhede wrote: Added .save_live_pending, .save_live_iterate and .save_live_complete_precopy

Re: [PATCH v1 2/2] Sample mtty: Add migration capability to mtty module

2020-05-06 Thread Kirti Wankhede
On 5/7/2020 6:31 AM, Yan Zhao wrote: On Tue, May 05, 2020 at 01:54:20AM +0800, Kirti Wankhede wrote: This patch makes mtty device migration capable. Purpose od this code is to test migration interface. Only stop-and-copy phase is implemented. Postcopy migration is not supported. Actual data

Re: [PATCH v16 QEMU 04/16] vfio: Add save and load functions for VFIO PCI devices

2020-05-06 Thread Kirti Wankhede
On 5/7/2020 1:33 AM, Alex Williamson wrote: On Thu, 7 May 2020 01:18:19 +0530 Kirti Wankhede wrote: On 5/6/2020 11:41 AM, Yan Zhao wrote: On Tue, May 05, 2020 at 12:37:11PM +0800, Alex Williamson wrote: On Tue, 5 May 2020 04:48:37 +0530 Kirti Wankhede wrote: On 3/26/2020 1:26 AM

Re: [PATCH Kernel v18 6/7] vfio iommu: Add migration capability to report supported features

2020-05-06 Thread Kirti Wankhede
On 5/7/2020 3:57 AM, Alex Williamson wrote: On Mon, 4 May 2020 21:28:58 +0530 Kirti Wankhede wrote: Added migration capability in IOMMU info chain. User application should check IOMMU info chain for migration capability to use dirty page tracking feature provided by kernel module. Signed

Re: [PATCH v16 QEMU 04/16] vfio: Add save and load functions for VFIO PCI devices

2020-05-06 Thread Kirti Wankhede
On 5/6/2020 11:41 AM, Yan Zhao wrote: On Tue, May 05, 2020 at 12:37:11PM +0800, Alex Williamson wrote: On Tue, 5 May 2020 04:48:37 +0530 Kirti Wankhede wrote: On 3/26/2020 1:26 AM, Alex Williamson wrote: On Wed, 25 Mar 2020 02:39:02 +0530 Kirti Wankhede wrote: These functions save

Re: [PATCH Kernel v18 4/7] vfio iommu: Implementation of ioctl for dirty pages tracking.

2020-05-06 Thread Kirti Wankhede
On 5/6/2020 1:45 PM, Yan Zhao wrote: On Mon, May 04, 2020 at 11:58:56PM +0800, Kirti Wankhede wrote: /* * Helper Functions for host iova-pfn list */ @@ -567,6 +654,18 @@ static int vfio_iommu_type1_pin_pages(void *iommu_data, vfio_unpin_page_external(dma

Re: [PATCH v16 QEMU 08/16] vfio: Register SaveVMHandlers for VFIO device

2020-05-06 Thread Kirti Wankhede
On 5/6/2020 10:23 PM, Dr. David Alan Gilbert wrote: * Cornelia Huck (coh...@redhat.com) wrote: On Wed, 6 May 2020 02:38:46 -0400 Yan Zhao wrote: On Tue, May 05, 2020 at 12:37:26PM +0800, Alex Williamson wrote: It's been a long time, but that doesn't seem like what I was asking. The sysfs

<    1   2   3   4   5   6   7   8   9   10   >