[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/28] pc: Add x86_topo_ids_from_apicid()
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PULL 06/28] pc: Add x86_topo_ids_from_apicid() |
Date: |
Tue, 19 Jul 2016 14:22:34 -0300 |
From: Igor Mammedov <address@hidden>
It's reverse of apicid_from_topo_ids() and will be used in follow up
patches to fill in data structures for query-hotpluggable-cpus and
for user friendly error reporting.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
include/hw/i386/topology.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h
index fc95572..1ebaee0 100644
--- a/include/hw/i386/topology.h
+++ b/include/hw/i386/topology.h
@@ -117,6 +117,21 @@ static inline void x86_topo_ids_from_idx(unsigned nr_cores,
topo->pkg_id = core_index / nr_cores;
}
+/* Calculate thread/core/package IDs for a specific topology,
+ * based on APIC ID
+ */
+static inline void x86_topo_ids_from_apicid(apic_id_t apicid,
+ unsigned nr_cores,
+ unsigned nr_threads,
+ X86CPUTopoInfo *topo)
+{
+ topo->smt_id = apicid &
+ ~(0xFFFFFFFFUL << apicid_smt_width(nr_cores, nr_threads));
+ topo->core_id = (apicid >> apicid_core_offset(nr_cores, nr_threads)) &
+ ~(0xFFFFFFFFUL << apicid_core_width(nr_cores, nr_threads));
+ topo->pkg_id = apicid >> apicid_pkg_offset(nr_cores, nr_threads);
+}
+
/* Make APIC ID for the CPU 'cpu_index'
*
* 'cpu_index' is a sequential, contiguous ID for the CPU.
--
2.5.5
- [Qemu-devel] [PULL 00/28] x86 queue for -rc0, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 01/28] target-i386: Provide TCG_PHYS_ADDR_BITS, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 02/28] target-i386: Allow physical address bits to be set, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 03/28] target-i386: Mask mtrr mask based on CPU physical address limits, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 05/28] target-i386: Use uint32_t for X86CPU.apic_id, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 04/28] target-i386: Fill high bits of mtrr mask, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 06/28] pc: Add x86_topo_ids_from_apicid(),
Eduardo Habkost <=
- [Qemu-devel] [PULL 07/28] target-i386: Set physical address bits based on host, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 09/28] pc: cpu: Consolidate apic-id validity checks in pc_cpu_pre_plug(), Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 08/28] pc: Extract CPU lookup into a separate function, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 10/28] target-i386: Replace custom apic-id setter/getter with static property, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 11/28] target-i386: Add socket/core/thread properties to X86CPU, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 12/28] target-i386: Add support for UMIP and RDPID CPUID bits, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 13/28] target-i386: cpu: Do not ignore error and fix apic parent, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 14/28] target-i386: Fix apic object leak when CPU is deleted, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 15/28] pc: Set APIC ID based on socket/core/thread ids if it's not been set yet, Eduardo Habkost, 2016/07/19
- [Qemu-devel] [PULL 17/28] pc: Register created initial and hotpluged CPUs in one place pc_cpu_plug(), Eduardo Habkost, 2016/07/19