diff --git a/base-hw/src/core/arndale/platform_support.cc b/base-hw/src/core/arndale/platform_support.cc index 1b73b65a2..f57b1c026 100644 --- a/base-hw/src/core/arndale/platform_support.cc +++ b/base-hw/src/core/arndale/platform_support.cc @@ -17,43 +17,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::PWM_IRQ_0, - Board::USB_HOST20_IRQ, - Board::USB_DRD30_IRQ, - Board::SATA_IRQ, - Board::I2C_HDMI_IRQ, - Board::SDMMC0_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - Native_region * Platform::_ram_regions(unsigned const i) { diff --git a/base-hw/src/core/imx31/platform_support.cc b/base-hw/src/core/imx31/platform_support.cc index 769812ce0..2f2622290 100644 --- a/base-hw/src/core/imx31/platform_support.cc +++ b/base-hw/src/core/imx31/platform_support.cc @@ -16,39 +16,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::EPIT_2_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] = diff --git a/base-hw/src/core/imx53/no_trustzone/platform_support.cc b/base-hw/src/core/imx53/no_trustzone/platform_support.cc index 3bc7be34a..dfae34b92 100644 --- a/base-hw/src/core/imx53/no_trustzone/platform_support.cc +++ b/base-hw/src/core/imx53/no_trustzone/platform_support.cc @@ -16,55 +16,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::EPIT_2_IRQ, - Board::GPIO1_IRQL, - Board::GPIO1_IRQH, - Board::GPIO2_IRQL, - Board::GPIO2_IRQH, - Board::GPIO3_IRQL, - Board::GPIO3_IRQH, - Board::GPIO4_IRQL, - Board::GPIO4_IRQH, - Board::GPIO5_IRQL, - Board::GPIO5_IRQH, - Board::GPIO6_IRQL, - Board::GPIO6_IRQH, - Board::GPIO7_IRQL, - Board::GPIO7_IRQH, - Board::I2C_2_IRQ, - Board::I2C_3_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] = diff --git a/base-hw/src/core/imx53/trustzone/platform_support.cc b/base-hw/src/core/imx53/trustzone/platform_support.cc index 74ae1ef20..9bea14a99 100644 --- a/base-hw/src/core/imx53/trustzone/platform_support.cc +++ b/base-hw/src/core/imx53/trustzone/platform_support.cc @@ -18,55 +18,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::EPIT_2_IRQ, - Board::GPIO1_IRQL, - Board::GPIO1_IRQH, - Board::GPIO2_IRQL, - Board::GPIO2_IRQH, - Board::GPIO3_IRQL, - Board::GPIO3_IRQH, - Board::GPIO4_IRQL, - Board::GPIO4_IRQH, - Board::GPIO5_IRQL, - Board::GPIO5_IRQH, - Board::GPIO6_IRQL, - Board::GPIO6_IRQH, - Board::GPIO7_IRQL, - Board::GPIO7_IRQH, - Board::I2C_2_IRQ, - Board::I2C_3_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] = diff --git a/base-hw/src/core/kernel/configuration.h b/base-hw/src/core/kernel/configuration.h index fee68cd39..2b6d10885 100644 --- a/base-hw/src/core/kernel/configuration.h +++ b/base-hw/src/core/kernel/configuration.h @@ -21,7 +21,7 @@ namespace Kernel USER_LAP_TIME_MS = 100, MAX_PDS = 256, MAX_THREADS = 256, - MAX_SIGNAL_RECEIVERS = 256, + MAX_SIGNAL_RECEIVERS = 2048, MAX_SIGNAL_CONTEXTS = 2048, MAX_VMS = 4, MAX_PRIORITY = 128, diff --git a/base-hw/src/core/kernel/kernel.cc b/base-hw/src/core/kernel/kernel.cc index 4ac3e0995..bbb52eb4b 100644 --- a/base-hw/src/core/kernel/kernel.cc +++ b/base-hw/src/core/kernel/kernel.cc @@ -34,6 +34,7 @@ #include /* base-hw includes */ +#include #include using namespace Kernel; @@ -55,8 +56,6 @@ namespace Kernel typedef Genode::umword_t umword_t; typedef Genode::Core_tlb Core_tlb; typedef Genode::Core_thread_id Core_thread_id; - - void init_platform(); } namespace Kernel @@ -120,6 +119,20 @@ namespace Kernel * Get core attributes */ unsigned core_id() { return core()->id(); } + + /** + * Return wether an interrupt is private to the kernel + * + * \param interrupt_id kernel name of the targeted interrupt + */ + bool private_interrupt(unsigned const interrupt_id) + { + bool ret = 0; + for (unsigned i = 0; i < PROCESSORS; i++) { + ret |= interrupt_id == Timer::interrupt_id(i); + } + return ret; + } } @@ -264,8 +277,13 @@ extern "C" void init_kernel_multiprocessor() t.sp = (addr_t)s + STACK_SIZE; t.init(processor_pool()->processor(processor_id), core(), &utcb, 1); + /* initialize interrupt objects */ + static Genode::uint8_t _irqs[Pic::MAX_INTERRUPT_ID * sizeof(Irq)]; + for (unsigned i = 0; i < Pic::MAX_INTERRUPT_ID; i++) { + if (private_interrupt(i)) { continue; } + new (&_irqs[i * sizeof(Irq)]) Irq(i); + } /* kernel initialization finished */ - init_platform(); Genode::printf("kernel initialized\n"); } reset_scheduling_time(processor_id); diff --git a/base-hw/src/core/odroid_xu/platform_support.cc b/base-hw/src/core/odroid_xu/platform_support.cc index 4ee53c2c2..5f7ede089 100644 --- a/base-hw/src/core/odroid_xu/platform_support.cc +++ b/base-hw/src/core/odroid_xu/platform_support.cc @@ -17,39 +17,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::PWM_IRQ_0, -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] = diff --git a/base-hw/src/core/panda/platform_support.cc b/base-hw/src/core/panda/platform_support.cc index a82f11513..1ef20a318 100644 --- a/base-hw/src/core/panda/platform_support.cc +++ b/base-hw/src/core/panda/platform_support.cc @@ -16,49 +16,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::GP_TIMER_3_IRQ, - Board::TL16C750_1_IRQ, - Board::TL16C750_2_IRQ, - Board::TL16C750_4_IRQ, - Board::GPIO1_IRQ, - Board::GPIO2_IRQ, - Board::GPIO3_IRQ, - Board::GPIO4_IRQ, - Board::GPIO5_IRQ, - Board::GPIO6_IRQ, - Board::HSUSB_EHCI_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] = diff --git a/base-hw/src/core/pbxa9/platform_support.cc b/base-hw/src/core/pbxa9/platform_support.cc index bbc8b1d98..3cc331396 100644 --- a/base-hw/src/core/pbxa9/platform_support.cc +++ b/base-hw/src/core/pbxa9/platform_support.cc @@ -16,46 +16,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::SP804_0_1_IRQ, - Board::KMI_0_IRQ, - Board::KMI_1_IRQ, - Board::ETHERNET_IRQ, - Board::PL011_1_IRQ, - Board::PL011_2_IRQ, - Board::PL011_3_IRQ, - Board::PL180_IRQ_0, - Board::PL180_IRQ_1 -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - Native_region * Platform::_ram_regions(unsigned const i) { diff --git a/base-hw/src/core/platform.cc b/base-hw/src/core/platform.cc index 71112075d..d04c8c522 100644 --- a/base-hw/src/core/platform.cc +++ b/base-hw/src/core/platform.cc @@ -19,6 +19,7 @@ /* core includes */ #include #include +#include #include using namespace Genode; @@ -120,11 +121,8 @@ Platform::Platform() init_alloc(&_core_mem_alloc, _ram_regions, _core_only_ram_regions, psl2); /* make interrupts available to the interrupt allocator */ - for (unsigned i = 0; ; i++) { - unsigned * const irq = _irq(i); - if (!irq) { break; } - _irq_alloc.add_range(*irq, 1); - } + for (unsigned i = 0; i < Kernel::Pic::MAX_INTERRUPT_ID; i++) + _irq_alloc.add_range(i, 1); /* * Use byte granuarity for MMIO regions because on some platforms, devices diff --git a/base-hw/src/core/rpi/platform_support.cc b/base-hw/src/core/rpi/platform_support.cc index be149680d..247dfc047 100644 --- a/base-hw/src/core/rpi/platform_support.cc +++ b/base-hw/src/core/rpi/platform_support.cc @@ -15,40 +15,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::TIMER_IRQ, - Board::DWC_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] = diff --git a/base-hw/src/core/vea9x4/no_trustzone/platform_support.cc b/base-hw/src/core/vea9x4/no_trustzone/platform_support.cc index 60eb4441c..84fd95664 100644 --- a/base-hw/src/core/vea9x4/no_trustzone/platform_support.cc +++ b/base-hw/src/core/vea9x4/no_trustzone/platform_support.cc @@ -16,46 +16,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - */ -static unsigned irq_ids[] = -{ - Board::SP804_0_1_IRQ, - Board::KMI_0_IRQ, - Board::KMI_1_IRQ, - Board::LAN9118_IRQ, - Board::PL180_0_IRQ, - Board::PL180_1_IRQ, - Board::PL011_1_IRQ, - Board::PL011_2_IRQ, - Board::PL011_3_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - Native_region * Platform::_ram_regions(unsigned const i) { diff --git a/base-hw/src/core/vea9x4/trustzone/platform_support.cc b/base-hw/src/core/vea9x4/trustzone/platform_support.cc index 39c076e1f..9726995d4 100644 --- a/base-hw/src/core/vea9x4/trustzone/platform_support.cc +++ b/base-hw/src/core/vea9x4/trustzone/platform_support.cc @@ -18,46 +18,9 @@ #include #include #include -#include using namespace Genode; -namespace Kernel { void init_platform(); } - -/** - * Interrupts that core shall provide to users - * - * Interrupts that are used by the non-secure world are also - * not provided to the secure-world Genode to prevent contention. - */ -static unsigned irq_ids[] = -{ - Board::PL180_0_IRQ, - Board::PL180_1_IRQ, - Board::PL011_1_IRQ, - Board::PL011_2_IRQ, - Board::PL011_3_IRQ -}; - -enum { IRQ_IDS_SIZE = sizeof(irq_ids)/sizeof(irq_ids[0]) }; - - -void Kernel::init_platform() -{ - /* make user IRQs become known by cores IRQ session backend and kernel */ - static uint8_t _irqs[IRQ_IDS_SIZE][sizeof(Irq)]; - for (unsigned i = 0; i < IRQ_IDS_SIZE; i++) { - new (_irqs[i]) Irq(irq_ids[i]); - } -} - - -unsigned * Platform::_irq(unsigned const i) -{ - return i < IRQ_IDS_SIZE ? &irq_ids[i] : 0; -} - - Native_region * Platform::_ram_regions(unsigned const i) { static Native_region _regions[] =