RE: virt_to_phys - what am I doing wrong?

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

 



If you don't have CONFIG_DISCONTIGMEM support enabled, this used to just
map to a simple macro.

	0xc1c8c000-0xc0000000+0x10000000 = 11c8c000

There should be another layer of indirection if CONFIG_DISCONTIGMEM
support is turned on which needs to be defined properly.  Do you have
that enabled by chance?

Regards,
Richard W.


/*
 * Page offset: 3GB
 */
#define PAGE_OFFSET	(0xc0000000UL)
#define PHYS_OFFSET	(0x80000000UL)

/*
 * On 2420 ES2, the dram is contiguous
 */
#define __virt_to_phys__is_a_macro
#define __virt_to_phys(vpage) ((vpage) - PAGE_OFFSET + PHYS_OFFSET )
#define __phys_to_virt__is_a_macro
#define __phys_to_virt(ppage) (((ppage)  - PHYS_OFFSET ) + PAGE_OFFSET)

> -----Original Message-----
> From: linux-omap-open-source-bounces@xxxxxxxxxxxxxx
[mailto:linux-omap-
> open-source-bounces@xxxxxxxxxxxxxx] On Behalf Of Tim Bird
> Sent: Thursday, June 09, 2005 12:04 PM
> To: linux-omap-open-source@xxxxxxxxxxxxxx; kernelnewbies@xxxxxxxxxxxx
> Subject: virt_to_phys - what am I doing wrong?
> 
> 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
> =============================
> _______________________________________________
> Linux-omap-open-source mailing list
> Linux-omap-open-source@xxxxxxxxxxxxxx
> http://linux.omap.com/mailman/listinfo/linux-omap-open-source

--
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