mips: do not list individual devices from configs/
v3 cover mips: do not list individual devices from configs/
Back when Kconfig was introduced, the individual dependencies for MIPS boards were never added to hw/mips/Kconfig. Do it now.
To simplify the task, include a couple cleanups to the SuperIO chip configuration symbols, as well as a change that makes USB device creation available even when building without default devices.
Tested by comparing old and new kconfigs; and also by building each of the boards one by one, with default devices disabled, and checking that the board can be started.
Paolo
v2->v3:
- add a comment in mipssim.c
- reimplement "mips: allow compiling out CONFIG_MIPS_ITU"
- extract patch 8 ("mips/loongson3_virt: do not require CONFIG_USB")
Bernhard Beschow (1):
hw/mips/Kconfig: Remove ISA dependencies from MIPSsim board
Paolo Bonzini (8):
usb: inline device creation functions
isa: clean up Kconfig selections for ISA_SUPERIO
isa: fix ISA_SUPERIO dependencies
isa: specify instance_size in isa_superio_type_info
isa: extract FDC37M81X to a separate file
mips: allow compiling out CONFIG_MIPS_ITU mips/loongson3_virt: do not require CONFIG_USB
mips: do not list individual devices from configs/
configs/devices/mips-softmmu/common.mak | 28 +++-------------- configs/devices/mips64el-softmmu/default.mak | 3 -- include/hw/usb.h | 27 +++++++++++++++-- target/mips/tcg/translate.h | 1 + target/mips/tcg/sysemu_helper.h.inc | 19 ++++++++---- hw/isa/fdc37m81x-superio.c | 32 ++++++++++++++++++++ hw/isa/isa-superio.c | 18 ----------- hw/isa/smc37c669-superio.c | 1 - hw/mips/loongson3_virt.c | 5 +-- hw/mips/mipssim.c | 7 +++-- hw/usb/bus.c | 23 -------------- target/mips/tcg/sysemu/cp0_helper.c | 8 +++++ target/mips/tcg/translate.c | 10 ++++++ .gitlab-ci.d/buildtest.yml | 2 +- hw/display/Kconfig | 2 +- hw/isa/Kconfig | 20 ++++++------ hw/isa/meson.build | 1 + hw/mips/Kconfig | 25 ++++++++++++--- 18 files changed, 134 insertions(+), 98 deletions(-) create mode 100644 hw/isa/fdc37m81x-superio.c
Signature · 1 line
2.43.0
PATCH v3 1/9 usb: inline device creation functions
Allow boards to use the device creation functions even if USB itself is not available; of course the functions will fail inexorably, but this can be okay if the calls are conditional on the existence of some USB host controller device. This is for example the case for hw/mips/loongson3_virt.c.
--- include/hw/usb.h | 27 ++++++++++++++++++++++++--- hw/usb/bus.c | 23 ----------------------- 2 files changed, 24 insertions(+), 26 deletions(-)
include/hw/usb.h +24 -3
@@ -30,6 +30,7 @@#include "qemu/iov.h" #include "qemu/queue.h" #include "qom/object.h" +#include "qapi/error.h" /* Constants related to the USB / PCI interaction */ #define USB_SBRN 0x60/* Serial Bus Release Number Register */
@@ -500,9 +501,6 @@ void usb_bus_release(USBBus *bus);USBBus *usb_bus_find (int busnr);void usb_legacy_register (const char *typename,const char *usbdevice_name,USBDevice *(*usbdevice_init)(void )); -USBDevice *usb_new (const char *name); -bool usb_realize_and_unref (USBDevice *dev,USBBus *bus,Error **errp); -USBDevice *usb_create_simple (USBBus *bus,const char *name);USBDevice *usbdevice_create (const char *cmdline);void usb_register_port (USBBus *bus,USBPort *port,void *opaque,int index,USBPortOps *ops,int speedmask);
@@ -582,4 +580,27 @@ void usb_pcap_init(FILE *fp);void usb_pcap_ctrl (USBPacket *p,bool setup);void usb_pcap_data (USBPacket *p,bool setup); +static inline USBDevice *usb_new (const char *name) +{ +return USB_DEVICE (qdev_new (name)); +} + +static inline USBDevice *usb_try_new (const char *name) +{ +return USB_DEVICE (qdev_try_new (name)); +} + +static inline bool usb_realize_and_unref (USBDevice *dev,USBBus *bus,Error **errp) +{ +return qdev_realize_and_unref (&dev->qdev, &bus->qbus, errp); +} + +static inline USBDevice *usb_create_simple (USBBus *bus,const char *name) +{ +USBDevice *dev =usb_new (name); + +usb_realize_and_unref (dev, bus, &error_abort); +return dev; +} +#endif
hw/usb/bus.c +0 -23
@@ -329,29 +329,6 @@ void usb_legacy_register(const char *typename, const char *usbdevice_name, } } -USBDevice *usb_new (const char *name) -{ -return USB_DEVICE (qdev_new (name)); -} - -static USBDevice *usb_try_new (const char *name) -{ -return USB_DEVICE (qdev_try_new (name)); -} - -bool usb_realize_and_unref (USBDevice *dev,USBBus *bus,Error **errp) -{ -return qdev_realize_and_unref (&dev->qdev, &bus->qbus, errp); -} - -USBDevice *usb_create_simple (USBBus *bus,const char *name) -{ -USBDevice *dev =usb_new (name); - -usb_realize_and_unref (dev, bus, &error_abort); -return dev; -} -static void usb_fill_port (USBPort *port,void *opaque,int index,USBPortOps *ops,int speedmask) {
Signature · 1 line
2.43.0
Re: [PATCH v3 1/9] usb: inline device creation functions
Quoted 6 lines · Paolo Bonzini
Allow boards to use the device creation functions even if USB itself is not available; of course the functions will fail inexorably, but this can be okay if the calls are conditional on the existence of some USB host controller device. This is for example the case for
hw/mips/loongson3_virt.c.
Quoted 6 lines
Signed-off-by Paolo Bonzini <[email protected]>--- include/hw/usb.h | 27 ++++++++++++++++++++++++--- hw/usb/bus.c | 23 ----------------------- 2 files changed, 24 insertions(+), 26 deletions(-)
See alternatives:
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
Re: [PATCH v3 1/9] usb: inline device creation functions
Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 6 lines · Paolo Bonzini
Allow boards to use the device creation functions even if USB itself is not available; of course the functions will fail inexorably, but this can be okay if the calls are conditional on the existence of some USB host controller device. This is for example the case for
hw/mips/loongson3_virt.c.Quoted 6 lines
Signed-off-by Paolo Bonzini <[email protected]>--- include/hw/usb.h | 27 ++++++++++++++++++++++++--- hw/usb/bus.c | 23 ----------------------- 2 files changed, 24 insertions(+), 26 deletions(-)
Quoted 3 lines
See alternatives:
https://lore.kernel.org/qemu-devel/[email protected]/
https://lore.kernel.org/qemu-devel/[email protected]/
That doesn't include usb_create_simple(), which is the one that matters the most here.
Paolo
PATCH v3 2/9 isa: clean up Kconfig selections for ISA_SUPERIO
In reply to Paolo BonziniAll users of ISA_SUPERIO include a floppy disk controller, serial port and parallel port via the automatic creation mechanism of isa-superio.c.
Select the symbol and remove it from the dependents.
--- hw/isa/Kconfig | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
hw/isa/Kconfig +4 -9
@@ -17,7 +17,11 @@ config ISA_SUPERIO bool select ISA_BUS select PCKBD + select PARALLEL + select SERIAL_ISA select FDC_ISA + # Some users of ISA_SUPERIO do not use it + #select IDE_ISA config PC87312 bool
@@ -26,9 +30,6 @@ config PC87312 select I8254 select I8257 select MC146818RTC - select SERIAL_ISA - select PARALLEL - select FDC_ISA select IDE_ISA config PIIX
@@ -49,8 +50,6 @@ config VT82C686 select ISA_SUPERIO select ACPI select ACPI_SMBUS - select SERIAL_ISA - select FDC_ISA select USB_UHCI select APM select I8254
@@ -58,14 +57,10 @@ config VT82C686 select I8259 select IDE_VIA select MC146818RTC - select PARALLEL config SMC37C669 bool select ISA_SUPERIO - select SERIAL_ISA - select PARALLEL - select FDC_ISA config LPC_ICH9 bool
Signature · 1 line
2.43.0
PATCH v3 3/9 hw/mips/Kconfig: Remove ISA dependencies from MIPSsim board
In reply to Paolo BonziniFrom: Bernhard Beschow <[email protected]>
The board doesn't have a working ISA bus, only some I/O space. Selecting ISA_BUS and including hw/isa/isa.h is not necessary.
Message-ID: <[email protected]>
--- hw/mips/mipssim.c | 7 +++++-- hw/mips/Kconfig | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-)
hw/mips/mipssim.c +5 -2
@@ -31,7 +31,6 @@#include "hw/clock.h" #include "hw/mips/mips.h" #include "hw/char/serial.h" -#include "hw/isa/isa.h" #include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h"
@@ -206,7 +205,11 @@ mips_mipssim_init(MachineState *machine)cpu_mips_irq_init_cpu (cpu);cpu_mips_clock_init (cpu); -/* Register 64 KB of ISA IO space at 0x1fd00000. */ +/* +* Register 64 KB of ISA IO space at 0x1fd00000. But without interrupts +* (except for the hardcoded serial port interrupt) -device cannot work, +* so do not expose the ISA bus to the user. +*/ memory_region_init_alias (isa,NULL ,"isa_mmio" ,get_system_io (),0 ,0x00010000 );memory_region_add_subregion (get_system_memory (),0x1fd00000 , isa);
hw/mips/Kconfig +1 -2
@@ -6,8 +6,7 @@ config MALTA config MIPSSIM bool - select ISA_BUS - select SERIAL_ISA + select SERIAL select MIPSNET config JAZZ
Signature · 1 line
2.43.0
PATCH v3 4/9 isa: fix ISA_SUPERIO dependencies
In reply to Paolo BonziniISA_SUPERIO does not provide an ISA bus, so it should not select the symbol:
instead it requires one. Among its users, VT82C686 is the only one that is a PCI-ISA bridge and does not already select ISA_BUS.
--- hw/isa/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/isa/Kconfig +2 -1
@@ -15,7 +15,7 @@ config I82378 config ISA_SUPERIO bool - select ISA_BUS + depends on ISA_BUS select PCKBD select PARALLEL select SERIAL_ISA
@@ -47,6 +47,7 @@ config PIIX config VT82C686 bool + select ISA_BUS select ISA_SUPERIO select ACPI select ACPI_SMBUS
Signature · 1 line
2.43.0
PATCH v3 5/9 isa: specify instance_size in isa_superio_type_info
In reply to Paolo BonziniRight now all subclasses of TYPE_ISA_SUPERIO have to specify an instance_size, because the ISASuperIODevice struct adds fields to ISADevice but the type does not include the increased instance size. Failure to do so results in an access past the bounds of struct ISADevice as soon as isa_superio_realize is called. Fix this by specifying the instance_size already in the superclass.
--- hw/isa/isa-superio.c | 2 +- hw/isa/smc37c669-superio.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
hw/isa/isa-superio.c +1 -1
@@ -187,6 +187,7 @@ static const TypeInfo isa_superio_type_info = { .abstract = true, .class_size = sizeof(ISASuperIOClass), .class_init = isa_superio_class_init, + .instance_size = sizeof(ISASuperIODevice), };/* SMS FDC37M817 Super I/O */
@@ -203,7 +204,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void *data)static const TypeInfo fdc37m81x_type_info = { .name =TYPE_FDC37M81X_SUPERIO , .parent =TYPE_ISA_SUPERIO , - .instance_size =sizeof (ISASuperIODevice), .class_init = fdc37m81x_class_init, };
hw/isa/smc37c669-superio.c +0 -1
@@ -85,7 +85,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)static const TypeInfo smc37c669_type_info = { .name =TYPE_SMC37C669_SUPERIO , .parent =TYPE_ISA_SUPERIO , - .instance_size =sizeof (ISASuperIODevice), .class_size =sizeof (ISASuperIOClass), .class_init = smc37c669_class_init, };
Signature · 1 line
2.43.0
PATCH v3 6/9 isa: extract FDC37M81X to a separate file
In reply to Paolo Bonziniisa-superio.c currently defines a SuperIO chip that is not used by any other user of the file. Extract the chip to a separate file.
--- hw/isa/fdc37m81x-superio.c | 32 ++++++++++++++++++++++++++++++++ hw/isa/isa-superio.c | 18 ------------------ hw/isa/Kconfig | 4 ++++ hw/isa/meson.build | 1 + hw/mips/Kconfig | 2 +- 5 files changed, 38 insertions(+), 19 deletions(-) create mode 100644 hw/isa/fdc37m81x-superio.c
hw/isa/fdc37m81x-superio.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* SMS FDC37M817 Super I/O +* +* Copyright (c) 2018 Philippe Mathieu-Daudé +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "hw/isa/superio.h" + +static void fdc37m81x_class_init (ObjectClass *klass,void *data) +{ +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + sc->serial.count =2 ;/* NS16C550A */ + sc->parallel.count =1 ; + sc->floppy.count =1 ;/* SMSC 82077AA Compatible */ + sc->ide.count =0 ; +} + +static const TypeInfo types[] = { + { + .name =TYPE_FDC37M81X_SUPERIO , + .parent =TYPE_ISA_SUPERIO , + .class_init = fdc37m81x_class_init, + }, +}; + +DEFINE_TYPES (types)
hw/isa/isa-superio.c +0 -18
@@ -190,27 +190,9 @@ static const TypeInfo isa_superio_type_info = { .instance_size = sizeof(ISASuperIODevice), }; -/* SMS FDC37M817 Super I/O */ -static void fdc37m81x_class_init (ObjectClass *klass,void *data) -{ -ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); - - sc->serial.count =2 ;/* NS16C550A */ - sc->parallel.count =1 ; - sc->floppy.count =1 ;/* SMSC 82077AA Compatible */ - sc->ide.count =0 ; -} - -static const TypeInfo fdc37m81x_type_info = { - .name =TYPE_FDC37M81X_SUPERIO , - .parent =TYPE_ISA_SUPERIO , - .class_init = fdc37m81x_class_init, -}; -static void isa_superio_register_types (void ) {type_register_static (&isa_superio_type_info); -type_register_static (&fdc37m81x_type_info); }type_init (isa_superio_register_types)
hw/isa/Kconfig +4 -0
@@ -23,6 +23,10 @@ config ISA_SUPERIO # Some users of ISA_SUPERIO do not use it #select IDE_ISA +config FDC37M81X + bool + select ISA_SUPERIO + config PC87312 bool select ISA_SUPERIO
hw/isa/meson.build +1 -0
@@ -4,6 +4,7 @@ system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('isa-bus.c')) system_ss.add(when: 'CONFIG_ISA_SUPERIO', if_true: files('isa-superio.c')) system_ss.add(when: 'CONFIG_PC87312', if_true: files('pc87312.c')) system_ss.add(when: 'CONFIG_PIIX', if_true: files('piix.c')) +system_ss.add(when: 'CONFIG_FDC37M81X', if_true: files('fdc37m81x-superio.c')) system_ss.add(when: 'CONFIG_SMC37C669', if_true: files('smc37c669-superio.c')) system_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686.c'))
hw/mips/Kconfig +1 -1
@@ -1,7 +1,7 @@ config MALTA bool + select FDC37M81X select GT64120 - select ISA_SUPERIO select PIIX config MIPSSIM
Signature · 1 line
2.43.0
Re: [PATCH v3 6/9] isa: extract FDC37M81X to a separate file
Am 13. Februar 2024 15:50:01 UTC schrieb Paolo Bonzini <[email protected]>:
Quoted 4 lines
isa-superio.ccurrently defines a SuperIO chip that is not used by any other user of the file. Extract the chip to a separate file.Reviewed-by BALATON Zoltan <[email protected]>
I think in v2 Zoltan only pointed out a typo in the commit message (which is now fixed) but didn't add an R-b tag so far.
Best regards,
Bernhard
Quoted 121 lines
Reviewed-by Bernhard Beschow <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>---
hw/isa/fdc37m81x-superio.c | 32 ++++++++++++++++++++++++++++++++ hw/isa/isa-superio.c | 18 ------------------ hw/isa/Kconfig | 4 ++++ hw/isa/meson.build | 1 + hw/mips/Kconfig | 2 +- 5 files changed, 38 insertions(+), 19 deletions(-)create mode 100644
hw/isa/fdc37m81x-superio.chw/isa/fdc37m81x-superio.c new file +32
-0@@ -0,0 +1,32 @@ +/* +* SMS FDC37M817 Super I/O +* +* Copyright (c) 2018 Philippe Mathieu-Daudé +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "hw/isa/superio.h" + +static void fdc37m81x_class_init (ObjectClass *klass,void *data) +{ +ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); + + sc->serial.count =2 ;/* NS16C550A */ + sc->parallel.count =1 ; + sc->floppy.count =1 ;/* SMSC 82077AA Compatible */ + sc->ide.count =0 ; +} + +static const TypeInfo types[] = { + { + .name =TYPE_FDC37M81X_SUPERIO , + .parent =TYPE_ISA_SUPERIO , + .class_init = fdc37m81x_class_init, + }, +}; + +DEFINE_TYPES (types)hw/isa/isa-superio.c +0
-18@@ -190,27 +190,9 @@ static const TypeInfo isa_superio_type_info = { .instance_size = sizeof(ISASuperIODevice), }; -/* SMS FDC37M817 Super I/O */ -static void fdc37m81x_class_init (ObjectClass *klass,void *data) -{ -ISASuperIOClass *sc =ISA_SUPERIO_CLASS (klass); - - sc->serial.count =2 ;/* NS16C550A */ - sc->parallel.count =1 ; - sc->floppy.count =1 ;/* SMSC 82077AA Compatible */ - sc->ide.count =0 ; -} - -static const TypeInfo fdc37m81x_type_info = { - .name =TYPE_FDC37M81X_SUPERIO , - .parent =TYPE_ISA_SUPERIO , - .class_init = fdc37m81x_class_init, -}; -static void isa_superio_register_types (void ) {type_register_static (&isa_superio_type_info); -type_register_static (&fdc37m81x_type_info); }type_init (isa_superio_register_types)hw/isa/Kconfig +4
-0@@ -23,6 +23,10 @@ config ISA_SUPERIO # Some users of ISA_SUPERIO do not use it #select IDE_ISA +config FDC37M81X + bool + select ISA_SUPERIO +config PC87312
bool
selectISA_SUPERIOhw/isa/meson.build +1
-0@@ -4,6 +4,7 @@ system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('isa-bus.c')) system_ss.add(when: 'CONFIG_ISA_SUPERIO', if_true: files('isa-superio.c')) system_ss.add(when: 'CONFIG_PC87312', if_true: files('pc87312.c')) system_ss.add(when: 'CONFIG_PIIX', if_true: files('piix.c')) +system_ss.add(when: 'CONFIG_FDC37M81X', if_true: files('fdc37m81x-superio.c')) system_ss.add(when: 'CONFIG_SMC37C669', if_true: files('smc37c669-superio.c')) system_ss.add(when: 'CONFIG_VT82C686', if_true: files('vt82c686.c'))hw/mips/Kconfig +0
-0@@ -1,7 +1,7 @@config MALTA
boolhw/mips/Kconfig +1
-1+ select FDC37M81X select GT64120 - select ISA_SUPERIO select PIIXconfig MIPSSIM
PATCH v3 7/9 mips: allow compiling out CONFIG_MIPS_ITU
In reply to Paolo Bonziniitc_reconfigure() is referenced from TCG, compile out the helpers that reference env->itu if CONFIG_MIPS_ITU is not defined. This makes it possible to build a QEMU binary that only includes boards without a CPS device (only Malta and Boston create one).
--- target/mips/tcg/translate.h | 1 + target/mips/tcg/sysemu_helper.h.inc | 19 +++++++++++++------ target/mips/tcg/sysemu/cp0_helper.c | 8 ++++++++ target/mips/tcg/translate.c | 10 ++++++++++ 4 files changed, 32 insertions(+), 6 deletions(-)
target/mips/tcg/translate.h +1 -0
@@ -9,6 +9,7 @@#define TARGET_MIPS_TRANSLATE_H #include "cpu.h" +#include "tcg/tcg-op.h" #include "exec/translator.h" #include "exec/helper-gen.h"
target/mips/tcg/sysemu_helper.h.inc +13 -6
@@ -9,6 +9,8 @@ * SPDX-License-Identifier: LGPL-2.1-or-later */ +#include CONFIG_DEVICES + /* CP0 helpers */ DEF_HELPER_1(mfc0_mvpcontrol, tl, env) DEF_HELPER_1(mfc0_mvpconf0, tl, env)
@@ -31,8 +33,6 @@ DEF_HELPER_1(mftc0_tcschedule, tl, env) DEF_HELPER_1(mfc0_tcschefback, tl, env) DEF_HELPER_1(mftc0_tcschefback, tl, env) DEF_HELPER_1(mfc0_count, tl, env) -DEF_HELPER_1(mfc0_saar, tl, env) -DEF_HELPER_1(mfhc0_saar, tl, env) DEF_HELPER_1(mftc0_entryhi, tl, env) DEF_HELPER_1(mftc0_status, tl, env) DEF_HELPER_1(mftc0_cause, tl, env)
@@ -57,7 +57,6 @@ DEF_HELPER_1(dmfc0_lladdr, tl, env) DEF_HELPER_1(dmfc0_maar, tl, env) DEF_HELPER_2(dmfc0_watchlo, tl, env, i32) DEF_HELPER_2(dmfc0_watchhi, tl, env, i32) -DEF_HELPER_1(dmfc0_saar, tl, env) #endif /* TARGET_MIPS64 */ DEF_HELPER_2(mtc0_index, void, env, tl)
@@ -103,9 +102,6 @@ DEF_HELPER_2(mtc0_srsconf4, void, env, tl) DEF_HELPER_2(mtc0_hwrena, void, env, tl) DEF_HELPER_2(mtc0_pwctl, void, env, tl) DEF_HELPER_2(mtc0_count, void, env, tl) -DEF_HELPER_2(mtc0_saari, void, env, tl) -DEF_HELPER_2(mtc0_saar, void, env, tl) -DEF_HELPER_2(mthc0_saar, void, env, tl) DEF_HELPER_2(mtc0_entryhi, void, env, tl) DEF_HELPER_2(mttc0_entryhi, void, env, tl) DEF_HELPER_2(mtc0_compare, void, env, tl)
@@ -189,3 +185,14 @@ DEF_HELPER_2(lcsr_drdcsr, i64, env, tl) DEF_HELPER_3(lcsr_wrcsr, void, env, tl, tl) DEF_HELPER_3(lcsr_dwrcsr, void, env, tl, tl) #endif + +#ifdef CONFIG_MIPS_ITU +DEF_HELPER_1(mfc0_saar, tl, env) +DEF_HELPER_1(mfhc0_saar, tl, env) +DEF_HELPER_2(mtc0_saari, void, env, tl) +DEF_HELPER_2(mtc0_saar, void, env, tl) +DEF_HELPER_2(mthc0_saar, void, env, tl) +#ifdef TARGET_MIPS64 +DEF_HELPER_1(dmfc0_saar, tl, env) +#endif +#endif
target/mips/tcg/sysemu/cp0_helper.c +8 -0
@@ -21,6 +21,8 @@*/ #include "qemu/osdep.h" +#include CONFIG_DEVICES +#include "qemu/log.h" #include "qemu/main-loop.h" #include "cpu.h"
@@ -371,6 +373,7 @@ target_ulong helper_mfc0_count(CPUMIPSState *env)return (int32_t )cpu_mips_get_count (env); } +#ifdef CONFIG_MIPS_ITU target_ulong helper_mfc0_saar (CPUMIPSState *env) {if ((env->CP0_SAARI &0x3f ) <2 ) {
@@ -386,6 +389,7 @@ target_ulong helper_mfhc0_saar(CPUMIPSState *env) }return 0 ; } +#endif target_ulong helper_mftc0_entryhi (CPUMIPSState *env) {
@@ -514,6 +518,7 @@ target_ulong helper_dmfc0_watchhi(CPUMIPSState *env, uint32_t sel)return env->CP0_WatchHi[sel]; } +#ifdef CONFIG_MIPS_ITU target_ulong helper_dmfc0_saar (CPUMIPSState *env) {if ((env->CP0_SAARI &0x3f ) <2 ) {
@@ -521,6 +526,7 @@ target_ulong helper_dmfc0_saar(CPUMIPSState *env) }return 0 ; } +#endif #endif /* TARGET_MIPS64 */ void helper_mtc0_index (CPUMIPSState *env,target_ulong arg1)
@@ -1100,6 +1106,7 @@ void helper_mtc0_count(CPUMIPSState *env, target_ulong arg1)cpu_mips_store_count (env, arg1); } +#ifdef CONFIG_MIPS_ITU void helper_mtc0_saari (CPUMIPSState *env,target_ulong arg1) {uint32_t target = arg1 &0x3f ;
@@ -1139,6 +1146,7 @@ void helper_mthc0_saar(CPUMIPSState *env, target_ulong arg1) } } } +#endif void helper_mtc0_entryhi (CPUMIPSState *env,target_ulong arg1) {
target/mips/tcg/translate.c +10 -0
@@ -49,6 +49,16 @@#ifdef CONFIG_USER_ONLY STUB_HELPER(cache, TCGv_env env, TCGv val, TCGv_i32 reg)#endif +#if definedCONFIG_SYSTEM_ONLY && !definedCONFIG_MIPS_ITU +STUB_HELPER(mfc0_saar, TCGv ret, TCGv_env env) +STUB_HELPER(mfhc0_saar, TCGv ret, TCGv_env env) +STUB_HELPER(mtc0_saari, TCGv_env env, TCGv val) +STUB_HELPER(mtc0_saar, TCGv_env env, TCGv val) +STUB_HELPER(mthc0_saar, TCGv_env env, TCGv val) +#ifdef TARGET_MIPS64 +STUB_HELPER(dmfc0_saar, TCGv ret, TCGv_env env) +#endif +#endif enum {/* indirect opcode tables */
Signature · 1 line
2.43.0
PATCH v3 8/9 mips/loongson3_virt: do not require CONFIG_USB
In reply to Paolo BonziniOnce the Kconfig for hw/mips is cleaned up, it will be possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded by CONFIG_USB. While the simpler creation functions such as usb_create_simple can be inlined, this is not true of usb_bus_find(). Remove it, replacing it with a search of the single USB bus created by loongson3_virt_devices_init().
--- hw/mips/loongson3_virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
hw/mips/loongson3_virt.c +3 -2
@@ -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" ); }pci_init_nic_devices (pci_bus, mc->default_nic);
Signature · 1 line
2.43.0
Re: [PATCH v3 8/9] mips/loongson3_virt: do not require CONFIG_USB
Quoted 18 lines · Paolo Bonzini
Once the
Kconfigfor hw/mips is cleaned up, it will be possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded byCONFIG_USB. While the simpler creation functions such asusb_create_simplecan be inlined, this is not true ofusb_bus_find(). Remove it, replacing it with a search of the single USB bus created byloongson3_virt_devices_init().Signed-off-by Paolo Bonzini <[email protected]>--- hw/mips/loongson3_virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/mips/loongson3_virt.c +0
-0@@ -447,8 +447,9 @@ static inline void loongson3_virt_devices_init(MachineState *machine,
hw/mips/loongson3_virt.c static inline void loongson3_virt_devices_init(MachineState *machine, · line 455
Quoted 10 lines
hw/mips/loongson3_virt.c +3
-2if (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" ); }pci_init_nic_devices (pci_bus, mc->default_nic);
Can we remove usb_bus_find() completely instead?
$ git grep -w usb_bus_find hw/hppa/machine.c:401: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/hppa/machine.c:402: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/mips/loongson3_virt.c:450: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/mips/loongson3_virt.c:451: usb_create_simple(usb_bus_find(-1), "usb-tablet"); hw/ppc/mac_newworld.c:434: USBBus *usb_bus = usb_bus_find(-1); hw/ppc/sam460ex.c:423: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/ppc/sam460ex.c:424: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/ppc/spapr.c:3027: USBBus *usb_bus = usb_bus_find(-1); hw/sh4/r2d.c:315: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/usb/bus.c:103:USBBus *usb_bus_find(int busnr) hw/usb/bus.c:669: USBBus *bus = usb_bus_find(-1 /* any */); include/hw/usb.h:500:USBBus *usb_bus_find(int busnr);
Re: [PATCH v3 8/9] mips/loongson3_virt: do not require CONFIG_USB
Quoted 9 lines · Philippe Mathieu-Daudé
Quoted 9 lines
if (defaults_enabled() && object_class_by_name("pci-ohci")) { pci_create_simple(pci_bus, -1, "pci-ohci");hw/mips/loongson3_virt.c +3
-2-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" ); }
Quoted 3 lines
Quoted 1 line
pci_init_nic_devices(pci_bus, mc->default_nic);Can we remove
usb_bus_find()completely instead?
s/instead/in fact/
Yes, we can, but this would be just one patch in that series...
Paolo
Quoted 17 lines
$ git grep -w usb_bus_find hw/hppa/machine.c:401: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/hppa/machine.c:402: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/mips/loongson3_virt.c:450: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/mips/loongson3_virt.c:451: usb_create_simple(usb_bus_find(-1), "usb-tablet"); hw/ppc/mac_newworld.c:434: USBBus *usb_bus = usb_bus_find(-1); hw/ppc/sam460ex.c:423: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/ppc/sam460ex.c:424: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/ppc/spapr.c:3027: USBBus *usb_bus = usb_bus_find(-1); hw/sh4/r2d.c:315: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/usb/bus.c:103:USBBus *usb_bus_find(int busnr) hw/usb/bus.c:669: USBBus *bus = usb_bus_find(-1 /* any */); include/hw/usb.h:500:USBBus *usb_bus_find(int busnr);
Re: [PATCH v3 8/9] mips/loongson3_virt: do not require CONFIG_USB
In reply to Philippe Mathieu-DaudéQuoted 32 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Paolo Bonzini
Once the
Kconfigfor hw/mips is cleaned up, it will be possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded byCONFIG_USB. While the simpler creation functions such asusb_create_simplecan be inlined, this is not true ofusb_bus_find(). Remove it, replacing it with a search of the single USB bus created byloongson3_virt_devices_init().Signed-off-by Paolo Bonzini <[email protected]>--- hw/mips/loongson3_virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/mips/loongson3_virt.c +0
-0@@ -447,8 +447,9 @@ static inline void loongson3_virt_devices_init(MachineState *machine,hw/mips/loongson3_virt.c static inline void · line 455
Quoted 10 lines
hw/mips/loongson3_virt.c +3
-2if (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" ); }pci_init_nic_devices (pci_bus, mc->default_nic);Can we remove
usb_bus_find()completely instead?
Quoted 13 lines
$ git grep -w usb_bus_find hw/hppa/machine.c:401: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/hppa/machine.c:402: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/mips/loongson3_virt.c:450: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/mips/loongson3_virt.c:451: usb_create_simple(usb_bus_find(-1), "usb-tablet"); hw/ppc/mac_newworld.c:434: USBBus *usb_bus = usb_bus_find(-1); hw/ppc/sam460ex.c:423: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/ppc/sam460ex.c:424: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/ppc/spapr.c:3027: USBBus *usb_bus = usb_bus_find(-1); hw/sh4/r2d.c:315: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/usb/bus.c:103:USBBus *usb_bus_find(int busnr) hw/usb/bus.c:669: USBBus *bus = usb_bus_find(-1 /* any */); include/hw/usb.h:500:USBBus *usb_bus_find(int busnr);
These are all the machines that add devices to a USB bus, there's no other example to do it in a different way currently. We could change this to get the usb bus in a different way but how? We could either peek into the object that owns the usb_bus or try using qdev_get_child_bus() but that needs the name of the bus which might change if other usb hosts are added so neither of these options seem better than this function. What would it bring to remove this function other than more complex or uglier code? I don't mind if you remove it just don't see the benefit in that.
Regards,
BALATON Zoltan
Re: [PATCH v3 8/9] mips/loongson3_virt: do not require CONFIG_USB
Quoted 51 lines · BALATON Zoltan
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Paolo Bonzini
Once the
Kconfigfor hw/mips is cleaned up, it will be possible to build a binary that does not include any USB host controller and therefore that does not include the code guarded byCONFIG_USB. While the simpler creation functions such asusb_create_simplecan be inlined, this is not true ofusb_bus_find(). Remove it, replacing it with a search of the single USB bus created byloongson3_virt_devices_init().Signed-off-by Paolo Bonzini <[email protected]>--- hw/mips/loongson3_virt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)hw/mips/loongson3_virt.c +0
-0@@ -447,8 +447,9 @@ static inline void loongson3_virt_devices_init(MachineState *machine,hw/mips/loongson3_virt.c static inline void · line 455
Quoted 10 lines
hw/mips/loongson3_virt.c +3
-2if (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" ); }pci_init_nic_devices (pci_bus, mc->default_nic);Can we remove
usb_bus_find()completely instead?Quoted 16 lines
$ git grep -w usb_bus_find hw/hppa/machine.c:401: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/hppa/machine.c:402: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/mips/loongson3_virt.c:450: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/mips/loongson3_virt.c:451: usb_create_simple(usb_bus_find(-1), "usb-tablet"); hw/ppc/mac_newworld.c:434: USBBus *usb_bus = usb_bus_find(-1); hw/ppc/sam460ex.c:423: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/ppc/sam460ex.c:424: usb_create_simple(usb_bus_find(-1), "usb-mouse"); hw/ppc/spapr.c:3027: USBBus *usb_bus = usb_bus_find(-1); hw/sh4/r2d.c:315: usb_create_simple(usb_bus_find(-1), "usb-kbd"); hw/usb/bus.c:103:USBBus *usb_bus_find(int busnr) hw/usb/bus.c:669: USBBus *bus = usb_bus_find(-1 /* any */); include/hw/usb.h:500:USBBus *usb_bus_find(int busnr);
Quoted 3 lines
These are all the machines that add devices to a USB bus, there's no other example to do it in a different way currently. We could change this to get the usb bus in a different way but how?
We can move object_resolve_type_unambiguous out of hw/i386/acpi-build.c to common code and use it, it's overall a self-explanatory function.
PATCH v3 9/9 mips: do not list individual devices from configs/
In reply to Paolo BonziniAdd new "select" and "imply" directives if needed. The resulting config-devices.mak files are the same as before.
Note that builds without default devices will become much smaller than before; for this reason, it's necessary to use only the bare minimum of USB functions, in particular only those that are inlined. For this reason, usb_bus_find() must be removed, as it only exists if CONFIG_USB is selected by a host controller.
--- configs/devices/mips-softmmu/common.mak | 28 +++----------------- configs/devices/mips64el-softmmu/default.mak | 3 --- .gitlab-ci.d/buildtest.yml | 2 +- hw/display/Kconfig | 2 +- hw/mips/Kconfig | 20 +++++++++++++- 5 files changed, 25 insertions(+), 30 deletions(-)
configs/devices/mips-softmmu/common.mak +4 -24
@@ -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
configs/devices/mips64el-softmmu/default.mak +0 -3
@@ -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
.gitlab-ci.d/buildtest.yml +1 -1
@@ -659,7 +659,7 @@ build-without-defaults: --disable-pie --disable-qom-cast-debug --disable-strip - TARGETS: avr-softmmu mips64-softmmu s390x-softmmu sh4-softmmu + TARGETS: avr-softmmu s390x-softmmu sh4-softmmu sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user MAKE_CHECK_ARGS: check
hw/display/Kconfig +1 -1
@@ -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
hw/mips/Kconfig +19 -1
@@ -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
Signature · 1 line
2.43.0
Hi,
Quoted 9 lines · Paolo Bonzini
Bernhard Beschow (1):
hw/mips/Kconfig: Remove ISA dependencies from MIPSsim boardPaolo Bonzini (8):
isa: clean up
Kconfigselections forISA_SUPERIO
isa: fixISA_SUPERIOdependencies
isa: specifyinstance_sizeinisa_superio_type_info
isa: extract FDC37M81X to a separate file
I'm a bit reluctant with the USB changes so far, so I'm queuing these 5 patches meanwhile.
Regards,
Phil.