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

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

 



On Wed, 11 Oct 2006 16:15:49 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote:
> 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 ?

Here's my understanding.

CPHYSADDR --- used to convert a CKSEG0 or CKSEG1 to a physical
address.  Be carefull when use it in 64-bit kernel.

__pa() --- inverse of __va(), of course :-) used to convert a kernel
linear logical address to a physycal address.

virt_to_phys() --- synonym of __pa() ?

Now I think passing kernel symbol address to __pa() is wrong.  This is
implied by DMA-mapping.txt:

  This rule also means that you may use neither kernel image addresses
  (items in data/text/bss segments), nor module image addresses, nor
  stack addresses for DMA.  These could all be mapped somewhere entirely
  different than the rest of physical memory.  Even if those classes of
  ...

Maybe introducing __pa_symbol() is better as your patch tried.

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

__pa() is used in many place indirectly via virt_to_page().

---
Atsushi Nemoto


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

  Powered by Linux