[PATCH v27 00/17] Add migration support for VFIO devices

2020-10-22 Thread Kirti Wankhede
ty page bitmap until bitmap for all requested pages are copied. Thanks, Kirti Kirti Wankhede (17): vfio: Add function to unmap VFIO region vfio: Add vfio_get_object callback to VFIODeviceOps vfio: Add save and load functions for VFIO PCI devices vfio: Add migration region initializatio

[PATCH v27 08/17] vfio: Add save state functions to SaveVMHandlers

2020-10-22 Thread Kirti Wankhede
data_size before moving to next steps. Includes Fix Reported-by: Zhi Wang https://www.mail-archive.com/qemu-devel@nongnu.org/msg743722.htm Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 276 ++ hw/vfio/tra

[PATCH v27 02/17] vfio: Add vfio_get_object callback to VFIODeviceOps

2020-10-22 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 v27 06/17] vfio: Add migration state change notifier

2020-10-22 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 37

[PATCH v27 01/17] vfio: Add function to unmap VFIO region

2020-10-22 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

Re: [PATCH v26 08/17] vfio: Add save state functions to SaveVMHandlers

2020-10-21 Thread Kirti Wankhede
turn 1; + } } data_size = vfio_save_buffer(f, vbasedev); -Original Message- From: Kirti Wankhede Sent: Wednesday, September 23, 2020 2:24 AM To: alex.william...@redhat.com; c...@nvidia.com Cc: Tian, Kevin ; Yang, Ziye ; Liu, Changpeng ; Liu, Yi L ; mlevi...@redhat.com; eskul...@redh

Re: [PATCH v26 05/17] vfio: Add VM state change handler to know state of VM

2020-10-20 Thread Kirti Wankhede
On 10/20/2020 4:21 PM, Cornelia Huck wrote: On Sun, 18 Oct 2020 01:54:56 +0530 Kirti Wankhede wrote: On 9/29/2020 4:33 PM, Dr. David Alan Gilbert wrote: * Cornelia Huck (coh...@redhat.com) wrote: On Wed, 23 Sep 2020 04:54:07 +0530 Kirti Wankhede wrote: VM state change handler gets

Re: [PATCH v26 13/17] vfio: create mapped iova list when vIOMMU is enabled

2020-10-19 Thread Kirti Wankhede
On 10/19/2020 10:54 PM, Alex Williamson wrote: On Mon, 19 Oct 2020 11:31:03 +0530 Kirti Wankhede wrote: On 9/26/2020 3:53 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:15 +0530 Kirti Wankhede wrote: Create mapped iova list when vIOMMU is enabled. For each mapped iova save

Re: [PATCH v26 13/17] vfio: create mapped iova list when vIOMMU is enabled

2020-10-19 Thread Kirti Wankhede
On 9/26/2020 3:53 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:15 +0530 Kirti Wankhede wrote: Create mapped iova list when vIOMMU is enabled. For each mapped iova save translated address. Add node to list on MAP and remove node from list on UNMAP. This list is used to track dirty

Re: [PATCH v26 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-10-18 Thread Kirti Wankhede
On 9/25/2020 5:23 PM, Cornelia Huck wrote: On Wed, 23 Sep 2020 04:54:09 +0530 Kirti Wankhede wrote: Define flags to be used as delimeter in migration file stream. Added .save_setup and .save_cleanup functions. Mapped & unmapped migration region from these functions at source during sa

Re: [PATCH v26 12/17] vfio: Add function to start and stop dirty pages tracking

2020-10-18 Thread Kirti Wankhede
On 9/26/2020 3:25 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:14 +0530 Kirti Wankhede wrote: Call VFIO_IOMMU_DIRTY_PAGES ioctl to start and stop dirty pages tracking for VFIO devices. Signed-off-by: Kirti Wankhede Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c

Re: [PATCH v26 09/17] vfio: Add load state functions to SaveVMHandlers

2020-10-18 Thread Kirti Wankhede
On 10/1/2020 3:37 PM, Cornelia Huck wrote: On Wed, 23 Sep 2020 04:54:11 +0530 Kirti Wankhede wrote: Sequence during _RESUMING device state: While data for this device is available, repeat below steps: a. read data_offset from where user application should write data. b. write data

Re: [PATCH v26 08/17] vfio: Add save state functions to SaveVMHandlers

2020-10-18 Thread Kirti Wankhede
On 9/26/2020 2:32 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:10 +0530 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 v26 05/17] vfio: Add VM state change handler to know state of VM

