Enable L4Linux network access on Raspberry Pi-b.

Lei Zhou lezhou at blackberry.com
Fri Jun 21 19:39:11 CEST 2019


Hi Adam & Hackers,

Did some research into L4Re memory management and IO server.     

For my original question 1: on native device tree file adapting to L4linux:
1>  Since Sigma0 got one-2-one mapping statically from Fiasco microkernel,  I think I still can directly use those reg_address declaration for each device nodes within native rpi3's bcm2710-rpi-3-b.dts.  I will only make following simple changes comparing to simple.dts from l4re in case they are necessary for L4Linux to use.
        >>model = "L4Linux (DT)";                                                 
        >>compatible = "L4Linux";                                                                                                                                 
        <</* compatible = "raspberrypi,3-model-b", "brcm,bcm2837";                
        <<model = "Raspberry Pi 3 Model B";*/  

/*------------------ copied from l4re..simple.dts ------------------*/          
        intc: l4icu {                                                           
                compatible = "l4,icu";                                          
                interrupt-controller;                                           
                /* type can be 'gic' or 'single' currently */                   
                l4icu-type = "gic";                                             
                #interrupt-cells = <3>;                                         
                /*                                                              
                l4icu-type = "single";                                          
                #interrupt-cells = <1>;                                         
                */                                                              
        };                                                                      
/*------------------------------------------------------------------*/ 

2> For my original question 3: in terms of io config for IO server.  Still don't have clear idea how to do it.
      Should I only need create a vBUS and grant access for L4linux to network NIC devices?  
      Specifically I copied Raspberry PI3 NIC part of device tree node here for reference as below
       -----------------------------------------------------------------------------------------------------------------
                   usb at 7e980000 {                                                  
                        compatible = "brcm,bcm2708-usb";                        
                        reg = <0x7e980000 0x10000 0x7e006000 0x1000>;           
                        interrupts = <0x2 0x0 0x1 0x9>;                         
                        #address-cells = <0x1>;                                 
                        #size-cells = <0x0>;                                    
                        clocks = <0x18>;                                        
                        clock-names = "otg";                                    
                        phys = <0x19>;                                          
                        phy-names = "usb2-phy";                                 
                        power-domains = <0x14 0x6>;                             
                        phandle = <0x6d>;                                       
                                                                                
                        usb1 at 1 {                                                
                                compatible = "usb424,9514";                     
                                reg = <0x1>;                                    
                                #address-cells = <0x1>;                         
                                #size-cells = <0x0>;                            
                                                                                
                                usbether at 1 {                                    
                                        compatible = "usb424,ec00";             
                                        reg = <0x1>;                            
                                        phandle = <0x6e>;                       
                                };                                              
                        };                                                      
                };       
     --------------------------------------------------------------------------------------------------------------------------------
    Is this sufficient to do IO config as following rpi_devices.io?
    Within rpi_devices.io, I defined a named vBUS as l4lx.   How does L4linux client know this "l4lx" vBUS is for me?  Should I need configure it within L4linux somewhere?
    ----------------------------------------------------------------------------------------------------------------------------
local Res = Io.Res                                                              
local Hw = Io.Hw                                                                
local hw = Io.system_bus()                                                      
                                                                                
-- create a virtual bus for client with its name as 'l4lx'                      
-- Give it access to NIC device                                                 
-- 'l4lx is name of vbus                                                        
Io.add_vbus("l4lx", Io.Vi.System_bus                                            
{                                                                               
  -- add device which matches the compatibility ID (CID)                        
  -- usb_net_smsc9514 for rpi-3b                                                
  -- 'usb424,ec00'                                                              
  -- NIC = wrap(hw:match("usb424,ec00"));                                       
  NIC = wrap(hw.NIC);                                                           
})                                                                              
                                                                                
Io.hw_add_devices(function()                                                    
                                                                                
  -- create a new named NIC device                                              
  NIC = Hw.Device(function()                                                    
    Property.hid = "smsc9514";                                                  
    compatible = {"usb424,ec00"};                                               
    -- Resource.regs = Res.mmio(0x4e000000, 0x4e000fff);                        
    -- Resource.irq = Res.irq(41);                                              
  end);                                                                         
                                                                                
end)                                                                            
--------------------------------------------------------------------------------------------------------~   

Much Appreciated!
Lei Zhou

________________________________________
From: Lei Zhou
Sent: Thursday, June 20, 2019 6:43 PM
To: Adam Lackorzynski; l4-hackers at os.inf.tu-dresden.de
Subject: Enable L4Linux network access on Raspberry Pi-b.

Hi Adam & Hackers,

Has anybody enabled network access for L4linux Raspberry pi3?     I read through all the history on related topics and understand the process to get it working.  I summarized the steps as below and major problem for me is how to convert device tree for L4linux and compose corresponding rpi_deices.io configuration.   Please see my specific question inlined in those steps.    Thanks in advance for your feedback.

1.  configure and Compile l4linux to support flattened device tree support.  Also enables
           CONFIG_USB_LAN78XX=y  &&
           CONFIG_USB_USBNET=y
           CONFIG_USB_NET_SMSC95XX=y
           CONFIG_L4_SERVER = y
           CONFIG_USE_OF = y
2. Adapt https://github.com/raspberrypi/linux/blob/rpi-4.19.y/arch/arm/boot/dts/bcm2710-rpi-3-b.dts into ./l4linux/arch/l4/boot/dts/simple.dts
   [Lei's question]:  I understand why  bcm2710-rpi-3-b.dts cannot be used directly because some of the reg_address physical address doesn't apply and might fail to be mapped.   How can I pick network access specific device nodes and its dependancies(power or clock etc) and how to change those illegal reg_address?

3. Create an rpi3_devices.io for L4Re with the devices and their resources and assign the desired devices to a vbus.
    [Lei's question]:  Should I define all device nodes one-2-one mapping from step 2's device tree?

4. Update your ned script and modules.list

-- vim:set ft=lua:

local L4 = require("L4");

loader = L4.default_loader;

-- Start io
vbus_l4linux = loader:new_channel();
--vbus_input   = loader:new_channel();
--vbus_fbdrv   = loader:new_channel();

loader:start(
  {
    caps = {
      sigma0  = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0);
      icu     = L4.Env.icu;
      -- input   = vbus_input:svr();
      l4linux = vbus_l4linux:svr();
      -- fbdrv   = vbus_fbdrv:svr();
    },
      log = {"IO", "y"},
      l4re_dbg = L4.Dbg.Warn,
  }, "rom/io -vvv rom/rpi_devices.io");

-- Start L4linux
loader:start(
   {
      caps = {
         -- fb  = mag_svc:create(L4.Proto.Goos, "g=640x480");
         vbus = vbus_l4linux;
      },
      log = L4.Env.log:m("rws"),
      l4re_dbg = L4.Dbg.Warn,
   },
   "rom/vmlinuz mem=64M console=ttyLv0 l4x_rd=rom/ramdisk- l4x_dtb=rom/rpi3b-simple.dtb"
    .. L4.Info.arch() .. ".rd " ..
    "root=1:0 ramdisk_size=4000 init=/bin/sh earlyprintk=1 ");

5. Build final bootstrap_l4linux.uimage for Raspberry.

Thanks very much!
Lei Zhou




More information about the l4-hackers mailing list