Skip to content

target-i386: move CPU object creation to cpu.c (v2)

Eduardo Habkost qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2target-i386: move CPU object creation to cpu.ctarget-i386/cpu.c target-i386/cpu.h target-i386/helper.c+16 -112 replies
2/2target-i386: make cpu_x86_create() get Error argumenttarget-i386/cpu.c target-i386/cpu.h target-i386/helper.c+21 -102 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/2] target-i386: move CPU object creation to cpu.c (v2)

This small series moves the X86CPU object creation to the cpu.c code, as the object creation will depend on the CPU class lookup, that will be done inside cpu.c.

I expect this to make the x86 CPU subclass work simpler. Maybe it will help simplify some of the CPU properties work, too.

This version is simply a rebase of v1 on top of Igor's series:
Subject: [Qemu-devel] [PATCH 0/6] x86 CPU cleanup (wave 2)

Git branch for testing:
git://github.com/ehabkost/qemu-hacks.git cpu-x86-create.v2
https://github.com/ehabkost/qemu-hacks/tree/cpu-x86-create.v2

As Igor have suggested instead moving cpu_x86_init() to cpu.c, I will try to explain the rationale, here:

The CPU creation consists of multiple steps:

1) Splitting cpu_model string into CPU model name and feature string;
2) Choosing the CPU model class;
3) Creating CPU object;
4) Parsing feature string;
5) cpu_x86_realize()

And:
* cpu_x86_register() already does steps 1 and 4.
* cpu_x86_init() does steps 2, 3, and 5
* We need to separate step 5 from the rest, as step 5 will eventually become the realize() method of the CPU object.

To accomplish that, the first patch in this series simply moves 3 lines of code (steps 2 and 3) from cpu_x86_init() to cpu_x86_register(), and renames cpu_x86_register() to cpu_x86_create(), so now:

* cpu_x86_create() does steps 1 to 4
* cpu_x86_init() simply become a trivial wrapper to call cpu_x86_create() (steps 1-4) and cpu_x86_realize() (step 5)

Eduardo Habkost (2):
target-i386: move CPU object creation to cpu.c
target-i386: make cpu_x86_create() get Error argument

 target-i386/cpu.c    | 22 ++++++++++++++++++----
 target-i386/cpu.h    |  2 +-
 target-i386/helper.c | 26 ++++++++++++++------------
 3 files changed, 33 insertions(+), 17 deletions(-)
Signature · 1 line
1.7.11.7