Interrupts in L4Linux

Sebastian Sumpf Sebastian.Sumpf at ...1...
Mon Mar 18 20:13:30 CET 2013

Hi Alexander,

On 03/18/2013 04:51 PM, Alexander Tarasikov wrote:
> Hello, Genode Hackers!
> I'm currently implementing an X86 PCI bus driver for L4Linux as a
> temporary solution for
> getting USB support in L4Linux.
> Current genode-side code is presented below. The l4linux patch is not
> ready, but I've
> submitted the relevant part of the diff to pastebin (it's only
> makefile and kconfig anyway)
> I have implemented the linux driver which calls the Genode pci service
> routines. I have
> also extended the l4lx io library to allow mapping pci memory space.
> With this patches,
> the ehci and ohci drivers probe in linux, but fail to work because
> interrupts are not triggered.
> I have implemented the fake irq thread which kicks the irq handler
> every millisecond and
> with that usb works. This indicates that the pci subsystem and memory
> mapping are
> I've got some questions regarding interrupt handling in L4Linux and
> Genode in general.
> 1. Why are NR_IRQS_HW interrupts reserved on X86 in l4linux? The EHCI controller
> wants the interrupt number 11 which is lower than NR_IRQS_HW. Ok, I
> worked around
> that by editing the constant and removing the "BUG_ON(NR_REQUESTABLE < 1)"
> in arch/l4/kernel/irq.c init_array function
> 2. How are capabilities actually assigned? it would seem to me that
> l4x_register_irq allocates the capabilitiies in the first available
> slot, but l4x_have_irqcap looks
> it up by index. I've worked around it by explicitely allocating 12
> capabilities via l4x_cap_alloc,
> but still got error -2004 on irq attach. Now, I've had success in
> attaching irq after I allocated
> the capability via the following code in l4lx:
> Genode::Foc_cpu_session_client cpu(Genode::env()->cpu_session_cap());
> p->irq_cap = cpu.alloc_irq().dst();
> 3. what's the purpose of multiplying the irq number by four in
> l4_msgtag_t ret = l4_irq_attach(p->irq_cap, data->irq << 2,
> l4x_cpu_thread_get_cap(p->cpu));?
> As far as I can see, in the base-foc irq implementation, irq number is
> never multiplied
> 4. non-genode question, probably. Do EHCI/PCI interrupts need a
> special kick to work? I've
> tried using Genode::Irq_session for irq11, but wait_for_irq never
> returns. On the other hand, I've
> tried the regular linux iso on the same machine (which is actually
> qemu) and the ehci interrupt
> is indeed 11 and it works fine there.
> So, the question is, why is interrupt handling broken and the only
> working interrupt in l4linux is timer
> which actually uses L4 timer ipc instead of irq and how this should be
> fixed. Also, what do you think
> of making a "genode" arch for linux and getting rid of l4linux which
> uses the Fiasco.OC API bypassing
> Genode interfaces?

Since you are on x86 and it's interrupt eleven you are concerned about
(is this Qemu?), I have one suggestion: Fiasco.OC on x86 uses the APIC
instead of the aged PIC as interrupt controller. This means that the
EHCI controller might not have IRQ 11 (on real hardware) or might have
another interrupt mode on Qemu (lately IRQ 11 uses level/high instead of
edge/high as trigger). To solve issues like that there is an ACPI driver
in Genode. Please try adding 'drivers/acpi' to your scenario,

<start name="acpi">
  <resource name="RAM" quantum="2M"/>
  <binary name="acpi_drv"/>
    <service name="PCI"/>
    <service name="IRQ" />
    <service name="PCI"> <any-child /> </service>
    <any-service> <parent/> <any-child /> </any-service>

to your configuration file/run script, and remove the 'pci_drv' from
your configuartion, since the driver will be started by the 'acpi_drv'.

Hope this helps,


More information about the users mailing list