About IO server settings for DMA in L4Linux

Jesse-SC Chou (周書正) jesse-sc.chou at mstarsemi.com
Fri Dec 9 10:21:37 CET 2016


Hi L4-hackers,

I'm a newbie of L4 micro-kernel. The Fiasco/L4/L4Linux is really a good design for system architecture in the future.
I'm trying to porting the L4 system to my target then evaluate.
On my target, there is an DMA controller, which moves data to flash.
Originally, Native-Linux uses dma_alloc_coherent() to allocate a DMA-dedicated memory.
CPU copies data to that DMA-dedicated memory, then DMA controller moves data from DMA-dedicated memory to flash.

In L4Linux, I guess there should be some settings of DMA in I/O server configuration files.
I'm searching for an example of configuring DMA-related settings.

I use the snapshot “l4re-snapshot-2016082114”. In my current configuration, "DEVICE1" is the DMA controller, "DEVICE2" is the flash,
and "DMAMEM" is the DMA-dedicated memory. However, it generates some DMA-related error in boot messages.
Such as:

IO      | no 'iommu' capability found use CPU-phys for DMA
IO      | warning: inconsistent fixed resource @ device: /System Bus/
error: failed to get physical address for 2000000.

And so on.

The first thing I want to do is to make the boot message correct and I have the following questions:
1. Is the "DMAMEM" device needed to be configured? If needed, how to specify this to be a DMA memory?
2. Will dma_alloc_coherent() use the "DMAMEM" or other memory? Can I use dma_alloc_coherent() as Native-Linux?
3. I've also found a flag "Property.flags = Io.Hw_device_DF_dma_supported;". I'm not sure its usage. I just add this flag to DEVICE1(DMA controller) and DEVICE2(flash), is it correct?
4. Is my l4linux-io.devs and l4linux-io.io correct or need other modification for DMA?
5. I’ve found “IO      |   DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)” in the boot message. What the “DMADOM” means?

Any suggestion is very appreciated. Thanks.

BRs,
Jesse

Here is my configurations:
----------------------------------------
l4linux-io.cfg:

local L4 = require("L4");
loader = L4.default_loader;
local lxname = "vmlinuz";
vbus_l4linux = loader:new_channel();
loader:start(
  {
    caps = {
      sigma0  = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0);
      icu     = L4.Env.icu;
      l4linux = vbus_l4linux:svr();
    },
    log = {"IO", "magenta"},
  }, "rom/io -vvv rom/l4linux-io.devs rom/l4linux-io.io");
-- Start Linux
loader:start(
  { caps = {
      vbus = vbus_l4linux;
    },
    l4re_dbg = L4.Dbg.Warn,
    log = L4.Env.log:m("rws"),
  },
  "rom/vmlinuz mem=64M console=ttyLv0 l4x_dtb=rom/simple.dtb l4x_rd=rom/ramdisk-"
  ..  L4.Info.arch() .. ".rd root=1:0 ramdisk_size=3072");
----------------------------------------
l4linux-io.devs:

local Res = Io.Res
local Hw = Io.Hw
Io.hw_add_devices(function()
  DEVICE1 = Hw.Device(function()
    Property.hid = "device1";
    compatible = {"arm,device1"};
    Resource.regs = Res.mmio(0x14000000, 0x15ffffff);
    Property.flags = Io.Hw_device_DF_dma_supported;
  end);
  DEVICE2 = Hw.Device(function()
    Property.hid = "device2";
    compatible = {"arm,device2"};
    Resource.regs = Res.mmio(0x1F000000, 0x1F3fffff);
    Resource.irq = Res.irq(66);
    Property.flags = Io.Hw_device_DF_dma_supported;
  end);
  DMAMEM = Hw.Device(function()
    Property.hid = "dmamem";
    compatible = {"arm,dmamem"};
    Resource.mmio = Io.Mmio_data_space(0x10000, 0);
  end);
end)
----------------------------------------
l4linux-io.io:

