Skip to contentSkip to conversation

s390x & functional tests pull request for the softfreeze

GIT PULL Applied Thomas Huth 2 participants 28 messages Mar 10 – Mar 19

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

[PULL 02/25] tests/functional: Don't try to run functional tests on Windows

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

They just don't work there yet, so don't try to run them there (these need some development work from a Windows wizard first).

Message-ID: <[email protected]>

---
 tests/functional/meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tests/functional/meson.build +3 -2
index b979cff2b97..9bec5a07516 100644
@@ -4,8 +4,9 @@
 # (e.g. tests that fetch assets from the internet) should be put into
 # the 'thorough' category instead.
 
-# Most tests run too slow with TCI enabled, so skip the functional tests there
-if get_option('tcg_interpreter')
+# Most tests run too slow with TCI enabled, and they haven't been adapted
+# to Windows yet, so skip the functional tests in these environments
+if get_option('tcg_interpreter') or host_os == 'windows'
   subdir_done()
 endif
 
Signature · 1 line
2.53.0
#2 lore raw

[PULL 04/25] tests/functional/x86_64: Disable memlock test for asan builds

In reply to Thomas Huth

From: Peter Maydell <[email protected]>

The address-sanitizer intercepts mlock() and makes it a no-op, because it interacts badly with the sanitizer's own use of large amounts of memory. This means that our 'memlock' test will always fail, because it checks via /proc for whether the QEMU process really locked some pages. Don't add the test when QEMU is built with asan.

Message-ID: <[email protected]>

---
 tests/functional/x86_64/meson.build | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
tests/functional/x86_64/meson.build +8 -1
index 05e4914c772..1ed10ad6c29 100644
@@ -14,13 +14,20 @@ tests_x86_64_system_quick = [
   'cpu_model_versions',
   'cpu_queries',
   'mem_addr_space',
-  'memlock',
   'migration',
   'pc_cpu_hotplug_props',
   'virtio_version',
   'vmstate',
 ]
 
+# The address-sanitizer makes mlock() a no-op because it
+# interacts badly with the sanitizer; this means the memlock
+# test (which checks via /proc for whether pages were locked)
+# will always fail on a sanitizer build, so don't run it.
+if not get_option('asan')
+  tests_x86_64_system_quick += [ 'memlock' ]
+endif
+
 tests_x86_64_system_thorough = [
   'acpi_bits',
   'hotplug_blk',
Signature · 1 line
2.53.0
#3 lore raw

[PULL 08/25] tests/functional/ppc64/pseries: Remove custom migration routine

In reply to Thomas Huth

From: Fabiano Rosas <[email protected]>

Don't implement a custom migration routine at PpcMigrationTest and instead reuse the generic one from MigrationTest.

This removes the dependency of PpcMigrationTest from PseriesMachine. Having one test import another causes unittest code to instantiate the imported test, resulting in the setup and teardown methods being invoked for the imported test class, even if no test from that class will be executed.

If run in parallel, the extra setup/teardown methods that result from importing can race with the ones from the actual test being executed and cause the following error:

File "<SRC_DIR>/tests/functional/qemu_test/testcase.py", line 238, in tearDown shutil.rmtree(self.workdir)
...
FileNotFoundError: [Errno 2] No such file or directory:
'<SRC_DIR>/build/tests/functional/ppc64/.../test_migration_with_exec/scratch'

The PseriesMachine class is changed to inherit from MigrationTest so both the migration routines and the class attributes of PseriesMachine can be accessed without the need to instantiate another object.

Fixes f4e34d0fd5 ("tests/functional: Add a OS level migration test for pseries")

Message-ID: <[email protected]>

[thuth: Remove superfluous ";" as suggested by Aditya]
---
 tests/functional/migration.py            |  5 +++++
 tests/functional/ppc64/test_migration.py | 11 -----------
 tests/functional/ppc64/test_pseries.py   | 10 +++++-----
 3 files changed, 10 insertions(+), 16 deletions(-)
tests/functional/migration.py +5 -0
index 49347a30bbf..e995328e833 100644
@@ -65,6 +65,11 @@ def _get_free_port(self, ports):
             self.skipTest('Failed to find a free port')
         return port
 
+    def migration_with_tcp_localhost_vms(self, dst_vm, src_vm):
+        with Ports() as ports:
+            uri = 'tcp:localhost:%u' % self._get_free_port(ports)
+            self.migrate_vms(uri, uri, dst_vm, src_vm)
+
     def migration_with_tcp_localhost(self):
         with Ports() as ports:
             dst_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
tests/functional/ppc64/test_migration.py +0 -11
index a3b819680bc..7d49ee175bb 100755
@@ -22,17 +22,6 @@ def test_migration_with_exec(self):
         self.set_machine('mac99')
         self.migration_with_exec()
 
-    def do_migrate_ppc64_linux(self, source_vm, dest_vm):
-        with Ports() as ports:
-            port = ports.find_free_port()
-            if port is None:
-                self.skipTest('Failed to find a free port')
-            uri = 'tcp:localhost:%u' % port
-
-            dest_vm.qmp('migrate-incoming', uri=uri)
-            source_vm.qmp('migrate', uri=uri)
-            self.assert_migration(source_vm, dest_vm)
-
 
 if __name__ == '__main__':
     MigrationTest.main()
tests/functional/ppc64/test_pseries.py +5 -5
index b45763c3050..cb6d25dc816 100755
@@ -7,11 +7,11 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
-from qemu_test import QemuSystemTest, Asset
+from qemu_test import Asset
 from qemu_test import wait_for_console_pattern
-from test_migration import PpcMigrationTest
+from migration import MigrationTest
 
-class PseriesMachine(QemuSystemTest):
+class PseriesMachine(MigrationTest):
 
     timeout = 90
     KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 '
@@ -116,11 +116,11 @@ def test_ppc64_linux_migration(self):
         wait_for_console_pattern(self, console_pattern, self.panic_message,
                                  vm=source_vm)
 
-        PpcMigrationTest().do_migrate_ppc64_linux(source_vm, dest_vm);
+        self.migration_with_tcp_localhost_vms(dest_vm, source_vm)
 
         # ensure the boot proceeds after migration
         wait_for_console_pattern(self, self.good_message, self.panic_message,
                                  vm=dest_vm)
 
 if __name__ == '__main__':
-    QemuSystemTest.main()
+    MigrationTest.main()
Signature · 1 line
2.53.0
#4 lore raw

[PULL 13/25] pc-bios/s390-ccw: Store device type independent of sense data

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Store the device type (e.g. block) directly as an attribute of the VDev rather than assume all devices can be identified by accessing CCW specific sense data.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/virtio.h        |  1 +
 pc-bios/s390-ccw/main.c          |  2 +-
 pc-bios/s390-ccw/virtio-blkdev.c | 39 +++++++++++++++++++-------------
 pc-bios/s390-ccw/virtio.c        | 11 ++++++---
 4 files changed, 33 insertions(+), 20 deletions(-)
pc-bios/s390-ccw/virtio.h +1 -0
index 391d6ff2f7f..39b507b2219 100644
@@ -239,6 +239,7 @@ struct VDev {
     SubChannelId schid;
     SenseId senseid;
     S390IplType ipl_type;
+    VirtioDevType dev_type;
     union {
         VirtioBlkConfig blk;
         VirtioScsiConfig scsi;
pc-bios/s390-ccw/main.c +1 -1
index 2e9261904fa..64bde497103 100644
@@ -251,7 +251,7 @@ static int virtio_setup(void)
     vdev->is_cdrom = false;
     int ret;
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_NET:
         puts("Network boot device detected");
         return 0;
pc-bios/s390-ccw/virtio-blkdev.c +23 -16
index 019c2718b18..9cc40e9108d 100644
@@ -53,14 +53,14 @@ int virtio_read_many(unsigned long sector, void *load_addr, int sec_num)
 {
     VDev *vdev = virtio_get_device();
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         return virtio_blk_read_many(vdev, sector, load_addr, sec_num);
     case VIRTIO_ID_SCSI:
         return virtio_scsi_read_many(vdev, sector, load_addr, sec_num);
+    default:
+        return -1;
     }
-
-    return -1;
 }
 
 unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list2,
@@ -119,7 +119,7 @@ void virtio_assume_iso9660(void)
 {
     VDev *vdev = virtio_get_device();
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         vdev->guessed_disk_nature = VIRTIO_GDN_SCSI;
         vdev->config.blk.blk_size = VIRTIO_ISO_BLOCK_SIZE;
@@ -129,6 +129,8 @@ void virtio_assume_iso9660(void)
     case VIRTIO_ID_SCSI:
         vdev->scsi_block_size = VIRTIO_ISO_BLOCK_SIZE;
         break;
+    default:
+        return;
     }
 }
 
@@ -139,13 +141,15 @@ void virtio_assume_eckd(void)
     vdev->guessed_disk_nature = VIRTIO_GDN_DASD;
     vdev->blk_factor = 1;
     vdev->config.blk.physical_block_exp = 0;
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         vdev->config.blk.blk_size = VIRTIO_DASD_DEFAULT_BLOCK_SIZE;
         break;
     case VIRTIO_ID_SCSI:
         vdev->config.blk.blk_size = vdev->scsi_block_size;
         break;
+    default:
+        break;
     }
     vdev->config.blk.geometry.heads = 15;
     vdev->config.blk.geometry.sectors =
@@ -162,50 +166,52 @@ bool virtio_ipl_disk_is_valid(void)
         return true;
     }
 
-    return (vdev->senseid.cu_model == VIRTIO_ID_BLOCK ||
-            vdev->senseid.cu_model == VIRTIO_ID_SCSI) &&
-           blksize >= 512 && blksize <= 4096;
+    return (vdev->dev_type == VIRTIO_ID_BLOCK || vdev->dev_type == VIRTIO_ID_SCSI)
+            && blksize >= 512 && blksize <= 4096;
 }
 
 int virtio_get_block_size(void)
 {
     VDev *vdev = virtio_get_device();
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         return vdev->config.blk.blk_size;
     case VIRTIO_ID_SCSI:
         return vdev->scsi_block_size;
+    default:
+        return 0;
     }
-    return 0;
 }
 
 uint8_t virtio_get_heads(void)
 {
     VDev *vdev = virtio_get_device();
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         return vdev->config.blk.geometry.heads;
     case VIRTIO_ID_SCSI:
         return vdev->guessed_disk_nature == VIRTIO_GDN_DASD
                ? vdev->config.blk.geometry.heads : 255;
+    default:
+        return 0;
     }
-    return 0;
 }
 
 uint8_t virtio_get_sectors(void)
 {
     VDev *vdev = virtio_get_device();
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         return vdev->config.blk.geometry.sectors;
     case VIRTIO_ID_SCSI:
         return vdev->guessed_disk_nature == VIRTIO_GDN_DASD
                ? vdev->config.blk.geometry.sectors : 63;
+    default:
+        return 0;
     }
-    return 0;
 }
 
 uint64_t virtio_get_blocks(void)
@@ -213,13 +219,14 @@ uint64_t virtio_get_blocks(void)
     VDev *vdev = virtio_get_device();
     const uint64_t factor = virtio_get_block_size() / VIRTIO_SECTOR_SIZE;
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_BLOCK:
         return vdev->config.blk.capacity / factor;
     case VIRTIO_ID_SCSI:
         return vdev->scsi_last_block / factor;
+    default:
+        return 0;
     }
-    return 0;
 }
 
 int virtio_blk_setup_device(SubChannelId schid)
pc-bios/s390-ccw/virtio.c +8 -3
index f384a990dcc..5dd407d5c9b 100644
@@ -41,7 +41,7 @@ VDev *virtio_get_device(void)
 
 VirtioDevType virtio_get_device_type(void)
 {
-    return vdev.senseid.cu_model;
+    return vdev.dev_type;
 }
 
 /* virtio spec v1.0 para 4.3.3.2 */
@@ -248,7 +248,7 @@ int virtio_setup_ccw(VDev *vdev)
         return -EIO;
     }
 
-    switch (vdev->senseid.cu_model) {
+    switch (vdev->dev_type) {
     case VIRTIO_ID_NET:
         vdev->nr_vqs = 2;
         vdev->cmd_vr_idx = 0;
@@ -346,12 +346,17 @@ bool virtio_is_supported(SubChannelId schid)
                 true)) {
         return false;
     }
+
+    vdev.dev_type = vdev.senseid.cu_model;
+
     if (vdev.senseid.cu_type == 0x3832) {
-        switch (vdev.senseid.cu_model) {
+        switch (vdev.dev_type) {
         case VIRTIO_ID_BLOCK:
         case VIRTIO_ID_SCSI:
         case VIRTIO_ID_NET:
             return true;
+        default:
+            return false;
         }
     }
     return false;
Signature · 1 line
2.53.0
#5 lore raw

[PULL 11/25] pc-bios/s390-ccw: Always reset virtio device on failed boot attempt

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

The virtio spec necessitates that live virtqueues must not be altered. Reset the failed device so that the queues are not live before we attempt to boot any fallback devices.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
pc-bios/s390-ccw/main.c +2 -1
index 76bf743900c..8e2c99bee13 100644
@@ -277,7 +277,8 @@ static void ipl_boot_device(void)
         break;
     case CU_TYPE_VIRTIO:
         if (virtio_setup() == 0) {
-            zipl_load();
+            zipl_load(); /* only return on error */
+            virtio_reset(virtio_get_device());
         }
         break;
     default:
Signature · 1 line
2.53.0
#6 lore raw

[PULL 03/25] tests/functional/ppc/test_40: Fix the URL of the NetBSD-7.1.2-prep.iso asset

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

We now need a slightly different URL to be able to download this asset.

Message-ID: <[email protected]>

---
 tests/functional/ppc/test_40p.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/functional/ppc/test_40p.py +1 -1
index 614972a7eb3..ed272147f6e 100755
@@ -27,7 +27,7 @@ class IbmPrep40pMachine(QemuSystemTest):
         'f86236e9d01b3f0dd0f5d3b8d5bbd40c68e78b4db560a108358f5ad58e636619')
     ASSET_NETBSD71 = Asset(
         ('https://archive.netbsd.org/pub/NetBSD-archive/'
-         'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso'),
+         'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso?key=NetBSD'),
         'cc7cb290b06aaa839362deb7bd9f417ac5015557db24088508330f76c3f825ec')
 
     # 12H0455 PPS Firmware Licensed Materials
Signature · 1 line
2.53.0
#0 lore raw

The following changes since commit de61484ec39f418e5c0d4603017695f9ffb8fe24:

Merge tag 'linux-user-for-v11-pull-request' of https://github.com/hdeller/qemu-hppa into staging (2026-03-09 14:53:42 +0000)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2026-03-10

for you to fetch changes up to f2bd9693f22b105182b0bacdba390a0e41b2cf82:

pc-bios/s390-ccw.img: Update the s390 bios blog with the latest changes (2026-03-10 06:46:45 +0100)

----------------------------------------------------------------
- Improve the s390-ccw bios to be able to boot from virtio-blk-pci devices
- Rework migration functional test to avoid a problem in the ppc64 test
- Disable functional memlock test for asan builds
- Some other minor tests improvements

----------------------------------------------------------------
Fabiano Rosas (4):
tests/functional/migration: Use socket_dir tests/functional/migration: Add migrate_vms tests/functional/migration: Use the migrate_vms helper tests/functional/ppc64/pseries: Remove custom migration routine

Jared Rossi (15):
pc-bios/s390-ccw: Fix misattributed function prototypes pc-bios/s390-ccw: Remove redundant vring schid attribute pc-bios/s390-ccw: Always reset virtio device on failed boot attempt
s390x: Remove duplicate definitions of IPL types pc-bios/s390-ccw: Store device type independent of sense data pc-bios/s390-ccw: Split virtio-ccw and generic virtio include/hw/s390x: Move CLP definitions for easier BIOS access pc-bios/s390-ccw: Introduce CLP Architecture
s390x: Add definitions for PCI IPL type
pc-bios/s390-ccw: Introduce PCI device
pc-bios/s390-ccw: Introduce virtio-pci functions pc-bios/s390-ccw: Add support for virtio-blk-pci IPL
s390x: Build IPLB for virtio-pci devices
hw: Add "loadparm" property to virtio block PCI devices booting on s390x tests/qtest: Add s390x PCI boot test to cdrom-test.c

Peter Maydell (1):
tests/functional/x86_64: Disable memlock test for asan builds

Thomas Huth (5):
tests/qemu-iotests: Mark 182 as Linux-only
tests/functional: Don't try to run functional tests on Windows tests/functional/ppc/test_40: Fix the URL of the NetBSD-7.1.2-prep.iso asset pc-bios/s390-ccw: Fix compiler warning when compiling with DEBUG enabled pc-bios/s390-ccw.img: Update the s390 bios blog with the latest changes

 MAINTAINERS                               |   1 +
 hw/s390x/ipl.h                            |   8 +-
 include/hw/pci/pci.h                      |   1 +
 include/hw/pci/pci_device.h               |   3 +
 include/hw/s390x/ipl/qipl.h               |  20 ++
 include/hw/s390x/{ => ipl}/s390-pci-clp.h |   0
 include/hw/s390x/s390-pci-bus.h           |   4 +-
 pc-bios/s390-ccw/clp.h                    |  24 ++
 pc-bios/s390-ccw/iplb.h                   |   4 -
 pc-bios/s390-ccw/pci.h                    |  39 +++
 pc-bios/s390-ccw/s390-ccw.h               |   9 +-
 pc-bios/s390-ccw/virtio-ccw.h             |  24 ++
 pc-bios/s390-ccw/virtio-pci.h             |  82 ++++++
 pc-bios/s390-ccw/virtio-scsi.h            |   2 +-
 pc-bios/s390-ccw/virtio.h                 |  19 +-
 hw/pci/pci.c                              |  38 +++
 hw/s390x/ipl.c                            |  63 ++++-
 hw/s390x/s390-pci-bus.c                   |   3 +-
 hw/s390x/s390-pci-vfio.c                  |   2 +-
 hw/virtio/virtio-blk-pci.c                |   1 +
 pc-bios/s390-ccw/bootmap.c                |   2 +-
 pc-bios/s390-ccw/clp.c                    |  99 +++++++
 pc-bios/s390-ccw/main.c                   |  88 +++++-
 pc-bios/s390-ccw/netmain.c                |   2 +-
 pc-bios/s390-ccw/pci.c                    | 118 ++++++++
 pc-bios/s390-ccw/virtio-blkdev.c          |  76 ++++--
 pc-bios/s390-ccw/virtio-ccw.c             | 239 +++++++++++++++++
 pc-bios/s390-ccw/virtio-net.c             |   5 +-
 pc-bios/s390-ccw/virtio-pci.c             | 433 ++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/virtio-scsi.c            |   8 +-
 pc-bios/s390-ccw/virtio.c                 | 293 +++++++-------------
 tests/qtest/cdrom-test.c                  |   7 +
 pc-bios/s390-ccw.img                      | Bin 87824 -> 95992 bytes
 pc-bios/s390-ccw/Makefile                 |   3 +-
 tests/functional/meson.build              |   5 +-
 tests/functional/migration.py             |  46 ++--
 tests/functional/ppc/test_40p.py          |   2 +-
 tests/functional/ppc64/test_migration.py  |  11 -
 tests/functional/ppc64/test_pseries.py    |  10 +-
 tests/functional/x86_64/meson.build       |   9 +-
 tests/qemu-iotests/182                    |   1 +
 41 files changed, 1492 insertions(+), 312 deletions(-)
 rename include/hw/s390x/{ => ipl}/s390-pci-clp.h (100%)
 create mode 100644 pc-bios/s390-ccw/clp.h
 create mode 100644 pc-bios/s390-ccw/pci.h
 create mode 100644 pc-bios/s390-ccw/virtio-ccw.h
 create mode 100644 pc-bios/s390-ccw/virtio-pci.h
 create mode 100644 pc-bios/s390-ccw/clp.c
 create mode 100644 pc-bios/s390-ccw/pci.c
 create mode 100644 pc-bios/s390-ccw/virtio-ccw.c
 create mode 100644 pc-bios/s390-ccw/virtio-pci.c
#8 lore raw

[PULL 16/25] pc-bios/s390-ccw: Introduce CLP Architecture

