mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
Feature:
- Use dma addresses instead of the virt_to_phys and vice versa functions.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iQEcBAABAgAGBQJQy9RFAAoJEFjIrFwIi8fJaYwH/0aC5xbJYSNubBI5opZe7APC
b1LzHpV1yXyIZc2wOqdhzFmmrzRLVHULnfG/oOF9/VaAjrxWeZVDs54DF33Xao9M
pOFLrY9kwK+AB5DPm0aBzF7JOS8Fd+alNM7Dork3mtsxbqqX3fx0OHvNTZJVdrj8
ToYVoTiz7dpXC1IIgBoJf6XKrwqvcQrZc7yXgz0A8ZZhCUZSBMHV1Lifx/8xzpQ+
bgfTSsH6CwejlpSXWQ6jfsF2C/Ku/nAWOKrpVZleb08svgPR/UA8Nhkjlaoj2xbp
zq/aWnpaF4fKiYmY6qrRGo+ABcUHua7Iaco8ZjNCyrIPfInSqhxua/Ajzk1xtNU=
=QiGx
-----END PGP SIGNATURE-----
Merge tag 'stable/for-linus-3.8-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb
Pull swiotlb update from Konrad Rzeszutek Wilk:
"Feature:
- Use dma addresses instead of the virt_to_phys and vice versa
functions.
Remove the multitude of phys_to_virt/virt_to_phys calls and instead
operate on the physical addresses instead of virtual in many of the
internal functions. This does provide a speed up in interrupt
handlers that do DMA operations and use SWIOTLB."
* tag 'stable/for-linus-3.8-rc0-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
swiotlb: Do not export swiotlb_bounce since there are no external consumers
swiotlb: Use physical addresses instead of virtual in swiotlb_tbl_sync_single
swiotlb: Use physical addresses for swiotlb_tbl_unmap_single
swiotlb: Return physical addresses when calling swiotlb_tbl_map_single
swiotlb: Make io_tlb_overflow_buffer a physical address
swiotlb: Make io_tlb_start a physical address instead of a virtual one
swiotlb: Make io_tlb_end a physical address instead of a virtual one
This commit is contained in:
commit
9b690c3d56
3 changed files with 163 additions and 151 deletions
|
|
@ -338,9 +338,8 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
|
|||
enum dma_data_direction dir,
|
||||
struct dma_attrs *attrs)
|
||||
{
|
||||
phys_addr_t phys = page_to_phys(page) + offset;
|
||||
phys_addr_t map, phys = page_to_phys(page) + offset;
|
||||
dma_addr_t dev_addr = xen_phys_to_bus(phys);
|
||||
void *map;
|
||||
|
||||
BUG_ON(dir == DMA_NONE);
|
||||
/*
|
||||
|
|
@ -356,10 +355,10 @@ dma_addr_t xen_swiotlb_map_page(struct device *dev, struct page *page,
|
|||
* Oh well, have to allocate and map a bounce buffer.
|
||||
*/
|
||||
map = swiotlb_tbl_map_single(dev, start_dma_addr, phys, size, dir);
|
||||
if (!map)
|
||||
if (map == SWIOTLB_MAP_ERROR)
|
||||
return DMA_ERROR_CODE;
|
||||
|
||||
dev_addr = xen_virt_to_bus(map);
|
||||
dev_addr = xen_phys_to_bus(map);
|
||||
|
||||
/*
|
||||
* Ensure that the address returned is DMA'ble
|
||||
|
|
@ -389,7 +388,7 @@ static void xen_unmap_single(struct device *hwdev, dma_addr_t dev_addr,
|
|||
|
||||
/* NOTE: We use dev_addr here, not paddr! */
|
||||
if (is_xen_swiotlb_buffer(dev_addr)) {
|
||||
swiotlb_tbl_unmap_single(hwdev, phys_to_virt(paddr), size, dir);
|
||||
swiotlb_tbl_unmap_single(hwdev, paddr, size, dir);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -434,8 +433,7 @@ xen_swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
|
|||
|
||||
/* NOTE: We use dev_addr here, not paddr! */
|
||||
if (is_xen_swiotlb_buffer(dev_addr)) {
|
||||
swiotlb_tbl_sync_single(hwdev, phys_to_virt(paddr), size, dir,
|
||||
target);
|
||||
swiotlb_tbl_sync_single(hwdev, paddr, size, dir, target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -494,11 +492,12 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
|
|||
if (swiotlb_force ||
|
||||
!dma_capable(hwdev, dev_addr, sg->length) ||
|
||||
range_straddles_page_boundary(paddr, sg->length)) {
|
||||
void *map = swiotlb_tbl_map_single(hwdev,
|
||||
start_dma_addr,
|
||||
sg_phys(sg),
|
||||
sg->length, dir);
|
||||
if (!map) {
|
||||
phys_addr_t map = swiotlb_tbl_map_single(hwdev,
|
||||
start_dma_addr,
|
||||
sg_phys(sg),
|
||||
sg->length,
|
||||
dir);
|
||||
if (map == SWIOTLB_MAP_ERROR) {
|
||||
/* Don't panic here, we expect map_sg users
|
||||
to do proper error handling. */
|
||||
xen_swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir,
|
||||
|
|
@ -506,7 +505,7 @@ xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl,
|
|||
sgl[0].dma_length = 0;
|
||||
return DMA_ERROR_CODE;
|
||||
}
|
||||
sg->dma_address = xen_virt_to_bus(map);
|
||||
sg->dma_address = xen_phys_to_bus(map);
|
||||
} else
|
||||
sg->dma_address = dev_addr;
|
||||
sg->dma_length = sg->length;
|
||||
|
|
|
|||
Loading…
Reference in a new issue