diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2018-02-15 01:12:54 +0100 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2018-07-11 20:13:33 +0200 |
commit | adbfa4e6f99689511f1079452508d9d22417544c (patch) | |
tree | f4dc68dbca63090aa995105ac8a87f182eb8e05f /arch/xtensa | |
parent | xtensa: use generic dma_noncoherent_ops (diff) | |
download | linux-adbfa4e6f99689511f1079452508d9d22417544c.tar.xz linux-adbfa4e6f99689511f1079452508d9d22417544c.zip |
xtensa: support DMA_ATTR_NO_KERNEL_MAPPING attribute
An application that doesn't need kernel mapping of the DMA memory it
allocates may specify DMA_ATTR_NO_KERNEL_MAPPING attribute to allocation
function. Support this attribute and return address of the first struct
page that covers the allocation.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'arch/xtensa')
-rw-r--r-- | arch/xtensa/kernel/pci-dma.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c index a83d60e92908..5c8a67fc3aa1 100644 --- a/arch/xtensa/kernel/pci-dma.c +++ b/arch/xtensa/kernel/pci-dma.c @@ -116,6 +116,10 @@ void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, *handle = phys_to_dma(dev, page_to_phys(page)); + if (attrs & DMA_ATTR_NO_KERNEL_MAPPING) { + return page; + } + #ifdef CONFIG_MMU if (PageHighMem(page)) { void *p; @@ -147,8 +151,10 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr, unsigned long addr = (unsigned long)vaddr; struct page *page; - if (addr >= XCHAL_KSEG_BYPASS_VADDR && - addr - XCHAL_KSEG_BYPASS_VADDR < XCHAL_KSEG_SIZE) { + if (attrs & DMA_ATTR_NO_KERNEL_MAPPING) { + page = vaddr; + } else if (addr >= XCHAL_KSEG_BYPASS_VADDR && + addr - XCHAL_KSEG_BYPASS_VADDR < XCHAL_KSEG_SIZE) { addr += XCHAL_KSEG_CACHED_VADDR - XCHAL_KSEG_BYPASS_VADDR; page = virt_to_page(addr); } else { |