Initial Thread physical to Virtual Mapping
Hello, I am attempting to integrate the Xilinx drivers, provided through their SDK, with seL4 on the Zynq7000. In the root thread, I created a virtual mapping for the SD Card peripheral, and I pass that virtual address into the driver, so that it is reading and writing to it. The controller has a built-in DMA that gets used for data transfer. I created a buffer in the root thread's virtual space to pass to the DMA, but it needs a physical address. I calculated the virtual/physical offset from the physical and virtual addresses for the application that are given by the elfloader, but that didn't seem to be the correct mapping. Is there a good way to get that mapping, either from within the application itself or from the kernel before hand? Thanks, Robbie VanVossen DornerWorks
Hi Robert,
This file maybe relevant from the kernel side [1], it's reserving the
IO/device areas as well as the available memory area for a specific
platform/board. From the root task (userspace), you may want to have a
look at this file [2] as an example, it has example functions to map
both regular pages and devices.
seL4 would map its own frames during bootstrapping process, and then
pass on the remaining free memory to the root task in a sort of
untyped memory regions (with physical addresses). Assuming you've
allocated the buffer from this untyped memory area, you can just map
it yourself (from userspace, elfloader has no idea about your newly
allocated buffer) and pass whatever addresses you want
(virtual/physical), see [3].
[1] https://github.com/seL4/seL4/blob/master/src/plat/imx31/machine/hardware.c
[2] https://github.com/heshamelmatary/sel4-riscv/blob/master/apps/sos/src/mappin...
[3] https://github.com/heshamelmatary/sel4-riscv/blob/master/apps/sos/src/main.c...
Best,
Hesham
On Thu, Dec 3, 2015 at 7:59 PM, Robert VanVossen
Hello,
I am attempting to integrate the Xilinx drivers, provided through their SDK, with seL4 on the Zynq7000. In the root thread, I created a virtual mapping for the SD Card peripheral, and I pass that virtual address into the driver, so that it is reading and writing to it.
The controller has a built-in DMA that gets used for data transfer. I created a buffer in the root thread's virtual space to pass to the DMA, but it needs a physical address. I calculated the virtual/physical offset from the physical and virtual addresses for the application that are given by the elfloader, but that didn't seem to be the correct mapping.
Is there a good way to get that mapping, either from within the application itself or from the kernel before hand?
Thanks, Robbie VanVossen DornerWorks
_______________________________________________ Devel mailing list Devel@sel4.systems https://sel4.systems/lists/listinfo/devel
-- Hesham
Hi Robbie, I believe that the "physical" address that is specified by the elf file is actually the physical location within the file. Given a capability to a frame, there is a system call for obtaining the physical address. System call code is automatically generated, so you will need to look in the build or stage directories: stage/arm/zynq7000/include/interfaces/sel4_client.h:306:seL4_ARM_Page_GetAddress(seL4_ARM_Page service) The best way to handle DMA is to allocate and map a frame, then use the GetAddress call to determine the physical address of the underlying memory. - Alex On Thu, 2015-12-03 at 14:59 -0500, Robert VanVossen wrote:
Hello,
I am attempting to integrate the Xilinx drivers, provided through their SDK, with seL4 on the Zynq7000. In the root thread, I created a virtual mapping for the SD Card peripheral, and I pass that virtual address into the driver, so that it is reading and writing to it.
The controller has a built-in DMA that gets used for data transfer. I created a buffer in the root thread's virtual space to pass to the DMA, but it needs a physical address. I calculated the virtual/physical offset from the physical and virtual addresses for the application that are given by the elfloader, but that didn't seem to be the correct mapping.
Is there a good way to get that mapping, either from within the application itself or from the kernel before hand?
Thanks, Robbie VanVossen DornerWorks
_______________________________________________ Devel mailing list Devel@sel4.systems https://sel4.systems/lists/listinfo/devel
________________________________ The information in this e-mail may be confidential and subject to legal professional privilege and/or copyright. National ICT Australia Limited accepts no liability for any damage caused by this email or its attachments.
participants (3)
-
Alexander Kroh
-
Hesham Almatary
-
Robert VanVossen