On 04/05/2022 10:25, 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_B160L 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>
>
> v2:
> - Rebase onto master
> - Add R-B tag to patch 1 from Richard
> - Add A-B tag from Helge to entire series
> - Update patch 12 to use CONFIG_HPPA_B160L instead of CONFIG_HPPA_GENERIC and
> also update the machine description
>
>
> 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_B160L 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 | 124 +++++++++---
> 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, 463 insertions(+), 445 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
Richard, thanks for taking the time to look over this (rather large) patchset. I've
replied to your comments, and from what I can see the v2 patchset should be fine to
merge. Are you happy for me to go ahead and send a PR with that and the artist fixes?
FWIW I also have another couple of tidy-up patchsets locally, one for lasips2 and
another for the hppa machine that are based on this series. So if we do happen to
find anything else, I can easily squash the fixes into one of the follow-up series
rather than make this one larger.
ATB,
Mark.