a question about __nocache_pa macro

Chan Kim ckim at etri.re.kr
Wed Apr 23 00:25:26 EDT 2014


Hi,
can someony explain this macro to me? It's in arch/sparc/include/asm/pgtsrmmu.h (linux 3.3)
#define __nocache_pa(VADDR) (((unsigned long)VADDR) - SRMMU_NOCACHE_VADDR + __pa((unsigned long)srmmu_nocache_pool))
it looks like converting virtual address VADDR to physical address for which no cache is used.
so I can see SRMMU_NOCACHE_VADDR is the virtual address start value from which no cache is used(in our case it's 0xc8000000),
and VADDR is relative to this start location (thus the minus).
But why do we add the last srmmu_nocache_pool term? we are adding the offset to physical nocache pool address. 
So it seems like it is converting a virtual address to a physcal address relative to nocache pool..
Why is it done this way?
Thanks in advance.
Chan


More information about the Kernelnewbies mailing list