[PATCH v4 03/15] pc-bios/s390-ccw: Always reset virtio device on failed boot attempt

jrossi@linux.ibm.com posted 15 patches 1 month, 1 week ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Jared Rossi <jrossi@linux.ibm.com>, Zhuoying Cai <zycai@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>, Halil Pasic <pasic@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Farhan Ali <alifm@linux.ibm.com>, John Snow <jsnow@redhat.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[PATCH v4 03/15] pc-bios/s390-ccw: Always reset virtio device on failed boot attempt
Posted by jrossi@linux.ibm.com 1 month, 1 week ago
From: Jared Rossi <jrossi@linux.ibm.com>

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.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 pc-bios/s390-ccw/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 76bf743900..8e2c99bee1 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -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:
-- 
2.52.0
Re: [PATCH v4 03/15] pc-bios/s390-ccw: Always reset virtio device on failed boot attempt
Posted by Eric Farman 1 month, 1 week ago
On Tue, 2026-03-03 at 21:59 -0500, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> 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.
> 
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>  pc-bios/s390-ccw/main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Eric Farman <farman@linux.ibm.com>

> 
> diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
> index 76bf743900..8e2c99bee1 100644
> --- a/pc-bios/s390-ccw/main.c
> +++ b/pc-bios/s390-ccw/main.c
> @@ -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:
Re: [PATCH v4 03/15] pc-bios/s390-ccw: Always reset virtio device on failed boot attempt
Posted by Thomas Huth 1 month, 1 week ago
On 04/03/2026 03.59, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> 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.
> 
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>   pc-bios/s390-ccw/main.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
> index 76bf743900..8e2c99bee1 100644
> --- a/pc-bios/s390-ccw/main.c
> +++ b/pc-bios/s390-ccw/main.c
> @@ -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:

Good idea! (Reminds me of 68c95ed1db070f7545e487e742715f01a545aab0 where we 
had to do something similar for virtio-net already).

Reviewed-by: Thomas Huth <thuth@redhat.com>