mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01:00
Store NUMA core mapping in platform interface.
This commit is contained in:
@@ -50,6 +50,7 @@ namespace Genode {
|
|||||||
|
|
||||||
/* map of virtual cpu ids in Genode to kernel cpu ids */
|
/* map of virtual cpu ids in Genode to kernel cpu ids */
|
||||||
uint8_t map_cpu_ids[MAX_SUPPORTED_CPUS];
|
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,
|
addr_t _map_pages(addr_t phys_page, addr_t pages,
|
||||||
bool guard_page = false);
|
bool guard_page = false);
|
||||||
@@ -119,6 +120,10 @@ namespace Genode {
|
|||||||
unsigned pager_index(Affinity::Location location) const;
|
unsigned pager_index(Affinity::Location location) const;
|
||||||
unsigned kernel_cpu_id(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) {
|
Affinity::Location sanitize(Affinity::Location location) {
|
||||||
return Affinity::Location(location.xpos() % _cpus.width(),
|
return Affinity::Location(location.xpos() % _cpus.width(),
|
||||||
location.ypos() % _cpus.height(),
|
location.ypos() % _cpus.height(),
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ Platform::Platform()
|
|||||||
" vs ", sizeof(map_cpu_ids) / sizeof(map_cpu_ids[0]));
|
" vs ", sizeof(map_cpu_ids) / sizeof(map_cpu_ids[0]));
|
||||||
nova_die();
|
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");
|
error("re-ording cpu_id failed");
|
||||||
nova_die();
|
nova_die();
|
||||||
}
|
}
|
||||||
@@ -405,6 +405,8 @@ Platform::Platform()
|
|||||||
size_t const num_mem_desc = (hip.hip_length - hip.mem_desc_offset)
|
size_t const num_mem_desc = (hip.hip_length - hip.mem_desc_offset)
|
||||||
/ hip.mem_desc_size;
|
/ hip.mem_desc_size;
|
||||||
|
|
||||||
|
log("HIP is ", hip.hip_length, " bytes long.");
|
||||||
|
|
||||||
addr_t mem_desc_base = ((addr_t)&hip + hip.mem_desc_offset);
|
addr_t mem_desc_base = ((addr_t)&hip + hip.mem_desc_offset);
|
||||||
|
|
||||||
/* define core's virtual address space */
|
/* define core's virtual address space */
|
||||||
@@ -477,6 +479,7 @@ Platform::Platform()
|
|||||||
bool efi_boot = false;
|
bool efi_boot = false;
|
||||||
size_t kernel_memory = 0;
|
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
|
* All "available" ram must be added to our physical allocator before all
|
||||||
* non "available" regions that overlaps with ram get removed.
|
* 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 base = mem_desc->addr;
|
||||||
uint64_t const size = mem_desc->size;
|
uint64_t const size = mem_desc->size;
|
||||||
log("detected physical memory: ", Hex(base, Hex::PREFIX, Hex::PAD),
|
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;
|
if (!mem_desc->size) continue;
|
||||||
@@ -798,7 +801,7 @@ Platform::Platform()
|
|||||||
cpu->core, ":", cpu->thread);
|
cpu->core, ":", cpu->thread);
|
||||||
|
|
||||||
log(" remap (", location.xpos(), "x", location.ypos(),") -> ",
|
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" : "");
|
boot_cpu() == kernel_cpu_id ? "boot cpu" : "");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user