Commit 4cf37bb7 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Ingo Molnar

x86, swiotlb: add map_page and unmap_page

This is a preparation of struct dma_mapping_ops unification. We use
map_page and unmap_page instead of map_single and unmap_single.

This is sorta temporary workaround. We will move them to lib/swiotlb.c
to enable x86's swiotlb code to directly use them.

We will remove map_single and unmap_single hooks in the last patch in
this patchset.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent abe6602b
...@@ -45,6 +45,23 @@ swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size, ...@@ -45,6 +45,23 @@ swiotlb_map_single_phys(struct device *hwdev, phys_addr_t paddr, size_t size,
return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction); return swiotlb_map_single(hwdev, phys_to_virt(paddr), size, direction);
} }
/* these will be moved to lib/swiotlb.c later on */
static dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction dir,
struct dma_attrs *attrs)
{
return swiotlb_map_single(dev, page_address(page) + offset, size, dir);
}
static void swiotlb_unmap_page(struct device *dev, dma_addr_t dma_handle,
size_t size, enum dma_data_direction dir,
struct dma_attrs *attrs)
{
swiotlb_unmap_single(dev, dma_handle, size, dir);
}
static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t flags) dma_addr_t *dma_handle, gfp_t flags)
{ {
...@@ -71,6 +88,8 @@ struct dma_mapping_ops swiotlb_dma_ops = { ...@@ -71,6 +88,8 @@ struct dma_mapping_ops swiotlb_dma_ops = {
.sync_sg_for_device = swiotlb_sync_sg_for_device, .sync_sg_for_device = swiotlb_sync_sg_for_device,
.map_sg = swiotlb_map_sg, .map_sg = swiotlb_map_sg,
.unmap_sg = swiotlb_unmap_sg, .unmap_sg = swiotlb_unmap_sg,
.map_page = swiotlb_map_page,
.unmap_page = swiotlb_unmap_page,
.dma_supported = NULL, .dma_supported = NULL,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment