Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F168962254
D57758.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57758.id.diff
View Options
diff --git a/sys/x86/include/x86_smp.h b/sys/x86/include/x86_smp.h
--- a/sys/x86/include/x86_smp.h
+++ b/sys/x86/include/x86_smp.h
@@ -107,6 +107,8 @@
void set_interrupt_apic_ids(void);
void mem_range_AP_init(void);
void topo_probe(void);
+int cpu_get_pkg_id(int cpu);
+int cpu_get_core_id(int cpu);
/* functions in mp_machdep.c */
void smp_cache_flush(smp_invl_cb_t curcpu_cb);
diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c
--- a/sys/x86/x86/mp_x86.c
+++ b/sys/x86/x86/mp_x86.c
@@ -822,6 +822,28 @@
}
}
+/*
+ * Physical package (socket) id of a logical CPU: its APIC id with the
+ * per-package bits shifted out. For drivers mapping per-socket hardware (e.g.
+ * AMD RAPL package MSRs) onto real sockets, not NUMA domains.
+ */
+int
+cpu_get_pkg_id(int cpu)
+{
+ return (cpu_apic_ids[cpu] >> pkg_id_shift);
+}
+
+/*
+ * Physical core id of a logical CPU: its APIC id with the SMT-thread bits
+ * shifted out, so a core's two siblings share an id. For drivers mapping
+ * per-core hardware (e.g. the SMT-shared AMD RAPL per-core MSR) onto real cores.
+ */
+int
+cpu_get_core_id(int cpu)
+{
+ return (cpu_apic_ids[cpu] >> core_id_shift);
+}
+
/*
* Add a scheduling group, a group of logical processors sharing
* a particular cache (and, thus having an affinity), to the scheduling
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Aug 31, 11:36 PM (7 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37731606
Default Alt Text
D57758.id.diff (1 KB)
Attached To
Mode
D57758: x86: add cpu_get_pkg_id() and cpu_get_core_id() topology helpers
Attached
Detach File
Event Timeline
Log In to Comment