2020-10-18 Thread Kirti Wankhede
+vfio_migration_set_state(char *name, uint32_t state) " (%s) state %d" +vfio_vmstate_change(char *name, int running, const char *reason, uint32_t dev_state) " (%s) running %d reason %s device state %d" diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index

Re: [PATCH v26 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-10-18 Thread Kirti Wankhede
On 9/26/2020 1:50 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:09 +0530 Kirti Wankhede wrote: Define flags to be used as delimeter in migration file stream. Added .save_setup and .save_cleanup functions. Mapped & unmapped migration region from these functions at source du

Re: [PATCH v26 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-10-17 Thread Kirti Wankhede
On 9/29/2020 3:49 PM, Dr. David Alan Gilbert wrote: * Philippe Mathieu-Daudé (phi...@redhat.com) wrote: On 9/23/20 1:24 AM, Kirti Wankhede wrote: Define flags to be used as delimeter in migration file stream. Typo "delimiter". Added .save_setup and .save_cleanup functio

Re: [PATCH v26 06/17] vfio: Add migration state change notifier

2020-10-17 Thread Kirti Wankhede
On 9/26/2020 1:50 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:08 +0530 Kirti Wankhede wrote: 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

Re: [PATCH v26 05/17] vfio: Add VM state change handler to know state of VM

2020-10-17 Thread Kirti Wankhede
On 9/26/2020 1:50 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:07 +0530 Kirti Wankhede wrote: 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 Reviewed-by: Dr. David

Re: [PATCH v26 05/17] vfio: Add VM state change handler to know state of VM

2020-10-17 Thread Kirti Wankhede
On 9/29/2020 4:33 PM, Dr. David Alan Gilbert wrote: * Cornelia Huck (coh...@redhat.com) wrote: On Wed, 23 Sep 2020 04:54:07 +0530 Kirti Wankhede wrote: 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

Re: [PATCH v26 04/17] vfio: Add migration region initialization and finalize function

2020-10-17 Thread Kirti Wankhede
On 9/26/2020 1:50 AM, Alex Williamson wrote: On Wed, 23 Sep 2020 04:54:06 +0530 Kirti Wankhede wrote: Whether the VFIO device supports migration or not is decided based of migration region query. If migration region query is successful and migration region initialization is successful

Re: [PATCH v26 04/17] vfio: Add migration region initialization and finalize function

2020-10-17 Thread Kirti Wankhede
On 9/24/2020 7:38 PM, Cornelia Huck wrote: On Wed, 23 Sep 2020 04:54:06 +0530 Kirti Wankhede wrote: Whether the VFIO device supports migration or not is decided based of migration region query. If migration region query is successful and migration region initialization is successful

[PATCH v26 16/17] vfio: Make vfio-pci device migration capable

2020-09-22 Thread Kirti Wankhede
structure and use migration blocker from generic structure of VFIO device. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/pci.c | 28 hw/vfio/pci.h | 1 - 2 files changed, 8 insertions(+), 21 deletions(-) diff

[PATCH v26 15/17] vfio: Add ioctl to get dirty pages bitmap during dma unmap.

2020-09-22 Thread Kirti Wankhede
-by: Kirti Wankhede Reviewed-by: Neo Jia --- Note: Comments from v25 for this patch are not addressed in this series. https://www.mail-archive.com/qemu-devel@nongnu.org/msg714646.html Need to investigate more on the points raised in previous version. hw/vfio/common.c | 90

[PATCH v26 14/17] vfio: Add vfio_listener_log_sync to mark dirty pages

2020-09-22 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 v26 13/17] vfio: create mapped iova list when vIOMMU is enabled

2020-09-22 Thread Kirti Wankhede
Create mapped iova list when vIOMMU is enabled. For each mapped iova save translated address. Add node to list on MAP and remove node from list on UNMAP. This list is used to track dirty pages during migration. Signed-off-by: Kirti Wankhede --- hw/vfio/common.c | 58

[PATCH v26 12/17] vfio: Add function to start and stop dirty pages tracking

2020-09-22 Thread Kirti Wankhede
Call VFIO_IOMMU_DIRTY_PAGES ioctl to start and stop dirty pages tracking for VFIO devices. Signed-off-by: Kirti Wankhede Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 36 1 file changed, 36 insertions(+) diff --git a/hw/vfio/migration.c b

[PATCH v26 10/17] memory: Set DIRTY_MEMORY_MIGRATION when IOMMU is enabled

2020-09-22 Thread Kirti Wankhede
mr->ram_block is NULL when mr->is_iommu is true, then fr.dirty_log_mask wasn't set correctly due to which memory listener's log_sync doesn't get called. This patch returns log_mask with DIRTY_MEMORY_MIGRATION set when IOMMU is enabled. Signed-off-by: Kirti Wankhede --- softmmu/memory

[PATCH v26 08/17] vfio: Add save state functions to SaveVMHandlers

2020-09-22 Thread Kirti Wankhede
data_size before moving to next steps. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 273 ++ hw/vfio/trace-events | 6 + include/hw/vfio/vfio-common.h | 1 + 3 files changed, 280 insertions(+) diff --git

[PATCH v26 09/17] vfio: Add load state functions to SaveVMHandlers

2020-09-22 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 170 +++ hw/vfio/trace

[PATCH v26 11/17] vfio: Get migration capability flags for container

2020-09-22 Thread Kirti Wankhede
if IOMMU module doesn't support migration capability. Signed-off-by: Kirti Wankhede Cc: Shameer Kolothum Cc: Eric Auger --- hw/vfio/common.c | 90 +++ hw/vfio/migration.c | 7 +++- include/hw/vfio/vfio-common.h | 3 ++ 3 files

[PATCH v26 17/17] qapi: Add VFIO devices migration stats in Migration stats

2020-09-22 Thread Kirti Wankhede
Added amount of bytes transferred to the target VM by all VFIO devices Signed-off-by: Kirti Wankhede --- Note: Comments from v25 for this patch are not addressed yet. https://www.mail-archive.com/qemu-devel@nongnu.org/msg715620.html Alex, need more pointer on documentation part raised Markus

[PATCH v26 06/17] vfio: Add migration state change notifier

2020-09-22 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 29

[PATCH v26 05/17] vfio: Add VM state change handler to know state of VM

2020-09-22 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 136 ++ hw/vfio

[PATCH v26 04/17] vfio: Add migration region initialization and finalize function

2020-09-22 Thread Kirti Wankhede
Whether the VFIO device supports migration or not is decided based of migration region query. If migration region query is successful and migration region initialization is successful then migration is supported else migration is blocked. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Acked

[PATCH v26 02/17] vfio: Add vfio_get_object callback to VFIODeviceOps

2020-09-22 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 v26 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-09-22 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 | 91 hw/vfio/t

[PATCH v26 03/17] vfio: Add save and load functions for VFIO PCI devices

2020-09-22 Thread Kirti Wankhede
These functions save and restore PCI device specific data - config space of PCI device. Used VMStateDescription to save and restore interrupt state. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/pci.c | 134 ++ hw/vfio

[PATCH v26 01/17] vfio: Add function to unmap VFIO region

2020-09-22 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 v25 00/17] Add migration support for VFIO devices

