qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/4] Initialize nr_cores and nr_threads early and related clearup
@ 2024-11-08  7:06 Xiaoyao Li
  2024-11-08  7:06 ` [PATCH v1 1/4] cpu: Introduce qemu_early_init_vcpu() to initialize nr_cores and nr_threads inside it Xiaoyao Li
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Xiaoyao Li @ 2024-11-08  7:06 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Peter Maydell, Michael Rolnik, Brian Cain, Song Gao,
	Laurent Vivier, Edgar E. Iglesias, Aurelien Jarno, Palmer Dabbelt,
	Alistair Francis, Bin Meng, Thomas Huth, David Hildenbrand,
	Mark Cave-Ayland, Artyom Tarasenko, Bastian Koppelmann,
	Max Filippov, qemu-devel, xiaoyao.li

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(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2024-12-05 11:54 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08  7:06 [PATCH v1 0/4] Initialize nr_cores and nr_threads early and related clearup Xiaoyao Li
2024-11-08  7:06 ` [PATCH v1 1/4] cpu: Introduce qemu_early_init_vcpu() to initialize nr_cores and nr_threads inside it Xiaoyao Li
2024-11-22 16:03   ` [PATCH] cpu: Initialize nr_cores and nr_threads in cpu_common_initfn() Xiaoyao Li
2024-11-22 17:26     ` Philippe Mathieu-Daudé
2024-11-22 19:17       ` Richard Henderson
2024-11-25  9:38     ` Igor Mammedov
2024-11-29  7:12       ` Xiaoyao Li
2024-12-05 11:53       ` Xiaoyao Li
2024-11-08  7:06 ` [PATCH v1 2/4] i386/cpu: Set up CPUID_HT in x86_cpu_expand_features() instead of cpu_x86_cpuid() Xiaoyao Li
2024-12-05  7:19   ` Zhao Liu
2024-12-05  7:54     ` Xiaoyao Li
2024-12-05  8:31       ` Zhao Liu
2024-12-05  8:34         ` Xiaoyao Li
2024-11-08  7:06 ` [PATCH v1 3/4] i386/cpu: Set and track CPUID_EXT3_CMP_LEG in env->features[FEAT_8000_0001_ECX] Xiaoyao Li
2024-11-08  7:06 ` [PATCH v1 4/4] i386/cpu: Rectify the comment on order dependency on qemu_init_vcpu() Xiaoyao Li
2024-11-11 10:49 ` [PATCH v1 0/4] Initialize nr_cores and nr_threads early and related clearup David Hildenbrand
2024-11-21 16:24   ` Xiaoyao Li
2024-11-21 17:39     ` Philippe Mathieu-Daudé
2024-11-21 18:52     ` Paolo Bonzini
2024-11-22  2:40       ` Xiaoyao Li
2024-11-22  9:44         ` David Hildenbrand
2024-11-22  9:53           ` Paolo Bonzini
2024-12-05  7:30 ` Zhao Liu
2024-12-05  8:05   ` Xiaoyao Li
2024-12-05  8:48     ` Zhao Liu
2024-12-05  8:50       ` Xiaoyao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).