All of lore.kernel.org
 help / color / mirror / Atom feed
* Question regarding behavior of virt_to_bus ....
@ 2005-10-04  7:56 Himanshu Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Himanshu Raj @ 2005-10-04  7:56 UTC (permalink / raw)
  To: xen-devel

Hi Folks,

I need some large chunk of physical memory, so I allocate it early using 
alloc_bootmem_low_pages and use it later (akin to bigphysarea patch). 
The trouble I am having is the following. Suppose the virtual address 
for the memory area is 0xc14d6000. After xen_create_contiguous_region 
call, I do a virt_to_bus and the bus address comes out to be 0x18000000. 
So far so good. However, later when I try to use this memory in a device 
driver, the call to virt_to_bus returns 0x14d6000. This result is 
baffling me, since that's what it would look like in a normal 32-bit 
i386 world, and not in xenified world.

Am I doing something stupid, or is there some technicality of memory 
subsystem that I don't get. Ofcourse, if I just use pci_alloc_consistent 
(for a small buffer), everything works fine, since there is no bootmem 
related contortion involved.

I will highly appreciate any input on this.

--Himanshu
-------------------------------------------------------------------------
Himanshu Raj
PhD Student, GaTech (www.cc.gatech.edu/~rhim)
I prefer to receive attachments in an open, non-proprietary format.
-------------------------------------------------------------------------

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

* RE: Question regarding behavior of virt_to_bus ....
@ 2005-10-04 10:10 Ian Pratt
  2005-10-04 14:58 ` Himanshu Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Pratt @ 2005-10-04 10:10 UTC (permalink / raw)
  To: Himanshu Raj, xen-devel

> I need some large chunk of physical memory, so I allocate it 
> early using alloc_bootmem_low_pages and use it later (akin to 
> bigphysarea patch). 

If it needs to be machine contiguous this won't work on its own.

You need to use xen_create_contiguous_region to attempt to change the
pages backing the region into a contigous extent. 

See dma_alloc

Ian

> The trouble I am having is the following. Suppose the virtual 
> address for the memory area is 0xc14d6000. After 
> xen_create_contiguous_region call, I do a virt_to_bus and the 
> bus address comes out to be 0x18000000. 
> So far so good. However, later when I try to use this memory 
> in a device driver, the call to virt_to_bus returns 
> 0x14d6000. This result is baffling me, since that's what it 
> would look like in a normal 32-bit
> i386 world, and not in xenified world.
> 
> Am I doing something stupid, or is there some technicality of 
> memory subsystem that I don't get. Ofcourse, if I just use 
> pci_alloc_consistent (for a small buffer), everything works 
> fine, since there is no bootmem related contortion involved.
> 
> I will highly appreciate any input on this.
> 
> --Himanshu
> --------------------------------------------------------------
> -----------
> Himanshu Raj
> PhD Student, GaTech (www.cc.gatech.edu/~rhim) I prefer to 
> receive attachments in an open, non-proprietary format.
> --------------------------------------------------------------
> -----------
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 

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

* Re: Question regarding behavior of virt_to_bus ....
  2005-10-04 10:10 Ian Pratt
@ 2005-10-04 14:58 ` Himanshu Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Himanshu Raj @ 2005-10-04 14:58 UTC (permalink / raw)
  To: Ian Pratt; +Cc: xen-devel

But I do call xen_create_contiguous_region.

On Tue, Oct 04, 2005 at 11:10:21AM +0100, Ian Pratt wrote:
> > I need some large chunk of physical memory, so I allocate it 
> > early using alloc_bootmem_low_pages and use it later (akin to 
> > bigphysarea patch). 
> 
> If it needs to be machine contiguous this won't work on its own.
> 
> You need to use xen_create_contiguous_region to attempt to change the
> pages backing the region into a contigous extent. 
> 
> See dma_alloc
> 
> Ian
> 
> > The trouble I am having is the following. Suppose the virtual 
> > address for the memory area is 0xc14d6000. After 
> > xen_create_contiguous_region call, I do a virt_to_bus and the 
> > bus address comes out to be 0x18000000. 
> > So far so good. However, later when I try to use this memory 
> > in a device driver, the call to virt_to_bus returns 
> > 0x14d6000. This result is baffling me, since that's what it 
> > would look like in a normal 32-bit
> > i386 world, and not in xenified world.
> > 
> > Am I doing something stupid, or is there some technicality of 
> > memory subsystem that I don't get. Ofcourse, if I just use 
> > pci_alloc_consistent (for a small buffer), everything works 
> > fine, since there is no bootmem related contortion involved.
> > 
> > I will highly appreciate any input on this.
> > 
> > --Himanshu
> > --------------------------------------------------------------
> > -----------
> > Himanshu Raj
> > PhD Student, GaTech (www.cc.gatech.edu/~rhim) I prefer to 
> > receive attachments in an open, non-proprietary format.
> > --------------------------------------------------------------
> > -----------
> > 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
> > 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

-- 
-------------------------------------------------------------------------
Himanshu Raj
PhD Student, GaTech (www.cc.gatech.edu/~rhim)
I prefer to receive attachments in an open, non-proprietary format.
-------------------------------------------------------------------------

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

end of thread, other threads:[~2005-10-04 14:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-04  7:56 Question regarding behavior of virt_to_bus Himanshu Raj
  -- strict thread matches above, loose matches on Subject: below --
2005-10-04 10:10 Ian Pratt
2005-10-04 14:58 ` Himanshu Raj

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.