On 28/04/2022 17:58, Helge Deller wrote:
> On 4/21/22 21:30, Mark Cave-Ayland wrote:
>> This patchset started off when I noticed that dino.c was accessing parent_obj
>> directly rather than using a QOM cast. After fixing that I noticed quite a few
>> other improvements that could be done to bring hppa up to our recommended
>> coding standards.
>>
>> The main aim of this patchset is to de-couple the dino and lasi devices from
>> the board using QOM to handle the initialisation instead of having global
>> device init functions. Included in this is switching the onboard devices
>> over to use qdev GPIOs for wiring instead of directly allocating QEMU IRQs.
>>
>> Along the way I've renamed the board config from CONFIG_DINO to
>> CONFIG_HPPA_GENERIC since that better represents the machine type, and then
>> used CONFIG_DINO and CONFIG_LASI for the appropriate devices which have been
>> moved to hw/pci-host/dino.c and hw/misc/lasi.c respectively.
>>
>> After the reorganisation it was trivial to remove hppa_sys.h and the majority
>> of pci.c which wasn't being used. Finally I tidied up the use of the QOM
>> machine type macros in machine.c.
>>
>> The result has been lightly tested with a tiny Linux image I had lying around
>> for testing my recent ESP changes, so more testing is welcome. There is a bit
>> more work to be done sorting out the lasips2 device init and machine init, but
>> since the patchset is already quite big I can follow up with that once this
>> series has been merged.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>
> Marc, thanks a lot for this big cleanup!
> I've reviewed and tested it with Linux and HP-UX guests.
>
> Please add:
> Acked-by: Helge Deller <deller@gmx.de>
>
> Thanks!!
> Helge
>
>>
>> Mark Cave-Ayland (50):
>> dino: checkpatch fixes
>> dino: move registers from dino_init() to DINO_PCI_BRIDGE init function
>> dino: move PCI bus initialisation to dino_pcihost_init()
>> dino: move PCI windows initialisation to dino_pcihost_init()
>> dino: add memory-as property containing a link to the memory address
>> space
>> dino: move pci_setup_iommu() to dino_pcihost_init()
>> dino: move PCI bus master address space setup to
>> dino_pcihost_realize()
>> dino: move initial register configuration to new dino_pcihost_reset()
>> function
>> dino: use QOM cast instead of directly referencing parent_obj
>> dino: return PCIBus from dino_init() using qdev_get_child_bus()
>> dino: split declarations from dino.c into dino.h
>> hppa: use new CONFIG_HPPA_GENERIC option instead of CONFIG_DINO to
>> build hppa machine
>> dino: change dino_init() to return the DINO device instead of PCIBus
>> machine.c: map DINO device during board configuration
>> dino.h: add defines for DINO IRQ numbers
>> dino: define IRQ inputs as qdev GPIOs
>> dino: wire up serial IRQ using a qdev GPIO in machine.c
>> dino: remove unused dino_set_timer_irq() IRQ handler
>> hppa: move dino_init() from dino.c to machine.c
>> dino: use numerical constant for iar0 and iar1 reset values
>> dino: move DINO HPA constants from hppa_hardware.h to dino.h
>> dino: move from hw/hppa to hw/pci-host
>> lasi: checkpatch fixes
>> lasi: move memory region initialisation to new lasi_init() function
>> lasi: move register memory mapping from lasi.c to machine.c
>> lasi: move initialisation of iar and rtc to new lasi_reset() function
>> lasi: move LASIState and associated QOM structures to lasi.h
>> lasi: replace lasi_get_irq() with defined constants
>> lasi: define IRQ inputs as qdev GPIOs
>> lasi: use qdev GPIOs to wire up IRQs in lasi_initfn()
>> lasi: fix serial port initialisation
>> lasi: update lasi_initfn() to return LASIState
>> lasi: move LAN initialisation to machine.c
>> lasi: move parallel port initialisation to machine.c
>> lasi: move second serial port initialisation to machine.c
>> lasi: move PS2 initialisation to machine.c
>> lasi: remove address space parameter from lasi_initfn()
>> lasi: move lasi_initfn() to machine.c
>> lasi: use constants for device register offsets
>> lasi: use numerical constant for iar reset value
>> hppa: move device headers from hppa_sys.h into individual .c files
>> lasi: move from hw/hppa to hw/misc
>> hppa: move hppa_pci_ignore_ops from pci.c to machine.c
>> hppa: remove hw/hppa/pci.c
>> hppa: remove unused trace-events from from hw/hppa
>> hppa: move enable_lan() define from hppa_sys.h to machine.c
>> hppa: remove the empty hppa_sys.h file
>> hppa: use MACHINE QOM macros for defining the hppa machine
>> hppa: fold machine_hppa_machine_init() into
>> machine_hppa_machine_init_class_init()
>> hppa: simplify machine function names in machine.c
>>
>> MAINTAINERS | 4 +
>> configs/devices/hppa-softmmu/default.mak | 2 +-
>> hw/hppa/Kconfig | 5 +-
>> hw/hppa/hppa_hardware.h | 5 -
>> hw/hppa/hppa_sys.h | 24 ---
>> hw/hppa/machine.c | 122 +++++++++---
>> hw/hppa/meson.build | 2 +-
>> hw/hppa/pci.c | 88 ---------
>> hw/hppa/trace-events | 14 --
>> hw/misc/Kconfig | 3 +
>> hw/{hppa => misc}/lasi.c | 161 ++++------------
>> hw/misc/meson.build | 3 +
>> hw/misc/trace-events | 5 +
>> hw/pci-host/Kconfig | 4 +
>> hw/{hppa => pci-host}/dino.c | 231 +++++++----------------
>> hw/pci-host/meson.build | 3 +
>> hw/pci-host/trace-events | 5 +
>> include/hw/misc/lasi.h | 78 ++++++++
>> include/hw/pci-host/dino.h | 146 ++++++++++++++
>> meson.build | 1 -
>> 20 files changed, 462 insertions(+), 444 deletions(-)
>> delete mode 100644 hw/hppa/hppa_sys.h
>> delete mode 100644 hw/hppa/pci.c
>> delete mode 100644 hw/hppa/trace-events
>> rename hw/{hppa => misc}/lasi.c (60%)
>> rename hw/{hppa => pci-host}/dino.c (71%)
>> create mode 100644 include/hw/misc/lasi.h
>> create mode 100644 include/hw/pci-host/dino.h
Thanks Helge! After a few brief experiments over the holiday weekend I'm going to
send a v2 with your A-B tags, and also change the machine from "HPPA generic" to
"HPPA BL160L". This will then match with both MAINTAINERS and also Linux which
identifies the machine as "model 9000/778/B160L".
Richard, any other thoughts before sending out a v2? And who should be the best
person to merge it?
ATB,
Mark.