Re: [PATCH v5 14/15] s390x/pci: Implement migration for emulated devices

Farhan Ali <[email protected]> Wed, 5 Aug 2026 15:02:02 -0700
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 8/3/2026 7:44 PM, Konstantin Shkolnyy wrote:
> Implement zPCI device state migration, consequently enabling migration
> of VMs that have emulated PCI devices, whether virtio or not.
> Migration is allowed for devices whose function handle has the
> FH_SHM_EMUL bit set. For these devices QEMU will save and restore the
> state of its zPCI emulator.
>
> This will enable emulated PCI migration starting with s390-ccw-virtio-11.1.
>
> Passthrough devices will continue to block migration.
>
> Signed-off-by: Konstantin Shkolnyy<[email protected]>
> ---
>   hw/s390x/s390-pci-bus.c         | 189 +++++++++++++++++++++++++++++++-
>   hw/s390x/s390-pci-inst.c        |   2 +-
>   hw/s390x/s390-virtio-ccw.c      |   4 +
>   include/hw/s390x/s390-pci-bus.h |   4 +
>   4 files changed, 193 insertions(+), 6 deletions(-)
>
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index a94e24a2ac..9441c80ef4 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -26,6 +26,7 @@
>   #include "hw/pci/pci_bridge.h"
>   #include "hw/pci/msi.h"
>   #include "exec/cpu-common.h"
> +#include "migration/blocker.h"
>   #include "qemu/error-report.h"
>   #include "qemu/module.h"
>   #include "system/physmem.h"
> @@ -34,6 +35,11 @@
>   
>   #include "trace.h"
>   
> +static const Property phb_props[] = {
> +    DEFINE_PROP_BOOL("x-zpci-emul-dev-migr-enabled", S390pciState,
> +                     emul_dev_migr_enabled, true),
> +};
> +
>   S390pciState *s390_get_phb(void)
>   {
>       static S390pciState *phb;
> @@ -917,6 +923,23 @@ static void set_pbdev_info(S390PCIBusDevice *pbdev)
>       pbdev->pci_group = s390_group_find(ZPCI_DEFAULT_FN_GRP);
>   }
>   
> +static int s390_set_emul_dev_migration_blocker(S390pciState *s, Error **errp)
> +{
> +    if (s->emul_dev_migr_enabled) {
> +        return 0;
> +    }
> +    error_setg(&s->emul_dev_migr_blocker,
> +               "Migration disabled for emulated zPCI devices on this machine type");
> +    return migrate_add_blocker(&s->emul_dev_migr_blocker, errp);
> +}
> +
I was trying to test this patch series, and something i tried was doing 
was a save/restore of a VM with just CCW devices. But with this patch 
the save/restore of the VM fails with error:

error: Requested operation is not valid: cannot migrate domain: 
Migration disabled for emulated zPCI devices on this machine type

I think this is a regression, as the save/restore works with the same 
guest definition with current master branch. I also think this may break 
live migration for guest with just CCW devices. Something to also note, 
by default libvirt auto adds a pci-root controller to the guest 
definition [1]. So i wonder if that's tripping up the migration blocker?


[1] 
https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/sect-guest_virtual_machine_device_configuration-configuring_device_controllers 


Thanks

Farhan