All of lore.kernel.org
 help / color / mirror / Atom feed
* question about page_to_phys
@ 2005-09-01  1:29 Xiaofeng Ling
  2005-09-01  9:07 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaofeng Ling @ 2005-09-01  1:29 UTC (permalink / raw)
  To: xen-devel

The page_to_phys is defined as
#define page_to_phys(page)   (phys_to_machine(page_to_pseudophys(page)))
so it return machine addresss
while virt_to_phys return psedophys. include/asm-xen/asm-i386/io.h
this is really confusing.
why not define page_to_machine?

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

* Re: question about page_to_phys
  2005-09-01  1:29 question about page_to_phys Xiaofeng Ling
@ 2005-09-01  9:07 ` Keir Fraser
       [not found]   ` <4316C793.4080501@intel.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2005-09-01  9:07 UTC (permalink / raw)
  To: Xiaofeng Ling; +Cc: xen-devel


On 1 Sep 2005, at 02:29, Xiaofeng Ling wrote:

> The page_to_phys is defined as
> #define page_to_phys(page)   
> (phys_to_machine(page_to_pseudophys(page)))
> so it return machine addresss
> while virt_to_phys return psedophys. include/asm-xen/asm-i386/io.h
> this is really confusing.
> why not define page_to_machine?

page_to_phys() is used only in places where we want to compare machine 
addresses (e.g., in deciding when to merge I/O requests). It was easier 
to abuse the macro definition than fix every place that it is used.

  -- Keir

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

* Re: question about page_to_phys
       [not found]     ` <ca96cc44c40fb9aea95586126b73ecc5@cl.cam.ac.uk>
@ 2005-09-01  9:56       ` Xiaofeng Ling
  2005-09-01 10:37         ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaofeng Ling @ 2005-09-01  9:56 UTC (permalink / raw)
  To: Keir Fraser, xen-devel

Keir Fraser wrote:
> 
> On 1 Sep 2005, at 10:19, Xiaofeng Ling wrote:
> 
> If a guest is in translate mode it should have no concept of pseudophys
> vs machine. That translation is hidden from it. Hence there should be
> no need to hack the virtual drivers -- page_to_phys() should naturally
> translate to pseudophys if SHADOW_TRANSLATE is configured.
> 
>   -- Keir
> 
so we need such a patch? but how to deal with virt_to_mfn in blkfront.c?

diff -r 9092486cc4b3 linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/io.h
@@ -101,7 +101,11 @@
   * Change "struct page" to physical address.
   */
  #define page_to_pseudophys(page) ((dma_addr_t)page_to_pfn(page) << 
PAGE_SHIFT)
+#ifndef CONFIG_SHADOW_TRANSLATE
  #define page_to_phys(page) 
(phys_to_machine(page_to_pseudophys(page)))
+#else
+#define page_to_phys(page)      (page_to_pseudophys(page))
+#endif

  #define bio_to_pseudophys(bio)  (page_to_pseudophys(bio_page((bio))) + \
                                   (unsigned long) bio_offset((bio)))

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

* Re: question about page_to_phys
  2005-09-01  9:56       ` Xiaofeng Ling
@ 2005-09-01 10:37         ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2005-09-01 10:37 UTC (permalink / raw)
  To: Xiaofeng Ling; +Cc: xen-devel


On 1 Sep 2005, at 10:56, Xiaofeng Ling wrote:

> so we need such a patch? but how to deal with virt_to_mfn in 
> blkfront.c?

I guess the phys<->mach macros should all be no-ops.

  -- Keir

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

end of thread, other threads:[~2005-09-01 10:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01  1:29 question about page_to_phys Xiaofeng Ling
2005-09-01  9:07 ` Keir Fraser
     [not found]   ` <4316C793.4080501@intel.com>
     [not found]     ` <ca96cc44c40fb9aea95586126b73ecc5@cl.cam.ac.uk>
2005-09-01  9:56       ` Xiaofeng Ling
2005-09-01 10:37         ` Keir Fraser

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.