Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xen: swiotlb: Open code map_resource callback

General dma_direct_map_resource() is going to be removed
in next patch, so simply open-code it in xen driver.

Reviewed-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/e9c66a92e818f416875441b6711963f9782dbbeb.1757423202.git.leonro@nvidia.com

authored by

Leon Romanovsky and committed by
Marek Szyprowski
bf0ecb3c 18c9cbb0

+20 -1
+20 -1
drivers/xen/swiotlb-xen.c
··· 392 392 } 393 393 } 394 394 395 + static dma_addr_t xen_swiotlb_direct_map_resource(struct device *dev, 396 + phys_addr_t paddr, 397 + size_t size, 398 + enum dma_data_direction dir, 399 + unsigned long attrs) 400 + { 401 + dma_addr_t dma_addr = paddr; 402 + 403 + if (unlikely(!dma_capable(dev, dma_addr, size, false))) { 404 + dev_err_once(dev, 405 + "DMA addr %pad+%zu overflow (mask %llx, bus limit %llx).\n", 406 + &dma_addr, size, *dev->dma_mask, dev->bus_dma_limit); 407 + WARN_ON_ONCE(1); 408 + return DMA_MAPPING_ERROR; 409 + } 410 + 411 + return dma_addr; 412 + } 413 + 395 414 /* 396 415 * Return whether the given device DMA address mask can be supported 397 416 * properly. For example, if your device can only drive the low 24-bits ··· 445 426 .alloc_pages_op = dma_common_alloc_pages, 446 427 .free_pages = dma_common_free_pages, 447 428 .max_mapping_size = swiotlb_max_mapping_size, 448 - .map_resource = dma_direct_map_resource, 429 + .map_resource = xen_swiotlb_direct_map_resource, 449 430 };