virtual memmap and page_address
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
Quoted 2 lines
When virtual memmaps are enabled,
page_addresswill 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
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
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_singleon an address returned frompage_address(). When virtual memmaps are enabled,page_addresswill return a region 5 pointer. It looks like all of the ia64 iommu code (swiotlb,
Quoted 8 lines
sba_iommuand sn2'spci_dma) assume that the address passed in is an identity mapped address since they use__pato 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 whatpage_addressshould return or what__vain general means for example). Turning onWANT_PAGE_VIRTUALand populatingpage->virtualwith an identity mapped address is another option, probably less expensive than switching toia64_tpain 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.