Hello, Here's a series against master, pushing QOM beyond what I've seen on Anthony's qom-upstream and qom-rebase branches. It depends on the object_class_foreach() fix posted separately.
Patch 1 is included here to show its use case in patch 5. Patch 2 suggests a way to start using QOM beyond "devices" in system emulation. Patch 3 suggests a way to integrate QOM into the user emulators as well. Patches 4-5 introduce a CPU class and prepare its use in system and user mode. Patches 6-7 build upon this infrastructure and start using it for ARM. This series is surely not yet the final goal as discussed on IRC. It does help with my and Peter's quest to further clean up the constantly growing mess surrounding ARM reset vs. one-time initialization though. The plan there is to get rid of the huge CPUID switch by moving the knowledge of reset values to CPU classes and by dumb copying of values from class to instance on reset. The latter for now requires to be able to obtain the ObjectClass matching a CPUState - in target-specific code this works by simple pointer arithmetic, encapsulated in a macro. So, in a spirit similar to Anthony's i440FX rework I'm posting this to check if I'm on the right track here before I start messing around with other targets. Regards, Andreas Cc: Anthony Liguori <aligu...@us.ibm.com> Cc: Peter Maydell <peter.mayd...@linaro.org> Cc: Paul Brook <p...@codesourcery.com> Andreas Färber (7): qom: Introduce object_class_is_abstract() qom: Register QOM infrastructure early qom: Add QOM support to user emulators qom: Introduce CPU class cpu: Introduce cpu_class_foreach() target-arm: Introduce QOM CPU and use for it CPUID lookup target-arm: Embed CPUARMState in QOM ARMCPU Makefile.objs | 1 + Makefile.target | 16 +++- Makefile.user | 1 + arch_init.c | 1 + bsd-user/main.c | 3 + darwin-user/main.c | 4 + hw/cpu.c | 52 +++++++++ include/qemu/cpu.h | 36 +++++++ include/qemu/object.h | 8 ++ linux-user/main.c | 3 + module.h | 4 + qom/object.c | 7 +- target-arm/cpu-core.c | 281 +++++++++++++++++++++++++++++++++++++++++++++++++ target-arm/cpu-core.h | 40 +++++++ target-arm/helper.c | 87 +++++----------- vl.c | 2 + 16 files changed, 480 insertions(+), 66 deletions(-) create mode 100644 hw/cpu.c create mode 100644 include/qemu/cpu.h create mode 100644 target-arm/cpu-core.c create mode 100644 target-arm/cpu-core.h -- 1.7.7