mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+)
On the s390 Linux kernel, IO_SPACE_LIMIT has been 0 since the initial zPCI implementation (commit cd24834130ac "s390/pci: base support"), making I/O BARs unusable. However, when virtio-pci devices operate in transitional mode, QEMU unconditionally exposes the legacy interface via BAR0. This results in firmware warnings during PCI enumeration, such as: pci 0005:00:00.0: [Firmware Bug]: BAR 0: invalid; can't size even though BAR0 is never usable on the s390 kernel. Close this gap by disabling legacy virtio-pci support starting from machine version 11.1. This effectively makes virtio-pci devices non-transitional and prevents the creation of the unusable legacy I/O BAR. This 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 (legacy support enabled), ensuring VMs created with those versions continue to work identically. Users can 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) Signed-off-by: Jaehoon Kim <[email protected]> Reviewed-by: Mohamed Mediouni <[email protected]> Reviewed-by: Halil Pasic <[email protected]> Reviewed-by: Matthew Rosato <[email protected]> Tested-by: Matthew Rosato <[email protected]> Message-ID: <[email protected]> Signed-off-by: Cornelia Huck <[email protected]>
This commit is contained in:
1 parent
2434407a6a
commit
26103c13cf
1 file changed
+26
@@ -788,6 +788,21 @@ static void machine_set_loadparm(Object *obj, Visitor *v,
|
||||
g_free(val);
|
||||
}
|
||||
|
||||
/*
|
||||
* S390x-specific global compatibility properties.
|
||||
*
|
||||
* On the s390 kernel, legacy virtio-pci is not usable because I/O BARs
|
||||
* are not supported (IO_SPACE_LIMIT is 0), and would only result in
|
||||
* unusable BARs and firmware warnings.
|
||||
*
|
||||
* Therefore, starting from v11.1, disable legacy virtio-pci by default,
|
||||
* while older machine types keep legacy behavior for compatibility.
|
||||
*/
|
||||
static GlobalProperty hw_compat_s390x[] = {
|
||||
{ TYPE_VIRTIO_PCI, "disable-legacy", "on", .optional = true},
|
||||
};
|
||||
static const size_t hw_compat_s390x_len = G_N_ELEMENTS(hw_compat_s390x);
|
||||
|
||||
static void ccw_machine_class_init(ObjectClass *oc, const void *data)
|
||||
{
|
||||
MachineClass *mc = MACHINE_CLASS(oc);
|
||||
@@ -878,6 +893,9 @@ static const TypeInfo ccw_machine_info = {
|
||||
const void *data) \
|
||||
{ \
|
||||
MachineClass *mc = MACHINE_CLASS(oc); \
|
||||
/* Apply global s390x-wide default properties */ \
|
||||
compat_props_add(mc->compat_props, hw_compat_s390x, \
|
||||
hw_compat_s390x_len); \
|
||||
MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \
|
||||
mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \
|
||||
mc->init = MACHINE_VER_SYM(mach_init, ccw, __VA_ARGS__); \
|
||||
@@ -923,7 +941,15 @@ static void ccw_machine_11_0_instance_options(MachineState *machine)
|
||||
|
||||
static void ccw_machine_11_0_class_options(MachineClass *mc)
|
||||
{
|
||||
/*
|
||||
* Preserve v11.0 and older version behavior:
|
||||
* keep legacy virtio-pci enabled.
|
||||
*/
|
||||
static GlobalProperty compat[] = {
|
||||
{ TYPE_VIRTIO_PCI, "disable-legacy", "off" },
|
||||
};
|
||||
ccw_machine_11_1_class_options(mc);
|
||||
compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
|
||||
compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len);
|
||||
}
|
||||
DEFINE_CCW_MACHINE(11, 0);
|
||||
|
||||
Reference in new issue
Block a user