UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 47662

14.1 Zynq - Changing Memory Access Type

Description

How can I change the memory access type from CortexA9 through the GP0 to PL to other options such as shared device accesses when running Linux?

Solution

The access type for memory in the Xilinx GIT tree (git.xilinx.com) can be altered by using the ioremap function associated with Linux. The function of ioremap is to assign virtual addresses to physical memory regions on the device. This allows data that is important to a certain task to be stored in the same relative location even if there is not enough free continuous physical space on the device. The advantage of this is physical memory no longer has to go through address relocation calculations each time a task is performed.

During the mapping of virtual memory space, it is possible to change certain attributes of the memory, such as access types. Within the Xilinx GIT tree, there are multiple ioremap functions that users can use to map their memory, each having different attributes.

For example, in the arch/arm/include/asm/io.h header file the following ioremap functions exist:

249 #defineioremap(cookie,size)__arch_ioremap((cookie),(size),MT_DEVICE)
250 #defineioremap_nocache(cookie,size)__arch_ioremap((cookie),(size),MT_DEVICE)
251 #defineioremap_cached(cookie,size)__arch_ioremap((cookie),(size),MT_DEVICE_CACHED)
252 #defineioremap_wc(cookie,size)__arch_ioremap((cookie),(size),MT_DEVICE_WC)
253 #defineiounmap__arch_iounmap

The difference between these functions is the MT_DEVICE attributes which can be found in the arch/arm/mm/mmu.c file:

(Note: MT_DEVICE for pre-ARMv6 will have 'strongly ordered' memory and ARMv6/post-ARMv6 will have 'shared device' memory)

195 staticstructmem_typemem_types[]={
196 [MT_DEVICE]={/*ARMv6shareddevice*/
197 .prot_pte=PROT_PTE_DEVICE|L_PTE_MT_DEV_SHARED|
198 L_PTE_SHARED,
199 .prot_l1=PMD_TYPE_TABLE,
200 .prot_sect=PROT_SECT_DEVICE|PMD_SECT_S,
201 .domain=DOMAIN_IO,
202 },
203
209 [MT_DEVICE_CACHED]={/*ioremap_cached*/
210 .prot_pte=PROT_PTE_DEVICE|L_PTE_MT_DEV_CACHED,
211 .prot_l1=PMD_TYPE_TABLE,
212 .prot_sect=PROT_SECT_DEVICE|PMD_SECT_WB,
213 .domain=DOMAIN_IO,
214 },
215 [MT_DEVICE_WC]={/*ioremap_wc*/
216 .prot_pte=PROT_PTE_DEVICE|L_PTE_MT_DEV_WC,
217 .prot_l1=PMD_TYPE_TABLE,
218 .prot_sect=PROT_SECT_DEVICE,
219 .domain=DOMAIN_IO,
220 },
221
276 };

Each instance of the ioremap function will allow for a different access type.

AR# 47662
Date Created 02/13/2013
Last Updated 02/13/2013
Status Active
Type General Article
Devices
  • Zynq-7000
Tools
  • EDK - 14.1
  • ISE Design Suite - 14.1