Thread (43 messages) 43 messages, 5 authors, 2013-10-25
STALE4627d
Revisions (3)
  1. v6 [diff vs current]
  2. v8 current
  3. v9 [diff vs current]

[PATCH v8 18/19] swiotlb-xen: no need to do execute two bus_to_phys translations in a row

From: Stefano Stabellini <hidden>
Date: 2013-10-17 18:05:21
Also in: lkml, xen-devel
Subsystem: the rest, xen hypervisor interface, xen swiotlb subsystem · Maintainers: Linus Torvalds, Juergen Gross, Stefano Stabellini

xen_unmap_single calls xen_bus_to_phys, then passes dev_addr to
is_xen_swiotlb_buffer that calls xen_bus_to_phys again.
xen_bus_to_phys is potentially a slow operation that might involve
walking a tree.
We can avoid calling xen_bus_to_phys twice by removing the
is_xen_swiotlb_buffer call and doing the check directly in
xen_unmap_single using the physical address.

Signed-off-by: Stefano Stabellini <redacted>
---
 drivers/xen/swiotlb-xen.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index 4d50058..6d9ca61 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -426,8 +426,8 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
 
 	xen_dma_unmap_page(hwdev, paddr, size, dir, attrs);
 
-	/* NOTE: We use dev_addr here, not paddr! */
-	if (is_xen_swiotlb_buffer(dev_addr)) {
+	if (paddr >= virt_to_phys(xen_io_tlb_start) &&
+		paddr < virt_to_phys(xen_io_tlb_end)) {
 		swiotlb_tbl_unmap_single(hwdev, paddr, size, dir);
 		return;
 	}
-- 
1.7.2.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help