diff mbox series

[v1,08/12] hw/xen/xen-hvm-common: skip ioreq creation on ioreq registration failure

Message ID 20221015050750.4185-9-vikram.garhwal@amd.com
State New
Headers show
Series Introduce xenpv machine for arm architecture | expand

Commit Message

Vikram Garhwal Oct. 15, 2022, 5:07 a.m. UTC
From: Stefano Stabellini <stefano.stabellini@amd.com>

On ARM it is possible to have a functioning xenpv machine with only the
PV backends and no IOREQ server. If the IOREQ server creation fails continue
to the PV backends initialization.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
 hw/xen/xen-hvm-common.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Alex Bennée Oct. 27, 2022, 8:46 a.m. UTC | #1
Vikram Garhwal <vikram.garhwal@amd.com> writes:

> From: Stefano Stabellini <stefano.stabellini@amd.com>
>
> On ARM it is possible to have a functioning xenpv machine with only the
> PV backends and no IOREQ server. If the IOREQ server creation fails continue
> to the PV backends initialization.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
>  hw/xen/xen-hvm-common.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
> index f848f9e625..7bccf595fc 100644
> --- a/hw/xen/xen-hvm-common.c
> +++ b/hw/xen/xen-hvm-common.c
> @@ -777,7 +777,11 @@ void xen_register_ioreq(XenIOState *state, unsigned int max_cpus,
>          goto err;
>      }
>  
> -    xen_create_ioreq_server(xen_domid, &state->ioservid);
> +    rc = xen_create_ioreq_server(xen_domid, &state->ioservid);
> +    if (rc) {
> +        DPRINTF("xen: failed to create ioreq server\n");

This should be a warn_report to properly inform the user.

> +        goto no_ioreq;

Maybe pushing the rest of this function into a local subroutine would
reduce the amount of goto messing about. Other candidates for cleaning
up/modernising:

  - g_malloc to g_new0
  - perror -> error_setg_errno

> +    }
>  
>      state->exit.notify = xen_exit_notifier;
>      qemu_add_exit_notifier(&state->exit);
> @@ -842,6 +846,7 @@ void xen_register_ioreq(XenIOState *state, unsigned int max_cpus,
>      QLIST_INIT(&state->dev_list);
>      device_listener_register(&state->device_listener);
>  
> +no_ioreq:
>      xen_bus_init();
>  
>      /* Initialize backend core & drivers */
diff mbox series

Patch

diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index f848f9e625..7bccf595fc 100644
--- a/hw/xen/xen-hvm-common.c
+++ b/hw/xen/xen-hvm-common.c
@@ -777,7 +777,11 @@  void xen_register_ioreq(XenIOState *state, unsigned int max_cpus,
         goto err;
     }
 
-    xen_create_ioreq_server(xen_domid, &state->ioservid);
+    rc = xen_create_ioreq_server(xen_domid, &state->ioservid);
+    if (rc) {
+        DPRINTF("xen: failed to create ioreq server\n");
+        goto no_ioreq;
+    }
 
     state->exit.notify = xen_exit_notifier;
     qemu_add_exit_notifier(&state->exit);
@@ -842,6 +846,7 @@  void xen_register_ioreq(XenIOState *state, unsigned int max_cpus,
     QLIST_INIT(&state->dev_list);
     device_listener_register(&state->device_listener);
 
+no_ioreq:
     xen_bus_init();
 
     /* Initialize backend core & drivers */