local hw = Io.system_bus()

Io.add_vbus("l4linux", Io.Vi.System_bus
{
  DEVICE1 = wrap(hw:match("arm,device1"));
  DEVICE2 = wrap(hw:match("arm,device2"));
  DMAMEM = wrap(hw:match("arm,dmamem"));
})
----------------------------------------
boot messages:

L4 Bootstrapper
  Build: #164 拻 12堎  9 11:39:51 CST 2016, 4.8.4
  Scanning up to 128 MB RAM, starting at offset 32MB
  Memory size is 128MB (20000000 - 27ffffff)
  RAM: 0000000020000000 - 0000000027ffffff: 131072kB
  Total RAM: 128MB
  Scanning fiasco
  Scanning sigma0
  Scanning moe
  Moving up to 13 modules behind 21100000
  moving module 02 { 219d5000-21a064ab } -> { 21ac6000-21af74ab } [201900]
  moving module 01 { 219c3000-219d434b } -> { 21ab4000-21ac534b } [70476]
  moving module 00 { 2193d000-219c29db } -> { 21a2e000-21ab39db } [547292]
  moving module 12 { 21935000-2193cd5d } -> { 21a26000-21a2dd5d } [32094]
  moving module 11 { 21635000-21934fff } -> { 21726000-21a25fff } [3145728]
  moving module 10 { 2121b000-21634487 } -> { 2130c000-21725487 } [4297864]
  moving module 09 { 2121a000-2121a0fa } -> { 2130b000-2130b0fa } [251]
  moving module 08 { 21219000-2121939b } -> { 2130a000-2130a39b } [924]
  moving module 07 { 2109e000-212188db } -> { 2118f000-213098db } [1550556]
  moving module 06 { 21084000-2109d583 } -> { 21175000-2118e583 } [103812]
  moving module 05 { 2102a000-210836b7 } -> { 2111b000-211746b7 } [366264]
  moving module 04 { 21010000-21029473 } -> { 21101000-2111a473 } [103540]
  moving module 03 { 2100f000-2100f325 } -> { 21100000-21100325 } [806]
  Loading fiasco
  Loading sigma0
  Loading moe
  find kernel info page...
  found kernel info page (via ELF) at 20002000
Regions of list 'regions'
    [ 20000000,  200001c7] {      1c8} Root   mbi_rt
    [ 20001000,  20001aff] {      b00} Kern   fiasco
    [ 20002000,  20092fff] {    91000} Kern   fiasco
    [ 200c0000,  200c9f43] {     9f44} Sigma0 sigma0
    [ 200d0000,  200d6177] {     6178} Sigma0 sigma0
    [ 20140000,  20168c27] {    28c28} Root   moe
    [ 20170000,  2017b58b] {     b58c} Root   moe
    [ 21000000,  2100e5e3] {     e5e4} Boot   bootstrap
    [ 21100000,  21a2dfff] {   92e000} Root   Module
  found kernel options (via ELF) at 20003000
  API Version: (87) experimental
  Sigma0 config    ip:200c0100 sp:00000000
  Roottask config  ip:2014020c sp:00000000
  Starting kernel fiasco at 200012b8
Realview System ID: Rev=0 HBI=000 Build=0 Arch=0 FPGA=00
  Invalid System ID for this kernel config
  Expected (00000000 & cfffff00) == 0190f500
  Stopping.
Hello from Startup::stage2
Number of IRQs available at this GIC: 160
FPU: Initialize
FPU0: Subarch: 2, Part: 30, Rev: 5, Var: 7, Impl: 41
ARM generic timer: freq=6000000 interval=6000 cnt=18158508199882336289
SERIAL ESC: allocated IRQ 98 for serial uart
Not using serial hack in slow timer handler.
Welcome to L4/Fiasco.OC!
L4/Fiasco.OC microkernel on arm
Rev: r72 compiled with gcc 4.8.4 for Realview    []
Build: #16 Tue Nov 29 12:16:44 CST 2016

