mbox series

[v2,0/7] hw/xen: Simplify legacy backends handling

Message ID 20240510104908.76908-1-philmd@linaro.org
Headers show
Series hw/xen: Simplify legacy backends handling | expand

Message

Philippe Mathieu-Daudé May 10, 2024, 10:49 a.m. UTC
Respin of Paolo's Xen patches from
https://lore.kernel.org/qemu-devel/20240509170044.190795-1-pbonzini@redhat.com/
rebased on one of my cleanup branches making backend
structures const. Treat xenfb as other backends.

Paolo Bonzini (2):
  hw/xen: initialize legacy backends from xen_bus_init()
  hw/xen: register legacy backends via xen_backend_init

Philippe Mathieu-Daudé (5):
  hw/xen: Remove declarations left over in 'xen-legacy-backend.h'
  hw/xen: Constify XenLegacyDevice::XenDevOps
  hw/xen: Constify xenstore_be::XenDevOps
  hw/xen: Make XenDevOps structures const
  hw/xen: Register framebuffer backend via xen_backend_init()

 include/hw/xen/xen-legacy-backend.h | 15 +--------------
 include/hw/xen/xen_pvdev.h          |  3 +--
 hw/9pfs/xen-9p-backend.c            |  8 +++++++-
 hw/display/xenfb.c                  | 15 +++++++++++++--
 hw/i386/pc.c                        |  1 -
 hw/usb/xen-usb.c                    | 14 ++++----------
 hw/xen/xen-bus.c                    |  4 ++++
 hw/xen/xen-hvm-common.c             |  2 --
 hw/xen/xen-legacy-backend.c         | 24 ++++--------------------
 hw/xenpv/xen_machine_pv.c           |  7 +------
 10 files changed, 35 insertions(+), 58 deletions(-)

Comments

Philippe Mathieu-Daudé May 10, 2024, 10:52 a.m. UTC | #1
On 10/5/24 12:49, Philippe Mathieu-Daudé wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> It is okay to register legacy backends in the middle of xen_bus_init().
> All that the registration does is record the existence of the backend
> in xenstore.
> 
> This makes it possible to remove them from the build without introducing
> undefined symbols in xen_be_init().  It also removes the need for the
> backend_register callback, whose only purpose is to avoid registering
> nonfunctional backends.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-ID: <20240509170044.190795-8-pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/xen/xen-legacy-backend.h | 11 ++---------
>   include/hw/xen/xen_pvdev.h          |  1 -
>   hw/9pfs/xen-9p-backend.c            |  8 +++++++-
>   hw/display/xenfb.c                  |  8 +++++++-
>   hw/usb/xen-usb.c                    | 14 ++++----------
>   hw/xen/xen-legacy-backend.c         | 16 ----------------
>   6 files changed, 20 insertions(+), 38 deletions(-)
Philippe Mathieu-Daudé May 29, 2024, 4:51 a.m. UTC | #2
ping?

On 10/5/24 12:49, Philippe Mathieu-Daudé wrote:
> Respin of Paolo's Xen patches from
> https://lore.kernel.org/qemu-devel/20240509170044.190795-1-pbonzini@redhat.com/
> rebased on one of my cleanup branches making backend
> structures const. Treat xenfb as other backends.
> 
> Paolo Bonzini (2):
>    hw/xen: initialize legacy backends from xen_bus_init()
>    hw/xen: register legacy backends via xen_backend_init
> 
> Philippe Mathieu-Daudé (5):
>    hw/xen: Remove declarations left over in 'xen-legacy-backend.h'
>    hw/xen: Constify XenLegacyDevice::XenDevOps
>    hw/xen: Constify xenstore_be::XenDevOps
>    hw/xen: Make XenDevOps structures const
>    hw/xen: Register framebuffer backend via xen_backend_init()
> 
>   include/hw/xen/xen-legacy-backend.h | 15 +--------------
>   include/hw/xen/xen_pvdev.h          |  3 +--
>   hw/9pfs/xen-9p-backend.c            |  8 +++++++-
>   hw/display/xenfb.c                  | 15 +++++++++++++--
>   hw/i386/pc.c                        |  1 -
>   hw/usb/xen-usb.c                    | 14 ++++----------
>   hw/xen/xen-bus.c                    |  4 ++++
>   hw/xen/xen-hvm-common.c             |  2 --
>   hw/xen/xen-legacy-backend.c         | 24 ++++--------------------
>   hw/xenpv/xen_machine_pv.c           |  7 +------
>   10 files changed, 35 insertions(+), 58 deletions(-)
>
Paul Durrant May 31, 2024, 9:10 a.m. UTC | #3
On 10/05/2024 11:49, Philippe Mathieu-Daudé wrote:
> XenDevOps @ops is not updated, mark it const.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/xen/xen-legacy-backend.h | 2 +-
>   hw/xen/xen-legacy-backend.c         | 6 +++---
>   2 files changed, 4 insertions(+), 4 deletions(-)
> 

Reviewed-by: Paul Durrant <paul@xen.org>
Paul Durrant May 31, 2024, 9:52 a.m. UTC | #4
On 10/05/2024 11:49, Philippe Mathieu-Daudé wrote:
> Keep XenDevOps structures in .rodata.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/xen/xen-legacy-backend.h | 8 ++++----
>   hw/9pfs/xen-9p-backend.c            | 2 +-
>   hw/display/xenfb.c                  | 4 ++--
>   hw/usb/xen-usb.c                    | 4 ++--
>   4 files changed, 9 insertions(+), 9 deletions(-)
> 

Reviewed-by: Paul Durrant <paul@xen.org>
Paul Durrant May 31, 2024, 9:57 a.m. UTC | #5
On 10/05/2024 11:49, Philippe Mathieu-Daudé wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> It is okay to register legacy backends in the middle of xen_bus_init().
> All that the registration does is record the existence of the backend
> in xenstore.
> 
> This makes it possible to remove them from the build without introducing
> undefined symbols in xen_be_init().  It also removes the need for the
> backend_register callback, whose only purpose is to avoid registering
> nonfunctional backends.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-ID: <20240509170044.190795-8-pbonzini@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/xen/xen-legacy-backend.h | 11 ++---------
>   include/hw/xen/xen_pvdev.h          |  1 -
>   hw/9pfs/xen-9p-backend.c            |  8 +++++++-
>   hw/display/xenfb.c                  |  8 +++++++-
>   hw/usb/xen-usb.c                    | 14 ++++----------
>   hw/xen/xen-legacy-backend.c         | 16 ----------------
>   6 files changed, 20 insertions(+), 38 deletions(-)
> 

Reviewed-by: Paul Durrant <paul@xen.org>
Paul Durrant May 31, 2024, 9:59 a.m. UTC | #6
On 10/05/2024 11:49, Philippe Mathieu-Daudé wrote:
> Align the framebuffer backend with the other legacy ones,
> register it via xen_backend_init() when '-vga xenfb' is
> used. It is safe because MODULE_INIT_XEN_BACKEND is called
> in xen_bus_realize(), long after CLI processing initialized
> the vga_interface_type variable.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/xen/xen-legacy-backend.h | 3 ---
>   hw/display/xenfb.c                  | 9 +++++++--
>   hw/xenpv/xen_machine_pv.c           | 2 --
>   3 files changed, 7 insertions(+), 7 deletions(-)
> 

Reviewed-by: Paul Durrant <paul@xen.org>