Fwd: Problems using qemu devices from l4re

Matthias Lange matthias.lange at kernkonzept.com
Fri Jul 4 11:17:24 CEST 2014


On Fri, Jul 04, 2014 at 10:31:56AM +0200, Maria Soler wrote:
> Hello again,
> 
> I have (tried to) apply those changes and the result is as follows:
> 
> Execution:
> ---------------------------------------------------------------------------------------------
> MOE: cmdline: moe rom/app.cfg
> MOE: Starting: rom/ned rom/app.cfg
> MOE: loading 'rom/ned'
> Ned says: Hi World!
> Ned: loading file: 'rom/app.cfg'
> io      | Dev_factory: register factory for N2Hw6DeviceE
> io      | GTF: register factory for 7Pci_dev
> io      | GTF: register factory for N2Hw12Msi_resourceE
> io      | Dev_factory: register factory for N2Hw11Gpio_deviceE
> io      | Io service
> io      | Ready. Waiting for request.
> ---------------------------------------------------------------------------------------------
> and it stops.
> 
> In the application I am using the l4io_request_iomem call (I have also
> tried with l4sigma0_map_iomem and the result is the exact same as it
> was before the changes).
> 
> The configuration file is now:
> -- Include L4 functionality
> require("L4");
> 
> local l     = L4.default_loader;
> 
> vbus_prodb = l:new_channel();

Here you are creating an IPC gate ...

> -- Start io
> 
> l:start(
>   {
>     caps = {
>       icu     = L4.Env.icu;
>       input   = vbus_prodb:svr();

... where the server side is connected to io's 'input' capability. 'input' is the
name of a vbus defined in the io configuration. The client side of the
'vbus_prodb' IPC gate is left unconnected.

>     },
>   }, "rom/io rom/app.io");

If I remember correctly you defined the 'prodb' vbus in your io configuration
file. But you are still missing to connect an IPC gate in io (see comment
below).

