virt_to_phys - what am I doing wrong?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I'm trying to use virt_to_phys() to find the physical address
of some kernel RAM.  (This is an on ARM OSK board).
It's not working as I expected:

membase = kmalloc(DEBUG_MEM_LENGTH, GFP_ATOMIC);
physbase = virt_to_phys(membase);
printk("membase=0x%p\n", membase);
printk("physbase=0x%lu\n", physbase);

Gives me:
membase=0xc1c8c000
physbase=0x298369024

physbase isn't in the range of real physical memory on my
machine.  (I'm only interested in the first page of the
allocation, so I don't care if subsequent pages are
not physically contiguous.)

Other uses of virt_to_phys() that I see in the the kernel source
seem to only use IOmapped mem, or DMA-able mem.

Is this even the right approach?  Do I need to walk page
tables myself?  I thought there would be a simple routine
for this, but I haven't found it.

Any help would be much appreciated.

Thanks,
 -- Tim

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux