[PATCH RFC v1 0/1] hw/s390x/ccw: Disable legacy mode

Jaehoon Kim posted 1 patch 3 days, 21 hours ago
Failed in applying to current master (apply log)
There is a newer version of this series
hw/s390x/s390-virtio-ccw.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
[PATCH RFC v1 0/1] hw/s390x/ccw: Disable legacy mode
Posted by Jaehoon Kim 3 days, 21 hours ago
Hello,

This RFC proposes disabling legacy virtio-pci devices by default on
s390x starting from machine version 11.1.

Background:

The s390 kernel has never supported the legacy virtio-pci interface
despite QEMU advertising it. IO_SPACE_LIMIT has been 0 since the
initial zPCI implementation (commit cd24834130ac "s390/pci: base
support"), making I/O BARs unusable, so our driver never supported it.

When virtio-pci devices operate in transitional mode, QEMU
unconditionally exposes the legacy interface via BAR0. During PCI
enumeration, this results in firmware warnings such as:

  pci 0005:00:00.0: [Firmware Bug]: BAR 0: invalid; can't size

even though the BAR is never usable on the s390 kernel.

It was also observed that forcing legacy-only mode (disable-modern=on)
does not work on s390x. The guest first attempts virtio_pci_modern_probe()
and then falls back to virtio_pci_legacy_probe(), which tries to map BAR0
via pci_iomap(). Since IO_SPACE_LIMIT=0 on s390, the BAR is unusable, the
mapping fails, and the device probe fails. This further confirms that
legacy support is not practically usable on s390x for new guests.

This patch closes this gap by disabling legacy virtio-pci support
starting from machine version 11.1, effectively making virtio-pci
devices non-transitional and preventing the creation of the unusable
legacy I/O BAR.

Implementation:

The patch introduces s390x-specific global compatibility properties that
set disable-legacy=on as the default for virtio-pci devices. Machine
versions v11.0 and earlier set disable-legacy=off to maintain their
original default behavior for compatibility.

Users can still override the default on the command line if needed:
  - On v11.1+: -global virtio-pci.disable-legacy=off (to enable legacy)
  - On v11.0-: -global virtio-pci.disable-legacy=on (to disable legacy)

I would appreciate feedback on this approach.

Thanks,
Jaehoon Kim

Jaehoon Kim (1):
  hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+)

 hw/s390x/s390-virtio-ccw.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

-- 
2.50.1