Reputation: 517
Working on the arm core adsp-sc572 (Kernel 4.0), I figured out __pa
is not working correct.
Allocating a big buffer (e.g.500kB) for DMA using kmalloc gives me a virtual address. When using __pa()
-> it sometimes returns an address out of the physical address range. e.g. 0x88AB0000
0x87FFFFFF
[..] -> 128MB RAM
0x80000000
__pa
calls __virt_to_phys
-> __pv_stub
which I do not unterstand.
static inline phys_addr_t __virt_to_phys(unsigned long x)
{
phys_addr_t t;
if (sizeof(phys_addr_t) == 4) {
__pv_stub(x, t, "add", __PV_BITS_31_24);
} else {
__pv_stub_mov_hi(t);
__pv_add_carry_stub(x, t);
}
return t;
}
Where is the beginning of the virtual address space defined? How does __pv_stub
work? Why does __pa return an invalid address?
Upvotes: 1
Views: 1040
Reputation: 146
Pleae refers to https://www.linuxquestions.org/questions/linux-kernel-70/physical-address-on-a-x86-64-bit-machine-914781-print/ , it may be helpful to you.
Part of the kernel virtual address space in Linux is a contiguous mapping of physical memory. If you use the __pa macro on a virtual address in that range you get the corresponding physical address. But are the page tables in that range or what does __pa do if you use it in some other range? I don't know.
Upvotes: 2