mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
i386/cpu: Extract a common fucntion to setup value of MSR_CORE_THREAD_COUNT
There are duplicated code to setup the value of MSR_CORE_THREAD_COUNT. Extract a common function for it. Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20241219110125.1266461-2-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
d662b66da4
commit
d3bb5d0d4f
5 changed files with 16 additions and 8 deletions
|
@ -309,3 +309,14 @@ void x86_cpu_get_crash_info_qom(Object *obj, Visitor *v,
|
|||
errp);
|
||||
qapi_free_GuestPanicInformation(panic_info);
|
||||
}
|
||||
|
||||
uint64_t cpu_x86_get_msr_core_thread_count(X86CPU *cpu)
|
||||
{
|
||||
CPUState *cs = CPU(cpu);
|
||||
uint64_t val;
|
||||
|
||||
val = cs->nr_threads * cs->nr_cores; /* thread count, bits 15..0 */
|
||||
val |= ((uint32_t)cs->nr_cores << 16); /* core count, bits 31..16 */
|
||||
|
||||
return val;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue