L4linux IPC communication with L4re application

Matthias Lange matthias.lange at kernkonzept.com
Tue Mar 15 17:29:55 CET 2016


On 03/15/2016 05:20 PM, ba_f wrote:
> Am 2016-03-10 00:36, schrieb Adam Lackorzynski:
>> On Tue Mar 08, 2016 at 17:05:05 +0100, Ahmed Makkawi wrote:
>>> I think the solution to the communication of an application on
>>> l4linux with
>>> an application on l4re would be to implement an ipc stream in the
>>> character
>>> device module in the l4linux kernel to communicate with the IPC
>>> stream on
>>> l4re application.
>>> the Problem now is l4linux modules are in C and the l4re application
>>> is in
>>> C++, is this a good idea to start searching in it or its a dead end and
>>> maybe someone would have a better idea to work on ?
>> That's one way of doing it, and yes, one needs to bridge from the Linux
>> driver to the L4Re world. There are several examples in L4Linux where
>> Linux drivers use L4 IPC to communicate with L4Re services. Most L4Re
>> services also have a C interface, exactly for the reason that they can
>> be used by C code. Doing such a C variant is reasonably easy, look for
>> example in pkg/l4re-core/l4re_c for how it is done. For Linux drivers,
>> any under drivers/ directory with 'l4' in the file name should provide
>> insights how it is used.
>> Adam
> Hi Adam,
> i struggling on the same problem.
> And i guess we'd prefer a clean C solution instead of mixing C++ in the
> Linux driver.
> As mentioned in an earlier post [1] i looked at several IPC examples in
> src/l4/pkg/examples written in C.
> I tried to adopt this, but failed (see earlier post).
> Is it even possible to use that L4re-App IPC C-Code in a L4Linux driver?

Yes. See for example drivers/tty/serial/l4ser.c and the usage of

> You also mentioned L4XV_FN* wrappers.
> What are they for and when to use them?

This macro wraps a semaphore around the IPC call. Otherwise multiple
concurrent function calls may mess up the UTCB.

> Anyway, i've looked up all l4linux/drivers with 'l4' in its name but,
> haven't found a proper example.
> Can you please point a concrete example, where an L4Linux-Driver acts as
> a Client to an L4re-Server?

l4ser.c and l4fb.c. Both drivers use L4Re APIs to communicate with L4Re


More information about the l4-hackers mailing list