diff options
author | Dapeng Mi <dapeng1.mi@linux.intel.com> | 2024-08-20 07:38:51 +0000 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2024-10-07 09:28:43 +0200 |
commit | 2eb2802a41a222bf8d78a88f193ce665071c869e (patch) | |
tree | 34e91b877d618b156012f9292b1a52ef0d52242e /arch/x86/kernel/cpu/intel.c | |
parent | 79390db9eb32b2ba63c6be9fb83f12617259011d (diff) | |
download | linux-2eb2802a41a222bf8d78a88f193ce665071c869e.tar.gz linux-2eb2802a41a222bf8d78a88f193ce665071c869e.tar.bz2 linux-2eb2802a41a222bf8d78a88f193ce665071c869e.zip |
x86/cpu/intel: Define helper to get CPU core native ID
Define helper get_this_hybrid_cpu_native_id() to return the CPU core
native ID. This core native ID combining with core type can be used to
figure out the CPU core uarch uniquely.
Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
Tested-by: Yongwei Ma <yongwei.ma@intel.com>
Link: https://lkml.kernel.org/r/20240820073853.1974746-3-dapeng1.mi@linux.intel.com
Diffstat (limited to 'arch/x86/kernel/cpu/intel.c')
-rw-r--r-- | arch/x86/kernel/cpu/intel.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index e7656cbef68d..624397e43ac6 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -1299,3 +1299,18 @@ u8 get_this_hybrid_cpu_type(void) return cpuid_eax(0x0000001a) >> X86_HYBRID_CPU_TYPE_ID_SHIFT; } + +/** + * get_this_hybrid_cpu_native_id() - Get the native id of this hybrid CPU + * + * Returns the uarch native ID [23:0] of a CPU in a hybrid processor. + * If the processor is not hybrid, returns 0. + */ +u32 get_this_hybrid_cpu_native_id(void) +{ + if (!cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) + return 0; + + return cpuid_eax(0x0000001a) & + (BIT_ULL(X86_HYBRID_CPU_TYPE_ID_SHIFT) - 1); +} |