linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* phys-to-virt kernel mapping and ioremap()
@ 2000-07-20 18:06 Timur Tabi
  2000-07-21 13:49 ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2000-07-20 18:06 UTC (permalink / raw)
  To: Linux MM mailing list, Linux Kernel Mailing list

I'm studying the code for __ioremap and I'm confused by something.

The phys_to_virt and virt_to_phys macros are very simple.  Basically, in kernel
space, the virtual address is an offset of the physical address, so it's very
simple.

__ioremap is supposed to take high PCI memory and map it to kernel space. 
However, __ioremap() calls get_vm_area() which then calls kmalloc(), which
allocates some memory from the heap.  Then remap_area_pages() is called, and
that uses the three-level page tables to map the memory allocated by kmalloc to
the PCI memory.

And that's where I'm confused.  Particularly:

1) Doesn't this mapping break the phys_to_virt and virt_to_phys macros?

2) kmalloc takes real physical memory from the kernel heap.  But then the
virtual addresses are remapped to other physical memory.  What happens to the
physical memory that kmalloc allocated?  Why isn't it freed?	


--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <20000720174852Z156962-31297+1037@vger.rutgers.edu>]

end of thread, other threads:[~2000-07-21 13:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-20 18:06 phys-to-virt kernel mapping and ioremap() Timur Tabi
2000-07-21 13:49 ` Jeff Garzik
     [not found] <20000720174852Z156962-31297+1037@vger.rutgers.edu>
2000-07-20 18:41 ` Jes Sorensen
2000-07-20 18:53   ` Timur Tabi
     [not found] ` <20000720183534Z156966-31297+1096@vger.rutgers.edu>
2000-07-20 19:06   ` Jes Sorensen
2000-07-20 19:12   ` Ivan Passos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox