From: yong.wu@mediatek.com (Yong Wu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] arm64: Add IOMMU dma_ops
Date: Thu, 18 Jun 2015 23:00:50 +0800 [thread overview]
Message-ID: <1434639650.26953.13.camel@mhfsdcap03> (raw)
In-Reply-To: <4e298538ccedbe6f593d8edc40eb3a08ad9e4df5.1434036796.git.robin.murphy@arm.com>
On Thu, 2015-06-11 at 16:54 +0100, Robin Murphy wrote:
> Taking some inspiration from the arch/arm code, implement the
> arch-specific side of the DMA mapping ops using the new IOMMU-DMA layer.
>
> Whilst proliferating per-device private IOMMU data via dev->archdata is
> less than ideal, it will do the job for now, especially since we can't
> easily handle the kind of problematic system topologies in the current
> IOMMU API anyway.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
> arch/arm64/include/asm/device.h | 3 +
> arch/arm64/include/asm/dma-mapping.h | 14 ++
> arch/arm64/mm/dma-mapping.c | 342 +++++++++++++++++++++++++++++++++++
> include/linux/dma-iommu.h | 4 +-
> 4 files changed, 361 insertions(+), 2 deletions(-)
[snip]
> +static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
> + void *cpu_addr, dma_addr_t dma_addr, size_t size,
> + struct dma_attrs *attrs)
> +{
> + struct vm_struct *area;
> + int ret;
> +
> + vma->vm_page_prot = __get_dma_pgprot(attrs, vma->vm_page_prot,
> + is_device_dma_coherent(dev));
> +
> + if (dma_mmap_from_coherent(dev, vma, cpu_addr, size, &ret))
> + return ret;
> +
> + area = find_vm_area(cpu_addr);
> + if (WARN_ON(!area || area->pages))
Is it: if (WARN_ON(!area || !area->pages))
> + return -ENXIO;
> +
> + return iommu_dma_mmap(area->pages, size, vma);
> +}
[snip]
> #endif /* __KERNEL__ */
> #endif /* __DMA_IOMMU_H */
next prev parent reply other threads:[~2015-06-18 15:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 15:54 [PATCH v2 0/4] arm64: IOMMU-backed DMA mapping Robin Murphy
2015-06-11 15:54 ` [PATCH v2 1/4] iommu/iova: Avoid over-allocating when size-aligned Robin Murphy
2015-06-11 15:54 ` [PATCH v2 2/4] iommu: Implement common IOMMU ops for DMA mapping Robin Murphy
2015-06-18 15:00 ` Yong Wu
2015-06-18 16:54 ` Robin Murphy
2015-06-19 1:06 ` Yong Wu
2015-07-03 9:27 ` Yong Wu
2015-07-03 16:44 ` Robin Murphy
2015-07-07 7:37 ` Yong Wu
2015-06-11 15:54 ` [PATCH v2 3/4] arm64: Add IOMMU dma_ops Robin Murphy
2015-06-18 15:00 ` Yong Wu [this message]
2015-06-11 15:54 ` [PATCH v2 4/4] arm64: Hook up " Robin Murphy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1434639650.26953.13.camel@mhfsdcap03 \
--to=yong.wu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).