This patch series converts the ARM GIC to a self-contained sysbus device, rather than having it be implemented by a C file which is #included in half a dozen different other files.
The motivation for this is that when we have a KVM in-kernel GIC implementation it will be easier to just drop that into the model if the GIC-to-rest-of-model interface is more cleanly defined. (Plus it's just less ugly :-)) Patches 1-3 are preliminary removals of config and provision of a way to signal a PPI without having to call a gic internal function to do it. Patch 4 is the actual sysbusization. Patches 5-9 convert the various GIC users to use the sysbus device rather than including the C file. 10-13 are minor post-conversion cleanups. 13 is a whitespace change, which I'm normally not hugely in favour of, but in this case it is a single line in the file... I've left the v7M NVIC still pulling in arm_gic.c by #include. The coupling of the NVIC and GIC code is much closer and so disentangling things would be more work, so this patch series is really only addressing the A-profile GIC. Possibly the right approach would be for the NVIC to subclass the GIC? Either that or to give up on common implementation. A good first step would probably be to make SysTick its own device, and use memory regions to avoid the gic distributor read/write functions having to call out to nvic_read/write functions. However M profile is definitely not a priority for me so I'm not planning to do that... The patches sit on top of arm-devs.next because of the Exynos patch which drops use of gic_cpu_write(). http://git.linaro.org/gitweb?p=people/pmaydell/qemu-arm.git;a=shortlog;h=refs/heads/arm-devs.next Patchset available here if you prefer git trees to emails: http://git.linaro.org/gitweb?p=people/pmaydell/qemu-arm.git;a=shortlog;h=refs/heads/gic-as-device Peter Maydell (13): hw/arm_gic: Move NCPU definition to arm_gic.c hw/arm_gic: Move gic_get_current_cpu into arm_gic.c hw/arm_gic.c: Expose PPI inputs as gpio inputs arm_gic: Make the GIC its own sysbus device hw/a15mpcore: switch to using sysbus GIC hw/a9mpcore.c: Switch to using sysbus GIC hw/realview_gic: switch to sysbus GIC hw/exynos4210_gic.c: Convert to using sysbus GIC hw/arm11mpcore: Convert to using sysbus GIC device hw/arm_gic: Make gic_reset a sysbus reset function hw/arm_gic.c: Use NVIC instead of LEGACY_INCLUDED_GIC define hw/arm_gic.c: gic_set_pending_private() is NVIC only hw/arm_gic.c: Remove stray hardcoded tab Makefile.target | 1 + hw/a15mpcore.c | 46 ++++++++------- hw/a9mpcore.c | 72 +++++++++++------------ hw/arm11mpcore.c | 56 ++++++++++--------- hw/arm_gic.c | 156 +++++++++++++++++++++++++++++++++++++++++++-------- hw/armv7m_nvic.c | 24 +++++--- hw/exynos4210_gic.c | 46 +++++++++------ hw/realview_gic.c | 46 +++++++++------- 8 files changed, 293 insertions(+), 154 deletions(-)