Calibrating timer loop... done.
MDB: use page size: 20
MDB: use page size: 12
SIGMA0: Hello!
  KIP @ 20002000
  allocated 4KB for maintenance structures
SIGMA0: Dump of all resource maps
RAM:------------------------
[4:20000000;20000fff]
[0:20093000;200bffff]
[0:200ca000;200cffff]
[0:200d7000;2013ffff]
[4:20140000;20168fff]
[0:20169000;2016ffff]
[4:20170000;2017bfff]
[0:2017c000;210fffff]
[4:21100000;21a2dfff]
[0:21a2e000;26ffffff]
IOMEM:----------------------
[0:0;1fffffff]
[0:28000000;ffffffff]
MOE: Hello world
MOE: found 104420 KByte free memory
MOE: found RAM from 20000000 to 27000000
MOE: allocated 112 KByte for the page array @0x20093000
MOE: virtual user address space [0-bfffffff]
MOE: rom name space cap -> [C:103000]
  BOOTFS: [21100000-21100326] [C:105000] l4linux-io.cfg
  BOOTFS: [21101000-2111a474] [C:107000] l4re
  BOOTFS: [2111b000-211746b8] [C:109000] ned
  BOOTFS: [21175000-2118e584] [C:10b000] hello
  BOOTFS: [2118f000-213098dc] [C:10d000] io
  BOOTFS: [2130a000-2130a39c] [C:10f000] l4linux-io.devs
  BOOTFS: [2130b000-2130b0fb] [C:111000] l4linux-io.io
  BOOTFS: [2130c000-21725488] [C:113000] vmlinuz
  BOOTFS: [21726000-21a26000] [C:115000] ramdisk-arm.rd
  BOOTFS: [21a26000-21a2dd5e] [C:117000] simple.dtb
MOE: cmdline: moe rom/l4linux-io.cfg
MOE: Starting: rom/ned rom/l4linux-io.cfg
MOE: loading 'rom/ned'
Ned says: Hi World!
Ned: loading file: 'rom/l4linux-io.cfg'
IO      | Io service
IO      | Verboseness level: 4
IO      | unused physical memory space:
IO      |   [00000000000000-0000001fffffff]
IO      |   [00000028000000-000000ffffffff]
IO      | no 'iommu' capability found use CPU-phys for DMA
IO      | Loading: config 'rom/l4linux-io.devs'
IO      | warning: inconsistent fixed resource @ device: /System Bus/
IO      |   : hid=device1
IO      |   DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      | warning: inconsistent fixed resource @ device: /System Bus/
IO      |   : hid=device2
IO      |   DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      | Loading: config 'rom/l4linux-io.io'
IO      | Real Hardware -----------------------------------
IO      | System Bus: hid=
IO      |   Resources: ==== start ====
IO      |   DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      |   Resources: ===== end =====
IO      |   DEVICE1: hid=device1
IO      |     Clients: ===== start ====
IO      |       DEVICE1: [N2Vi9Proxy_devE]
IO      |     Clients: ===== end ====
IO      |     Resources: ==== start ====
IO      |     IOMEM   [00000014000000-00000015ffffff 2000000] non-pref (32bit) (align=1ffffff flags=2)
IO      |     DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      |     Resources: ===== end =====
IO      |   DEVICE2: hid=device2
IO      |     Clients: ===== start ====
IO      |       DEVICE2: [N2Vi9Proxy_devE]
IO      |     Clients: ===== end ====
IO      |     Resources: ==== start ====
IO      |     IOMEM   [0000001f000000-0000001f3fffff 400000] non-pref (32bit) (align=3fffff flags=2)
IO      |     IRQ     [00000000000042-00000000000042 1] none (32bit) (align=0 flags=1)
IO      |     DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      |     Resources: ===== end =====
IO      |   DMAMEM: hid=dmamem
IO      |     Clients: ===== start ====
IO      |       DMAMEM: [N2Vi9Proxy_devE]
IO      |     Clients: ===== end ====
IO      |     Resources: ==== start ====
IO      |     IOMEM   [00000020124000-00000020133fff 10000] non-pref (32bit) (align=ffff flags=2)
IO      |     Resources: ===== end =====
IO      | warning: could not register control interface at cap 'platform_ctl'
IO      | Ready. Waiting for request.
PH  0 offs=00008000 flags=rwx PH-type=0x1
      virt=02000000 evirt=0248c17c
      phys=02000000 ephys=0248c17c
      f_sz=004023d5 memsz=0048c17c
