Who uses memory originally from IO device

Adam Lackorzynski adam at os.inf.tu-dresden.de
Mon Jul 7 23:54:18 CEST 2014


On Fri Jul 04, 2014 at 15:15:17 +0200, Martin Schröder wrote:
> Am 03.07.2014 18:21, schrieb Martin Schröder:
> >My board is equipped with 128MB external DRAM:
> >
> >>L4 Bootstrapper
> >>  Build: #1234 Do 3. Jul 17:34:17 CEST 2014, 4.6.2
> >>  Scanning up to 128 MB RAM
> >>  Memory size is 128MB (40000000 - 47ffffff)
> >>  RAM: 0000000040000000 - 0000000047ffffff: 131072kB
> >>  Total RAM: 128MB
> >
> >In addition the CPU has 128kb internal RAM (so called On-Chip-RAM) which
> >is located at address 0 - 0001ffff.
> >
> >I want to expose this OCRAM as a virtual device to a (already existing)
> >kernel driver within l4linux, so I added these few lines to my config:
> >
> >>OCRAM => new Device() {
> >>  .hid= "ocram";
> >>  new-res Mmio(0x00000000 .. 0x0001FFFF);
> >>}
> >>
> >>client0 => new System_bus() {
> >>  ...
> >>  "ocram" = wrap(hw-root.OCRAM);
> >>}
> >
> >Unfortunately IO cannot map this device, but maps instead something else
> >which is of no use for me:
> >
> >>io      | <0x1bff0>IOMEM   [00000000000000-0000000001ffff 20000]
> >>non-pref (32bit) (align=1ffff flags=4002)
> >>io      | WARNING: phys mmio resource allocation failed
> >>io      | <0x1bff0>IOMEM   [00000000000000-0000000001ffff 20000]
> >>non-pref (32bit) (align=1ffff flags=4002)
> >>io      | allocated resource: <0x1bff0>IOMEM
> >>[00000001000000-0000000101ffff 20000] non-pref (align=1ffff flags=4002)
> >
> >But a few lines up I see:
> >
> >>MOE: Hello world!
> >>MOE: found 109032 KByte free memory
> >>MOE: found RAM from 40000000 to 47000000
> >>...
> >
> >Probably MOE assumes this as normal ram and adds it to its pool.
> >
> >But how can I inhibit MOE grabbing this piece of RAM and instead assign
> >it to the OCRAM device in IO?
> 
> After some debugging it am convinced that MOE is not using or blocking this
> OCRAM at address 0x0.
> 
> But what is the reason that io cannot allocate the requested memory and maps
> instead something of the same size?

There's some unfortunate behavior of io that could be the cause here.
Could you add 0xc000 as a third flag to the MMIO specification to mark
this as a fixed resource? We've changed the behavior internally already.



Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/




More information about the l4-hackers mailing list