[meta-xilinx] Linux/FreeRTOS AMP vrings

Edward Wingate edwingate8 at gmail.com
Mon Jul 13 10:14:16 PDT 2015


On Thu, Jul 2, 2015 at 10:49 AM, Edward Wingate <edwingate8 at gmail.com> wrote:
> How does this get reconciled with the only addresses that FreeRTOS
> knows about (1e400000/1e404000)?  It seems I need to somehow get Linux
> to allocate the vrings at 1e400000/1e404000 instead of where it is
> currently allocating at.

There's a comment in the FreeRTOS application linker script for vring
memory placement that says "Linker script has to match Linux dma
allocation".  So I think I need to modify my linker script somehow,
but not sure how to go about getting FreeRTOS vring memory allocation
to match Linux DMA allocation.

The vring memory allocation in the FreeRTOS app linker script puts
them after the trace buffer and after the end of the ELF:

   /* Trace buffer should be inside carveout */
   __trace_buffer_start = .;
   . = . + 0x8000; /* It should be TRACE_BUFFER_SIZE */
   __trace_buffer_end = .;
   __elf_end = .; /* This is size of carveout */

/* Linker script has to match Linux dma allocation
* TX buffer has to start at align address but alignment
* is done by dma_alloc_from_coherent and get_order and
bitmap_find_free_region functions
* Algorithm is easy 1 << (count position the most significant bit from
((__elf_end - 1) >> (PAGE_SHIFT -1))
*/
   . = ALIGN(0x400000);

   __ring_tx_addr = .;
   . = . + (256 * 16) + (2 *(3+256)); /* vring size macro without
vring_used_elements */

   . = ALIGN(0x1000); /* Used buffer must be aligned */
   __ring_tx_addr_used = .;
   . = . + 4 + (8 * 256); /* vring_used structure */
   __ring_tx_addr_used_end = .;
   . = ALIGN(0x2000);

   __ring_rx_addr = .;
  . = . + (256 * 16) + (2 *(3+256)); /* vring size macro without
vring_used_elements */
  . = ALIGN(0x1000);
  __ring_rx_addr_used = .; /* Used buffer must be aligned */
  . = . + 4 + (8 * 256); /* vring_used structure */
  __ring_rx_addr_used_end = .;
  . = ALIGN(0x2000);

In this case, RING_TX is at 0x1E400000 and RING_RX at 0x1E404000.  I
tried relocating the vrings to around the memory location Linux wants
to be allocate them (0x1D000000) and adding another corresponding
carveout entry in the resource table, but Linux will then allocate the
vrings at yet another memory location. (And FreeRTOS has problems
accessing that memory location, probably because MMU settings hasn't
been set up correctly.)

How do I get FreeRTOS vring memory location (defined in the linker
script) and the Linux dma allocation for vrings (defined in the
resource table) to sync up to the same memory location?  The memory
location for the vrings in the resource table does sync with the
linker script, but when Linux processes the resource table, it will
allocate vring at another memory location.  Thanks for your help.



More information about the meta-xilinx mailing list