From: Kirti Wankhede <kwankhede@nvidia.com>
To: Shenming Lu <lushenming@huawei.com>,
Alex Williamson <alex.williamson@redhat.com>,
Cornelia Huck <cohuck@redhat.com>, <qemu-devel@nongnu.org>,
<qemu-arm@nongnu.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Neo Jia <cjia@nvidia.com>,
mst@redhat.com, Marc Zyngier <maz@kernel.org>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Eric Auger <eric.auger@redhat.com>,
yuzenghui@huawei.com, wanghaibin.wang@huawei.com
Subject: Re: [PATCH v3 1/3] vfio: Move the saving of the config space to the right place in VFIO migration
Date: Mon, 1 Mar 2021 11:27:28 +0530 [thread overview]
Message-ID: <6e88241a-3d4e-9e8b-ed10-a8f2ba7179b1@nvidia.com> (raw)
In-Reply-To: <20210223022225.50-2-lushenming@huawei.com>
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
On 2/23/2021 7:52 AM, Shenming Lu wrote:
> On ARM64 the VFIO SET_IRQS ioctl is dependent on the VM interrupt
> setup, if the restoring of the VFIO PCI device config space is
> before the VGIC, an error might occur in the kernel.
>
> So we move the saving of the config space to the non-iterable
> process, thus it will be called after the VGIC according to
> their priorities.
>
> As for the possible dependence of the device specific migration
> data on it's config space, we can let the vendor driver to
> include any config info it needs in its own data stream.
>
> Signed-off-by: Shenming Lu <lushenming@huawei.com>
> ---
> hw/vfio/migration.c | 25 +++++++++++++++----------
> 1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 00daa50ed8..f5bf67f642 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -575,11 +575,6 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque)
> return ret;
> }
>
> - ret = vfio_save_device_config_state(f, opaque);
> - if (ret) {
> - return ret;
> - }
> -
> ret = vfio_update_pending(vbasedev);
> if (ret) {
> return ret;
> @@ -620,6 +615,19 @@ static int vfio_save_complete_precopy(QEMUFile *f, void *opaque)
> return ret;
> }
>
> +static void vfio_save_state(QEMUFile *f, void *opaque)
> +{
> + VFIODevice *vbasedev = opaque;
> + int ret;
> +
> + ret = vfio_save_device_config_state(f, opaque);
> + if (ret) {
> + error_report("%s: Failed to save device config space",
> + vbasedev->name);
> + qemu_file_set_error(f, ret);
> + }
> +}
> +
> static int vfio_load_setup(QEMUFile *f, void *opaque)
> {
> VFIODevice *vbasedev = opaque;
> @@ -670,11 +678,7 @@ static int vfio_load_state(QEMUFile *f, void *opaque, int version_id)
> switch (data) {
> case VFIO_MIG_FLAG_DEV_CONFIG_STATE:
> {
> - ret = vfio_load_device_config_state(f, opaque);
> - if (ret) {
> - return ret;
> - }
> - break;
> + return vfio_load_device_config_state(f, opaque);
> }
> case VFIO_MIG_FLAG_DEV_SETUP_STATE:
> {
> @@ -720,6 +724,7 @@ static SaveVMHandlers savevm_vfio_handlers = {
> .save_live_pending = vfio_save_pending,
> .save_live_iterate = vfio_save_iterate,
> .save_live_complete_precopy = vfio_save_complete_precopy,
> + .save_state = vfio_save_state,
> .load_setup = vfio_load_setup,
> .load_cleanup = vfio_load_cleanup,
> .load_state = vfio_load_state,
>
next prev parent reply other threads:[~2021-03-01 5:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-23 2:22 [PATCH v3 0/3] vfio: Some fixes and optimizations for VFIO migration Shenming Lu
2021-02-23 2:22 ` [PATCH v3 1/3] vfio: Move the saving of the config space to the right place in " Shenming Lu
2021-03-01 5:57 ` Kirti Wankhede [this message]
2021-02-23 2:22 ` [PATCH v3 2/3] vfio: Set the priority of the VFIO VM state change handler explicitly Shenming Lu
2021-02-23 2:22 ` [PATCH v3 3/3] vfio: Avoid disabling and enabling vectors repeatedly in VFIO migration Shenming Lu
2021-03-02 21:26 ` Alex Williamson
2021-03-09 7:25 ` Shenming Lu
2021-03-09 18:12 ` Alex Williamson
2021-03-02 5:58 ` [PATCH v3 0/3] vfio: Some fixes and optimizations for " Shenming Lu
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=6e88241a-3d4e-9e8b-ed10-a8f2ba7179b1@nvidia.com \
--to=kwankhede@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=cjia@nvidia.com \
--cc=cohuck@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eric.auger@redhat.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=lushenming@huawei.com \
--cc=maz@kernel.org \
--cc=mst@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=wanghaibin.wang@huawei.com \
--cc=yuzenghui@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).