From: Jared Rossi <[email protected]>

Call Logical Processor (CLP) Architecture is used for managing PCI functions on s390x. Define and include the structures and routines needed to interact with PCI devices during IPL.

Message-ID: <[email protected]>

[thuth: fix a typo in one of the comments]
---
 pc-bios/s390-ccw/clp.h    | 24 ++++++++++
 pc-bios/s390-ccw/clp.c    | 99 +++++++++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/Makefile |  2 +-
 3 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 pc-bios/s390-ccw/clp.h
 create mode 100644 pc-bios/s390-ccw/clp.c
pc-bios/s390-ccw/clp.h new file +24 -0
new file mode 100644
index 00000000000..1ac2f8c177f
@@ -0,0 +1,24 @@
+/*
+ * Call Logical Processor (CLP) architecture definitions
+ *
+ * Copyright 2025 IBM Corp.
+ * Author(s): Jared Rossi <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef CLP_H
+#define CLP_H
+
+#ifndef QEMU_PACKED
+#define QEMU_PACKED __attribute__((packed))
+#endif
+
+#include <stdint.h>
+#include <s390-pci-clp.h>
+
+int clp_pci(void *data);
+int find_pci_function(uint32_t fid, ClpFhListEntry *entry);
+int enable_pci_function(uint32_t *fhandle);
+
+#endif
pc-bios/s390-ccw/clp.c new file +99 -0

99 lines not on this page · raw message

pc-bios/s390-ccw/Makefile +1 -1
index 259cff09db6..9c29548f849 100644
@@ -35,7 +35,7 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \
 	  virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o \
-	  virtio-ccw.o
+	  virtio-ccw.o clp.o
 
 SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
 
Signature · 1 line
2.53.0
#9 lore raw

[PULL 12/25] s390x: Remove duplicate definitions of IPL types

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Remove the duplicate definitions from hw/s390x/ipl.h and pc-bios/s390-ccw/iplb.h and add a shared definition. The new definition is an enum to enforce default handling in switches.

Because the IPL type is determined by the IPLB, and because an IPLB is not strictly necessary, the IPL type is set to a default value if not otherwise specified. A default IPL type is required so future functionality may add IPL new bus and/or device types that dictate specific behavior during IPL.

Message-ID: <[email protected]>

---
 hw/s390x/ipl.h              |  5 -----
 include/hw/s390x/ipl/qipl.h | 10 ++++++++++
 pc-bios/s390-ccw/iplb.h     |  4 ----
 pc-bios/s390-ccw/virtio.h   |  1 +
 pc-bios/s390-ccw/main.c     | 14 ++++++++++----
 5 files changed, 21 insertions(+), 13 deletions(-)
hw/s390x/ipl.h +0 -5
index 086e57681c2..c542d30ce2d 100644
@@ -103,11 +103,6 @@ QEMU_BUILD_BUG_MSG(offsetof(S390IPLState, iplb) & 3, "alignment of iplb wrong");
 #define DIAG308_PV_STORE            9
 #define DIAG308_PV_START            10
 
-#define S390_IPL_TYPE_FCP 0x00
-#define S390_IPL_TYPE_CCW 0x02
-#define S390_IPL_TYPE_PV 0x05
-#define S390_IPL_TYPE_QEMU_SCSI 0xff
-
 #define S390_IPLB_HEADER_LEN 8
 #define S390_IPLB_MIN_PV_LEN 148
 #define S390_IPLB_MIN_CCW_LEN 200
include/hw/s390x/ipl/qipl.h +10 -0
index 6824391111c..6dc12dd859f 100644
@@ -20,6 +20,16 @@
 #define LOADPARM_LEN    8
 #define NO_LOADPARM "\0\0\0\0\0\0\0\0"
 
+enum S390IplType {
+    S390_IPL_TYPE_FCP = 0x00,
+    S390_IPL_TYPE_CCW = 0x02,
+    S390_IPL_TYPE_PV = 0x05,
+    S390_IPL_TYPE_QEMU_SCSI = 0xff
+};
+typedef enum S390IplType S390IplType;
+
+#define QEMU_DEFAULT_IPL S390_IPL_TYPE_CCW
+
 /*
  * The QEMU IPL Parameters will be stored at absolute address
  * 204 (0xcc) which means it is 32-bit word aligned but not
pc-bios/s390-ccw/iplb.h +0 -4
index 08f259ff319..926e8eed5d4 100644
@@ -23,10 +23,6 @@ extern QemuIplParameters qipl;
 extern IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
 extern bool have_iplb;
 
-#define S390_IPL_TYPE_FCP 0x00
-#define S390_IPL_TYPE_CCW 0x02
-#define S390_IPL_TYPE_QEMU_SCSI 0xff
-
 static inline bool manage_iplb(IplParameterBlock *iplb, bool store)
 {
     register unsigned long addr asm("0") = (unsigned long) iplb;
pc-bios/s390-ccw/virtio.h +1 -0
index 06ba4e45aca..391d6ff2f7f 100644
@@ -238,6 +238,7 @@ struct VDev {
     VirtioGDN guessed_disk_nature;
     SubChannelId schid;
     SenseId senseid;
+    S390IplType ipl_type;
     union {
         VirtioBlkConfig blk;
         VirtioScsiConfig scsi;
pc-bios/s390-ccw/main.c +10 -4
index 8e2c99bee13..2e9261904fa 100644
@@ -149,7 +149,7 @@ static bool find_subch(int dev_no)
     return false;
 }
 
-static void menu_setup(void)
+static void menu_setup(VDev *vdev)
 {
     if (memcmp(loadparm_str, LOADPARM_PROMPT, LOADPARM_LEN) == 0) {
         menu_set_parms(QIPL_FLAG_BM_OPTS_CMD, 0);
@@ -162,11 +162,13 @@ static void menu_setup(void)
         return;
     }
 
-    switch (iplb.pbt) {
+    switch (vdev->ipl_type) {
     case S390_IPL_TYPE_CCW:
     case S390_IPL_TYPE_QEMU_SCSI:
         menu_set_parms(qipl.qipl_flags & BOOT_MENU_FLAG_MASK,
                        qipl.boot_menu_timeout);
+        /* fall through */
+    default:
         return;
     }
 }
@@ -190,6 +192,7 @@ static void css_setup(void)
 static void boot_setup(void)
 {
     char lpmsg[] = "LOADPARM=[________]\n";
+    VDev *vdev = virtio_get_device();
 
     if (have_iplb && memcmp(iplb.loadparm, NO_LOADPARM, LOADPARM_LEN) != 0) {
         ebcdic_to_ascii((char *) iplb.loadparm, loadparm_str, LOADPARM_LEN);
@@ -198,7 +201,10 @@ static void boot_setup(void)
     }
 
     if (have_iplb) {
-        menu_setup();
+        vdev->ipl_type = iplb.pbt;
+        menu_setup(vdev);
+    } else {
+        vdev->ipl_type = QEMU_DEFAULT_IPL;
     }
 
     memcpy(lpmsg + 10, loadparm_str, 8);
@@ -216,7 +222,7 @@ static bool find_boot_device(void)
     VDev *vdev = virtio_get_device();
     bool found = false;
 
-    switch (iplb.pbt) {
+    switch (vdev->ipl_type) {
     case S390_IPL_TYPE_CCW:
         vdev->scsi_device_selected = false;
         debug_print_int("device no. ", iplb.ccw.devno);
Signature · 1 line
2.53.0
#10 lore raw

[PULL 23/25] tests/qtest: Add s390x PCI boot test to cdrom-test.c

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Add a rudimentary test for s390x IPL to verify that a guest may boot using virtio-blk-pci device.

Message-ID: <[email protected]>

---
 tests/qtest/cdrom-test.c | 7 +++++++
 1 file changed, 7 insertions(+)
tests/qtest/cdrom-test.c +7 -0
index 56e2d283a9d..a65854d2bc5 100644
@@ -246,6 +246,13 @@ static void add_s390x_tests(void)
                             "-drive if=none,id=d2,media=cdrom,file=",
                             test_cdboot);
     }
+    if (qtest_has_device("virtio-blk-pci")) {
+        qtest_add_data_func("cdrom/boot/pci-bus-with-bootindex",
+                            "-device virtio-scsi -device virtio-serial "
+                            "-device virtio-blk-pci,drive=d1,bootindex=1 "
+                            "-drive if=none,id=d1,media=cdrom,file=",
+                            test_cdboot);
+    }
 }
 
 int main(int argc, char **argv)
Signature · 1 line
2.53.0
#11 lore raw

[PULL 06/25] tests/functional/migration: Add migrate_vms

In reply to Thomas Huth

From: Fabiano Rosas <[email protected]>

Add a migration helper to MigrationTest that uses the migrate-incoming QMP command and takes the already instantiated VMs. The -incoming 'defer' command line option is preferred way instead of the -incoming URI syntax that's currently used.

Message-ID: <[email protected]>

---
 tests/functional/migration.py | 5 +++++
 1 file changed, 5 insertions(+)
tests/functional/migration.py +5 -0
index 0aa873edbaa..3362e5c743e 100644
@@ -40,6 +40,11 @@ def assert_migration(self, src_vm, dst_vm):
         self.assertEqual(dst_vm.cmd('query-status')['status'], 'running')
         self.assertEqual(src_vm.cmd('query-status')['status'],'postmigrate')
 
+    def migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
+        dst_vm.qmp('migrate-incoming', uri=dst_uri)
+        src_vm.qmp('migrate', uri=src_uri)
+        self.assert_migration(src_vm, dst_vm)
+
     def do_migrate(self, dest_uri, src_uri=None):
         dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu")
         dest_vm.add_args('-nodefaults')
Signature · 1 line
2.53.0
#12 lore raw

[PULL 14/25] pc-bios/s390-ccw: Split virtio-ccw and generic virtio

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Separate the CCW specific virtio routines and create generic wrappers for easier reuse of existing virtio functions with non-CCW devices.

Message-ID: <[email protected]>

