mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
nova: Store memory ranges for NUMA nodes.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <platform_generic.h>
|
||||
#include <core_mem_alloc.h>
|
||||
#include <address_space.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
namespace Genode {
|
||||
|
||||
@@ -51,6 +52,7 @@ namespace Genode {
|
||||
/* map of virtual cpu ids in Genode to kernel cpu ids */
|
||||
uint8_t map_cpu_ids[MAX_SUPPORTED_CPUS];
|
||||
uint8_t cpu_numa_map[MAX_SUPPORTED_CPUS];
|
||||
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);
|
||||
@@ -120,10 +122,27 @@ namespace Genode {
|
||||
unsigned pager_index(Affinity::Location location) const;
|
||||
unsigned kernel_cpu_id(Affinity::Location location) const;
|
||||
|
||||
/**
|
||||
* @brief ID of NUMA region the CPU belongs to
|
||||
*
|
||||
* @param kernel_cpu_id id of CPU
|
||||
* @return unsigned ID of corresponding NUMA region
|
||||
*/
|
||||
unsigned domain_of_cpu(unsigned kernel_cpu_id) const {
|
||||
return cpu_numa_map[kernel_cpu_id];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return memory range of a given NUMA region
|
||||
*
|
||||
* @param numa_id ID of NUMA region
|
||||
* @return Genode::Range_allocator::Range physical address range for this NUMA region
|
||||
*/
|
||||
|
||||
Genode::Range_allocator::Range &mem_range(unsigned numa_id) {
|
||||
return numa_mem_ranges[numa_id];
|
||||
}
|
||||
|
||||
Affinity::Location sanitize(Affinity::Location location) {
|
||||
return Affinity::Location(location.xpos() % _cpus.width(),
|
||||
location.ypos() % _cpus.height(),
|
||||
|
||||
@@ -522,6 +522,8 @@ Platform::Platform()
|
||||
|
||||
_io_mem_alloc.remove_range((addr_t)base, (size_t)size);
|
||||
ram_alloc().add_range((addr_t)base, (size_t)size);
|
||||
log("Add mem range ", reinterpret_cast<void*>(base), "-", reinterpret_cast<void*>(base + size), " for node ", mem_desc->domain);
|
||||
numa_mem_ranges[mem_desc->domain] = {base, base + size};
|
||||
}
|
||||
|
||||
addr_t hyp_log = 0;
|
||||
|
||||
Reference in New Issue
Block a user