qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 00/20] generic_cpu_init() and generic_cpu_create() fun


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 00/20] generic_cpu_init() and generic_cpu_create() functions
Date: Tue, 18 Dec 2012 18:03:53 -0200

This is just a proof of concept, of how I think we could gradually move to
make the architectures share CPU creation/initialization code.

I have implemented a quick cpu_realize() function, just for testing, while we
don't have qdev realizefn support implemented.

I have converted the following targets to use generic_cpu_init(): openrisc, arm,
m68k, unicore32.

To support other architectures with additional CPU lookup requirements
(automatically adding "<arch>-cpu" suffix, or CPU model aliases), we can simply
add fields to CPUClass for the target-specific behavior, that can be used by
generic_cpu_create(). We can also extend generic_cpu_init() later to support
parsing of "+feature,-feature" feature strings, to set properties on the CPU
objects, like on x86.

Note that this series is completely untested except for checking if the code
compiles. I am just using the series as a way to demonstrate what I have in
mind.


Eduardo Habkost (20):
  qemu-common.h: "use" env parameter in no-op version of
    qemu_init_vcpu()
  cpu: introduce CPU_GET_ENV macros
  cpu: make cpu_init return CPUState QOM object
  cpu: replace trivial old_cpu_init functions
  alpha: convert cpu_init to QOM
  m68k: convert cpu_init to QOM
  target-unicore32: convert cpu_init to QOM
  cpu: move cpu_model_str to CPUState
  cpu: introduce cpu_realize()
  cpu: introduce generic_cpu_init() & generic_cpu_create() functions
  target-openrisc: implement CPU realize() method
  hw/openrisc_sim.c: coding style/indentation fix
  target-openrisc: replace cpu_openrisc_init() with generic_cpu_init()
  target-arm: move final steps of cpu_arm_init() to realize function
  target-arm: replace cpu_arm_init() with generic_cpu_init()
  target-m68k: move final steps of cpu_m68k_init() to realize function
  target-m68k: replace cpu_m68k_init() with generic_cpu_init()
  target-unicore32: move final steps of uc32_cpu_init() to realize
    function
  target-unicore32: replace uc32_cpu_init() with generic_cpu_init()
  cpu: convert cpu_copy() to QOM

 bsd-user/main.c             |  2 +-
 cpu-all.h                   |  1 -
 cpu-defs.h                  |  1 -
 exec.c                      |  8 +++--
 hw/alpha_dp264.c            |  2 +-
 hw/an5206.c                 |  2 +-
 hw/dummy_m68k.c             |  2 +-
 hw/mcf5208.c                |  2 +-
 hw/openrisc_sim.c           |  4 +--
 hw/puv3.c                   |  2 +-
 hw/shix.c                   |  2 +-
 include/qemu/cpu.h          | 42 ++++++++++++++++++++++
 linux-user/main.c           |  2 +-
 linux-user/syscall.c        |  2 +-
 qemu-common.h               |  2 +-
 qom/cpu.c                   | 48 +++++++++++++++++++++++++
 target-alpha/cpu-qom.h      |  7 ++++
 target-alpha/cpu.h          |  2 +-
 target-alpha/translate.c    |  6 ++--
 target-arm/cpu-qom.h        |  8 ++++-
 target-arm/cpu.c            | 76 ++++++++++++++++++++++++++++++++++++++-
 target-arm/cpu.h            | 13 +++----
 target-arm/helper.c         | 87 ---------------------------------------------
 target-cris/cpu-qom.h       |  7 ++++
 target-cris/cpu.h           |  9 +----
 target-i386/cpu-qom.h       |  7 ++++
 target-i386/cpu.h           |  9 +----
 target-i386/helper.c        |  4 +--
 target-lm32/cpu-qom.h       |  7 ++++
 target-lm32/cpu.h           |  9 +----
 target-m68k/cpu-qom.h       |  7 ++++
 target-m68k/cpu.c           | 52 ++++++++++++++++++++++++++-
 target-m68k/cpu.h           |  3 +-
 target-m68k/helper.c        | 59 ------------------------------
 target-microblaze/cpu-qom.h |  7 ++++
 target-microblaze/cpu.h     |  9 +----
 target-mips/cpu-qom.h       |  7 ++++
 target-mips/cpu.h           |  9 +----
 target-mips/translate.c     |  2 +-
 target-openrisc/cpu.c       | 25 ++++---------
 target-openrisc/cpu.h       | 17 ++++-----
 target-ppc/cpu-qom.h        |  7 ++++
 target-ppc/cpu.h            |  9 +----
 target-ppc/helper.c         |  2 +-
 target-s390x/cpu-qom.h      |  7 ++++
 target-s390x/cpu.h          |  2 +-
 target-s390x/helper.c       |  2 +-
 target-sh4/cpu-qom.h        |  7 ++++
 target-sh4/cpu.h            |  9 +----
 target-sh4/translate.c      |  2 +-
 target-sparc/cpu-qom.h      |  7 ++++
 target-sparc/cpu.c          |  2 +-
 target-sparc/cpu.h          |  9 +----
 target-unicore32/cpu-qom.h  |  7 ++++
 target-unicore32/cpu.c      | 23 +++++++++++-
 target-unicore32/cpu.h      |  5 +--
 target-unicore32/helper.c   | 21 -----------
 target-xtensa/cpu-qom.h     |  7 ++++
 target-xtensa/cpu.h         |  9 +----
 59 files changed, 394 insertions(+), 315 deletions(-)

-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]