[thuth: Use SPDX license identifier in virtio-ccw.c]
---
 pc-bios/s390-ccw/s390-ccw.h      |   3 -
 pc-bios/s390-ccw/virtio-ccw.h    |  24 ++++
 pc-bios/s390-ccw/virtio-scsi.h   |   2 +-
 pc-bios/s390-ccw/virtio.h        |   5 +-
 pc-bios/s390-ccw/main.c          |   8 +-
 pc-bios/s390-ccw/netmain.c       |   2 +-
 pc-bios/s390-ccw/virtio-blkdev.c |  15 +-
 pc-bios/s390-ccw/virtio-ccw.c    | 239 +++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/virtio-net.c    |   3 +-
 pc-bios/s390-ccw/virtio-scsi.c   |   8 +-
 pc-bios/s390-ccw/virtio.c        | 239 ++++++-------------------------
 pc-bios/s390-ccw/Makefile        |   3 +-
 12 files changed, 330 insertions(+), 221 deletions(-)
 create mode 100644 pc-bios/s390-ccw/virtio-ccw.h
 create mode 100644 pc-bios/s390-ccw/virtio-ccw.c
pc-bios/s390-ccw/s390-ccw.h +0 -3
index 47ea66bd4d1..ccd68ff0a4b 100644
@@ -66,9 +66,6 @@ void sclp_setup(void);
 void sclp_get_loadparm_ascii(char *loadparm);
 int sclp_read(char *str, size_t count);
 
-/* virtio.c */
-bool virtio_is_supported(SubChannelId schid);
-
 /* bootmap.c */
 void zipl_load(void);
 
pc-bios/s390-ccw/virtio-ccw.h new file +24 -0
new file mode 100644
index 00000000000..a506767eaa8
@@ -0,0 +1,24 @@
+/*
+ * Virtio definitions for CCW devices
+ *
+ * Copyright 2025 IBM Corp.
+ * Author(s): Jared Rossi <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef VIRTIO_CCW_H
+#define VIRTIO_CCW_H
+
+/* main.c */
+extern SubChannelId blk_schid;
+
+/* virtio-ccw.c */
+int drain_irqs_ccw(SubChannelId schid);
+bool virtio_ccw_is_supported(VDev *vdev);
+int virtio_ccw_run(VDev *vdev, int vqid, VirtioCmd *cmd);
+long virtio_ccw_notify(SubChannelId schid, int vq_idx, long cookie);
+int virtio_ccw_setup(VDev *vdev);
+int virtio_ccw_reset(VDev *vdev);
+
+#endif
pc-bios/s390-ccw/virtio-scsi.h +1 -1
index c5612e16a26..070f24b7e5a 100644
@@ -69,6 +69,6 @@ static inline bool virtio_scsi_response_ok(const VirtioScsiCmdResp *r)
 
 int virtio_scsi_read_many(VDev *vdev,
                           unsigned long sector, void *load_addr, int sec_num);
-int virtio_scsi_setup_device(SubChannelId schid);
+int virtio_scsi_setup_device(VDev *vdev);
 
 #endif /* VIRTIO_SCSI_H */
pc-bios/s390-ccw/virtio.h +4 -1
index 39b507b2219..c3cb5a6ee3b 100644
@@ -108,6 +108,7 @@ struct VRing {
 };
 typedef struct VRing VRing;
 
+char *virtio_get_ring_area(int ring_num);
 
 /***********************************************
  *               Virtio block                  *
@@ -269,6 +270,8 @@ struct VirtioCmd {
 };
 typedef struct VirtioCmd VirtioCmd;
 
+void vring_init(VRing *vr, VqInfo *info);
+bool virtio_is_supported(VDev *vdev);
 bool vring_notify(VRing *vr);
 int drain_irqs(void);
 void vring_send_buf(VRing *vr, void *p, int len, int flags);
@@ -283,7 +286,7 @@ int virtio_net_init(void *mac_addr);
 void virtio_net_deinit(void);
 
 /* virtio-blkdev.c */
-int virtio_blk_setup_device(SubChannelId schid);
+int virtio_blk_setup_device(VDev *vdev);
 int virtio_read(unsigned long sector, void *load_addr);
 unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list2,
                                  void *load_addr);
pc-bios/s390-ccw/main.c +5 -3
index 64bde497103..32154c5db8d 100644
@@ -71,6 +71,7 @@ static int is_dev_possibly_bootable(int dev_no, int sch_no)
     bool is_virtio;
     Schib schib;
     int r;
+    VDev *vdev = virtio_get_device();
 
     blk_schid.sch_no = sch_no;
     r = stsch_err(blk_schid, &schib);
@@ -91,7 +92,8 @@ static int is_dev_possibly_bootable(int dev_no, int sch_no)
      * Note: we always have to run virtio_is_supported() here to make
      * sure that the vdev.senseid data gets pre-initialized correctly
      */
-    is_virtio = virtio_is_supported(blk_schid);
+    vdev->schid = blk_schid;
+    is_virtio = virtio_is_supported(vdev);
 
     /* No specific devno given, just return whether the device is possibly bootable */
     if (dev_no < 0) {
@@ -256,10 +258,10 @@ static int virtio_setup(void)
         puts("Network boot device detected");
         return 0;
     case VIRTIO_ID_BLOCK:
-        ret = virtio_blk_setup_device(blk_schid);
+        ret = virtio_blk_setup_device(vdev);
         break;
     case VIRTIO_ID_SCSI:
-        ret = virtio_scsi_setup_device(blk_schid);
+        ret = virtio_scsi_setup_device(vdev);
         break;
     default:
         puts("\n! No IPL device available !\n");
pc-bios/s390-ccw/netmain.c +1 -1
index a9521dff416..651cedf6efa 100644
@@ -500,7 +500,7 @@ static bool find_net_dev(Schib *schib, int dev_no)
             continue;
         }
         enable_subchannel(net_schid);
-        if (!virtio_is_supported(net_schid)) {
+        if (!virtio_is_supported(virtio_get_device())) {
             continue;
         }
         if (virtio_get_device_type() != VIRTIO_ID_NET) {
pc-bios/s390-ccw/virtio-blkdev.c +9 -6
index 9cc40e9108d..9722b6970f1 100644
@@ -12,6 +12,7 @@
 #include "s390-ccw.h"
 #include "virtio.h"
 #include "virtio-scsi.h"
+#include "virtio-ccw.h"
 
 #define VIRTIO_BLK_F_GEOMETRY   (1 << 4)
 #define VIRTIO_BLK_F_BLK_SIZE   (1 << 6)
@@ -229,15 +230,17 @@ uint64_t virtio_get_blocks(void)
     }
 }
 
-int virtio_blk_setup_device(SubChannelId schid)
+int virtio_blk_setup_device(VDev *vdev)
 {
-    VDev *vdev = virtio_get_device();
-
     vdev->guest_features[0] = VIRTIO_BLK_F_GEOMETRY | VIRTIO_BLK_F_BLK_SIZE;
-    vdev->schid = schid;
-    virtio_setup_ccw(vdev);
 
     puts("Using virtio-blk.");
 
-    return 0;
+    switch (vdev->ipl_type) {
+    case S390_IPL_TYPE_QEMU_SCSI:
+    case S390_IPL_TYPE_CCW:
+        return virtio_ccw_setup(vdev);
+    default:
+        return 1;
+    }
 }
pc-bios/s390-ccw/virtio-ccw.c new file +239 -0

239 lines not on this page · raw message

pc-bios/s390-ccw/virtio-net.c +2 -1
index 7eb08500695..f58f7ffc55b 100644
@@ -19,6 +19,7 @@
 #include <ethernet.h>
 #include "s390-ccw.h"
 #include "virtio.h"
+#include "virtio-ccw.h"
 #include "s390-time.h"
 #include "helper.h"
 
@@ -54,7 +55,7 @@ int virtio_net_init(void *mac_addr)
     rx_last_idx = 0;
 
     vdev->guest_features[0] = VIRTIO_NET_F_MAC_BIT;
-    virtio_setup_ccw(vdev);
+    virtio_ccw_setup(vdev);
 
     if (!(vdev->guest_features[0] & VIRTIO_NET_F_MAC_BIT)) {
         puts("virtio-net device does not support the MAC address feature");
pc-bios/s390-ccw/virtio-scsi.c +3 -5
index 71db75ce7b4..9ea00c6fe67 100644
@@ -15,6 +15,7 @@
 #include "virtio.h"
 #include "scsi.h"
 #include "virtio-scsi.h"
+#include "virtio-ccw.h"
 #include "s390-time.h"
 #include "helper.h"
 
@@ -476,12 +477,9 @@ static int virtio_scsi_setup(VDev *vdev)
     return 0;
 }
 
