xen: use a common function for pv and hvm guest backend register calls
PATCH 1/1 xen: use a common function for pv and hvm guest backend register calls
Instead of calling xen_be_register() for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.
This at once fixes the error that hvm domains couldn't use the qusb backend.
---
Is it on purpose the qnic and vfb backends are not registered for HVM?
--- hw/xen/xen_backend.c | 10 ++++++++++ hw/xenpv/xen_machine_pv.c | 7 +------ include/hw/xen/xen_backend.h | 1 + xen-hvm.c | 4 +--- 4 files changed, 13 insertions(+), 9 deletions(-)
hw/xen/xen_backend.c +10 -0
@@ -800,6 +800,16 @@ int xen_be_register(const char *type, struct XenDevOps *ops)return xenstore_scan (type, xen_domid, ops); } +void xen_be_register_common (void ) +{ +xen_be_register ("console" , &xen_console_ops); +xen_be_register ("vkbd" , &xen_kbdmouse_ops); +xen_be_register ("qdisk" , &xen_blkdev_ops); +#ifdef CONFIG_USB_LIBUSB +xen_be_register ("qusb" , &xen_usb_ops); +#endif +} +int xen_be_bind_evtchn (struct XenDevice *xendev) {if (xendev->local_port !=-1 ) {
hw/xenpv/xen_machine_pv.c +1 -6
@@ -67,14 +67,9 @@ static void xen_init_pv(MachineState *machine)break ; } -xen_be_register ("console" , &xen_console_ops); -xen_be_register ("vkbd" , &xen_kbdmouse_ops); +xen_be_register_common ();xen_be_register ("vfb" , &xen_framebuffer_ops); -xen_be_register ("qdisk" , &xen_blkdev_ops);xen_be_register ("qnic" , &xen_netdev_ops); -#ifdef CONFIG_USB_LIBUSB -xen_be_register ("qusb" , &xen_usb_ops); -#endif /* configure framebuffer */ if (xenfb_enabled) {
include/hw/xen/xen_backend.h +1 -0
@@ -87,6 +87,7 @@ void xen_be_check_state(struct XenDevice *xendev);/* xen backend driver bits */ int xen_be_init (void ); +void xen_be_register_common (void );int xen_be_register (const char *type,struct XenDevOps *ops);int xen_be_set_state (struct XenDevice *xendev,enum xenbus_state state);int xen_be_bind_evtchn (struct XenDevice *xendev);
xen-hvm.c +1 -3
@@ -1318,9 +1318,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)error_report ("xen backend core setup failed" ); goto err; } -xen_be_register ("console" , &xen_console_ops); -xen_be_register ("vkbd" , &xen_kbdmouse_ops); -xen_be_register ("qdisk" , &xen_blkdev_ops); +xen_be_register_common ();xen_read_physmap (state);return ;
Signature · 1 line
2.6.6
Quoted 6 lines · Juergen Gross
Instead of calling
xen_be_register()for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.This at once fixes the error that hvm domains couldn't use the qusb backend.
Looks good to me. Should I take this through the usb patch queue, together with the other xen-usb fixes (once codestyle issues are fixed)? If so, can I get an ack from xen please, preferably fast enough for -rc2?
thanks,
Gerd
Quoted 8 lines · Juergen Gross
Instead of calling
xen_be_register()for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.This at once fixes the error that hvm domains couldn't use the qusb backend.
Signed-off-by Juergen Gross <[email protected]>
Quoted 2 lines
---
Is it on purpose the qnic and vfb backends are not registered for HVM?
I guess it has not been usefull. Stefano may have a better answer.
Signature · 6 lines
Anthony PERARD _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 10 lines · Juergen Gross
Instead of calling
xen_be_register()for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.This at once fixes the error that hvm domains couldn't use the qusb backend.
Signed-off-by Juergen Gross <[email protected]>---
Is it on purpose the qnic and vfb backends are not registered for HVM?
Yes, it is on purpose: there is no code in any toolstacks to use qnic, and the presence of vfb can cause problems to Linux HVM guests (or at least it used to), additionally vfb for HVM guests is also disabled in libxl.
In general, it is a good idea to disable code that is not supposed to be used.
Can qusb be used with HVM guests with libxl/xl?
Quoted 77 lines
hw/xen/xen_backend.c | 10 ++++++++++ hw/xenpv/xen_machine_pv.c | 7 +------ include/hw/xen/xen_backend.h | 1 + xen-hvm.c | 4 +--- 4 files changed, 13 insertions(+), 9 deletions(-)hw/xen/xen_backend.c +10
-0@@ -800,6 +800,16 @@ int xen_be_register(const char *type, struct XenDevOps *ops)return xenstore_scan (type, xen_domid, ops); } +void xen_be_register_common (void ) +{ +xen_be_register ("console" , &xen_console_ops); +xen_be_register ("vkbd" , &xen_kbdmouse_ops); +xen_be_register ("qdisk" , &xen_blkdev_ops); +#ifdef CONFIG_USB_LIBUSB +xen_be_register ("qusb" , &xen_usb_ops); +#endif +} +int xen_be_bind_evtchn (struct XenDevice *xendev) {if (xendev->local_port !=-1 ) {hw/xenpv/xen_machine_pv.c +1
-6@@ -67,14 +67,9 @@ static void xen_init_pv(MachineState *machine)break ; } -xen_be_register ("console" , &xen_console_ops); -xen_be_register ("vkbd" , &xen_kbdmouse_ops); +xen_be_register_common ();xen_be_register ("vfb" , &xen_framebuffer_ops); -xen_be_register ("qdisk" , &xen_blkdev_ops);xen_be_register ("qnic" , &xen_netdev_ops); -#ifdef CONFIG_USB_LIBUSB -xen_be_register ("qusb" , &xen_usb_ops); -#endif /* configure framebuffer */ if (xenfb_enabled) {include/hw/xen/xen_backend.h +1
-0@@ -87,6 +87,7 @@ void xen_be_check_state(struct XenDevice *xendev);/* xen backend driver bits */ int xen_be_init (void ); +void xen_be_register_common (void );int xen_be_register (const char *type,struct XenDevOps *ops);int xen_be_set_state (struct XenDevice *xendev,enum xenbus_state state);int xen_be_bind_evtchn (struct XenDevice *xendev);xen-hvm.c +1
-3@@ -1318,9 +1318,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)error_report ("xen backend core setup failed" ); goto err; } -xen_be_register ("console" , &xen_console_ops); -xen_be_register ("vkbd" , &xen_kbdmouse_ops); -xen_be_register ("qdisk" , &xen_blkdev_ops); +xen_be_register_common ();xen_read_physmap (state);return ;Signature · 1 line
2.6.6
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines · Juergen Gross
Instead of calling
xen_be_register()for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.
Quoted 7 lines
Quoted 2 lines
This at once fixes the error that hvm domains couldn't use the qusb backend.
Looks good to me. Should I take this through the usb patch queue, together with the other xen-usb fixes (once codestyle issues are fixed)? If so, can I get an ack from xen please, preferably fast enough for -rc2?
Hi Gerd, I am happy for you to handle all three patches (if for any reasons you change your mind I can do it).
"xen: bug fixes in Xen backend handling" v2 is ready to be committed, and I am just waiting for an answer on this patch.
Quoted 17 lines · Stefano Stabellini
Quoted 10 lines · Juergen Gross
Instead of calling
xen_be_register()for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.This at once fixes the error that hvm domains couldn't use the qusb backend.
Signed-off-by Juergen Gross <[email protected]>---
Is it on purpose the qnic and vfb backends are not registered for HVM?Yes, it is on purpose: there is no code in any toolstacks to use qnic, and the presence of vfb can cause problems to Linux HVM guests (or at least it used to), additionally vfb for HVM guests is also disabled in libxl.
Quoted 4 lines
In general, it is a good idea to disable code that is not supposed to be used.
Can qusb be used with HVM guests with libxl/xl?
Yes. You have to specify "type=qusb" for usbctrl, then it will work. I have verified that.
Juergen
Quoted 18 lines · Juergen Gross
Quoted 17 lines · Stefano Stabellini
Quoted 10 lines · Juergen Gross
Instead of calling
xen_be_register()for each supported backend type for hvm and pv guests in their machine init functions use a common function in order not to have to add new backends twice.This at once fixes the error that hvm domains couldn't use the qusb backend.
Signed-off-by Juergen Gross <[email protected]>---
Is it on purpose the qnic and vfb backends are not registered for HVM?Yes, it is on purpose: there is no code in any toolstacks to use qnic, and the presence of vfb can cause problems to Linux HVM guests (or at least it used to), additionally vfb for HVM guests is also disabled in libxl.
Quoted 7 lines
Quoted 4 lines
In general, it is a good idea to disable code that is not supposed to be used.
Can qusb be used with HVM guests with libxl/xl?
Yes. You have to specify "type=qusb" for usbctrl, then it will work. I have verified that.
Good, thanks.