2020-09-22 Thread Kirti Wankhede
Replaced ioctl 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. T

Re: [PATCH QEMU v25 15/17] vfio: Add ioctl to get dirty pages bitmap during dma unmap.

2020-06-25 Thread Kirti Wankhede
On 6/25/2020 12:26 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:24 +0530 Kirti Wankhede wrote: With vIOMMU, IO virtual address range can get unmapped while in pre-copy phase of migration. In that case, unmap ioctl should return pages pinned in that range and QEMU should find its

Re: [PATCH QEMU v25 14/17] vfio: Add vfio_listener_log_sync to mark dirty pages

2020-06-25 Thread Kirti Wankhede
On 6/25/2020 12:25 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:23 +0530 Kirti Wankhede wrote: 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

Re: [PATCH QEMU v25 13/17] vfio: create mapped iova list when vIOMMU is enabled

2020-06-25 Thread Kirti Wankhede
On 6/25/2020 12:25 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:22 +0530 Kirti Wankhede wrote: Create mapped iova list when vIOMMU is enabled. For each mapped iova save translated address. Add node to list on MAP and remove node from list on UNMAP. This list is used to track dirty

Re: [PATCH QEMU v25 09/17] vfio: Add load state functions to SaveVMHandlers

2020-06-25 Thread Kirti Wankhede
On 6/25/2020 12:24 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:18 +0530 Kirti Wankhede wrote: Sequence during _RESUMING device state: While data for this device is available, repeat below steps: a. read data_offset from where user application should write data. b. write data

