Skip to contentSkip to conversation

Physical memory addresses/PCI memory addresses/io_remap

DISCUSSION Petr Vandrovec 2 participants 2 messages Dec 14, 2000

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Russell King

virtual space - address space that the kernel runs in
physical space - address space that the CPU sits in
PCI memory space - memory address space that the PCI peripherals sit in

    == bus address...
Quoted 10 lines

Many, if not all ARM architectures have physical address 0 different from PCI memory address 0.

According to include/linux/fb.h, fb drivers should place a physical address into "fix.smem_start" and "fix.mmio_start", which can then be passed to io_remap_page_range.

1. Should pci_resource_start be returning the PCI memory space address or a physical memory space address?

I believe that pci_resource_start() should return physical address, not bus one. It already happens on PReP.

Quoted 2 lines

3. Do we need a macro to convert PCI memory space addresses to physical memory space addresses?

No. You need PCI memory space address only for busmastering transfers. And for PCI DMA there is specialized API... Currently all bus -> physical mapping should be hidden in platform specific PCI code.

Quoted 3 lines

4. What does this mean for ioremap? (currently, on ARM, ioremap takes PCI memory space addresses, not a physical memory address, which makes the physmap MTD driver technically broken).

And ioremap() should take physical address, returning virtual one.
Best regards,
Petr Vandrovec [email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 5 lines
Quoted 2 lines

1. Should pci_resource_start be returning the PCI memory space address or a physical memory space address?

I believe that pci_resource_start() should return physical address, not bus one. It already happens on PReP.

It returns a cookie for use with ioremap. Who says that a given device has a constant bus or physical mapping that is unique ?

Quoted 5 lines
Quoted 3 lines

4. What does this mean for ioremap? (currently, on ARM, ioremap takes PCI memory space addresses, not a physical memory address, which makes the physmap MTD driver technically broken).

And ioremap() should take physical address, returning virtual one.

No. Ioremap takes a cookie and returns a different cookie suitable for using with readb/writeb/memcpy_fromio and friends.

Eg on Sparc64 its a physical address and readb uses TLB bypass

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/