From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
x86@kernel.org, Borislav Petkov <bp@suse.de>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Tony Luck <tony.luck@intel.com>, Len Brown <len.brown@intel.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
linux-kernel@vger.kernel.org,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Dave Hansen <dave.hansen@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH 3/4] x86/cpu/intel: Add function to get name of hybrid CPU types
Date: Fri, 2 Oct 2020 18:17:44 -0700 [thread overview]
Message-ID: <20201003011745.7768-4-ricardo.neri-calderon@linux.intel.com> (raw)
In-Reply-To: <20201003011745.7768-1-ricardo.neri-calderon@linux.intel.com>
Provided a human-friendly string name for each type of CPU micro-
architecture in Intel hybrid parts. This string is to be used in the
CPU type sysfs interface.
In order to uniquely identify CPUs of the same type, compose the name
string as <cpu_type_name>_<native_model_id_nr>.
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Len Brown <len.brown@intel.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
---
arch/x86/include/asm/intel-family.h | 4 ++++
arch/x86/kernel/cpu/cpu.h | 3 +++
arch/x86/kernel/cpu/intel.c | 23 +++++++++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h
index 5e658ba2654a..4ec2272e0049 100644
--- a/arch/x86/include/asm/intel-family.h
+++ b/arch/x86/include/asm/intel-family.h
@@ -133,4 +133,8 @@
/* Family 5 */
#define INTEL_FAM5_QUARK_X1000 0x09 /* Quark X1000 SoC */
+/* Types of CPUs in hybrid parts. */
+#define INTEL_HYBRID_TYPE_ATOM 0x20
+#define INTEL_HYBRID_TYPE_CORE 0x40
+
#endif /* _ASM_X86_INTEL_FAMILY_H */
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index 9d033693519a..b4474238e1f3 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -56,8 +56,11 @@ extern __ro_after_init enum tsx_ctrl_states tsx_ctrl_state;
extern void __init tsx_init(void);
extern void tsx_enable(void);
extern void tsx_disable(void);
+extern const char *intel_get_hybrid_cpu_type_name(u32 cpu_type);
#else
static inline void tsx_init(void) { }
+static inline const char *intel_get_hybrid_cpu_type_name(u32 cpu_type)
+{ return NULL; }
#endif /* CONFIG_CPU_SUP_INTEL */
extern void get_cpu_cap(struct cpuinfo_x86 *c);
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 59a1e3ce3f14..e1dee382cf98 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -1191,3 +1191,26 @@ void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c)
cpu_model_supports_sld = true;
split_lock_setup();
}
+
+static char hybrid_name[64];
+
+const char *intel_get_hybrid_cpu_type_name(u32 cpu_type)
+{
+ u32 native_model_id = cpu_type & X86_HYBRID_CPU_NATIVE_MODEL_ID_MASK;
+ u8 type = cpu_type >> X86_HYBRID_CPU_TYPE_ID_SHIFT;
+
+ switch (type) {
+ case INTEL_HYBRID_TYPE_ATOM:
+ snprintf(hybrid_name, sizeof(hybrid_name), "intel_atom_%u",
+ native_model_id);
+ break;
+ case INTEL_HYBRID_TYPE_CORE:
+ snprintf(hybrid_name, sizeof(hybrid_name), "intel_core_%u",
+ native_model_id);
+ break;
+ default:
+ return NULL;
+ }
+
+ return hybrid_name;
+}
--
2.17.1
next prev parent reply other threads:[~2020-10-03 1:16 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-03 1:17 [PATCH 0/4] drivers core: Introduce CPU type sysfs interface Ricardo Neri
2020-10-03 1:17 ` [PATCH 1/4] " Ricardo Neri
2020-10-03 3:27 ` Randy Dunlap
2020-10-06 1:15 ` Ricardo Neri
2020-10-10 3:14 ` Randy Dunlap
2020-10-03 8:53 ` Greg Kroah-Hartman
2020-10-03 11:05 ` Greg Kroah-Hartman
2020-10-06 1:08 ` Ricardo Neri
2020-10-06 0:57 ` Ricardo Neri
2020-10-06 7:37 ` Greg Kroah-Hartman
2020-10-07 3:14 ` Ricardo Neri
2020-10-07 5:15 ` Greg Kroah-Hartman
2020-10-08 3:34 ` Ricardo Neri
2020-11-12 6:19 ` Brice Goglin
2020-11-12 6:42 ` Greg Kroah-Hartman
2020-11-12 9:10 ` Brice Goglin
2020-11-12 10:49 ` Greg Kroah-Hartman
2020-11-17 15:55 ` Brice Goglin
2020-11-18 10:45 ` Brice Goglin
2020-11-18 10:57 ` Greg Kroah-Hartman
[not found] ` <38f290d2-4c3a-d1b0-f3cc-a0897ea10abd@gmail.com>
2020-11-12 11:34 ` Greg Kroah-Hartman
2020-11-19 8:25 ` Fox Chen
2020-10-03 1:17 ` [PATCH 2/4] x86/cpu: Describe hybrid CPUs in cpuinfo_x86 Ricardo Neri
2020-10-03 4:07 ` kernel test robot
2020-10-03 1:17 ` Ricardo Neri [this message]
2020-10-03 1:17 ` [PATCH 4/4] x86/cpu/topology: Implement the CPU type sysfs interface Ricardo Neri
2020-10-03 3:33 ` Randy Dunlap
2020-10-03 5:28 ` kernel test robot
2020-10-03 8:55 ` Greg Kroah-Hartman
2020-10-06 1:05 ` Ricardo Neri
2020-10-03 8:49 ` [PATCH 0/4] drivers core: Introduce " Borislav Petkov
2020-10-06 0:27 ` Ricardo Neri
2020-10-06 8:51 ` Qais Yousef
2020-10-07 2:50 ` Ricardo Neri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201003011745.7768-4-ricardo.neri-calderon@linux.intel.com \
--to=ricardo.neri-calderon@linux.intel.com \
--cc=ak@linux.intel.com \
--cc=bp@suse.de \
--cc=dave.hansen@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kan.liang@linux.intel.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=ravi.v.shankar@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®