> l:start(
>    {
>      caps = {
>                 log = L4.Env.log:m("rws"),
>                 prodb =  vbus_prodb:svr();

This line has to go into io's cap array.

Here you connect the server side of the 'vbus_prodb' IPC gate to the
capability named 'prodb' (this name is local to your application).

>                 vbus = vbus_prodb;

And here you connect the client side of the 'vbus_prodb' IPC gate to the
capability named 'vbus'. The result is, that there is 

1. no 'wire' between io and your application and
2. that io does not connect to the 'prodb' vbus. (You can provide io with
multiple '-v' options to make it more verbose and make it print information
about physical and virtual devices and their mappings to virtual busses)

Please note: capability names are always local to the application. You use the
name to lookup capabilities in your application's capability space
(L4Re::Env::get_cap()). So you can name the capability which connects to the
'prodb' vbus in io like you want (e.g. prodb_bus = vbus_prodb). Your
application then has to allocate a vbus capability and has to look for
'prodb_bus' in its capability space.

Matthias.

>         },
>      log  = { "app", "green" },
>    },
>    "rom/app" , { FSTAB_FILE = "rom/fstab" }
> 
> On Thu, Jul 3, 2014 at 11:40 AM, Matthias Lange
> <matthias.lange at kernkonzept.com> wrote:
> > On Wed, Jul 02, 2014 at 04:38:07PM +0200, Maria Soler wrote:
> >> Hello,
> >>
> >> I am running l4re on qemu (qemu-system-arm) and I have been trying to
> >> use a qemu device from l4re, but I have been unsuccessful so far. This
> >> device creates a file in the host and that is how I have been testing
> >> if I was actually writing/reading on the device: I was trying to write
> >> from the guest and read from the host (didn't work) and trying to
> >> write from the host and read from the guest, but didn't work either.
> >>
> >> What I have tried so far:
> >> - I have tried to use sigma0_map_iomem like this:
> >> ---------------------------------------------
> >> string = malloc(SIZE);
> >> l4sigma0_map_iomem(L4_BASE_PAGER_CAP, 0xXXXXXXXX, string, SIZE, 1);
> >> //I have tried both cached and uncached.
> >> printf("Received: %s\n",string); //prints nothing, regardless of the
> >> content of the file in the host
> >> memset(p,'a',SIZE); //the file in the host remains unchanged
> >> ---------------------------------------------
> >>
> >> The qemu device is mapped in address 0xXXXXXXXX and its size is bigger
> >> than SIZE. SIZE is a multiple of 4KB and so is 0xXXXXXXXX.
> >>
> >> I have tried to use this option by itself and combined with an io
> >> server (I actually tried this first, but now that I have seen that
> >> there is no difference in the behavior if I add it or remove it, I
> >> think they are maybe unrelated or most probably I am not using them
> >> the right way). To create the io server I have included an app.io file
> >> as follows:
> >> ---------------------------------------------
> >> -- Example configuration for io
> >>
> >> local hw = Io.system_bus()
> >>
> >> -- Configure two platform devices to be known to io
> >> Io.hw_add_devices
> >> {
> >>   comm = Io.Hw.Device
> >>   {
> >>     hid = "COMM";
> >>     Io.Res.irq(63);
> >>     Io.Res.mmio(BASE_ADDR, TOP_COMM);
> >>   },
> >>   data = Io.Hw.Device
> >>   {
> >>     hid = "DATA";
> >>     Io.Res.irq(63);
> >>     Io.Res.mmio(TOP_COMM+0x1000, TOP_DATA);
> >>   }
> >>
> >> }
> >>
> >> Io.add_vbusses
> >> {
> >> -- Create a virtual bus for a client and give access to the device
> >>   prodb = Io.Vi.System_bus
> >>         {
> >>           comm_bus = wrap(hw:match("comm"));
> >>           data_bus = wrap(hw:match("data"));
> >>         }
> >> }
> >> ---------------------------------------------
> >>
> >> and added to my .cfg file:
> >> ---------------------------------------------
> >> vbus = l:new_channel();
> >>
> >> -- Start io
> >>
> >> l:start(
> >>    {
> >>      caps = {
> >>      sigma0  = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0);
> >>        icu     = L4.Env.icu;
> >>        input   = vbus_prodb:svr();
> >>      },
> >>   }, "rom/io rom/app.io");
> >>
> >> l:start(
> >>    {
> >>      prodb =  vbus:svr();
> >>      log  = { "app", "green" }
> >>    },
> >>    "rom/app" , { FSTAB_FILE = "rom/fstab" }
> >> );
> >> ---------------------------------------------
> >>
> >> Both with and without the io server, the application compiles and
> >> runs, but there is no communication with the file in the host, so I
> >> guess I am not mapping the device in the right way.
> >>
> >> I have also tried to use libio instead of sigma0 as follows:
> >> ---------------------------------------------
> >> string = malloc(SIZE);
> >> l4io_request_iomem(0xXXXXXXXX, SIZE, 1, string); //I have tried both
> >> cached and uncached.
> >> printf("Received: %s\n",string); //prints nothing, regardless of the
> >> content of the file in the host
> >> memset(p,'a',SIZE); //the file in the host remains unchanged
> >> ---------------------------------------------
> >>
> >> And this warning appears: app  | libio: Warning: Query of 'vbus' failed!
> >> but it runs, so I don't really know what I am doing wrong. There is no
> >> complete example that I have found with either libio or sigma0, so I
> >> need some hints on this, please.
> >
> > As far as I can see from your configs you missed to connect the vbus to the
> > applications vbus capability. In io you need to create the server side of the
> > prodb vbus like
> >
> >   prodb = vbus_prodb:svr()
> >
> > The application needs a line like
> >
> >   vbus = vbus_prodb
> >
> > in its configuration. Then the application can query its vbus for connected
> > devices.
> >
> > Matthias.
> >
> >
> > --
> > Matthias Lange, matthias.lange at kernkonzept.com, +49 - 351 - 41 88 86 14
> >
> > Kernkonzept GmbH.  Sitz: Dresden.  Amtsgericht Dresden, HRB 31129.
> > Geschäftsführer: Dr.-Ing. Michael Hohmuth
> >

-- 
Matthias Lange, matthias.lange at kernkonzept.com, +49 - 351 - 41 88 86 14

Kernkonzept GmbH.  Sitz: Dresden.  Amtsgericht Dresden, HRB 31129.
Geschäftsführer: Dr.-Ing. Michael Hohmuth





More information about the l4-hackers mailing list