Re: [PATCH QEMU v25 11/17] vfio: Get migration capability flags for container

2020-06-25 Thread Kirti Wankhede
On 6/25/2020 12:25 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:20 +0530 Kirti Wankhede wrote: 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

Re: [PATCH QEMU v25 03/17] vfio: Add save and load functions for VFIO PCI devices

2020-06-24 Thread Kirti Wankhede
On 6/23/2020 1:58 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:12 +0530 Kirti Wankhede wrote: 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

Re: [PATCH QEMU v25 17/17] qapi: Add VFIO devices migration stats in Migration stats

2020-06-23 Thread Kirti Wankhede
answers :) Kirti Wankhede writes: Added amount of bytes transferred to the target VM by all VFIO devices Signed-off-by: Kirti Wankhede [...] diff --git a/qapi/migration.json b/qapi/migration.json index d5000558c6c9..952864b05455 100644 --- a/qapi/migration.json +++ b/qapi/migration.json

Re: [PATCH QEMU v25 08/17] vfio: Add save state functions to SaveVMHandlers

2020-06-23 Thread Kirti Wankhede
On 6/23/2020 4:20 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:17 +0530 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 QEMU v25 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-06-23 Thread Kirti Wankhede
On 6/23/2020 4:20 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:16 +0530 Kirti Wankhede wrote: Define flags to be used as delimeter in migration file stream. Added .save_setup and .save_cleanup functions. Mapped & unmapped migration region from these functions at source du

Re: [PATCH QEMU v25 05/17] vfio: Add VM state change handler to know state of VM

2020-06-23 Thread Kirti Wankhede
On 6/23/2020 4:20 AM, Alex Williamson wrote: On Sun, 21 Jun 2020 01:51:14 +0530 Kirti Wankhede wrote: 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 Reviewed-by: Dr. David

[PATCH QEMU v25 15/17] vfio: Add ioctl to get dirty pages bitmap during dma unmap.

2020-06-20 Thread Kirti Wankhede
-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/common.c | 85 +--- 1 file changed, 81 insertions(+), 4 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 0518cf228ed5..a06b8f2f66e2 100644 --- a/hw/vfio/common.c +++ b/hw/vfio

[PATCH QEMU v25 13/17] vfio: create mapped iova list when vIOMMU is enabled

2020-06-20 Thread Kirti Wankhede
Create mapped iova list when vIOMMU is enabled. For each mapped iova save translated address. Add node to list on MAP and remove node from list on UNMAP. This list is used to track dirty pages during migration. Signed-off-by: Kirti Wankhede --- hw/vfio/common.c | 58

[PATCH QEMU v25 16/17] vfio: Make vfio-pci device migration capable

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

[PATCH QEMU v25 11/17] vfio: Get migration capability flags for container

2020-06-20 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 v25 17/17] qapi: Add VFIO devices migration stats in Migration stats

2020-06-20 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 | 11 ++- include/qemu/vfio-helpers.h | 3 +++ migration/migration.c | 14

[PATCH QEMU v25 14/17] vfio: Add vfio_listener_log_sync to mark dirty pages

2020-06-20 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 v25 10/17] memory: Set DIRTY_MEMORY_MIGRATION when IOMMU is enabled

2020-06-20 Thread Kirti Wankhede
mr->ram_block is NULL when mr->is_iommu is true, then fr.dirty_log_mask wasn't set correctly due to which memory listener's log_sync doesn't get called. This patch returns log_mask with DIRTY_MEMORY_MIGRATION set when IOMMU is enabled. Signed-off-by: Kirti Wankhede --- memory.c | 2 +-

