mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
i386/cpu: Introduce bitmap to cache available CPU topology levels
Currently, QEMU checks the specify number of topology domains to detect if there's extended topology levels (e.g., checking nr_dies). With this bitmap, the extended CPU topology (the levels other than SMT, core and package) could be easier to detect without touching the topology details. This is also in preparation for the follow-up to decouple CPUID[0x1F] subleaf with specific topology level. Tested-by: Yongwei Ma <yongwei.ma@intel.com> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Tested-by: Babu Moger <babu.moger@amd.com> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Message-ID: <20240424154929.1487382-10-zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
2613747a79
commit
6ddeb0ec8c
5 changed files with 48 additions and 5 deletions
|
@ -60,6 +60,21 @@ typedef struct X86CPUTopoInfo {
|
|||
unsigned threads_per_core;
|
||||
} X86CPUTopoInfo;
|
||||
|
||||
/*
|
||||
* CPUTopoLevel is the general i386 topology hierarchical representation,
|
||||
* ordered by increasing hierarchical relationship.
|
||||
* Its enumeration value is not bound to the type value of Intel (CPUID[0x1F])
|
||||
* or AMD (CPUID[0x80000026]).
|
||||
*/
|
||||
enum CPUTopoLevel {
|
||||
CPU_TOPO_LEVEL_INVALID,
|
||||
CPU_TOPO_LEVEL_SMT,
|
||||
CPU_TOPO_LEVEL_CORE,
|
||||
CPU_TOPO_LEVEL_DIE,
|
||||
CPU_TOPO_LEVEL_PACKAGE,
|
||||
CPU_TOPO_LEVEL_MAX,
|
||||
};
|
||||
|
||||
/* Return the bit width needed for 'count' IDs */
|
||||
static unsigned apicid_bitwidth_for_count(unsigned count)
|
||||
{
|
||||
|
@ -168,4 +183,12 @@ static inline apic_id_t x86_apicid_from_cpu_idx(X86CPUTopoInfo *topo_info,
|
|||
return x86_apicid_from_topo_ids(topo_info, &topo_ids);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether there's extended topology level (die)?
|
||||
*/
|
||||
static inline bool x86_has_extended_topo(unsigned long *topo_bitmap)
|
||||
{
|
||||
return test_bit(CPU_TOPO_LEVEL_DIE, topo_bitmap);
|
||||
}
|
||||
|
||||
#endif /* HW_I386_TOPOLOGY_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue