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.
Thank you! María.
Hi Maria,
Am 02.07.2014 16:38, schrieb Maria Soler:
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:srv(),
},
}, "rom/io rom/app.io");
l:start( {
caps = { log = L4.Env.log:m("rws"),
prodb = vbus,
}, l4re_dbg = L4.Dbg.Warn,
log = { "app", "green" }, }, "rom/app" , { FSTAB_FILE = "rom/fstab" }
);
Maybe this could help?
Best regards, Martin
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.
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();
-- Start io
l:start( { caps = { icu = L4.Env.icu; input = vbus_prodb:svr(); }, }, "rom/io rom/app.io");
l:start( { caps = { log = L4.Env.log:m("rws"), prodb = vbus_prodb:svr(); vbus = vbus_prodb; }, log = { "app", "green" }, }, "rom/app" , { FSTAB_FILE = "rom/fstab" }
On Thu, Jul 3, 2014 at 11:40 AM, Matthias Lange matthias.lange@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@kernkonzept.com, +49 - 351 - 41 88 86 14
Kernkonzept GmbH. Sitz: Dresden. Amtsgericht Dresden, HRB 31129. Geschäftsführer: Dr.-Ing. Michael Hohmuth
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@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@kernkonzept.com, +49 - 351 - 41 88 86 14
Kernkonzept GmbH. Sitz: Dresden. Amtsgericht Dresden, HRB 31129. Geschäftsführer: Dr.-Ing. Michael Hohmuth
Hello again,
Still the same problem, I cannot make it work. I have activated -v in io (you said there are several -v options, where can I find more information? I couldn't find anything about that so far) and made some changes in the cfg and io files. Actually I have created a devs file. The current state of these files is:
app.cfg ---------------------------------------------------------------------------------- -- Include L4 functionality require("L4");
local l = L4.default_loader; local nsshm = l:create_namespace({}); local prodb = l:new_channel();
-- Start io
l:start( { caps = { input = prodb:svr(), icu = L4.Env.icu, sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), }, }, "rom/io -v rom/app.devs rom/app.io");
l:start( { caps = { log = L4.Env.log:m("wrs"), vbus = prodb, }, log = { "app", "green" }, l4re_dbg = L4.Dbg.Warn, }, "rom/app" ); ----------------------------------------------------------------------------------
app.devs ---------------------------------------------------------------------------------- -- 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(0xXXXXXX, 0xYYYYYYY); Io.Res.mmio(0xWWWWW, 0xZZZZZZZZ); } } -- Io.add_vbus("prodb", Io.Vi.System_bus -- { -- COMM = wrap(Io.Hw:match("COMM")); -- }) ----------------------------------------------------------------------------------
and app.io ---------------------------------------------------------------------------------- prodb => new System_bus() { COMM => wrap(hw-root.COMM); } ----------------------------------------------------------------------------------
The verbosity has not improved much. The output is: 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 | WARNING: Service registration failed: 'prodb' io | Ready. Waiting for request.
So the new piece of information is only WARNING: Service registration failed: 'prodb' " Checking the code, this comes from l4/pkg/io/server/src/main.cc - Add_system_bus, so the check registry->register_obj(b, b->name()).is_valid() fails, which means that the bus created in the io file is not valid and so it is not registered. Is this the reason why the execution gets stalled? Can you see what it is that I am doing wrong now and what a possible fix may be?
Checking the configuration files l4/conf/examples/arm-rv-lcd.cfg l4/conf/examples/arm-rv-lcd.io and l4/pkg/io/config/arm-rv-eb.devs there is no relevant difference that I can see with my configuration files (other than the use of mag, which I don't know and my configuration files being much more simple). I would really appreciate any piece of advice.
Than you very much, María Soler.
Hi,
On Mon Jul 07, 2014 at 23:40:22 +0200, Maria Soler wrote:
Still the same problem, I cannot make it work. I have activated -v in io (you said there are several -v options, where can I find more
-v can be specified multiple times for more verbosity (such as -vvvv).
information? I couldn't find anything about that so far) and made some changes in the cfg and io files. Actually I have created a devs file. The current state of these files is:
app.cfg
-- Include L4 functionality require("L4");
local l = L4.default_loader; local nsshm = l:create_namespace({}); local prodb = l:new_channel();
-- Start io
l:start( { caps = { input = prodb:svr(),
Put "prodb = prodb:svr()," here (instead of input).
icu = L4.Env.icu, sigma0 = L4.cast(L4.Proto.Factory,
L4.Env.sigma0):create(L4.Proto.Sigma0), }, }, "rom/io -v rom/app.devs rom/app.io");
l:start( { caps = { log = L4.Env.log:m("wrs"), vbus = prodb, }, log = { "app", "green" },
Just use one of the 'log' entries here.
l4re_dbg = L4.Dbg.Warn,
}, "rom/app" );
app.devs
-- 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(0xXXXXXX, 0xYYYYYYY); Io.Res.mmio(0xWWWWW, 0xZZZZZZZZ); } } -- Io.add_vbus("prodb", Io.Vi.System_bus -- { -- COMM = wrap(Io.Hw:match("COMM"));
-- })
and app.io
prodb => new System_bus() { COMM => wrap(hw-root.COMM); }
The verbosity has not improved much. The output is: 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 | WARNING: Service registration failed: 'prodb' io | Ready. Waiting for request.
So the new piece of information is only WARNING: Service registration failed: 'prodb' " Checking the code, this comes from l4/pkg/io/server/src/main.cc - Add_system_bus, so the check registry->register_obj(b, b->name()).is_valid() fails, which means that the bus created in the io file is not valid and so it is not registered. Is this the reason why the execution gets stalled? Can you see what it is that I am doing wrong now and what a possible fix may be?
For the register_obj to work, the statement in the lua script must be there, i.e. the name 'prodb' is important here.
Checking the configuration files l4/conf/examples/arm-rv-lcd.cfg l4/conf/examples/arm-rv-lcd.io and l4/pkg/io/config/arm-rv-eb.devs there is no relevant difference that I can see with my configuration files (other than the use of mag, which I don't know and my configuration files being much more simple). I would really appreciate any piece of advice.
Adam
l4-hackers@os.inf.tu-dresden.de