PH  1 offs=003b7404 flags=r-x PH-type=0x4
      virt=023af404 evirt=023af428
      phys=023af404 ephys=023af428
      f_sz=00000024 memsz=00000024
PH  2 offs=00000000 flags=rwx PH-type=0x6474e551
      virt=00000000 evirt=00000000
      phys=00000000 ephys=00000000
      f_sz=00000000 memsz=00000000
Starting binary at 0x2000330, argc=7 argv=0xafff4f8c *argv=0xb1007ff4 argv0=rom/vmlinuz
External resolver is at 0xa80007c4
======> L4Linux starting... <========
Linux version 4.7.0-l4 (jesse at tplabpcu07640) (gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) ) #119 Thu Dec 8 18:05:42 CST 2016
Binary name: rom/vmlinuz
   This is an AEABI build.
Linux kernel command line (6 args): mem=64M console=ttyLv0 l4x_dtb=rom/simple.dtb l4x_rd=rom/ramdisk-arm.rd root=1:0 ramdisk_size=3072
CPU mapping (l:p)[1]: 0:0
Image: 02000000 - 02600000 [6144 KiB].
Areas: Text:     02000000 - 023af428 [3773kB]
       RO-Data:  022c7000 - 02397000 [832kB]
       Data:     023d8000 - 023fda80 [150kB]
      Init:     023b0000 - 023d8000 [160kB]
       BSS:      024023d5 - 0248c17c [551kB]
Device scan:
  Device: L4ICU
  Device: DMAMEM
    MEM: 20124000 - 20133fff
  Device: DEVICE1
    MEM: 14000000 - 15ffffff
    DMAD: 00000000 - 00000000
  Device: DEVICE2
    MEM: 1f000000 - 1f3fffff
    IRQ: 00000042 - 00000042
    DMAD: 00000000 - 00000000
Device scan done.
l4lx_thread_create: Created thread 41d (cpu0) (u:b3000e00, v:b3000c00, sp:023d9fa4)
main thread will be 41d
L4x: section-with-init(-data): Virt: 0x2000000 to 0x248cfff [4660 KiB]
section-with-init(-data): Phys: 0x2017c000 to 0x20608fff, [4660 KiB]
L4x: section-with-init-text: Virt: 0x2000000 to 0x248cfff [4660 KiB]
error: failed to get physical address for 2000000.
L4x: Main thread running, waiting...
L4x: Memory size: 64MB
L4x: Setting superpages for main memory
L4x: Adjusted memory start: 02000000
L4x:     Main memory: Virt: 0x2600000 to 0x65fffff [65536 KiB]
    Main memory: Phys: 0x21c00000 to 0x25bfffff, [65536 KiB]
l4x: vmalloc area: 06600000 - 0e600000
L4x:            text: Virt: 0x2000000 to 0x248cfff [4660 KiB]
error: failed to get physical address for 2000000.
Loading: rom/ramdisk-arm.rd
INITRD: Size of RAMdisk is 3072KiB
RAMdisk from 00002000 to 00302000 [3072KiB]
l4lx_thread_create: Created thread 422 (timer0) (u:b3000a00, v:00000000, sp:02423fa0)
IO      | new iomem region: p=1f000000 v=400000 s=400000 (bmb=0x34470)
Booting Linux on physical CPU 0x0
Linux version 4.7.0-l4 (jesse at tplabpcu07640) (gcc version 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.1) ) #119 Thu Dec 8 18:05:42 CST 2016
DTB: virt=02600100 phys=21c00100
CPU: Fiasco [410fc075] revision 5 (ARMv7), cr=00400000
CPU: div instructions available: patching division code
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
Machine model: L4Linux (DT)
Memory policy: Data cache writealloc
CPU: All CPU(s) started in SVC mode.
INITRD: 00002000 - 00302000
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 17717
Kernel command line: mem=64M console=ttyLv0 l4x_dtb=rom/simple.dtb l4x_rd=rom/ramdisk-arm.rd root=1:0 ramdisk_size=3072
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 64632K/71684K available (2941K kernel code, 150K rwdata, 832K rodata, 160K init, 551K bss, 7052K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xbffff000 - 0xc0000000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0x06600000 - 0x0e600000   ( 128 MB)
    lowmem  : 0x00000000 - 0x06600000   ( 102 MB)
    modules : 0x01010000 - 0x02000000   (  15 MB)
      .text : 0x02000000 - 0x023af428   (3774 kB)
      .init : 0x023b0000 - 0x023d8000   ( 160 kB)
      .data : 0x023d8000 - 0x023fda80   ( 151 kB)
       .bss : 0x024023d5 - 0x0248c17c   ( 552 kB)
NR_IRQS:282
clocksource: l4kipclk: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns
l4timer: Using IRQ210
sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns
__l4x_ioremap: Mapping physaddr 1f000000 [0x400000 Bytes, 1f000000+400000] to 00400000+000000
clocksource_probe: no matching clocksources found
Console: colour dummy device 80x30
console [ttyLv0] enabled
Calibrating delay loop... 1594.16 BogoMIPS (lpj=7970816)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x2000000 - 0x2000000
VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
Failed to create "l4x" debugfs directory: 1
clocksource: Switched to clocksource l4kipclk
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
Trying to unpack rootfs image as initramfs...
rootfs image is not initramfs (junk in compressed archive); looks like an initrd
INITRD: Freeing memory.
l4x: Checks passed.
NetWinder Floating Point Emulator V0.97 (double precision)
futex hash table entries: 256 (order: -1, 3072 bytes)
workingset: timestamp_bits=29 max_order=14 bucket_order=0
squashfs: version 4.0 (2009/01/31) Phillip Lougher
jffs2: version 2.2. ? 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
L4 serial driver
serial-ttyLv.0: ttyLv0 at MMIO 0x1 (irq = 211, base_baud = 230400) is a L4-vcon
l4ser_shm: L4 shared mem serial driver
l4cdds: No name given, not starting.
brd: module loaded
l4bdds: No name given, not starting.
mousedev: PS/2 mouse device common for all mice
IO      | new iomem region: p=14000000 v=2000000 s=2000000 (bmb=0x344f8)
__l4x_ioremap: Mapping physaddr 14000000 [0x2000000 Bytes, 14000000+2000000] to 0e600000+000000
Creating 1 MTD partitions on "NOR_FLASH":
0x000000f00000-0x000001000000 : "DATA"
NET: Registered protocol family 17
L4IRQ: set irq type of 211 to 1
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 3072KiB [1 disk] into ram disk... done.
EXT4-fs (ram0): couldn't mount as ext3 due to feature incompatibilities
EXT4-fs (ram0): mounting ext2 file system using the ext4 subsystem
EXT4-fs (ram0): mounted filesystem without journal. Opts: (null)
VFS: Mounted root (ext2 filesystem) readonly on device 1:0.
Freeing unused kernel memory: 160K (023b0000 - 023d8000)
This architecture does not have kernel memory protection.

Please press Enter to activate this console.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20161209/ca98269b/attachment.html>


More information about the l4-hackers mailing list