[PATCH v2 8/8] mips: do not list individual devices from configs/

Paolo Bonzini posted 8 patches 9 months, 3 weeks ago
Maintainers: "Philippe Mathieu-Daudé" <philmd@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Gerd Hoffmann <kraxel@redhat.com>
There is a newer version of this series
[PATCH v2 8/8] mips: do not list individual devices from configs/
Posted by Paolo Bonzini 9 months, 3 weeks ago
Add new "select" and "imply" directives if needed.  The resulting
config-devices.mak files are the same as before.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configs/devices/mips-softmmu/common.mak      | 28 +++-----------------
 configs/devices/mips64el-softmmu/default.mak |  3 ---
 hw/mips/loongson3_virt.c                     |  5 ++--
 hw/display/Kconfig                           |  2 +-
 hw/mips/Kconfig                              | 20 +++++++++++++-
 5 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/configs/devices/mips-softmmu/common.mak b/configs/devices/mips-softmmu/common.mak
index 1a853841b27..416a5d353e8 100644
--- a/configs/devices/mips-softmmu/common.mak
+++ b/configs/devices/mips-softmmu/common.mak
@@ -1,28 +1,8 @@
 # Common mips*-softmmu CONFIG defines
 
-CONFIG_ISA_BUS=y
-CONFIG_PCI=y
-CONFIG_PCI_DEVICES=y
-CONFIG_VGA_ISA=y
-CONFIG_VGA_MMIO=y
-CONFIG_VGA_CIRRUS=y
-CONFIG_VMWARE_VGA=y
-CONFIG_SERIAL=y
-CONFIG_SERIAL_ISA=y
-CONFIG_PARALLEL=y
-CONFIG_I8254=y
-CONFIG_PCSPK=y
-CONFIG_PCKBD=y
-CONFIG_FDC=y
-CONFIG_I8257=y
-CONFIG_IDE_ISA=y
-CONFIG_PFLASH_CFI01=y
-CONFIG_I8259=y
-CONFIG_MC146818RTC=y
-CONFIG_MIPS_CPS=y
-CONFIG_MIPS_ITU=y
+# Uncomment the following lines to disable these optional devices:
+# CONFIG_PCI_DEVICES=n
+# CONFIG_TEST_DEVICES=n
+
 CONFIG_MALTA=y
-CONFIG_PCNET_PCI=y
 CONFIG_MIPSSIM=y
-CONFIG_SMBUS_EEPROM=y
-CONFIG_TEST_DEVICES=y
diff --git a/configs/devices/mips64el-softmmu/default.mak b/configs/devices/mips64el-softmmu/default.mak
index d5188f7ea58..88a37cf27f1 100644
--- a/configs/devices/mips64el-softmmu/default.mak
+++ b/configs/devices/mips64el-softmmu/default.mak
@@ -3,8 +3,5 @@
 include ../mips-softmmu/common.mak
 CONFIG_FULOONG=y
 CONFIG_LOONGSON3V=y
-CONFIG_ATI_VGA=y
-CONFIG_RTL8139_PCI=y
 CONFIG_JAZZ=y
-CONFIG_VT82C686=y
 CONFIG_MIPS_BOSTON=y
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 33eae01eca2..da47af2fa71 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -447,8 +447,9 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
 
     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");
