From 7cc6d4e82827fa157cd0618198f72d9e853cac23 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Mon, 27 Mar 2023 17:11:00 +0200 Subject: [PATCH] base-nova: Added syscall for querying the CPU vendor. This is helpful to implement CPU vendor-specific features in userspace drivers. --- repos/base-nova/src/core/include/platform.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/repos/base-nova/src/core/include/platform.h b/repos/base-nova/src/core/include/platform.h index c648c84db9..30addd45d3 100644 --- a/repos/base-nova/src/core/include/platform.h +++ b/repos/base-nova/src/core/include/platform.h @@ -20,6 +20,7 @@ #include #include #include +#include namespace Genode { @@ -51,9 +52,13 @@ namespace Genode { /* map of virtual cpu ids in Genode to kernel cpu ids */ uint8_t map_cpu_ids[MAX_SUPPORTED_CPUS]; + + /* map of virtual cpu ids in Genode to kernel NUMA ids */ uint8_t cpu_numa_map[MAX_SUPPORTED_CPUS]; + /* map of kernel NUMA region to Genode memory ranges */ Genode::Range_allocator::Range numa_mem_ranges[MAX_SUPPORTED_CPUS]; // TODO: Add new macro for max of numa regions + addr_t _map_pages(addr_t phys_page, addr_t pages, bool guard_page = false); @@ -164,6 +169,17 @@ namespace Genode { } } } + + /** + * @brief Return NUMA-interal vendor code for CPU + * + */ + Nova::Hip::Cpu_desc::Vendor cpu_vendor() { + extern addr_t __initial_sp; + Nova::Hip const &hip = *(Nova::Hip *)__initial_sp; + + return static_cast(hip.cpu_desc_of_cpu(0)->vendor); + } }; }