qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] hw/mips: Improve the default USB settings in the loongson3-virt machine
@ 2023-07-14 10:49 Thomas Huth
  2023-07-14 14:36 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Huth @ 2023-07-14 10:49 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Huacai Chen, qemu-devel
  Cc: Jiaxun Yang, qemu-trivial

It's possible to compile QEMU without the USB devices (e.g. when using
"--without-default-devices" as option for the "configure" script).
To be still able to run the loongson3-virt machine in default mode with
such a QEMU binary, we have to check here for the availability of the
OHCI controller first before instantiating the USB devices.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 v3: Back to runtime detection, but more simple this time compared to v1
     (checking for OHCI should be enough, since this implies CONFIG_USB
      which is the switch that usb-kbd and usb-tablet are depending on)

 hw/mips/loongson3_virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 4018b8c1d3..3ad0a223df 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -447,7 +447,7 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
 
     pci_vga_init(pci_bus);
 
-    if (defaults_enabled()) {
+    if (defaults_enabled() && object_class_by_name("pci-ohci")) {
         pci_create_simple(pci_bus, -1, "pci-ohci");
         usb_create_simple(usb_bus_find(-1), "usb-kbd");
         usb_create_simple(usb_bus_find(-1), "usb-tablet");
-- 
2.39.3



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

* Re: [PATCH v3] hw/mips: Improve the default USB settings in the loongson3-virt machine
  2023-07-14 10:49 [PATCH v3] hw/mips: Improve the default USB settings in the loongson3-virt machine Thomas Huth
@ 2023-07-14 14:36 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-07-14 14:36 UTC (permalink / raw)
  To: Thomas Huth, Huacai Chen, qemu-devel; +Cc: Jiaxun Yang, qemu-trivial

On 14/7/23 12:49, Thomas Huth wrote:
> It's possible to compile QEMU without the USB devices (e.g. when using
> "--without-default-devices" as option for the "configure" script).
> To be still able to run the loongson3-virt machine in default mode with
> such a QEMU binary, we have to check here for the availability of the
> OHCI controller first before instantiating the USB devices.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   v3: Back to runtime detection, but more simple this time compared to v1
>       (checking for OHCI should be enough, since this implies CONFIG_USB
>        which is the switch that usb-kbd and usb-tablet are depending on)
> 
>   hw/mips/loongson3_virt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

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

And queued to mips-fixes, thanks!


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

end of thread, other threads:[~2023-07-14 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-14 10:49 [PATCH v3] hw/mips: Improve the default USB settings in the loongson3-virt machine Thomas Huth
2023-07-14 14:36 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).