From: Cornelia Huck <cohuck@redhat.com>
To: Kirti Wankhede <kwankhede@nvidia.com>
Cc: alex.williamson@redhat.com, cjia@nvidia.com,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [RFC PATCH v1 2/4] Add migration functions for VFIO devices
Date: Wed, 17 Oct 2018 11:00:22 +0200 [thread overview]
Message-ID: <20181017110022.24af9ed1.cohuck@redhat.com> (raw)
In-Reply-To: <1539713558-2453-3-git-send-email-kwankhede@nvidia.com>
On Tue, 16 Oct 2018 23:42:36 +0530
Kirti Wankhede <kwankhede@nvidia.com> wrote:
> - Migration function are implemented for VFIO_DEVICE_TYPE_PCI device.
> - Added SaveVMHandlers and implemented all basic functions required for live
> migration.
> - Added VM state change handler to know running or stopped state of VM.
> - Added migration state change notifier to get notification on migration state
> change. This state is translated to VFIO device state and conveyed to vendor
> driver.
>
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> Reviewed-by: Neo Jia <cjia@nvidia.com>
> ---
> hw/vfio/Makefile.objs | 2 +-
> hw/vfio/migration.c | 716 ++++++++++++++++++++++++++++++++++++++++++
> include/hw/vfio/vfio-common.h | 23 ++
> 3 files changed, 740 insertions(+), 1 deletion(-)
> create mode 100644 hw/vfio/migration.c
>
> diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs
> index a2e7a0a7cf02..6206ad47e90e 100644
> --- a/hw/vfio/Makefile.objs
> +++ b/hw/vfio/Makefile.objs
> @@ -1,6 +1,6 @@
> ifeq ($(CONFIG_LINUX), y)
> obj-$(CONFIG_SOFTMMU) += common.o
> -obj-$(CONFIG_PCI) += pci.o pci-quirks.o display.o
> +obj-$(CONFIG_PCI) += pci.o pci-quirks.o display.o migration.o
I don't think you want to make this explicitly pci-specific, but build
in a proper split of common infrastructure and pci handling from the
beginning.
> obj-$(CONFIG_VFIO_CCW) += ccw.o
> obj-$(CONFIG_SOFTMMU) += platform.o
> obj-$(CONFIG_VFIO_XGMAC) += calxeda-xgmac.o
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> new file mode 100644
> index 000000000000..8a4f515226e0
> --- /dev/null
> +++ b/hw/vfio/migration.c
(...)
> +static int vfio_save_device_config_state(QEMUFile *f, void *opaque)
> +{
> + VFIODevice *vbasedev = opaque;
> +
> + qemu_put_be64(f, VFIO_MIG_FLAG_DEV_CONFIG_STATE);
> +
> + if (vbasedev->type == VFIO_DEVICE_TYPE_PCI) {
> + VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
> + PCIDevice *pdev = &vdev->pdev;
> + uint32_t msi_flags, msi_addr_lo, msi_addr_hi = 0, msi_data;
> + bool msi_64bit;
> + int i;
> +
> + for (i = 0; i < PCI_ROM_SLOT; i++) {
> + uint32_t bar;
> +
> + bar = pci_default_read_config(pdev, PCI_BASE_ADDRESS_0 + i * 4, 4);
> + qemu_put_be32(f, bar);
> + }
> +
> + msi_flags = pci_default_read_config(pdev,
> + pdev->msi_cap + PCI_MSI_FLAGS, 2);
> + msi_64bit = (msi_flags & PCI_MSI_FLAGS_64BIT);
> +
> + msi_addr_lo = pci_default_read_config(pdev,
> + pdev->msi_cap + PCI_MSI_ADDRESS_LO, 4);
> + qemu_put_be32(f, msi_addr_lo);
> +
> + if (msi_64bit) {
> + msi_addr_hi = pci_default_read_config(pdev,
> + pdev->msi_cap + PCI_MSI_ADDRESS_HI,
> + 4);
> + }
> + qemu_put_be32(f, msi_addr_hi);
> +
> + msi_data = pci_default_read_config(pdev,
> + pdev->msi_cap + (msi_64bit ? PCI_MSI_DATA_64 : PCI_MSI_DATA_32),
> + 2);
> + qemu_put_be32(f, msi_data);
> + }
This is an example of a function that should go into a pci-specific
file. Especially as config space is not a universal concept.
> + qemu_put_be64(f, VFIO_MIG_FLAG_END_OF_STATE);
> +
> + return qemu_file_get_error(f);
> +}
WARNING: multiple messages have this Message-ID (diff)
From: Cornelia Huck <cohuck@redhat.com>
To: Kirti Wankhede <kwankhede@nvidia.com>
Cc: alex.williamson@redhat.com, cjia@nvidia.com,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [RFC PATCH v1 2/4] Add migration functions for VFIO devices
Date: Wed, 17 Oct 2018 11:00:22 +0200 [thread overview]
Message-ID: <20181017110022.24af9ed1.cohuck@redhat.com> (raw)
In-Reply-To: <1539713558-2453-3-git-send-email-kwankhede@nvidia.com>
On Tue, 16 Oct 2018 23:42:36 +0530
Kirti Wankhede <kwankhede@nvidia.com> wrote:
> - Migration function are implemented for VFIO_DEVICE_TYPE_PCI device.
> - Added SaveVMHandlers and implemented all basic functions required for live
> migration.
> - Added VM state change handler to know running or stopped state of VM.
> - Added migration state change notifier to get notification on migration state
> change. This state is translated to VFIO device state and conveyed to vendor
> driver.
>
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> Reviewed-by: Neo Jia <cjia@nvidia.com>
> ---
> hw/vfio/Makefile.objs | 2 +-
> hw/vfio/migration.c | 716 ++++++++++++++++++++++++++++++++++++++++++
> include/hw/vfio/vfio-common.h | 23 ++
> 3 files changed, 740 insertions(+), 1 deletion(-)
> create mode 100644 hw/vfio/migration.c
>
> diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs
> index a2e7a0a7cf02..6206ad47e90e 100644
> --- a/hw/vfio/Makefile.objs
> +++ b/hw/vfio/Makefile.objs
> @@ -1,6 +1,6 @@
> ifeq ($(CONFIG_LINUX), y)
> obj-$(CONFIG_SOFTMMU) += common.o
> -obj-$(CONFIG_PCI) += pci.o pci-quirks.o display.o
> +obj-$(CONFIG_PCI) += pci.o pci-quirks.o display.o migration.o
I don't think you want to make this explicitly pci-specific, but build
in a proper split of common infrastructure and pci handling from the
beginning.
> obj-$(CONFIG_VFIO_CCW) += ccw.o
> obj-$(CONFIG_SOFTMMU) += platform.o
> obj-$(CONFIG_VFIO_XGMAC) += calxeda-xgmac.o
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> new file mode 100644
> index 000000000000..8a4f515226e0
> --- /dev/null
> +++ b/hw/vfio/migration.c
(...)
> +static int vfio_save_device_config_state(QEMUFile *f, void *opaque)
> +{
> + VFIODevice *vbasedev = opaque;
> +
> + qemu_put_be64(f, VFIO_MIG_FLAG_DEV_CONFIG_STATE);
> +
> + if (vbasedev->type == VFIO_DEVICE_TYPE_PCI) {
> + VFIOPCIDevice *vdev = container_of(vbasedev, VFIOPCIDevice, vbasedev);
> + PCIDevice *pdev = &vdev->pdev;
> + uint32_t msi_flags, msi_addr_lo, msi_addr_hi = 0, msi_data;
> + bool msi_64bit;
> + int i;
> +
> + for (i = 0; i < PCI_ROM_SLOT; i++) {
> + uint32_t bar;
> +
> + bar = pci_default_read_config(pdev, PCI_BASE_ADDRESS_0 + i * 4, 4);
> + qemu_put_be32(f, bar);
> + }
> +
> + msi_flags = pci_default_read_config(pdev,
> + pdev->msi_cap + PCI_MSI_FLAGS, 2);
> + msi_64bit = (msi_flags & PCI_MSI_FLAGS_64BIT);
> +
> + msi_addr_lo = pci_default_read_config(pdev,
> + pdev->msi_cap + PCI_MSI_ADDRESS_LO, 4);
> + qemu_put_be32(f, msi_addr_lo);
> +
> + if (msi_64bit) {
> + msi_addr_hi = pci_default_read_config(pdev,
> + pdev->msi_cap + PCI_MSI_ADDRESS_HI,
> + 4);
> + }
> + qemu_put_be32(f, msi_addr_hi);
> +
> + msi_data = pci_default_read_config(pdev,
> + pdev->msi_cap + (msi_64bit ? PCI_MSI_DATA_64 : PCI_MSI_DATA_32),
> + 2);
> + qemu_put_be32(f, msi_data);
> + }
This is an example of a function that should go into a pci-specific
file. Especially as config space is not a universal concept.
> + qemu_put_be64(f, VFIO_MIG_FLAG_END_OF_STATE);
> +
> + return qemu_file_get_error(f);
> +}
next prev parent reply other threads:[~2018-10-17 9:00 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-16 18:12 [RFC PATCH v1 0/4] Add migration support for VFIO device Kirti Wankhede
2018-10-16 18:12 ` [Qemu-devel] " Kirti Wankhede
2018-10-16 18:12 ` [RFC PATCH v1 1/4] VFIO KABI for migration interface Kirti Wankhede
2018-10-16 18:12 ` [Qemu-devel] " Kirti Wankhede
2018-10-16 22:34 ` Alex Williamson
2018-10-16 22:34 ` [Qemu-devel] " Alex Williamson
2018-10-17 20:47 ` Kirti Wankhede
2018-10-17 20:47 ` [Qemu-devel] " Kirti Wankhede
2018-10-17 23:14 ` Alex Williamson
2018-10-17 23:14 ` [Qemu-devel] " Alex Williamson
2018-10-18 1:49 ` Gonglei (Arei)
2018-10-18 1:49 ` [Qemu-devel] " Gonglei (Arei)
2018-10-17 9:06 ` Christoph Hellwig
2018-10-17 9:06 ` [Qemu-devel] " Christoph Hellwig
2018-10-17 10:09 ` Dr. David Alan Gilbert
2018-10-17 10:09 ` [Qemu-devel] " Dr. David Alan Gilbert
2018-10-17 21:17 ` Kirti Wankhede
2018-10-17 21:17 ` [Qemu-devel] " Kirti Wankhede
2018-10-18 9:23 ` Dr. David Alan Gilbert
2018-10-18 9:23 ` [Qemu-devel] " Dr. David Alan Gilbert
2018-10-16 18:12 ` [RFC PATCH v1 2/4] Add migration functions for VFIO devices Kirti Wankhede
2018-10-16 18:12 ` [Qemu-devel] " Kirti Wankhede
2018-10-17 9:00 ` Cornelia Huck [this message]
2018-10-17 9:00 ` Cornelia Huck
2018-10-17 21:03 ` Kirti Wankhede
2018-10-17 21:03 ` [Qemu-devel] " Kirti Wankhede
2018-10-16 18:12 ` [RFC PATCH v1 3/4] Add vfio_listerner_log_sync to mark dirty pages Kirti Wankhede
2018-10-16 18:12 ` [Qemu-devel] " Kirti Wankhede
2018-10-16 18:12 ` [RFC PATCH v1 4/4] Make vfio-pci device migration capable Kirti Wankhede
2018-10-16 18:12 ` [Qemu-devel] " Kirti Wankhede
2018-10-17 8:49 ` [RFC PATCH v1 0/4] Add migration support for VFIO device Cornelia Huck
2018-10-17 8:49 ` [Qemu-devel] " Cornelia Huck
2018-10-17 20:59 ` Kirti Wankhede
2018-10-17 20:59 ` [Qemu-devel] " Kirti Wankhede
2018-10-18 2:41 ` Tian, Kevin
2018-10-18 2:41 ` [Qemu-devel] " Tian, Kevin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181017110022.24af9ed1.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.