[PATCH QEMU v25 12/17] vfio: Add function to start and stop dirty pages tracking

2020-06-20 Thread Kirti Wankhede
Call VFIO_IOMMU_DIRTY_PAGES ioctl to start and stop dirty pages tracking for VFIO devices. Signed-off-by: Kirti Wankhede Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 36 1 file changed, 36 insertions(+) diff --git a/hw/vfio/migration.c b

[PATCH QEMU v25 06/17] vfio: Add migration state change notifier

2020-06-20 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 29

[PATCH QEMU v25 05/17] vfio: Add VM state change handler to know state of VM

2020-06-20 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 87 +++ hw/vfio

[PATCH QEMU v25 09/17] vfio: Add load state functions to SaveVMHandlers

2020-06-20 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 Reviewed-by: Dr. David Alan Gilbert --- hw/vfio/migration.c | 177 +++ hw/vfio/trace

[PATCH QEMU v25 08/17] vfio: Add save state functions to SaveVMHandlers

2020-06-20 Thread Kirti Wankhede
data_size before moving to next steps. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/migration.c | 283 ++ hw/vfio/trace-events | 6 + include/hw/vfio/vfio-common.h | 1 + 3 files changed, 290 insertions(+) diff --git

[PATCH QEMU v25 04/17] vfio: Add migration region initialization and finalize function

2020-06-20 Thread Kirti Wankhede
Whether the VFIO device supports migration or not is decided based of migration region query. If migration region query is successful and migration region initialization is successful then migration is supported else migration is blocked. Signed-off-by: Kirti Wankhede Reviewed-by: Neo Jia Acked

[PATCH QEMU v25 07/17] vfio: Register SaveVMHandlers for VFIO device

2020-06-20 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 | 92 hw/vfio/t

[PATCH QEMU v25 03/17] vfio: Add save and load functions for VFIO PCI devices

2020-06-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 | 95 +++ include/hw/vfio/vfio

[PATCH QEMU v25 01/17] vfio: Add function to unmap VFIO region

2020-06-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 v25 00/17] Add migration support for VFIO devices

2020-06-20 Thread Kirti Wankhede
tion region. - Replaced ioctl 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

[PATCH QEMU v25 02/17] vfio: Add vfio_get_object callback to VFIODeviceOps

2020-06-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 2/2] vfio iommu: typecast corrections

2020-06-02 Thread Kirti Wankhede
Fixes sparse warnings by adding '__user' in typecast for copy_[from,to]_user() Fixes: d6a4c185660c (vfio iommu: Implementation of ioctl for dirty pages tracking) Signed-off-by: Kirti Wankhede Reported-by: kbuild test robot --- drivers/vfio/vfio_iommu_type1.c | 4 ++-- 1 file changed, 2

[PATCH 1/2] vfio iommu: Use shift operation for 64-bit integer division

2020-06-02 Thread Kirti Wankhede
pages tracking) Signed-off-by: Kirti Wankhede Reported-by: kbuild test robot --- drivers/vfio/vfio_iommu_type1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 97a29bc04d5d..9d9c8709a24c 100644 --- a/driver

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

2020-06-02 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 0/8] Add UAPIs to support migration for VFIO devices

2020-05-29 Thread Kirti Wankhede
On 5/29/2020 4:29 AM, Alex Williamson wrote: On Wed, 27 May 2020 09:48:22 +0100 "Dr. David Alan Gilbert" wrote: * Yan Zhao (yan.y.z...@intel.com) wrote: BTW, for viommu, the downtime data is as below. under the same network condition and guest memory size, and no running dirty data/memory

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

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

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

2020-05-28 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 Reviewed-by: Yan Zhao --- drivers/vfio/vfi

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

2020-05-28 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 Reviewed-by: Yan Zhao --- drivers/vfio/vfio_iommu_type1.c | 9 + 1 file changed

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

2020-05-28 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 v24 1/8] vfio: UAPI for migration interface for device state

2020-05-28 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 Reviewed-by: Cornelia Huck Reviewed-by: Yan Zhao --- include/uapi/linux/vfio.h | 228 ++ 1 file changed

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

