Skip to content

Initialize nr_cores and nr_threads early and related clearup

Xiaoyao Li qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4cpu: Introduce qemu_early_init_vcpu() to initialize nr_cores and nr_threads inside itaccel/tcg/user-exec-stub.c hw/core/cpu-common.c include/hw/core/cpu.h +20 more+56 -26 replies
2/4i386/cpu: Set up CPUID_HT in x86_cpu_expand_features() instead of cpu_x86_cpuid()target/i386/cpu.c+5 -14 replies
3/4i386/cpu: Set and track CPUID_EXT3_CMP_LEG in env->features[FEAT_8000_0001_ECX]target/i386/cpu.c+9 -110 replies
4/4i386/cpu: Rectify the comment on order dependency on qemu_init_vcpu()target/i386/cpu.c+15 -180 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH v1 0/4] Initialize nr_cores and nr_threads early and related clearup

This series is extracted from TDX QEMU v6[1] series per Paolo's request.

It is originally motivated by x86 TDX to track CPUID_HT in env->features[] which requires nr_cores and nr_cores being initialized earlier than in qemu_init_vcpu().

Initialize of nr_cores and nr_threads earlier in x86's cpu_realizefn() can make it work for x86 but it's duplicated with the initialization in qemu_init_vcpu() which are used by all the ARCHes. Since initialize them earlier also work for other ARCHes, introduce qemu_init_early_vcpu() to hold the initialization of nr_cores and nr_threads and call it at the beginning in realizefn() for each ARCH.

Note, I only tested it for x86 ARCH. Please help test on other ARCHes.

The following patch 2 - 4 are x86 specific.

[1] https://lore.kernel.org/qemu-devel/CABgObfZVxaQL4FSJX396kAJ67Qp=XhEWwcmv+NQZCbdpfbV9xg@mail.gmail.com/

Xiaoyao Li (4):
cpu: Introduce qemu_early_init_vcpu() to initialize nr_cores and
nr_threads inside it
i386/cpu: Set up CPUID_HT in x86_cpu_expand_features() instead of

    cpu_x86_cpuid()
  i386/cpu: Set and track CPUID_EXT3_CMP_LEG in
    env->features[FEAT_8000_0001_ECX]

i386/cpu: Rectify the comment on order dependency on qemu_init_vcpu()

 accel/tcg/user-exec-stub.c |  4 +++
 hw/core/cpu-common.c       |  2 +-
 include/hw/core/cpu.h      |  8 +++++
 system/cpus.c              |  6 +++-
 target/alpha/cpu.c         |  2 ++
 target/arm/cpu.c           |  2 ++
 target/avr/cpu.c           |  2 ++
 target/hexagon/cpu.c       |  2 ++
 target/hppa/cpu.c          |  2 ++
 target/i386/cpu.c          | 61 +++++++++++++++++++-------------------
 target/loongarch/cpu.c     |  2 ++
 target/m68k/cpu.c          |  2 ++
 target/microblaze/cpu.c    |  2 ++
 target/mips/cpu.c          |  2 ++
 target/openrisc/cpu.c      |  2 ++
 target/ppc/cpu_init.c      |  2 ++
 target/riscv/cpu.c         |  2 ++
 target/rx/cpu.c            |  2 ++
 target/s390x/cpu.c         |  2 ++
 target/sh4/cpu.c           |  2 ++
 target/sparc/cpu.c         |  2 ++
 target/tricore/cpu.c       |  2 ++
 target/xtensa/cpu.c        |  2 ++
 23 files changed, 85 insertions(+), 32 deletions(-)
Signature · 1 line
2.34.1