-int virtio_scsi_setup_device(SubChannelId schid)
+int virtio_scsi_setup_device(VDev *vdev)
 {
-    VDev *vdev = virtio_get_device();
-
-    vdev->schid = schid;
-    virtio_setup_ccw(vdev);
+    virtio_ccw_setup(vdev);
 
     if (vdev->config.scsi.sense_size != VIRTIO_SCSI_SENSE_SIZE) {
         puts("Config: sense size mismatch");
pc-bios/s390-ccw/virtio.c +40 -199

290 lines not on this page · raw message

pc-bios/s390-ccw/Makefile +2 -1
index a0f24c94a87..259cff09db6 100644
@@ -34,7 +34,8 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 .PHONY : all clean build-all distclean
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \
-	  virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o
+	  virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o \
+	  virtio-ccw.o
 
 SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
 
Signature · 1 line
2.53.0
#13 lore raw

[PULL 18/25] pc-bios/s390-ccw: Introduce PCI device

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Define selected s390x PCI instructions.

Message-ID: <[email protected]>

[thuth: Remove unused defines as suggested by Farhan]
---
 pc-bios/s390-ccw/pci.h    |  36 ++++++++++++
 pc-bios/s390-ccw/pci.c    | 118 ++++++++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/Makefile |   2 +-
 3 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 pc-bios/s390-ccw/pci.h
 create mode 100644 pc-bios/s390-ccw/pci.c
pc-bios/s390-ccw/pci.h new file +36 -0
new file mode 100644
index 00000000000..968635eff11
@@ -0,0 +1,36 @@
+/*
+ * s390x PCI definitions
+ *
+ * Copyright 2025 IBM Corp.
+ * Author(s): Jared Rossi <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef PCI_H
+#define PCI_H
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "clp.h"
+
+#define ZPCI_CREATE_REQ(handle, space, len)                    \
+    ((uint64_t) handle << 32 | space << 16 | len)
+
+union register_pair {
+    unsigned __int128 pair;
+    struct {
+        unsigned long even;
+        unsigned long odd;
+    };
+};
+
+#define PCI_CFGBAR             0xF  /* Base Address Register for config space */
+#define PCI_CAPABILITY_LIST    0x34 /* Offset of first capability list entry */
+
+int pci_write(uint32_t fhandle, uint64_t offset, uint8_t pcias, uint64_t data,
+              uint8_t len);
+int pci_read(uint32_t fhandle, uint64_t offset, uint8_t pcias, void *buf,
+             uint8_t len);
+
+#endif
pc-bios/s390-ccw/pci.c new file +118 -0

118 lines not on this page · raw message

pc-bios/s390-ccw/Makefile +1 -1
index 9c29548f849..a62fc9d7660 100644
@@ -35,7 +35,7 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \
 	  virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o \
-	  virtio-ccw.o clp.o
+	  virtio-ccw.o clp.o pci.o
 
 SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
 
Signature · 1 line
2.53.0
#14 lore raw

[PULL 09/25] pc-bios/s390-ccw: Fix misattributed function prototypes

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

The virtio-blkdev functions are incorrectly listed in s390-ccw.h as belonging to virtio.c. Additionally, virtio_load_direct() has an unused subchan_id argument.

Remove the unused argument and move the prototypes to virtio.h so that they are independent from the CCW bus.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/s390-ccw.h      | 4 ----
 pc-bios/s390-ccw/virtio.h        | 7 +++++++
 pc-bios/s390-ccw/bootmap.c       | 2 +-
 pc-bios/s390-ccw/virtio-blkdev.c | 2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)
pc-bios/s390-ccw/s390-ccw.h +0 -4
index b1dc35cdedf..47ea66bd4d1 100644
@@ -67,11 +67,7 @@ void sclp_get_loadparm_ascii(char *loadparm);
 int sclp_read(char *str, size_t count);
 
 /* virtio.c */
-unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list2,
-                                 unsigned long subchan_id, void *load_addr);
 bool virtio_is_supported(SubChannelId schid);
-int virtio_blk_setup_device(SubChannelId schid);
-int virtio_read(unsigned long sector, void *load_addr);
 
 /* bootmap.c */
 void zipl_load(void);
pc-bios/s390-ccw/virtio.h +7 -0
index 5c5e808a500..597bd423586 100644
@@ -277,7 +277,14 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd);
 int virtio_reset(VDev *vdev);
 int virtio_setup_ccw(VDev *vdev);
 
+/* virtio-net.c */
 int virtio_net_init(void *mac_addr);
 void virtio_net_deinit(void);
 
+/* virtio-blkdev.c */
+int virtio_blk_setup_device(SubChannelId schid);
+int virtio_read(unsigned long sector, void *load_addr);
+unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list2,
+                                 void *load_addr);
+
 #endif /* VIRTIO_H */
pc-bios/s390-ccw/bootmap.c +1 -1
index 0f8baa01985..420ee32eff8 100644
@@ -662,7 +662,7 @@ static int zipl_load_segment(ComponentEntry *entry)
                  */
                 break;
             }