2020-05-28 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 Reviewed-by:

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

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

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

2020-05-28 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 Reviewed-by: Cornelia Huck Reviewed-by: Yan Zhao --- include/uapi/linux/vfio.h | 57

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

2020-05-28 Thread Kirti Wankhede
igration 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 (8): vfio: UAPI

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

2020-05-28 Thread Kirti Wankhede
On 5/28/2020 10:17 AM, Yan Zhao wrote: The whole series works for us in general: Reviewed-by: Yan Zhao Thanks. Kirti On Wed, May 20, 2020 at 11:38:00PM +0530, Kirti Wankhede wrote: Hi, This patch set adds: * IOCTL VFIO_IOMMU_DIRTY_PAGES to get dirty pages bitmap

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

2020-05-25 Thread Kirti Wankhede
On 5/25/2020 12:29 PM, 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

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

2020-05-21 Thread Kirti Wankhede
On 5/21/2020 7:48 PM, Dr. David Alan Gilbert wrote: * Kirti Wankhede (kwankh...@nvidia.com) wrote: Define flags to be used as delimeter in migration file stream. Added .save_setup and .save_cleanup functions. Mapped & unmapped migration region from these functions at source during sa

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

2020-05-21 Thread Kirti Wankhede
On 5/21/2020 3:20 PM, Dr. David Alan Gilbert wrote: * Kirti Wankhede (kwankh...@nvidia.com) wrote: 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

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

2020-05-21 Thread Kirti Wankhede
On 5/21/2020 12:34 PM, Yan Zhao wrote: On Thu, May 21, 2020 at 12:39:48PM +0530, Kirti Wankhede wrote: On 5/21/2020 10:38 AM, Yan Zhao wrote: On Wed, May 20, 2020 at 10:46:12AM -0600, Alex Williamson wrote: On Wed, 20 May 2020 19:10:07 +0530 Kirti Wankhede wrote: On 5/20/2020 8:25 AM

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

2020-05-21 Thread Kirti Wankhede
On 5/21/2020 12:34 PM, Yan Zhao wrote: On Thu, May 21, 2020 at 12:39:48PM +0530, Kirti Wankhede wrote: On 5/21/2020 10:38 AM, Yan Zhao wrote: On Wed, May 20, 2020 at 10:46:12AM -0600, Alex Williamson wrote: On Wed, 20 May 2020 19:10:07 +0530 Kirti Wankhede wrote: On 5/20/2020 8:25 AM

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

2020-05-21 Thread Kirti Wankhede
On 5/21/2020 10:38 AM, Yan Zhao wrote: On Wed, May 20, 2020 at 10:46:12AM -0600, Alex Williamson wrote: On Wed, 20 May 2020 19:10:07 +0530 Kirti Wankhede wrote: 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

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

2020-05-20 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 v23 14/18] vfio: Add function to start and stop dirty pages tracking

2020-05-20 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 v23 13/18] vfio: Get migration capability flags for container

2020-05-20 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 v23 16/18] vfio: Add ioctl to get dirty pages bitmap during dma unmap.

2020-05-20 Thread Kirti Wankhede
-by: Kirti Wankhede Reviewed-by: Neo Jia --- hw/vfio/common.c | 84 +--- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 3f7049fbd1b0..2dd9e8b24788 100644 --- a/hw/vfio/common.c +++ b/hw/vfio

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

2020-05-20 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 | 18

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

2020-05-20 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 a6c69e1391ba..27f22f1a9974 100644 --- a/memory.c +++ b/memory.c @@ -1788,7 +1788,7 @@ bool memory_region_is_ram_device(MemoryRegion *mr) uint8_t

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

2020-05-20 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 v23 07/18] vfio: Add migration state change notifier

2020-05-20 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 v23 10/18] vfio: Add load state functions to SaveVMHandlers

2020-05-20 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 v23 11/18] iommu: add callback to get address limit IOMMU supports

2020-05-20 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 v23 08/18] vfio: Register SaveVMHandlers for VFIO device

2020-05-20 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 v23 06/18] vfio: Add VM state change handler to know state of VM

2020-05-20 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 v23 09/18] vfio: Add save state functions to SaveVMHandlers

2020-05-20 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

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