Re: phys-to-virt kernel mapping and ioremap()

Jes Sorensen
2000-07-20T18:41:51Z

>>>>> "Timur" == Timur Tabi <ttabi@interactivesi.com> writes:

Timur> I'm studying the code for __ioremap and I'm confused by
Timur> something. The phys_to_virt and virt_to_phys macros are very
Timur> simple. Basically, in kernel space, the virtual address is an
Timur> offset of the physical address, so it's very simple.

You are making a bad assumption here, that PCI shared memory can be
treated as regular memory which it cannot.

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

Those two macros are not defined on ioremap'ed regions so it is
irrelevant.

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

I asume it is used to generate page tables for the io memory it is
mapping, but I haven't looked at the code.

Jes