Re: [PATCH 1/5] Make __pa() uses CPHYSADDR() if really needed

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

 



Hi Atsushi,

Atsushi Nemoto wrote:
> On Wed, 11 Oct 2006 14:08:41 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote:
>> -#define __pa(x)			((unsigned long) (x) - PAGE_OFFSET)
>> +#if defined(CONFIG_64BITS) && !defined(CONFIG_BUILD_ELF64)
>> +#define __pa(x)			CPHYSADDR(x)
>> +#else
>> +#define __pa(x)			((unsigned long)(x) - PAGE_OFFSET)
>> +#endif
>>  #define __va(x)			((void *)((unsigned long) (x) + PAGE_OFFSET))
> 
> Please do not do this.  CONFIG_BUILD_ELF64=n does not mean we only
> have less then 512MB memory.  We can have large flat area at
> PAGE_OFFSET (0x9800000000000000) in 64-bit kernel, so __pa() should
> accepct a value such as 0x9800000020000000.
> 

To deal with such address there's virt_to_phys() routine. __pa() is
normally used during early bootmem init (as CPHYSADDR(), BTW). At early
bootmem, we normally deal with address in KSEG0. Once we have switched
to XKPHYS address, I agree we should use virt_to_phys().

If we look at how to convert a virtual address into a physical one,
we have:

	CPHYSADDR()
	__pa()
	virt_to_phys()

What definition would you give to each of them ?

BTW, if you grep for __pa() you'll notice that it's almost not used
by the kernel. I suspect that's because of CPHYSADDR() existence which
is really confusing.

		Franck


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux