Various swiotlb fixes
Quoted 2 lines · Andi Kleen
I added support for swiotlb=force for easier testing.
This bootparam has exposed a bug in today's ia64 swiotlb code, because of which the kernel was not booting on my tiger with "swiotlb=force"
In swiotlb_map/unmap_sg(), sg->dma_address is getting setup with virtual address instead of physical.
Attached patch fixes this issue.
thanks,
suresh
Signed-off-by Suresh Siddha <[email protected]>
arch/ia64/lib/swiotlb.c renamed from arch/ia64/lib/swiotlb.c.orig +2 -2
@@ -492,7 +492,7 @@ addr =SG_ENT_VIRT_ADDRESS (sg); dev_addr =virt_to_phys (addr);if (swiotlb_force ||address_needs_mapping (hwdev, dev_addr)) { - sg->dma_address = (dma_addr_t )map_single (hwdev, addr, sg->length, dir); + sg->dma_address = (dma_addr_t )virt_to_phys (map_single (hwdev, addr, sg->length, dir));if (!sg->dma_address) {/* Don't panic here, we expect pci_map_sg users to do proper error handling. */
@@ -522,7 +522,7 @@for (i =0 ; i < nelems; i++, sg++)if (sg->dma_address !=SG_ENT_PHYS_ADDRESS (sg)) -unmap_single (hwdev, (void *) sg->dma_address, sg->dma_length, dir); +unmap_single (hwdev, (void *)phys_to_virt (sg->dma_address), sg->dma_length, dir);else if (dir ==DMA_FROM_DEVICE )mark_clean (SG_ENT_VIRT_ADDRESS (sg), sg->dma_length); }