Store NUMA core mapping in platform interface.

This commit is contained in:
Michael Mueller
2022-10-06 16:07:01 +02:00
parent 3e736fc888
commit ce1a137ddb
2 changed files with 11 additions and 3 deletions

View File

@@ -50,6 +50,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];
addr_t _map_pages(addr_t phys_page, addr_t pages,
bool guard_page = false);
@@ -119,6 +120,10 @@ namespace Genode {
unsigned pager_index(Affinity::Location location) const;
unsigned kernel_cpu_id(Affinity::Location location) const;
unsigned domain_of_cpu(unsigned kernel_cpu_id) const {
return cpu_numa_map[kernel_cpu_id];
}
Affinity::Location sanitize(Affinity::Location location) {
return Affinity::Location(location.xpos() % _cpus.width(),
location.ypos() % _cpus.height(),

View File

@@ -370,7 +370,7 @@ Platform::Platform()
" vs ", sizeof(map_cpu_ids) / sizeof(map_cpu_ids[0]));
nova_die();
}
if (!hip.remap_cpu_ids(map_cpu_ids, (unsigned)boot_cpu())) {
if (!hip.remap_cpu_ids(map_cpu_ids, cpu_numa_map, (unsigned)boot_cpu())) {
error("re-ording cpu_id failed");
nova_die();
}
@@ -405,6 +405,8 @@ Platform::Platform()
size_t const num_mem_desc = (hip.hip_length - hip.mem_desc_offset)
/ hip.mem_desc_size;
log("HIP is ", hip.hip_length, " bytes long.");
addr_t mem_desc_base = ((addr_t)&hip + hip.mem_desc_offset);
/* define core's virtual address space */
@@ -477,6 +479,7 @@ Platform::Platform()
bool efi_boot = false;
size_t kernel_memory = 0;
log("Found ", num_mem_desc, " memory entries in HIP");
/*
* All "available" ram must be added to our physical allocator before all
* non "available" regions that overlaps with ram get removed.
@@ -497,7 +500,7 @@ Platform::Platform()
uint64_t const base = mem_desc->addr;
uint64_t const size = mem_desc->size;
log("detected physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD),
" - size: ", Hex(size, Hex::PREFIX, Hex::PAD));
" - size: ", Hex(size, Hex::PREFIX, Hex::PAD), " - node: ", mem_desc->domain, " type: ", static_cast<uint8_t>(mem_desc->type));
}
if (!mem_desc->size) continue;
@@ -798,7 +801,7 @@ Platform::Platform()
cpu->core, ":", cpu->thread);
log(" remap (", location.xpos(), "x", location.ypos(),") -> ",
kernel_cpu_id, " - ", text, ") ",
kernel_cpu_id, " - ", text, " node: ", cpu->numa_id, ") ",
boot_cpu() == kernel_cpu_id ? "boot cpu" : "");
});
}