|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [xev-devel][PATCH][linux-4.19] swiotlb-xen.c: Fixed cache invalidation fault
Problem: xen_swiotlb_map_sg_attrs() maps a set of buffers described in
scatterlist.
It calls xen_dma_map_page() and sets sglist.dma_address to the address
calculated by
xen_phys_to_bus(). Let's call it dma_address_1.
xen_dma_map_page() maps the area and gets dma address different from
dma_address_1,
let's call it dma_address_2. Then function __swiotlb_map_page() makes
conversion:
dma_addr -> phys_addr -> virt_addr using dma_address_2 and passes "virt_addr"
to __dma_map_area(), the latter successfully invalidates cache.
When xen_swiotlb_unmap_sg_attrs() unmaps the area it passes dma_address_1
to __swiotlb_unmap_page(). __swiotlb_unmap_page() makes the same convertion:
dma_addr -> phys_addr -> virt_addr using dma_address_1 and passes "virt_addr"
to __dma_map_area(), the latter gets Data Abort in attempt to invalidate cache.
The problem manfests on devices that have dma_pfn_offset != 0.
Specifically, while loading brcmfmac module (BCM4345 WiFi chip) in Dom0.
What was done: sglist.dma_address is set to phys_to_dma("phys").
Signed-off-by: Nataliya Korovkina <malus.brandywine@xxxxxxxxx>
---
drivers/xen/swiotlb-xen.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index a6f9ba85dc4b..9363a52e4756 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -583,7 +583,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct
scatterlist *sgl,
sg->length,
dir,
attrs);
- sg->dma_address = dev_addr;
+ sg->dma_address = phys_to_dma(hwdev, dev_addr);
} else {
/* we are not interested in the dma_addr returned by
* xen_dma_map_page, only in the potential cache
flushes executed
@@ -594,7 +594,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct
scatterlist *sgl,
sg->length,
dir,
attrs);
- sg->dma_address = dev_addr;
+ sg->dma_address = phys_to_dma(hwdev, dev_addr);
}
sg_dma_len(sg) = sg->length;
}
--
2.17.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |