hw: don't implement IRQ usage policy in core

Fix #995
Fix #1112
Fix #1113
This commit is contained in:
Stefan Kalkowski 2014-04-04 17:36:05 +02:00 committed by Christian Helmuth
parent a9521853bd
commit b5fe1d752b
13 changed files with 25 additions and 377 deletions

View File

@ -17,43 +17,9 @@
#include <pic.h>
#include <processor_driver.h>
#include <timer.h>
#include <kernel/irq.h>
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)
{

View File

@ -16,39 +16,9 @@
#include <board.h>
#include <pic.h>
#include <processor_driver.h>
#include <kernel/irq.h>
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[] =

View File

@ -16,55 +16,9 @@
#include <board.h>
#include <pic.h>
#include <processor_driver.h>
#include <kernel/irq.h>
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[] =

View File

@ -18,55 +18,9 @@
#include <board.h>
#include <pic.h>
#include <processor_driver.h>
#include <kernel/irq.h>
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[] =

View File

@ -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,

View File

@ -34,6 +34,7 @@
#include <unmanaged_singleton.h>
/* base-hw includes */
#include <kernel/irq.h>
#include <kernel/perf_counter.h>
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);

View File

@ -17,39 +17,9 @@
#include <pic.h>
#include <processor_driver.h>
#include <timer.h>
#include <kernel/irq.h>
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[] =

View File

@ -16,49 +16,9 @@
#include <board.h>
#include <processor_driver.h>
#include <pic.h>
#include <kernel/irq.h>
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[] =

View File

@ -16,46 +16,9 @@
#include <board.h>
#include <processor_driver.h>
#include <pic.h>
#include <kernel/irq.h>
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)
{

View File

@ -19,6 +19,7 @@
/* core includes */
#include <core_parent.h>
#include <platform.h>
#include <pic.h>
#include <util.h>
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

View File

@ -15,40 +15,9 @@
#include <platform.h>
#include <board.h>
#include <processor_driver.h>
#include <kernel/irq.h>
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[] =

View File

@ -16,46 +16,9 @@
#include <board.h>
#include <processor_driver.h>
#include <pic.h>
#include <kernel/irq.h>
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)
{

View File

@ -18,46 +18,9 @@
#include <processor_driver.h>
#include <platform.h>
#include <pic/vea9x4_trustzone.h>
#include <kernel/irq.h>
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[] =