From bf340eee91a99b062fc458950ebd9e8552bf90b3 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 1 Aug 2018 14:20:30 +0200 Subject: [PATCH] hw: provide CPU count to core by bootstrap The count is supposed to provide the actual available CPUs, which may not be equal to NR_OF_CPUS. Issue #2929 --- repos/base-hw/src/bootstrap/platform.cc | 2 +- repos/base-hw/src/bootstrap/platform.h | 1 + repos/base-hw/src/core/platform.h | 2 +- repos/base-hw/src/lib/hw/boot_info.h | 7 +++++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/repos/base-hw/src/bootstrap/platform.cc b/repos/base-hw/src/bootstrap/platform.cc index ed05228dcc..211b8b98a8 100644 --- a/repos/base-hw/src/bootstrap/platform.cc +++ b/repos/base-hw/src/bootstrap/platform.cc @@ -198,7 +198,7 @@ Platform::Platform() (addr_t)&core_pd->array, core_pd->mappings, boot_modules, board.core_mmio, board.acpi_rsdp, - board.framebuffer); + board.framebuffer, board.cpus); /* add all left RAM to bootinfo */ ram_alloc.for_each_free_region([&] (Memory_region const & r) { diff --git a/repos/base-hw/src/bootstrap/platform.h b/repos/base-hw/src/bootstrap/platform.h index 7b1047c836..18b8141909 100644 --- a/repos/base-hw/src/bootstrap/platform.h +++ b/repos/base-hw/src/bootstrap/platform.h @@ -47,6 +47,7 @@ class Bootstrap::Platform Mmio_space const core_mmio; Hw::Acpi_rsdp acpi_rsdp { }; Hw::Framebuffer framebuffer { }; + unsigned cpus { NR_OF_CPUS }; Board(); }; diff --git a/repos/base-hw/src/core/platform.h b/repos/base-hw/src/core/platform.h index 302c0129d9..c08223b49c 100644 --- a/repos/base-hw/src/core/platform.h +++ b/repos/base-hw/src/core/platform.h @@ -144,7 +144,7 @@ class Genode::Platform : public Genode::Platform_generic bool supports_direct_unmap() const { return 1; } Affinity::Space affinity_space() const { - return Affinity::Space(NR_OF_CPUS); } + return Affinity::Space(_boot_info().cpus); } /* * The system-wide maximum number of capabilities is constrained diff --git a/repos/base-hw/src/lib/hw/boot_info.h b/repos/base-hw/src/lib/hw/boot_info.h index 513c6ebc7c..2b1bf3fb36 100644 --- a/repos/base-hw/src/lib/hw/boot_info.h +++ b/repos/base-hw/src/lib/hw/boot_info.h @@ -32,6 +32,7 @@ struct Hw::Boot_info Memory_region_array ram_regions { }; Acpi_rsdp const acpi_rsdp; Framebuffer const framebuffer; + unsigned const cpus; Boot_info(addr_t const table, addr_t const table_alloc, @@ -39,10 +40,12 @@ struct Hw::Boot_info Mapping const boot_modules, Mmio_space const mmio_space, Acpi_rsdp const &acpi_rsdp, - Framebuffer const &fb) + Framebuffer const &fb, + unsigned const &cpus) : table(table), table_allocator(table_alloc), elf_mappings(elf_mappings), boot_modules(boot_modules), - mmio_space(mmio_space), acpi_rsdp(acpi_rsdp), framebuffer(fb) {} + mmio_space(mmio_space), acpi_rsdp(acpi_rsdp), framebuffer(fb), + cpus(cpus) {} }; #endif /* _SRC__LIB__HW__BOOT_INFO_H_ */