All of lore.kernel.org
 help / color / mirror / Atom feed
* page_to_phys
@ 2009-10-09 14:02 Kristoffer Glembo
  2009-10-09 21:21 ` page_to_phys David Miller
  2009-10-11  9:22 ` page_to_phys kristoffer
  0 siblings, 2 replies; 3+ messages in thread
From: Kristoffer Glembo @ 2009-10-09 14:02 UTC (permalink / raw)
  To: sparclinux

Hi,

Currently in io_32.h page_to_phys is defined as:

#define page_to_phys(page)	(((page) - mem_map) << PAGE_SHIFT)

Should it not be:

#define page_to_phys(page)	((((page) - mem_map) << PAGE_SHIFT) + phys_base)

or perhaps:

#define page_to_phys(page)	((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)

Best regards,
Kristoffer Glembo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: page_to_phys
  2009-10-09 14:02 page_to_phys Kristoffer Glembo
@ 2009-10-09 21:21 ` David Miller
  2009-10-11  9:22 ` page_to_phys kristoffer
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2009-10-09 21:21 UTC (permalink / raw)
  To: sparclinux

From: Kristoffer Glembo <kristoffer@gaisler.com>
Date: Fri, 09 Oct 2009 16:02:14 +0200

> Currently in io_32.h page_to_phys is defined as:
> 
> #define page_to_phys(page)	(((page) - mem_map) << PAGE_SHIFT)
> 
> Should it not be:
> 
> #define page_to_phys(page) ((((page) - mem_map) << PAGE_SHIFT) +
> #phys_base)
> 
> or perhaps:
> 
> #define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) <<
> #PAGE_SHIFT)

Sparc 32-bit doesn't offset the mem_map at phys_base.

What is offset by phys_base is what gets mapped at PAGE_OFFSET
virtually.

That's why the things that translate between virtual and physical
addresses do take phys_base into account.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: page_to_phys
  2009-10-09 14:02 page_to_phys Kristoffer Glembo
  2009-10-09 21:21 ` page_to_phys David Miller
@ 2009-10-11  9:22 ` kristoffer
  1 sibling, 0 replies; 3+ messages in thread
From: kristoffer @ 2009-10-11  9:22 UTC (permalink / raw)
  To: sparclinux



Quoting David Miller <davem@davemloft.net>:

>
> Sparc 32-bit doesn't offset the mem_map at phys_base. 
>
> What is offset by phys_base is what gets mapped at PAGE_OFFSET
> virtually. 
>

Thanks for the clarification. Got temporarily confused. :-)

Best regards,
Kristoffer Glembo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-11  9:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-09 14:02 page_to_phys Kristoffer Glembo
2009-10-09 21:21 ` page_to_phys David Miller
2009-10-11  9:22 ` page_to_phys kristoffer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.