Skip to contentSkip to conversation

virtual memmap and page_address

DISCUSSION Jesse Barnes 3 participants 4 messages Dec 15, 2004

lore
Share & tools
lore
#0 lore raw

I've been messing around with some of the drm drivers lately, and in some cases they'll call pci_map_single on an address returned from page_address(). When virtual memmaps are enabled, page_address will return a region 5 pointer. It looks like all of the ia64 iommu code (swiotlb, sba_iommu and sn2's pci_dma) assume that the address passed in is an identity mapped address since they use __pa to get the physical address. This is fast, but also incorrect when the routines are handed a region 5 address. So we either have to fix our iommu mapping routines or change some other assumptions (either about what page_address should return or what __va in general means for example). Turning on WANT_PAGE_VIRTUAL and populating page->virtual with an identity mapped address is another option, probably less expensive than switching to ia64_tpa in the mapping routines.

Comments?

Thanks,
Jesse

#1 lore raw
Quoted 2 lines

When virtual memmaps are enabled, page_address will return a region 5 pointer.

Are you sure? It looks to me that without WANT_PAGE_VIRTUAL that we end up in lowmem_page_address(), which just gives us:

__va(page_to_pfn(page) << PAGE_SHIFT)

which has got to be a region 7 address.

What's the code path that you are looking at that can return a region 5 address?

-Tony

#2 lore raw
In reply to Jesse Barnes
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Jesse Barnes

Jesse> I've been messing around with some of the drm drivers lately, Jesse> and in some cases they'll call pci_map_single on an address Jesse> returned from page_address(). When virtual memmaps are Jesse> enabled, page_address will return a region 5 pointer.

Huh? The page _descriptor_ is in region 5, but surely not page_address()?

	--david
#3 lore raw
In reply to Jesse Barnes
Quoted 4 lines · Jesse Barnes

I've been messing around with some of the drm drivers lately, and in some cases they'll call pci_map_single on an address returned from page_address(). When virtual memmaps are enabled, page_address will return a region 5 pointer. It looks like all of the ia64 iommu code (swiotlb,

Quoted 8 lines

sba_iommu and sn2's pci_dma) assume that the address passed in is an identity mapped address since they use __pa to get the physical address. This is fast, but also incorrect when the routines are handed a region 5 address. So we either have to fix our iommu mapping routines or change some other assumptions (either about what page_address should return or what __va in general means for example). Turning on WANT_PAGE_VIRTUAL and populating page->virtual with an identity mapped address is another option, probably less expensive than switching to ia64_tpa in the mapping routines.

Nevermind, obviously I haven't had enough coffee this morning. page_address correctly returns an identity mapped address so my problem lies elsewhere.