+        Object *usb_bus = object_resolve_path_type("", TYPE_USB_BUS, NULL);
+        usb_create_simple(USB_BUS(usb_bus), "usb-kbd");
+        usb_create_simple(USB_BUS(usb_bus), "usb-tablet");
     }
 
     for (i = 0; i < nb_nics; i++) {
diff --git a/hw/display/Kconfig b/hw/display/Kconfig
index 1aafe1923d2..5b2b3840f7a 100644
--- a/hw/display/Kconfig
+++ b/hw/display/Kconfig
@@ -55,7 +55,7 @@ config VGA_MMIO
 
 config VMWARE_VGA
     bool
-    default y if PCI_DEVICES && PC_PCI
+    default y if PCI_DEVICES && (PC_PCI || MIPS)
     depends on PCI
     select VGA
 
diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
index e57db4f6412..5c83ef49cf6 100644
--- a/hw/mips/Kconfig
+++ b/hw/mips/Kconfig
@@ -1,8 +1,15 @@
 config MALTA
     bool
+    imply PCNET_PCI
+    imply PCI_DEVICES
+    imply TEST_DEVICES
     select FDC37M81X
     select GT64120
+    select MIPS_CPS
     select PIIX
+    select PFLASH_CFI01
+    select SERIAL
+    select SMBUS_EEPROM
 
 config MIPSSIM
     bool
@@ -31,17 +38,26 @@ config JAZZ
 
 config FULOONG
     bool
+    imply PCI_DEVICES
+    imply TEST_DEVICES
+    imply ATI_VGA
+    imply RTL8139_PCI
     select PCI_BONITO
+    select SMBUS_EEPROM
     select VT82C686
 
 config LOONGSON3V
     bool
+    imply PCI_DEVICES
+    imply TEST_DEVICES
+    imply VIRTIO_PCI
+    imply VIRTIO_NET
     imply VIRTIO_VGA
     imply QXL if SPICE
+    imply USB_OHCI_PCI
     select SERIAL
     select GOLDFISH_RTC
     select LOONGSON_LIOINTC
-    select PCI_DEVICES
     select PCI_EXPRESS_GENERIC_BRIDGE
     select MSI_NONBROKEN
     select FW_CFG_MIPS
@@ -53,6 +69,8 @@ config MIPS_CPS
 
 config MIPS_BOSTON
     bool
+    imply PCI_DEVICES
+    imply TEST_DEVICES
     select FITLOADER
     select MIPS_CPS
     select PCI_EXPRESS_XILINX
-- 
2.43.0
Re: [PATCH v2 8/8] mips: do not list individual devices from configs/
Posted by BALATON Zoltan 9 months, 3 weeks ago
On Wed, 7 Feb 2024, Paolo Bonzini wrote:
> Add new "select" and "imply" directives if needed.  The resulting
> config-devices.mak files are the same as before.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> configs/devices/mips-softmmu/common.mak      | 28 +++-----------------
> configs/devices/mips64el-softmmu/default.mak |  3 ---
> hw/mips/loongson3_virt.c                     |  5 ++--
> hw/display/Kconfig                           |  2 +-
> hw/mips/Kconfig                              | 20 +++++++++++++-
> 5 files changed, 27 insertions(+), 31 deletions(-)
>
> diff --git a/configs/devices/mips-softmmu/common.mak b/configs/devices/mips-softmmu/common.mak
> index 1a853841b27..416a5d353e8 100644
> --- a/configs/devices/mips-softmmu/common.mak
> +++ b/configs/devices/mips-softmmu/common.mak
> @@ -1,28 +1,8 @@
> # Common mips*-softmmu CONFIG defines
>
> -CONFIG_ISA_BUS=y
> -CONFIG_PCI=y
> -CONFIG_PCI_DEVICES=y
> -CONFIG_VGA_ISA=y
> -CONFIG_VGA_MMIO=y
> -CONFIG_VGA_CIRRUS=y
> -CONFIG_VMWARE_VGA=y
> -CONFIG_SERIAL=y
> -CONFIG_SERIAL_ISA=y
> -CONFIG_PARALLEL=y
> -CONFIG_I8254=y
> -CONFIG_PCSPK=y
> -CONFIG_PCKBD=y
> -CONFIG_FDC=y
> -CONFIG_I8257=y
> -CONFIG_IDE_ISA=y
> -CONFIG_PFLASH_CFI01=y
> -CONFIG_I8259=y
> -CONFIG_MC146818RTC=y
> -CONFIG_MIPS_CPS=y
> -CONFIG_MIPS_ITU=y
> +# Uncomment the following lines to disable these optional devices:
> +# CONFIG_PCI_DEVICES=n
> +# CONFIG_TEST_DEVICES=n
> +
> CONFIG_MALTA=y
> -CONFIG_PCNET_PCI=y
> CONFIG_MIPSSIM=y
> -CONFIG_SMBUS_EEPROM=y
> -CONFIG_TEST_DEVICES=y
> diff --git a/configs/devices/mips64el-softmmu/default.mak b/configs/devices/mips64el-softmmu/default.mak
> index d5188f7ea58..88a37cf27f1 100644
> --- a/configs/devices/mips64el-softmmu/default.mak
> +++ b/configs/devices/mips64el-softmmu/default.mak
> @@ -3,8 +3,5 @@
> include ../mips-softmmu/common.mak
> CONFIG_FULOONG=y
> CONFIG_LOONGSON3V=y
> -CONFIG_ATI_VGA=y
> -CONFIG_RTL8139_PCI=y
> CONFIG_JAZZ=y
> -CONFIG_VT82C686=y
> CONFIG_MIPS_BOSTON=y
> diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
> index 33eae01eca2..da47af2fa71 100644
> --- a/hw/mips/loongson3_virt.c
> +++ b/hw/mips/loongson3_virt.c
> @@ -447,8 +447,9 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
>
>     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");
> +        Object *usb_bus = object_resolve_path_type("", TYPE_USB_BUS, NULL);
> +        usb_create_simple(USB_BUS(usb_bus), "usb-kbd");
> +        usb_create_simple(USB_BUS(usb_bus), "usb-tablet");
>     }
>
>     for (i = 0; i < nb_nics; i++) {

Is this hunk supposed to be in this patch?

Regards,
BALATON Zoltan

> diff --git a/hw/display/Kconfig b/hw/display/Kconfig
> index 1aafe1923d2..5b2b3840f7a 100644
> --- a/hw/display/Kconfig
> +++ b/hw/display/Kconfig
> @@ -55,7 +55,7 @@ config VGA_MMIO
>
> config VMWARE_VGA
>     bool
> -    default y if PCI_DEVICES && PC_PCI
> +    default y if PCI_DEVICES && (PC_PCI || MIPS)
>     depends on PCI
>     select VGA
>
> diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
> index e57db4f6412..5c83ef49cf6 100644
> --- a/hw/mips/Kconfig
> +++ b/hw/mips/Kconfig
> @@ -1,8 +1,15 @@
> config MALTA
>     bool
> +    imply PCNET_PCI
> +    imply PCI_DEVICES
> +    imply TEST_DEVICES
>     select FDC37M81X
>     select GT64120
> +    select MIPS_CPS
>     select PIIX
> +    select PFLASH_CFI01
> +    select SERIAL
> +    select SMBUS_EEPROM
>
> config MIPSSIM
>     bool
> @@ -31,17 +38,26 @@ config JAZZ
>
> config FULOONG
>     bool
> +    imply PCI_DEVICES
> +    imply TEST_DEVICES
> +    imply ATI_VGA
> +    imply RTL8139_PCI
>     select PCI_BONITO
> +    select SMBUS_EEPROM
>     select VT82C686
>
> config LOONGSON3V
>     bool
> +    imply PCI_DEVICES
> +    imply TEST_DEVICES
> +    imply VIRTIO_PCI
> +    imply VIRTIO_NET
>     imply VIRTIO_VGA
>     imply QXL if SPICE
> +    imply USB_OHCI_PCI
>     select SERIAL
>     select GOLDFISH_RTC
>     select LOONGSON_LIOINTC
> -    select PCI_DEVICES
>     select PCI_EXPRESS_GENERIC_BRIDGE
>     select MSI_NONBROKEN
>     select FW_CFG_MIPS
> @@ -53,6 +69,8 @@ config MIPS_CPS
>
> config MIPS_BOSTON
>     bool
> +    imply PCI_DEVICES
> +    imply TEST_DEVICES
>     select FITLOADER
>     select MIPS_CPS
>     select PCI_EXPRESS_XILINX
>
Re: [PATCH v2 8/8] mips: do not list individual devices from configs/
Posted by Paolo Bonzini 9 months, 3 weeks ago
Il mer 7 feb 2024, 14:18 BALATON Zoltan <balaton@eik.bme.hu> ha scritto:

> >     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");
> > +        Object *usb_bus = object_resolve_path_type("", TYPE_USB_BUS,
> NULL);
> > +        usb_create_simple(USB_BUS(usb_bus), "usb-kbd");
> > +        usb_create_simple(USB_BUS(usb_bus), "usb-tablet");
> >     }
> >
> >     for (i = 0; i < nb_nics; i++) {
>
> Is this hunk supposed to be in this patch?
>

Yes, it fixes compilation --without-default-devices (where usb_bus_find
does not exist). Before this patch CONFIG_USB is always selected, even
without default devices.

Paolo


> Regards,
> BALATON Zoltan
>
> > diff --git a/hw/display/Kconfig b/hw/display/Kconfig
> > index 1aafe1923d2..5b2b3840f7a 100644
> > --- a/hw/display/Kconfig
> > +++ b/hw/display/Kconfig
> > @@ -55,7 +55,7 @@ config VGA_MMIO
> >
> > config VMWARE_VGA
> >     bool
> > -    default y if PCI_DEVICES && PC_PCI
> > +    default y if PCI_DEVICES && (PC_PCI || MIPS)
> >     depends on PCI
> >     select VGA
> >
> > diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
> > index e57db4f6412..5c83ef49cf6 100644
> > --- a/hw/mips/Kconfig
> > +++ b/hw/mips/Kconfig
> > @@ -1,8 +1,15 @@
> > config MALTA
> >     bool
> > +    imply PCNET_PCI
> > +    imply PCI_DEVICES
> > +    imply TEST_DEVICES
> >     select FDC37M81X
> >     select GT64120
> > +    select MIPS_CPS
> >     select PIIX
> > +    select PFLASH_CFI01
> > +    select SERIAL
> > +    select SMBUS_EEPROM
> >
> > config MIPSSIM
> >     bool
> > @@ -31,17 +38,26 @@ config JAZZ
> >
> > config FULOONG
> >     bool
> > +    imply PCI_DEVICES
> > +    imply TEST_DEVICES
> > +    imply ATI_VGA
> > +    imply RTL8139_PCI
> >     select PCI_BONITO
> > +    select SMBUS_EEPROM
> >     select VT82C686
> >
> > config LOONGSON3V
> >     bool
> > +    imply PCI_DEVICES
> > +    imply TEST_DEVICES
> > +    imply VIRTIO_PCI
> > +    imply VIRTIO_NET
> >     imply VIRTIO_VGA
> >     imply QXL if SPICE
> > +    imply USB_OHCI_PCI
> >     select SERIAL
> >     select GOLDFISH_RTC
> >     select LOONGSON_LIOINTC
> > -    select PCI_DEVICES
> >     select PCI_EXPRESS_GENERIC_BRIDGE
> >     select MSI_NONBROKEN
> >     select FW_CFG_MIPS
> > @@ -53,6 +69,8 @@ config MIPS_CPS
> >
> > config MIPS_BOSTON
> >     bool
> > +    imply PCI_DEVICES
> > +    imply TEST_DEVICES
> >     select FITLOADER
> >     select MIPS_CPS
> >     select PCI_EXPRESS_XILINX
> >
>
>
Re: [PATCH v2 8/8] mips: do not list individual devices from configs/
Posted by Bernhard Beschow 9 months, 3 weeks ago

Am 7. Februar 2024 13:55:51 UTC schrieb Paolo Bonzini <pbonzini@redhat.com>:
>Il mer 7 feb 2024, 14:18 BALATON Zoltan <balaton@eik.bme.hu> ha scritto:
>
>> >     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");
>> > +        Object *usb_bus = object_resolve_path_type("", TYPE_USB_BUS,
>> NULL);
>> > +        usb_create_simple(USB_BUS(usb_bus), "usb-kbd");
>> > +        usb_create_simple(USB_BUS(usb_bus), "usb-tablet");
>> >     }
>> >
>> >     for (i = 0; i < nb_nics; i++) {
>>
>> Is this hunk supposed to be in this patch?
>>
>
>Yes, it fixes compilation --without-default-devices (where usb_bus_find
>does not exist). Before this patch CONFIG_USB is always selected, even
>without default devices.

Might be worth pointing out in the commit message. I wondered about this, too.

Bernhard

>
>Paolo
>
>
>> Regards,
>> BALATON Zoltan
>>
>> > diff --git a/hw/display/Kconfig b/hw/display/Kconfig
>> > index 1aafe1923d2..5b2b3840f7a 100644
>> > --- a/hw/display/Kconfig
>> > +++ b/hw/display/Kconfig
>> > @@ -55,7 +55,7 @@ config VGA_MMIO
>> >
>> > config VMWARE_VGA
>> >     bool
>> > -    default y if PCI_DEVICES && PC_PCI
>> > +    default y if PCI_DEVICES && (PC_PCI || MIPS)
>> >     depends on PCI
>> >     select VGA
>> >
>> > diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig
>> > index e57db4f6412..5c83ef49cf6 100644
>> > --- a/hw/mips/Kconfig
>> > +++ b/hw/mips/Kconfig
>> > @@ -1,8 +1,15 @@
>> > config MALTA
>> >     bool
>> > +    imply PCNET_PCI
>> > +    imply PCI_DEVICES
>> > +    imply TEST_DEVICES
>> >     select FDC37M81X
>> >     select GT64120
>> > +    select MIPS_CPS
>> >     select PIIX
>> > +    select PFLASH_CFI01
>> > +    select SERIAL
>> > +    select SMBUS_EEPROM
>> >
>> > config MIPSSIM
>> >     bool
>> > @@ -31,17 +38,26 @@ config JAZZ
>> >
>> > config FULOONG
>> >     bool
>> > +    imply PCI_DEVICES
>> > +    imply TEST_DEVICES
>> > +    imply ATI_VGA
>> > +    imply RTL8139_PCI
>> >     select PCI_BONITO
>> > +    select SMBUS_EEPROM
>> >     select VT82C686
>> >
>> > config LOONGSON3V
>> >     bool
>> > +    imply PCI_DEVICES
>> > +    imply TEST_DEVICES
>> > +    imply VIRTIO_PCI
>> > +    imply VIRTIO_NET
>> >     imply VIRTIO_VGA
>> >     imply QXL if SPICE
>> > +    imply USB_OHCI_PCI
>> >     select SERIAL
>> >     select GOLDFISH_RTC
>> >     select LOONGSON_LIOINTC
>> > -    select PCI_DEVICES
>> >     select PCI_EXPRESS_GENERIC_BRIDGE
>> >     select MSI_NONBROKEN
>> >     select FW_CFG_MIPS
>> > @@ -53,6 +69,8 @@ config MIPS_CPS
>> >
>> > config MIPS_BOSTON
>> >     bool
>> > +    imply PCI_DEVICES
>> > +    imply TEST_DEVICES
>> >     select FITLOADER
>> >     select MIPS_CPS
>> >     select PCI_EXPRESS_XILINX
>> >
>>
>>