33
44#include <xen/xen.h>
55
6+ #include <asm/intel-family.h>
67#include <asm/apic.h>
78#include <asm/processor.h>
89#include <asm/smp.h>
@@ -27,6 +28,36 @@ void topology_set_dom(struct topo_scan *tscan, enum x86_topology_domains dom,
2728 }
2829}
2930
31+ enum x86_topology_cpu_type get_topology_cpu_type (struct cpuinfo_x86 * c )
32+ {
33+ if (c -> x86_vendor == X86_VENDOR_INTEL ) {
34+ switch (c -> topo .intel_type ) {
35+ case INTEL_CPU_TYPE_ATOM : return TOPO_CPU_TYPE_EFFICIENCY ;
36+ case INTEL_CPU_TYPE_CORE : return TOPO_CPU_TYPE_PERFORMANCE ;
37+ }
38+ }
39+ if (c -> x86_vendor == X86_VENDOR_AMD ) {
40+ switch (c -> topo .amd_type ) {
41+ case 0 : return TOPO_CPU_TYPE_PERFORMANCE ;
42+ case 1 : return TOPO_CPU_TYPE_EFFICIENCY ;
43+ }
44+ }
45+
46+ return TOPO_CPU_TYPE_UNKNOWN ;
47+ }
48+
49+ const char * get_topology_cpu_type_name (struct cpuinfo_x86 * c )
50+ {
51+ switch (get_topology_cpu_type (c )) {
52+ case TOPO_CPU_TYPE_PERFORMANCE :
53+ return "performance" ;
54+ case TOPO_CPU_TYPE_EFFICIENCY :
55+ return "efficiency" ;
56+ default :
57+ return "unknown" ;
58+ }
59+ }
60+
3061static unsigned int __maybe_unused parse_num_cores_legacy (struct cpuinfo_x86 * c )
3162{
3263 struct {
@@ -87,6 +118,7 @@ static void parse_topology(struct topo_scan *tscan, bool early)
87118 .cu_id = 0xff ,
88119 .llc_id = BAD_APICID ,
89120 .l2c_id = BAD_APICID ,
121+ .cpu_type = TOPO_CPU_TYPE_UNKNOWN ,
90122 };
91123 struct cpuinfo_x86 * c = tscan -> c ;
92124 struct {
@@ -132,6 +164,8 @@ static void parse_topology(struct topo_scan *tscan, bool early)
132164 case X86_VENDOR_INTEL :
133165 if (!IS_ENABLED (CONFIG_CPU_SUP_INTEL ) || !cpu_parse_topology_ext (tscan ))
134166 parse_legacy (tscan );
167+ if (c -> cpuid_level >= 0x1a )
168+ c -> topo .cpu_type = cpuid_eax (0x1a );
135169 break ;
136170 case X86_VENDOR_HYGON :
137171 if (IS_ENABLED (CONFIG_CPU_SUP_HYGON ))
0 commit comments