-            address = virtio_load_direct(cur_desc[0], cur_desc[1], 0,
+            address = virtio_load_direct(cur_desc[0], cur_desc[1],
                                          (void *)address);
             if (!address) {
                 puts("zIPL load segment failed");
pc-bios/s390-ccw/virtio-blkdev.c +1 -1
index 7b2d1e20f4d..4b819dd80fb 100644
@@ -64,7 +64,7 @@ int virtio_read_many(unsigned long sector, void *load_addr, int sec_num)
 }
 
 unsigned long virtio_load_direct(unsigned long rec_list1, unsigned long rec_list2,
-                                 unsigned long subchan_id, void *load_addr)
+                                 void *load_addr)
 {
     u8 status;
     int sec = rec_list1;
Signature · 1 line
2.53.0
#15 lore raw

[PULL 01/25] tests/qemu-iotests: Mark 182 as Linux-only

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

Running test 182 on FreeBSD fails with this error message in the output:

+warning: File lock requested but OFD locking syscall is unavailable, falling back to POSIX file locks +Due to the implementation, locks can be lost unexpectedly.

OFD locks seem to be only available on Linux, so let's mark this test as Linux-only to silence the failure.

Message-ID: <[email protected]>

---
 tests/qemu-iotests/182 | 1 +
 1 file changed, 1 insertion(+)
tests/qemu-iotests/182 +1 -0
index bbd1132b052..af5eeb599c1 100755
@@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
+_supported_os Linux
 
 size=32M
 
Signature · 1 line
2.53.0
#16 lore raw

[PULL 10/25] pc-bios/s390-ccw: Remove redundant vring schid attribute

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

The schid is already stored as an attribute of the VDev itself and any other instances are copies of this same value. To avoid CCW specific attributes in the VRing let's just access the existing VDev schid attribute as needed.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/virtio.h        | 3 +--
 pc-bios/s390-ccw/virtio-blkdev.c | 2 +-
 pc-bios/s390-ccw/virtio-net.c    | 2 +-
 pc-bios/s390-ccw/virtio.c        | 9 ++++-----
 4 files changed, 7 insertions(+), 9 deletions(-)
pc-bios/s390-ccw/virtio.h +1 -2
index 597bd423586..06ba4e45aca 100644
@@ -103,7 +103,6 @@ struct VRing {
     VRingDesc *desc;
     VRingAvail *avail;
     VRingUsed *used;
-    SubChannelId schid;
     long cookie;
     int id;
 };
@@ -269,7 +268,7 @@ struct VirtioCmd {
 typedef struct VirtioCmd VirtioCmd;
 
 bool vring_notify(VRing *vr);
-int drain_irqs(SubChannelId schid);
+int drain_irqs(void);
 void vring_send_buf(VRing *vr, void *p, int len, int flags);
 int vr_poll(VRing *vr);
 int vring_wait_reply(void);
pc-bios/s390-ccw/virtio-blkdev.c +1 -1
index 4b819dd80fb..019c2718b18 100644
@@ -42,7 +42,7 @@ static int virtio_blk_read_many(VDev *vdev, unsigned long sector, void *load_add
     /* Now we can tell the host to read */
     vring_wait_reply();
 
-    if (drain_irqs(vr->schid)) {
+    if (drain_irqs()) {
         /* Well, whatever status is supposed to contain... */
         status = 1;
     }
pc-bios/s390-ccw/virtio-net.c +1 -1
index 301445bf978..7eb08500695 100644
@@ -88,7 +88,7 @@ int send(int fd, const void *buf, int len, int flags)
     while (!vr_poll(txvq)) {
         yield();
     }
-    if (drain_irqs(txvq->schid)) {
+    if (drain_irqs()) {
         puts("send: drain irqs failed");
         return -1;
     }
pc-bios/s390-ccw/virtio.c +4 -5
index cd6c99c7e32..f384a990dcc 100644
@@ -72,14 +72,14 @@ static long virtio_notify(SubChannelId schid, int vq_idx, long cookie)
  *             Virtio functions                *
  ***********************************************/
 
-int drain_irqs(SubChannelId schid)
+int drain_irqs(void)
 {
     Irb irb = {};
     int r = 0;
 
     while (1) {
         /* FIXME: make use of TPI, for that enable subchannel and isc */
-        if (tsch(schid, &irb)) {
+        if (tsch(vdev.schid, &irb)) {
             /* Might want to differentiate error codes later on. */
             if (irb.scsw.cstat) {
                 r = -EIO;
@@ -134,7 +134,7 @@ static void vring_init(VRing *vr, VqInfo *info)
 
 bool vring_notify(VRing *vr)
 {
-    vr->cookie = virtio_notify(vr->schid, vr->id, vr->cookie);
+    vr->cookie = virtio_notify(vdev.schid, vr->id, vr->cookie);
     return vr->cookie >= 0;
 }
 
@@ -211,7 +211,7 @@ int virtio_run(VDev *vdev, int vqid, VirtioCmd *cmd)
     } while (cmd[i++].flags & VRING_DESC_F_NEXT);
 
     vring_wait_reply();
-    if (drain_irqs(vr->schid)) {
+    if (drain_irqs()) {
         return -1;
     }
     return 0;
@@ -316,7 +316,6 @@ int virtio_setup_ccw(VDev *vdev)
         }
         info.num = config.num;
         vring_init(&vdev->vrings[i], &info);
-        vdev->vrings[i].schid = vdev->schid;
         if (run_ccw(vdev, CCW_CMD_SET_VQ, &info, sizeof(info), false)) {
             puts("Cannot set VQ info");
             return -EIO;
Signature · 1 line
2.53.0
#17 lore raw

[PULL 22/25] hw: Add "loadparm" property to virtio block PCI devices booting on s390x

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

The loadparm is required on s390x to pass the information to the boot loader such as which kernel should be started or whether the boot menu should be shown.

Because PCI devices do not naturally allocate space for this, the property is added on an architecture specific basis for supported device types.

Message-ID: <[email protected]>

---
 include/hw/pci/pci.h        |  1 +
 include/hw/pci/pci_device.h |  3 +++
 hw/pci/pci.c                | 38 +++++++++++++++++++++++++++++++++++++
 hw/s390x/ipl.c              | 11 +++++++++--
 hw/virtio/virtio-blk-pci.c  |  1 +
 5 files changed, 52 insertions(+), 2 deletions(-)
include/hw/pci/pci.h +1 -0
index 64141e92fec..5b179091dee 100644
@@ -380,6 +380,7 @@ const char *pci_root_bus_path(PCIDevice *dev);
 bool pci_bus_bypass_iommu(PCIBus *bus);
 PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn);
 int pci_qdev_find_device(const char *id, PCIDevice **pdev);
+void pci_qdev_property_add_specifics(DeviceClass *dc);
 void pci_bus_get_w64_range(PCIBus *bus, Range *range);
 
 void pci_device_deassert_intx(PCIDevice *dev);
include/hw/pci/pci_device.h +3 -0
index 88ccea50113..5cac6e16886 100644
@@ -62,6 +62,9 @@ struct PCIDevice {
     bool partially_hotplugged;
     bool enabled;
 
+    /* only for s390x */
+    char *loadparm;
+
     /* PCI config space */
     uint8_t *config;
 
hw/pci/pci.c +38 -0
index 6399ebd41cb..2c3657d00de 100644
@@ -36,6 +36,7 @@
 #include "migration/qemu-file-types.h"
 #include "migration/vmstate.h"
 #include "net/net.h"
+#include "system/arch_init.h"
 #include "system/numa.h"
 #include "system/runstate.h"
 #include "system/system.h"
@@ -2843,6 +2844,43 @@ int pci_qdev_find_device(const char *id, PCIDevice **pdev)
     return rc;
 }
 
+static char *pci_qdev_property_get_loadparm(Object *obj, Error **errp)
+{
+    return g_strdup(PCI_DEVICE(obj)->loadparm);
+}
+
+static void pci_qdev_property_set_loadparm(Object *obj, const char *value,
+                                       Error **errp)
+{
+    void *lp_str;
+
+    if (object_property_get_int(obj, "bootindex", NULL) < 0) {
+        error_setg(errp, "'loadparm' is only valid for boot devices");
+        return;
+    }
+
+    lp_str = g_malloc0(strlen(value) + 1);
+    if (!qdev_prop_sanitize_s390x_loadparm(lp_str, value, errp)) {
+        g_free(lp_str);
+        return;
+    }
+    PCI_DEVICE(obj)->loadparm = lp_str;
+}
+
+void pci_qdev_property_add_specifics(DeviceClass *dc)
+{
+    ObjectClass *oc = OBJECT_CLASS(dc);
+
+    /* The loadparm property is only supported on s390x */
+    if (target_s390x()) {
+        object_class_property_add_str(oc, "loadparm",
+                                      pci_qdev_property_get_loadparm,
+                                      pci_qdev_property_set_loadparm);
+        object_class_property_set_description(oc, "loadparm",
+                                              "load parameter (s390x only)");
+    }
+}
+
 MemoryRegion *pci_address_space(PCIDevice *dev)
 {
     return pci_get_bus(dev)->address_space_mem;
hw/s390x/ipl.c +9 -2
index 7e09a8cf80d..1babcd2b7dd 100644
@@ -461,6 +461,7 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb)
     int devtype;
     uint8_t *lp;
     g_autofree void *scsi_lp = NULL;
+    g_autofree void *pci_lp = NULL;
 
     ccw_dev = s390_get_ccw_device(dev_st, &devtype);
     if (ccw_dev) {
@@ -513,6 +514,14 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb)
 
     pbdev = s390_get_pci_device(dev_st, &devtype);
     if (pbdev) {
+        pci_lp = object_property_get_str(OBJECT(pbdev->pdev), "loadparm", NULL);
+        if (pci_lp && strlen(pci_lp) > 0) {
+            lp = pci_lp;
+        } else {
+            /* Use machine loadparm as a place holder if PCI LP is unset */
+            lp = S390_CCW_MACHINE(qdev_get_machine())->loadparm;
+        }
+
         switch (devtype) {
         case PCI_DEVTYPE_VIRTIO:
             iplb->len = cpu_to_be32(S390_IPLB_MIN_PCI_LEN);
@@ -523,8 +532,6 @@ static bool s390_build_iplb(DeviceState *dev_st, IplParameterBlock *iplb)
             return false;
         }
 
-        /* Per-device loadparm not yet supported for non-ccw IPL */
-        lp = S390_CCW_MACHINE(qdev_get_machine())->loadparm;
         s390_ipl_convert_loadparm((char *)lp, iplb->loadparm);
         iplb->flags |= DIAG308_FLAGS_LP_VALID;
 
hw/virtio/virtio-blk-pci.c +1 -0
index 64a434c81b5..3eecc23a657 100644
@@ -71,6 +71,7 @@ static void virtio_blk_pci_class_init(ObjectClass *klass, const void *data)
 
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
     device_class_set_props(dc, virtio_blk_pci_properties);
+    pci_qdev_property_add_specifics(dc);
     k->realize = virtio_blk_pci_realize;
     pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET;
     pcidev_k->device_id = PCI_DEVICE_ID_VIRTIO_BLOCK;
Signature · 1 line
2.53.0
#18 lore raw

[PULL 19/25] pc-bios/s390-ccw: Introduce virtio-pci functions

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Define common functionality for interacting with virtio-pci devices.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/virtio-pci.h |  80 ++++++++++++++++
 pc-bios/s390-ccw/virtio.h     |   3 +
 pc-bios/s390-ccw/virtio-pci.c | 167 ++++++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/Makefile     |   2 +-
 4 files changed, 251 insertions(+), 1 deletion(-)
 create mode 100644 pc-bios/s390-ccw/virtio-pci.h
 create mode 100644 pc-bios/s390-ccw/virtio-pci.c
pc-bios/s390-ccw/virtio-pci.h new file +80 -0
new file mode 100644
index 00000000000..54c524f6986
@@ -0,0 +1,80 @@
+/*
+ * Definitions for virtio-pci
+ *
+ * Copyright 2025 IBM Corp.
+ * Author(s): Jared Rossi <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef VIRTIO_PCI_H
+#define VIRTIO_PCI_H
+
+/* Common configuration */
+#define VPCI_CAP_COMMON_CFG          1
+/* Notifications */
+#define VPCI_CAP_NOTIFY_CFG          2
+/* ISR access */
+#define VPCI_CAP_ISR_CFG             3
+/* Device specific configuration */
+#define VPCI_CAP_DEVICE_CFG          4
+/* PCI configuration access */
+#define VPCI_CAP_PCI_CFG             5
+/* Additional shared memory capability */
+#define VPCI_CAP_SHARED_MEMORY_CFG   8
+/* PCI vendor data configuration */
+#define VPCI_CAP_VENDOR_CFG          9
+
+/* Offsets within capability header */
+#define VPCI_CAP_VNDR        0
+#define VPCI_CAP_NEXT        1
+#define VPCI_CAP_LEN         2
+#define VPCI_CAP_CFG_TYPE    3
+#define VPCI_CAP_BAR         4
+#define VPCI_CAP_OFFSET      8
+#define VPCI_CAP_LENGTH      12
+
+#define VPCI_N_CAP_MULT 16 /* Notify multiplier, VPCI_CAP_NOTIFY_CFG only */
+
+/* Common Area Offsets for virtio-pci queue */
+#define VPCI_C_OFFSET_DFSELECT      0
+#define VPCI_C_OFFSET_DF            4
+#define VPCI_C_OFFSET_GFSELECT      8
+#define VPCI_C_OFFSET_GF            12
+#define VPCI_C_COMMON_NUMQ          18
+#define VPCI_C_OFFSET_STATUS        20
+#define VPCI_C_OFFSET_Q_SELECT      22
+#define VPCI_C_OFFSET_Q_SIZE        24
+#define VPCI_C_OFFSET_Q_ENABLE      28
+#define VPCI_C_OFFSET_Q_NOFF        30
+#define VPCI_C_OFFSET_Q_DESCLO      32
+#define VPCI_C_OFFSET_Q_DESCHI      36
+#define VPCI_C_OFFSET_Q_AVAILLO     40
+#define VPCI_C_OFFSET_Q_AVAILHI     44
+#define VPCI_C_OFFSET_Q_USEDLO      48
+#define VPCI_C_OFFSET_Q_USEDHI      52
+
+#define VIRTIO_F_VERSION_1          1   /* Feature bit 32 */
+
+struct VirtioPciCap {
+    uint8_t bar;     /* Which PCIAS it's in */
+    uint32_t off;    /* Offset within bar */
+};
+typedef struct VirtioPciCap  VirtioPciCap;
+
+void virtio_pci_id2type(VDev *vdev, uint16_t device_id);
+int virtio_pci_reset(VDev *vdev);
+long virtio_pci_notify(int vq_id);
+
+int vpci_read_flex(uint64_t offset, uint8_t pcias, void *buf, int len);
+int vpci_read_bswap64(uint64_t offset, uint8_t pcias, uint64_t *buf);
+int vpci_read_bswap32(uint64_t offset, uint8_t pcias, uint32_t *buf);
+int vpci_read_bswap16(uint64_t offset, uint8_t pcias, uint16_t *buf);
+int vpci_read_byte(uint64_t offset, uint8_t pcias, uint8_t *buf);
+
+int vpci_bswap64_write(uint64_t offset, uint8_t pcias, uint64_t data);
+int vpci_bswap32_write(uint64_t offset, uint8_t pcias, uint32_t data);
+int vpci_bswap16_write(uint64_t offset, uint8_t pcias, uint16_t data);
+int vpci_write_byte(uint64_t offset, uint8_t pcias, uint8_t data);
+
+#endif
pc-bios/s390-ccw/virtio.h +3 -0
index c3cb5a6ee3b..1ef64675f4a 100644
@@ -18,6 +18,8 @@
 #define VIRTIO_CONFIG_S_DRIVER          2
 /* Driver has used its parts of the config, and is happy */
 #define VIRTIO_CONFIG_S_DRIVER_OK       4
+/* Feature negotiation complete */
+#define VIRTIO_CONFIG_S_FEATURES_OK     8
 /* We've given up on this device. */
 #define VIRTIO_CONFIG_S_FAILED          0x80
 
@@ -255,6 +257,7 @@ struct VDev {
     uint8_t scsi_dev_heads;
     bool scsi_device_selected;
     ScsiDevice selected_scsi_device;
+    uint32_t pci_fh;
     uint32_t max_transfer;
     uint32_t guest_features[2];
 };
pc-bios/s390-ccw/virtio-pci.c new file +167 -0

167 lines not on this page · raw message

pc-bios/s390-ccw/Makefile +1 -1
index a62fc9d7660..3e5dfb64d5d 100644
@@ -35,7 +35,7 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \
 	  virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o \
-	  virtio-ccw.o clp.o pci.o
+	  virtio-ccw.o clp.o pci.o virtio-pci.o
 
 SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
 
Signature · 1 line
2.53.0
#19 lore raw

[PULL 05/25] tests/functional/migration: Use socket_dir

In reply to Thomas Huth

From: Fabiano Rosas <[email protected]>

Use QemuBaseTest.socket_dir instead of calling tempfile directly so all tests have consistent directory prefixes.

Message-ID: <[email protected]>

---
 tests/functional/migration.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tests/functional/migration.py +2 -4
index 2bfb1f77901..0aa873edbaa 100644
@@ -11,7 +11,6 @@
 # This work is licensed under the terms of the GNU GPL, version 2 or
 # later.  See the COPYING file in the top-level directory.
 
-import tempfile
 import time
 
 from qemu_test import QemuSystemTest, which
@@ -65,9 +64,8 @@ def migration_with_tcp_localhost(self):
             self.do_migrate(dest_uri)
 
     def migration_with_unix(self):
-        with tempfile.TemporaryDirectory(prefix='socket_') as socket_path:
-            dest_uri = 'unix:%s/qemu-test.sock' % socket_path
-            self.do_migrate(dest_uri)
+        dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
+        self.do_migrate(dest_uri)
 
     def migration_with_exec(self):
         if not which('ncat'):
Signature · 1 line
2.53.0
#20 lore raw

[PULL 25/25] pc-bios/s390-ccw.img: Update the s390 bios blog with the latest changes

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

- Make sure the reset virtio devices on failed boot attempts
- Add support for booting via virtio-blk-pci

---
 pc-bios/s390-ccw.img | Bin 87824 -> 95992 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)
pc-bios/s390-ccw.img binary +0 -0
index ff60978d28c59a3d9ee706e48ff268aad6476ddc..48ac78c894592b655062fcf9513acc39d917f176 100644
GIT binary patch
Signature · 1 line
2.53.0
#21 lore raw

[PULL 15/25] include/hw/s390x: Move CLP definitions for easier BIOS access

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Move the s390-pci-clp definitions into the "ipl" sub-directory, which is visible to the s390-bios. This allows the bios to reuse the architected definitions and prevents code duplication.

Message-ID: <[email protected]>

---
 MAINTAINERS                               | 1 +
 include/hw/s390x/{ => ipl}/s390-pci-clp.h | 0
 include/hw/s390x/s390-pci-bus.h           | 2 +-
 hw/s390x/s390-pci-vfio.c                  | 2 +-
 4 files changed, 3 insertions(+), 2 deletions(-)
 rename include/hw/s390x/{ => ipl}/s390-pci-clp.h (100%)
MAINTAINERS +1 -0
index f6d43a41431..9d1614fd7e9 100644
@@ -1882,6 +1882,7 @@ R: Eric Farman <[email protected]>
 S: Supported
 F: hw/s390x/s390-pci*
 F: include/hw/s390x/s390-pci*
+F: include/hw/s390x/ipl/s390-pci*
 F: util/s390x_pci_mmio.c
 L: [email protected]
 
include/hw/s390x/ipl/s390-pci-clp.h renamed from include/hw/s390x/s390-pci-clp.h +0 -0
similarity index 100%
rename from include/hw/s390x/s390-pci-clp.h
rename to include/hw/s390x/ipl/s390-pci-clp.h
include/hw/s390x/s390-pci-bus.h +1 -1
index 04944d4fed7..f643e130579 100644
@@ -19,7 +19,7 @@
 #include "hw/s390x/sclp.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/css.h"
-#include "hw/s390x/s390-pci-clp.h"
+#include "hw/s390x/ipl/s390-pci-clp.h"
 #include "qom/object.h"
 
 #define TYPE_S390_PCI_HOST_BRIDGE "s390-pcihost"
hw/s390x/s390-pci-vfio.c +1 -1
index 9e31029d7ac..8ce44dbecce 100644
@@ -17,7 +17,7 @@
 
 #include "trace.h"
 #include "hw/s390x/s390-pci-bus.h"
-#include "hw/s390x/s390-pci-clp.h"
+#include "hw/s390x/ipl/s390-pci-clp.h"
 #include "hw/s390x/s390-pci-vfio.h"
 #include "hw/vfio/pci.h"
 #include "hw/vfio/vfio-container-legacy.h"
Signature · 1 line
2.53.0
#22 lore raw

[PULL 17/25] s390x: Add definitions for PCI IPL type

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Define a new PBT code and IPLB layout in preparation for supporting PCI device IPL on s390x.

Message-ID: <[email protected]>

---
 include/hw/s390x/ipl/qipl.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/hw/s390x/ipl/qipl.h +10 -0
index 6dc12dd859f..8d3c83a80bd 100644
@@ -23,6 +23,7 @@
 enum S390IplType {
     S390_IPL_TYPE_FCP = 0x00,
     S390_IPL_TYPE_CCW = 0x02,
+    S390_IPL_TYPE_PCI = 0x04,
     S390_IPL_TYPE_PV = 0x05,
     S390_IPL_TYPE_QEMU_SCSI = 0xff
 };
@@ -108,6 +109,14 @@ struct IplBlockQemuScsi {
 } QEMU_PACKED;
 typedef struct IplBlockQemuScsi IplBlockQemuScsi;
 
+struct IplBlockPci {
+    uint32_t reserved0[76];
+    uint8_t  opt;
+    uint8_t  reserved1[3];
+    uint32_t fid;
+} QEMU_PACKED;
+typedef struct IplBlockPci IplBlockPci;
+
 union IplParameterBlock {
     struct {
         uint32_t len;
@@ -123,6 +132,7 @@ union IplParameterBlock {
             IplBlockFcp fcp;
             IPLBlockPV pv;
             IplBlockQemuScsi scsi;
+            IplBlockPci pci;
         };
     } QEMU_PACKED;
     struct {
Signature · 1 line
2.53.0
#23 lore raw

[PULL 07/25] tests/functional/migration: Use the migrate_vms helper

In reply to Thomas Huth

From: Fabiano Rosas <[email protected]>

Change do_migrate() to call the migrate_vms() helper and provide it with the two VMs already created. Rename do_migrate -> migrate and adjust the callers.

While here, standardize on the "src" and "dst" names.

Message-ID: <[email protected]>

---
 tests/functional/migration.py | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)
tests/functional/migration.py +18 -16
index 3362e5c743e..49347a30bbf 100644
@@ -45,17 +45,19 @@ def migrate_vms(self, dst_uri, src_uri, dst_vm, src_vm):
         src_vm.qmp('migrate', uri=src_uri)
         self.assert_migration(src_vm, dst_vm)
 
-    def do_migrate(self, dest_uri, src_uri=None):
-        dest_vm = self.get_vm('-incoming', dest_uri, name="dest-qemu")
-        dest_vm.add_args('-nodefaults')
-        dest_vm.launch()
+    def migrate(self, dst_uri, src_uri=None):
+        dst_vm = self.get_vm('-incoming', 'defer', name="dst-qemu")
+        dst_vm.add_args('-nodefaults')
+        dst_vm.launch()
+
+        src_vm = self.get_vm(name="src-qemu")
+        src_vm.add_args('-nodefaults')
+        src_vm.launch()
+
         if src_uri is None:
-            src_uri = dest_uri
-        source_vm = self.get_vm(name="source-qemu")
-        source_vm.add_args('-nodefaults')
-        source_vm.launch()
-        source_vm.qmp('migrate', uri=src_uri)
-        self.assert_migration(source_vm, dest_vm)
+            src_uri = dst_uri
+
+        self.migrate_vms(dst_uri, src_uri, dst_vm, src_vm)
 
     def _get_free_port(self, ports):
         port = ports.find_free_port()
@@ -65,18 +67,18 @@ def _get_free_port(self, ports):
 
     def migration_with_tcp_localhost(self):
         with Ports() as ports:
-            dest_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
-            self.do_migrate(dest_uri)
+            dst_uri = 'tcp:localhost:%u' % self._get_free_port(ports)
+            self.migrate(dst_uri)
 
     def migration_with_unix(self):
-        dest_uri = 'unix:%s/migration.sock' % self.socket_dir().name
-        self.do_migrate(dest_uri)
+        dst_uri = 'unix:%s/migration.sock' % self.socket_dir().name
+        self.migrate(dst_uri)
 
     def migration_with_exec(self):
         if not which('ncat'):
             self.skipTest('ncat is not available')
         with Ports() as ports:
             free_port = self._get_free_port(ports)
-            dest_uri = 'exec:ncat -l localhost %u' % free_port
+            dst_uri = 'exec:ncat -l localhost %u' % free_port
             src_uri = 'exec:ncat localhost %u' % free_port
-            self.do_migrate(dest_uri, src_uri)
+            self.migrate(dst_uri, src_uri)
Signature · 1 line
2.53.0
#24 lore raw

[PULL 20/25] pc-bios/s390-ccw: Add support for virtio-blk-pci IPL

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Add little-endian virt-queue configuration and support for virtio-blk-pci IPL devices.

Message-ID: <[email protected]>

[thuth: Fix coding style error & spelling warning reported by checkpatch.pl]
---
 pc-bios/s390-ccw/pci.h           |   3 +
 pc-bios/s390-ccw/virtio-pci.h    |   2 +
 pc-bios/s390-ccw/virtio.h        |   1 +
 pc-bios/s390-ccw/main.c          |  61 ++++++-
 pc-bios/s390-ccw/virtio-blkdev.c |  18 +++
 pc-bios/s390-ccw/virtio-pci.c    | 266 +++++++++++++++++++++++++++++++
 pc-bios/s390-ccw/virtio.c        |  54 ++++++-
 7 files changed, 400 insertions(+), 5 deletions(-)
pc-bios/s390-ccw/pci.h +3 -0
index 968635eff11..b9eb86b2e67 100644
@@ -26,8 +26,11 @@ union register_pair {
 };
 
 #define PCI_CFGBAR             0xF  /* Base Address Register for config space */
+#define PCI_CMD_REG            0x4  /* Offset of command register */
 #define PCI_CAPABILITY_LIST    0x34 /* Offset of first capability list entry */
 
+#define PCI_BUS_MASTER_MASK    0x0020 /* LE bit 3 of 16 bit register */
+
 int pci_write(uint32_t fhandle, uint64_t offset, uint8_t pcias, uint64_t data,
               uint8_t len);
 int pci_read(uint32_t fhandle, uint64_t offset, uint8_t pcias, void *buf,
pc-bios/s390-ccw/virtio-pci.h +2 -0
index 54c524f6986..90d07cb9a76 100644
@@ -65,6 +65,8 @@ typedef struct VirtioPciCap  VirtioPciCap;
 void virtio_pci_id2type(VDev *vdev, uint16_t device_id);
 int virtio_pci_reset(VDev *vdev);
 long virtio_pci_notify(int vq_id);
+int virtio_pci_setup(VDev *vdev);
+int virtio_pci_setup_device(void);
 
 int vpci_read_flex(uint64_t offset, uint8_t pcias, void *buf, int len);
 int vpci_read_bswap64(uint64_t offset, uint8_t pcias, uint64_t *buf);
pc-bios/s390-ccw/virtio.h +1 -0
index 1ef64675f4a..d32a4830cad 100644
@@ -273,6 +273,7 @@ struct VirtioCmd {
 };
 typedef struct VirtioCmd VirtioCmd;
 
+bool be_ipl(void);
 void vring_init(VRing *vr, VqInfo *info);
 bool virtio_is_supported(VDev *vdev);
 bool vring_notify(VRing *vr);
pc-bios/s390-ccw/main.c +59 -2

91 lines not on this page · raw message

pc-bios/s390-ccw/virtio-blkdev.c +18 -0
index 9722b6970f1..98b6cec3a09 100644
@@ -13,10 +13,22 @@
 #include "virtio.h"
 #include "virtio-scsi.h"
 #include "virtio-ccw.h"
+#include "virtio-pci.h"
+#include "bswap.h"
 
 #define VIRTIO_BLK_F_GEOMETRY   (1 << 4)
 #define VIRTIO_BLK_F_BLK_SIZE   (1 << 6)
 
+/*
+ * Format header for little endian IPL
+ */
+static void fmt_blk_hdr_le(VirtioBlkOuthdr *hdr)
+{
+    hdr->type = bswap32(hdr->type);
+    hdr->ioprio = bswap32(hdr->ioprio);
+    hdr->sector = bswap64(hdr->sector);
+}
+
 static int virtio_blk_read_many(VDev *vdev, unsigned long sector, void *load_addr,
                                 int sec_num)
 {
@@ -29,6 +41,10 @@ static int virtio_blk_read_many(VDev *vdev, unsigned long sector, void *load_add
     out_hdr.ioprio = 99;
     out_hdr.sector = virtio_sector_adjust(sector);
 
+    if (!be_ipl()) {
+        fmt_blk_hdr_le(&out_hdr);
+    }
+
     vring_send_buf(vr, &out_hdr, sizeof(out_hdr), VRING_DESC_F_NEXT);
 
     /* This is where we want to receive data */
@@ -240,6 +256,8 @@ int virtio_blk_setup_device(VDev *vdev)
     case S390_IPL_TYPE_QEMU_SCSI:
     case S390_IPL_TYPE_CCW:
         return virtio_ccw_setup(vdev);
+    case S390_IPL_TYPE_PCI:
+        return virtio_pci_setup(vdev);
     default:
         return 1;
     }
pc-bios/s390-ccw/virtio-pci.c +266 -0

269 lines not on this page · raw message

pc-bios/s390-ccw/virtio.c +51 -3

106 lines not on this page · raw message

Signature · 1 line
2.53.0
#25 lore raw

[PULL 21/25] s390x: Build IPLB for virtio-pci devices

In reply to Thomas Huth

From: Jared Rossi <[email protected]>

Search for a corresponding S390PCIBusDevice and build an IPLB if a device has been indexed for boot but does not identify as a CCW device,

PCI devices are not yet included in boot probing (they must have a boot index).

Message-ID: <[email protected]>

[thuth: Fix endianness issue when running on a little endian host]
---
 hw/s390x/ipl.h                  |  3 ++
 include/hw/s390x/s390-pci-bus.h |  2 ++
 hw/s390x/ipl.c                  | 56 ++++++++++++++++++++++++++++++---
 hw/s390x/s390-pci-bus.c         |  3 +-
 4 files changed, 57 insertions(+), 7 deletions(-)
hw/s390x/ipl.h +3 -0
index c542d30ce2d..403cd08450d 100644
@@ -107,6 +107,7 @@ QEMU_BUILD_BUG_MSG(offsetof(S390IPLState, iplb) & 3, "alignment of iplb wrong");
 #define S390_IPLB_MIN_PV_LEN 148
 #define S390_IPLB_MIN_CCW_LEN 200
 #define S390_IPLB_MIN_FCP_LEN 384
+#define S390_IPLB_MIN_PCI_LEN 376
 #define S390_IPLB_MIN_QEMU_SCSI_LEN 200
 
 static inline bool iplb_valid_len(IplParameterBlock *iplb)
@@ -179,6 +180,8 @@ static inline bool iplb_valid(IplParameterBlock *iplb)
         return len >= S390_IPLB_MIN_FCP_LEN;
     case S390_IPL_TYPE_CCW:
         return len >= S390_IPLB_MIN_CCW_LEN;
+    case S390_IPL_TYPE_PCI:
+        return len >= S390_IPLB_MIN_PCI_LEN;
     case S390_IPL_TYPE_QEMU_SCSI:
     default:
         return false;
include/hw/s390x/s390-pci-bus.h +2 -0
index f643e130579..9228523ce8e 100644
@@ -402,6 +402,8 @@ S390PCIBusDevice *s390_pci_find_dev_by_fh(S390pciState *s, uint32_t fh);
 S390PCIBusDevice *s390_pci_find_dev_by_fid(S390pciState *s, uint32_t fid);
 S390PCIBusDevice *s390_pci_find_dev_by_target(S390pciState *s,
                                               const char *target);
+S390PCIBusDevice *s390_pci_find_dev_by_pci(S390pciState *s,
+                                           PCIDevice *pci_dev);
 S390PCIBusDevice *s390_pci_find_next_avail_dev(S390pciState *s,
                                                S390PCIBusDevice *pbdev);
 void s390_pci_ism_reset(void);
hw/s390x/ipl.c +51 -5

97 lines not on this page · raw message

hw/s390x/s390-pci-bus.c +1 -2
index 3166b91c461..4de7b587e8a 100644
@@ -250,8 +250,7 @@ S390PCIBusDevice *s390_pci_find_dev_by_target(S390pciState *s,
     return NULL;
 }
 
-static S390PCIBusDevice *s390_pci_find_dev_by_pci(S390pciState *s,
-                                                  PCIDevice *pci_dev)
+S390PCIBusDevice *s390_pci_find_dev_by_pci(S390pciState *s, PCIDevice *pci_dev)
 {
     S390PCIBusDevice *pbdev;
 
Signature · 1 line
2.53.0
#26 lore raw

[PULL 24/25] pc-bios/s390-ccw: Fix compiler warning when compiling with DEBUG enabled

In reply to Thomas Huth

From: Thomas Huth <[email protected]>

When compiling with DEBUG=1, there is currently a compiler warning:

pc-bios/s390-ccw: Compiling main.o
In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/main.c:14:
In file included from /home/thuth/devel/qemu/pc-bios/s390-ccw/helper.h:16:
/home/thuth/devel/qemu/pc-bios/s390-ccw/s390-ccw.h:122:31: warning: format specifies type
'unsigned int' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]

   122 |     printf("%s 0x%X\n", desc, addr);
       |                  ~~           ^~~~
       |                  %llX

1 warning generated.

Fix it by using the right format string here.

Message-ID: <[email protected]>

---
 pc-bios/s390-ccw/s390-ccw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
pc-bios/s390-ccw/s390-ccw.h +1 -1
index ccd68ff0a4b..1e1f71775ec 100644
@@ -112,7 +112,7 @@ static inline void fill_hex_val(char *out, void *ptr, unsigned size)
 static inline void debug_print_int(const char *desc, u64 addr)
 {
 #ifdef DEBUG
-    printf("%s 0x%X\n", desc, addr);
+    printf("%s 0x%llx\n", desc, addr);
 #endif
 }
 
Signature · 1 line
2.53.0
#27 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth

The following changes since commit de61484ec39f418e5c0d4603017695f9ffb8fe24:

Merge tag 'linux-user-for-v11-pull-request' of https://github.com/hdeller/qemu-hppa into staging (2026-03-09 14:53:42 +0000)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2026-03-10

for you to fetch changes up to f2bd9693f22b105182b0bacdba390a0e41b2cf82:

Quoted 7 lines

pc-bios/s390-ccw.img: Update the s390 bios blog with the latest changes (2026-03-10 06:46:45 +0100)

----------------------------------------------------------------
- Improve the s390-ccw bios to be able to boot from virtio-blk-pci devices
- Rework migration functional test to avoid a problem in the ppc64 test
- Disable functional memlock test for asan builds
- Some other minor tests improvements

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/11.0
for any user-visible changes.

-- PMM

#7 lore raw

Re: [PULL 03/25] tests/functional/ppc/test_40: Fix the URL of the NetBSD-7.1.2-prep.iso asset

In reply to Thomas Huth
Quoted 17 lines · Thomas Huth

From: Thomas Huth <[email protected]>

We now need a slightly different URL to be able to download this asset.

Message-ID: <[email protected]>

---
 tests/functional/ppc/test_40p.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/functional/ppc/test_40p.py +0 -0
index 614972a7eb3..ed272147f6e 100755

tests/functional/ppc/test_40p.py class IbmPrep40pMachine(QemuSystemTest): · line 31

Quoted 6 lines
tests/functional/ppc/test_40p.py +1 -1
@@ -27,7 +27,7 @@ class IbmPrep40pMachine(QemuSystemTest):
         'f86236e9d01b3f0dd0f5d3b8d5bbd40c68e78b4db560a108358f5ad58e636619')
     ASSET_NETBSD71 = Asset(
         ('https://archive.netbsd.org/pub/NetBSD-archive/'
-         'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso'),
+         'NetBSD-7.1.2/iso/NetBSD-7.1.2-prep.iso?key=NetBSD'),
         'cc7cb290b06aaa839362deb7bd9f417ac5015557db24088508330f76c3f825ec')

My local machine has been sat downloading this file very very slowly for the last half an hour. Is there somewhere that we can get the asset from that manages faster downloads?

thanks
-- PMM