Received: from eggs.gnu.org ([140.186.70.92]:38731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9Q2-0008Be-Dd for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt9Pt-00061P-FQ for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:33 -0500 Received: from cantor2.suse.de ([195.135.220.15]:55606 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt9Pt-00060p-2s for qemu-devel@nongnu.org; Thu, 02 Feb 2012 22:02:25 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 3 Feb 2012 03:59:31 +0100 Message-Id: <1328237992-14953-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC v3 00/21] Introduce QOM CPU and use it for ARM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?UTF-8?q?Andreas=20F=C3=A4rber?= Hello, Here's an improved and extended series on incrementally converting CPUSta= te to QOM, rebased onto Anthony's qom-upstream.14 plus some master updates. The general idea behind the series is to cease having CPU-dependent code in generic functions, in favor of storing constant data in CPU classes an= d letting instance methods either be dumb initializations or overwritten. After the initial introduction of the types, this series is mainly mechan= ical code movement. This series does NOT yet... ...model ARM CPU has-a cp15 register, ...introduce SoCs (child plus devices), ...touch machines. Patch 1 rearranges module init for QOM, so that objects can really be use= d beyond devices. Introduces a neutral type_init() macro for new types. Does not depend on 3rd QOM series and could be cherry-picked. Patch 2 adds QOM support to the user emulators. Note that more dependenci= es and some stubs were now needed to successfully compile. Patch 3 introduces the QOM CPU base class. Patches 4-19 derive and start using a QOM CPU for ARM. Patch 5 integrates legacy CPUARMState into QOM. Patch 7 is a proof of concept for CPUState -> CPU lookup. Patch 19 completes freeing cpu_reset() and cpu_arm_init() of any model lo= gic. Patch 20 adds a sample read-only property accessing legacy CPUState. Patch 21 is a hack to allow inspecting this using QMP/qmp qom-list --path=3D/cpu --property=3Dhalted For some reason the logic seems inverted (False for -S, True while runnin= g)... Available at: http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/qom-cpu.v3 TODO: We might want to sort -cpu ? alphabetically; object_class_foreach() prints them in hash table order. Agenda: AF: Convert one other target as proof of concept. Once Anthony's 3rd QOM series is merged, sort out and merge (what is now)= 1-19. all: Incrementally (hopefully in parallel) derive QOM CPUs for all target= s. Only when all targets are converted will it be possible to move fields fr= om CPU_COMMON into CPU, to add properties in common code, to simplify some function names and to eliminate CPUState *env in core code! Regards, Andreas Cc: Anthony Liguori Cc: Peter Maydell v2 -> v3: * Rebased against qom-upstream.14 branch (and that against master). * Build common dependencies for user emulators in libuser/. * New dependencies needed after moving properties into object.c. * Add a qemu-user.c with stubs needed for successful linking. * Move cpu.c from hw/ to qom/ (built only once). * Use proper GPL headers. * Rename target-arm/cpu-core.c to cpu.c now that we no longer need VPATH. * Leave cpu-core.h as is to separate from legacy cpu.h. * Fix -cpu alias "pxa270": handled in cpu_arm_init(). * Use proper GPL headers. * Start removing CPUID uses in cpu_reset_model_id() and cpu.h. * Fully convert cpu_reset_model_id() to ARMCPUInfo or per-model code. * Experiment with adding properties. v1 -> v2: * Cherry-pick Anthony's object_class_foreach() patch. * Don't introduce extra early_init(), just relocate former MODULE_INIT_DE= VICE. * Provide new type_init() macro to be used instead of device_init(). * Drop processor_init() and MODULE_INIT_CPU in favor of MODULE_INIT_DEVIC= E. * Prepare cast macros for CPU. * Add documentation. * Fix ARMCPUClass type name (arm-cpu-core -> arm-cpu). * Add documentation. * Rename ARMCPUDef to ARMCPUInfo. * Use a C99-style table for initializing the classes through class_data instead of individual class_init functions (suggested by Anthony). * Prepare reset callback. * Make ENV_GET_OBJECT() use an inline function for readability. * Invoke the CPU's reset method from cpu_reset(). * Do feature initialization via table where sensible. * Add feature flags to ARMCPU as well (suggested by PMM for future tweaki= ng, also simplifies load/save a bit) and initialize them from ARMCPUClass. * Make feature inference work for ARMCPU as well by not passing the ARMCP= UClass. Use function-local macros to avoid the ugliness of deferencing the feat= ures pointer. Andreas F=C3=A4rber (21): qom: Register QOM infrastructure early qom: Add QOM support to user emulators qom: Introduce CPU class target-arm: Introduce QOM CPU and use it for CPUID lookup target-arm: Embed CPUARMState in QOM ARMCPU target-arm: Prepare model-specific class_init function target-arm: Overwrite reset handler for ti925t target-arm: Move CPU feature flags out of CPUState target-arm: No longer abort on unhandled CPUIDs on reset target-arm: Store cp15 c0_c1 and c0_c2 in ARMCPUClass target-arm: Store cp15 c0_cachetype register in ARMCPUClass target-arm: Move cp15 c1_sys register to ARMCPUClass target-arm: Store JTAG_ID in ARMCPUClass target-arm: Move the PXA270's iwMMXt reset to pxa270_reset() target-arm: Store VFP FPSID register in ARMCPUClass target-arm: Store VFP MVFR0 and MVFR1 in ARMCPUClass target-arm: Store CLIDR in ARMCPUClass target-arm: Store CCSIDRs in ARMCPUClass target-arm: Kill off cpu_reset_model_id() target-arm: Prepare halted property for CPU target-arm: Just for testing! Makefile.objs | 6 + Makefile.target | 1 + Makefile.user | 1 + bsd-user/main.c | 2 + configure | 2 + darwin-user/main.c | 3 + include/qemu/cpu.h | 73 ++++++ linux-user/main.c | 2 + module.h | 5 +- qemu-user.c | 37 +++ qom/Makefile | 1 + qom/cpu.c | 50 ++++ target-arm/cpu-core.h | 93 ++++++++ target-arm/cpu.c | 631 +++++++++++++++++++++++++++++++++++++++++++= ++++++ target-arm/cpu.h | 27 +-- target-arm/helper.c | 425 +++------------------------------ target-arm/machine.c | 6 +- vl.c | 4 +- 18 files changed, 944 insertions(+), 425 deletions(-) create mode 100644 include/qemu/cpu.h create mode 100644 qemu-user.c create mode 100644 qom/cpu.c create mode 100644 target-arm/cpu-core.h create mode 100644 target-arm/cpu.c --=20 1.7.7