Fwd: Problems using qemu devices from l4re

Matthias Lange matthias.lange at kernkonzept.com
Thu Jul 3 11:40:10 CEST 2014


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





More information about the l4-hackers mailing list