X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=kitten%2Finclude%2Flwk%2Fcpuinfo.h;fp=kitten%2Finclude%2Flwk%2Fcpuinfo.h;h=f7c4152fea373b805660bb12c9a81ae73eed7e43;hb=66a1a4c7a9edcd7d8bc207aca093d694a6e6b5b2;hp=0000000000000000000000000000000000000000;hpb=f7cf9c19ecb0a589dd45ae0d2c91814bd3c2acc2;p=palacios-OLD.git diff --git a/kitten/include/lwk/cpuinfo.h b/kitten/include/lwk/cpuinfo.h new file mode 100644 index 0000000..f7c4152 --- /dev/null +++ b/kitten/include/lwk/cpuinfo.h @@ -0,0 +1,47 @@ +#ifndef _LWK_CPUINFO_H +#define _LWK_CPUINFO_H + +#include +#include +#include +#include +#include + +/** + * CPU information. + * Each CPU in the system is described by one of these structures. + */ +struct cpuinfo { + /* Identification */ + uint16_t logical_id; // CPU's kernel assigned ID + uint16_t physical_id; // CPU's hardware ID + + /* Topology information */ + uint16_t numa_node_id; // NUMA node ID this CPU is in + cpumask_t numa_node_map; // CPUs in this CPU's NUMA node + cpumask_t llc_share_map; // CPUs sharing last level cache + + /* Physical packaging */ + uint16_t phys_socket_id; // Physical socket/package + uint16_t phys_core_id; // Core ID in the socket/package + uint16_t phys_hwthread_id; // Hardware thread ID in core + + /* Memory management info */ + vmpagesize_t pagesz_mask; // Page sizes supported by the CPU + + /* Architecture specific */ + struct arch_cpuinfo arch; +} ____cacheline_aligned; + +extern struct cpuinfo cpu_info[NR_CPUS]; +extern cpumask_t cpu_present_map; +extern cpumask_t cpu_online_map; + +/** + * Returns the number of CPUs in the system. + */ +#define num_cpus() cpus_weight(cpu_present_map) + +extern void print_cpuinfo(struct cpuinfo *); + +#endif