* [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine
@ 2023-06-21 7:41 Thomas Huth
2023-07-13 8:46 ` Thomas Huth
2023-07-13 10:09 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 5+ messages in thread
From: Thomas Huth @ 2023-06-21 7:41 UTC (permalink / raw)
To: Huacai Chen, Jiaxun Yang, Philippe Mathieu-Daudé, qemu-devel
Cc: Michael Tokarev
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
USB devices first before instantiating them.
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
v2: Use #ifdef instead of runtime check
hw/mips/loongson3_virt.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 216812f660..3094413eea 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -51,6 +51,7 @@
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
#include "qemu/error-report.h"
+#include CONFIG_DEVICES
#define PM_CNTL_MODE 0x10
@@ -447,11 +448,13 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
pci_vga_init(pci_bus);
+#ifdef CONFIG_USB_OHCI_PCI
if (defaults_enabled()) {
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");
}
+#endif
for (i = 0; i < nb_nics; i++) {
NICInfo *nd = &nd_table[i];
--
2.39.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine
2023-06-21 7:41 [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine Thomas Huth
@ 2023-07-13 8:46 ` Thomas Huth
2023-07-13 10:09 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2023-07-13 8:46 UTC (permalink / raw)
To: Huacai Chen, Jiaxun Yang, Philippe Mathieu-Daudé, qemu-devel
Cc: Michael Tokarev, QEMU Trivial
On 21/06/2023 09.41, 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
> USB devices first before instantiating them.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v2: Use #ifdef instead of runtime check
>
> hw/mips/loongson3_virt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
> index 216812f660..3094413eea 100644
> --- a/hw/mips/loongson3_virt.c
> +++ b/hw/mips/loongson3_virt.c
> @@ -51,6 +51,7 @@
> #include "sysemu/reset.h"
> #include "sysemu/runstate.h"
> #include "qemu/error-report.h"
> +#include CONFIG_DEVICES
>
> #define PM_CNTL_MODE 0x10
>
> @@ -447,11 +448,13 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
>
> pci_vga_init(pci_bus);
>
> +#ifdef CONFIG_USB_OHCI_PCI
> if (defaults_enabled()) {
> 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");
> }
> +#endif
>
> for (i = 0; i < nb_nics; i++) {
> NICInfo *nd = &nd_table[i];
Ping?
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine
2023-06-21 7:41 [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine Thomas Huth
2023-07-13 8:46 ` Thomas Huth
@ 2023-07-13 10:09 ` Philippe Mathieu-Daudé
2023-07-13 11:47 ` Michael Tokarev
1 sibling, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-07-13 10:09 UTC (permalink / raw)
To: Thomas Huth, Huacai Chen, Jiaxun Yang, qemu-devel; +Cc: Michael Tokarev
Hi Thomas,
On 21/6/23 09:41, 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
> USB devices first before instantiating them.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
> v2: Use #ifdef instead of runtime check
>
> hw/mips/loongson3_virt.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
> index 216812f660..3094413eea 100644
> --- a/hw/mips/loongson3_virt.c
> +++ b/hw/mips/loongson3_virt.c
> @@ -51,6 +51,7 @@
> #include "sysemu/reset.h"
> #include "sysemu/runstate.h"
> #include "qemu/error-report.h"
> +#include CONFIG_DEVICES
I'm a but reluctant to include CONFIG_DEVICES.
> +#ifdef CONFIG_USB_OHCI_PCI
> if (defaults_enabled()) {
What about:
if (defaults_enabled() && object_class_by_name(TYPE_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");
> }
> +#endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine
2023-07-13 10:09 ` Philippe Mathieu-Daudé
@ 2023-07-13 11:47 ` Michael Tokarev
2023-07-13 11:51 ` Thomas Huth
0 siblings, 1 reply; 5+ messages in thread
From: Michael Tokarev @ 2023-07-13 11:47 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, Thomas Huth, Huacai Chen,
Jiaxun Yang, qemu-devel
13.07.2023 13:09, Philippe Mathieu-Daudé wrote:
> Hi Thomas,
>
> On 21/6/23 09:41, 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
>> USB devices first before instantiating them.
>>
>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>> v2: Use #ifdef instead of runtime check
>>
>> hw/mips/loongson3_virt.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
>> index 216812f660..3094413eea 100644
>> --- a/hw/mips/loongson3_virt.c
>> +++ b/hw/mips/loongson3_virt.c
>> @@ -51,6 +51,7 @@
>> #include "sysemu/reset.h"
>> #include "sysemu/runstate.h"
>> #include "qemu/error-report.h"
>> +#include CONFIG_DEVICES
>
> I'm a but reluctant to include CONFIG_DEVICES.
>
>> +#ifdef CONFIG_USB_OHCI_PCI
>> if (defaults_enabled()) {
>
> What about:
>
> if (defaults_enabled() && object_class_by_name(TYPE_PCI_OHCI)) {
I think it was a v1 like this :)
/mjt
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine
2023-07-13 11:47 ` Michael Tokarev
@ 2023-07-13 11:51 ` Thomas Huth
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2023-07-13 11:51 UTC (permalink / raw)
To: Michael Tokarev, Philippe Mathieu-Daudé, Huacai Chen,
Jiaxun Yang, qemu-devel
On 13/07/2023 13.47, Michael Tokarev wrote:
> 13.07.2023 13:09, Philippe Mathieu-Daudé wrote:
>> Hi Thomas,
>>
>> On 21/6/23 09:41, 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
>>> USB devices first before instantiating them.
>>>
>>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>>> ---
>>> v2: Use #ifdef instead of runtime check
>>>
>>> hw/mips/loongson3_virt.c | 3 +++
>>> 1 file changed, 3 insertions(+)
>>>
>>> diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
>>> index 216812f660..3094413eea 100644
>>> --- a/hw/mips/loongson3_virt.c
>>> +++ b/hw/mips/loongson3_virt.c
>>> @@ -51,6 +51,7 @@
>>> #include "sysemu/reset.h"
>>> #include "sysemu/runstate.h"
>>> #include "qemu/error-report.h"
>>> +#include CONFIG_DEVICES
>>
>> I'm a but reluctant to include CONFIG_DEVICES.
>>
>>> +#ifdef CONFIG_USB_OHCI_PCI
>>> if (defaults_enabled()) {
>>
>> What about:
>>
>> if (defaults_enabled() && object_class_by_name(TYPE_PCI_OHCI)) {
>
> I think it was a v1 like this :)
Yes, that's how I did it in v1:
https://lore.kernel.org/qemu-devel/20230525064731.1854107-1-thuth@redhat.com/
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-13 11:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-21 7:41 [PATCH v2] hw/mips: Improve the default USB settings in the loongson3-virt machine Thomas Huth
2023-07-13 8:46 ` Thomas Huth
2023-07-13 10:09 ` Philippe Mathieu-Daudé
2023-07-13 11:47 ` Michael Tokarev
2023-07-13 11:51 ` Thomas Huth
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).