All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] hw/s390x/ccw: Disable legacy mode
@ 2026-04-20 14:47 Jaehoon Kim
  2026-04-20 14:47 ` [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) Jaehoon Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Jaehoon Kim @ 2026-04-20 14:47 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x
  Cc: richard.henderson, iii, david, pasic, borntraeger, farman,
	mjrosato, cohuck, Jaehoon Kim

Hello,

This is v2 of the patch.

Changes in v2:
- Drop RFC tag as the approach has been reviewed and agreed in principle.
- Improve comments to clarify why legacy virtio-pci is not usable on s390x
  due to lack of I/O BAR support (IO_SPACE_LIMIT is 0).

No functional changes.

RFC v1:
https://lore.kernel.org/qemu-devel/20260417154332.849664-1-jhkim@linux.ibm.com/

Thanks,
Jaehoon Kim.

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

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

-- 
2.50.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+)
  2026-04-20 14:47 [PATCH v2 0/1] hw/s390x/ccw: Disable legacy mode Jaehoon Kim
@ 2026-04-20 14:47 ` Jaehoon Kim
  2026-04-21 18:01   ` Matthew Rosato
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jaehoon Kim @ 2026-04-20 14:47 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x
  Cc: richard.henderson, iii, david, pasic, borntraeger, farman,
	mjrosato, cohuck, Jaehoon Kim, Mohamed Mediouni

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 <jhkim@linux.ibm.com>
Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
---
 hw/s390x/s390-virtio-ccw.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index cc768daeb0..4d35f9b10b 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -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);
-- 
2.50.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+)
  2026-04-20 14:47 ` [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) Jaehoon Kim
@ 2026-04-21 18:01   ` Matthew Rosato
  2026-04-21 22:34   ` Halil Pasic
  2026-04-22  9:53   ` Cornelia Huck
  2 siblings, 0 replies; 5+ messages in thread
From: Matthew Rosato @ 2026-04-21 18:01 UTC (permalink / raw)
  To: Jaehoon Kim, qemu-devel, qemu-s390x
  Cc: richard.henderson, iii, david, pasic, borntraeger, farman, cohuck,
	Mohamed Mediouni

On 4/20/26 10:47 AM, Jaehoon Kim wrote:
> 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 <jhkim@linux.ibm.com>
> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>

Code looks good to me:

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>

I also took the patch (along with 11.1 compat machine update) and did a
general regression of various virtio-pci devices with kvm-accelerated
s390x guests using s390-ccw-virtio-11.1.

Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>

Thanks Jaehoon!

> ---
>  hw/s390x/s390-virtio-ccw.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index cc768daeb0..4d35f9b10b 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -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);



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+)
  2026-04-20 14:47 ` [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) Jaehoon Kim
  2026-04-21 18:01   ` Matthew Rosato
@ 2026-04-21 22:34   ` Halil Pasic
  2026-04-22  9:53   ` Cornelia Huck
  2 siblings, 0 replies; 5+ messages in thread
From: Halil Pasic @ 2026-04-21 22:34 UTC (permalink / raw)
  To: Jaehoon Kim
  Cc: qemu-devel, qemu-s390x, richard.henderson, iii, david,
	borntraeger, farman, mjrosato, cohuck, Mohamed Mediouni,
	Halil Pasic

On Mon, 20 Apr 2026 09:47:34 -0500
Jaehoon Kim <jhkim@linux.ibm.com> wrote:

> 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 <jhkim@linux.ibm.com>
> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>

Reviewed-by: Halil Pasic <pasic@linux.ibm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+)
  2026-04-20 14:47 ` [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) Jaehoon Kim
  2026-04-21 18:01   ` Matthew Rosato
  2026-04-21 22:34   ` Halil Pasic
@ 2026-04-22  9:53   ` Cornelia Huck
  2 siblings, 0 replies; 5+ messages in thread
From: Cornelia Huck @ 2026-04-22  9:53 UTC (permalink / raw)
  To: Jaehoon Kim, qemu-devel, qemu-s390x
  Cc: richard.henderson, iii, david, pasic, borntraeger, farman,
	mjrosato, Jaehoon Kim, Mohamed Mediouni

On Mon, Apr 20 2026, Jaehoon Kim <jhkim@linux.ibm.com> wrote:

> 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 <jhkim@linux.ibm.com>
> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr>
> ---
>  hw/s390x/s390-virtio-ccw.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)

Thanks, queued to s390-next.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-22  9:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 14:47 [PATCH v2 0/1] hw/s390x/ccw: Disable legacy mode Jaehoon Kim
2026-04-20 14:47 ` [PATCH v2 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) Jaehoon Kim
2026-04-21 18:01   ` Matthew Rosato
2026-04-21 22:34   ` Halil Pasic
2026-04-22  9:53   ` Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.