From: Joseph Lo <josephl-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
arnd-r2nGTMty4D4@public.gmane.org,
stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org,
catalin.marinas-5wv7dgnIgG8@public.gmane.org,
thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
will.deacon-5wv7dgnIgG8@public.gmane.org,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
Subject: Re: [RFC PATCH 4/5] arm64: add IOMMU dma_ops
Date: Mon, 26 Jan 2015 17:10:22 +0800 [thread overview]
Message-ID: <54C6047E.6070005@nvidia.com> (raw)
In-Reply-To: <aa7de3b1dd189c31eb8b14d0c0eea699183f8a2c.1421086706.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
On 01/13/2015 04:48 AM, 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.
>
> Signed-off-by: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org>
> ---
[snip]
> static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
> {
> +#ifdef CONFIG_IOMMU_DMA
> + if (dev->archdata.mapping)
Hi Robin,
Report one more issue, it would be safer like this.
if (dev && dev->archdata.mapping)
I do some more tests with a generic buffer allocator (ION). Allocate
buffer from ION and then import by Tegra/DRM. I saw a crash in ION.
Please reference and follow the call stack below. You could find out it
could pass NULL of the dev pointer (ion_page_pool_alloc_pages).
[ 83.836688] Call trace:
[ 83.836694] [<ffffffc000422fd0>] swiotlb_sync_single+0xc/0xa4
[ 83.836707] [<ffffffc0004230dc>] swiotlb_sync_sg_for_device+0x44/0x70
[ 83.836713] [<ffffffc000211030>] __swiotlb_sync_sg_for_device+0x28/0xac
[ 83.836720] [<ffffffc0005eb934>] ion_pages_sync_for_device+0xfc/0x10c
[ 83.836724] [<ffffffc0005ecb6c>] ion_page_pool_alloc+0xc8/0xe0
[ 83.836729] [<ffffffc0005ed3d0>] ion_system_heap_allocate+0xfc/0x324
[ 83.836732] [<ffffffc0005eae98>] ion_alloc+0xf0/0x480
[ 83.836736] [<ffffffc0005eb3bc>] ion_ioctl+0x194/0x608
[ 83.836741] [<ffffffc0005eeae0>] compat_ion_ioctl+0x300/0x6e0
[ 83.836747] [<ffffffc000340280>] compat_sys_ioctl+0x108/0x139c
Thanks
-Joseph
> + return iova_to_phys(dev, dev_addr);
> +#endif
> return (phys_addr_t)dev_addr;
> }
WARNING: multiple messages have this Message-ID (diff)
From: josephl@nvidia.com (Joseph Lo)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 4/5] arm64: add IOMMU dma_ops
Date: Mon, 26 Jan 2015 17:10:22 +0800 [thread overview]
Message-ID: <54C6047E.6070005@nvidia.com> (raw)
In-Reply-To: <aa7de3b1dd189c31eb8b14d0c0eea699183f8a2c.1421086706.git.robin.murphy@arm.com>
On 01/13/2015 04:48 AM, 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.
>
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
[snip]
> static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr)
> {
> +#ifdef CONFIG_IOMMU_DMA
> + if (dev->archdata.mapping)
Hi Robin,
Report one more issue, it would be safer like this.
if (dev && dev->archdata.mapping)
I do some more tests with a generic buffer allocator (ION). Allocate
buffer from ION and then import by Tegra/DRM. I saw a crash in ION.
Please reference and follow the call stack below. You could find out it
could pass NULL of the dev pointer (ion_page_pool_alloc_pages).
[ 83.836688] Call trace:
[ 83.836694] [<ffffffc000422fd0>] swiotlb_sync_single+0xc/0xa4
[ 83.836707] [<ffffffc0004230dc>] swiotlb_sync_sg_for_device+0x44/0x70
[ 83.836713] [<ffffffc000211030>] __swiotlb_sync_sg_for_device+0x28/0xac
[ 83.836720] [<ffffffc0005eb934>] ion_pages_sync_for_device+0xfc/0x10c
[ 83.836724] [<ffffffc0005ecb6c>] ion_page_pool_alloc+0xc8/0xe0
[ 83.836729] [<ffffffc0005ed3d0>] ion_system_heap_allocate+0xfc/0x324
[ 83.836732] [<ffffffc0005eae98>] ion_alloc+0xf0/0x480
[ 83.836736] [<ffffffc0005eb3bc>] ion_ioctl+0x194/0x608
[ 83.836741] [<ffffffc0005eeae0>] compat_ion_ioctl+0x300/0x6e0
[ 83.836747] [<ffffffc000340280>] compat_sys_ioctl+0x108/0x139c
Thanks
-Joseph
> + return iova_to_phys(dev, dev_addr);
> +#endif
> return (phys_addr_t)dev_addr;
> }
next prev parent reply other threads:[~2015-01-26 9:10 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-12 20:48 [RFC PATCH 0/5] arm64: IOMMU-backed DMA mapping Robin Murphy
2015-01-12 20:48 ` Robin Murphy
2015-01-13 8:02 ` Yingjoe Chen
2015-01-13 8:02 ` Yingjoe Chen
2015-01-13 12:07 ` Robin Murphy
2015-01-13 12:07 ` Robin Murphy
2015-01-15 18:35 ` Robin Murphy
2015-01-15 18:35 ` Robin Murphy
2015-01-16 7:21 ` Yong Wu
2015-01-16 7:21 ` Yong Wu
2015-01-16 20:12 ` Robin Murphy
2015-01-16 20:12 ` Robin Murphy
[not found] ` <cover.1421086706.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2015-01-12 20:48 ` [RFC PATCH 1/5] arm64: Combine coherent and non-coherent swiotlb dma_ops Robin Murphy
2015-01-12 20:48 ` Robin Murphy
2015-01-12 20:48 ` [RFC PATCH 2/5] arm64: implement generic IOMMU configuration Robin Murphy
2015-01-12 20:48 ` Robin Murphy
2015-01-12 20:48 ` [RFC PATCH 3/5] iommu: implement common IOMMU ops for DMA mapping Robin Murphy
2015-01-12 20:48 ` Robin Murphy
[not found] ` <09e5515a9afcb3235f4c425520cd18a6032d31b4.1421086706.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2015-01-23 17:42 ` Laura Abbott
2015-01-23 17:42 ` Laura Abbott
[not found] ` <54C287F7.3060603-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-01-23 18:14 ` Robin Murphy
2015-01-23 18:14 ` Robin Murphy
2015-01-27 0:21 ` Joerg Roedel
2015-01-27 0:21 ` Joerg Roedel
[not found] ` <20150127002116.GI30345-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-01-27 12:27 ` Robin Murphy
2015-01-27 12:27 ` Robin Murphy
[not found] ` <54C7843B.3000605-5wv7dgnIgG8@public.gmane.org>
2015-01-27 12:38 ` Joerg Roedel
2015-01-27 12:38 ` Joerg Roedel
[not found] ` <20150127123809.GJ30345-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-01-28 13:53 ` Will Deacon
2015-01-28 13:53 ` Will Deacon
2015-01-12 20:48 ` [RFC PATCH 4/5] arm64: add IOMMU dma_ops Robin Murphy
2015-01-12 20:48 ` Robin Murphy
[not found] ` <aa7de3b1dd189c31eb8b14d0c0eea699183f8a2c.1421086706.git.robin.murphy-5wv7dgnIgG8@public.gmane.org>
2015-01-23 15:26 ` Will Deacon
2015-01-23 15:26 ` Will Deacon
[not found] ` <20150123152605.GA31460-5wv7dgnIgG8@public.gmane.org>
2015-01-23 17:33 ` Robin Murphy
2015-01-23 17:33 ` Robin Murphy
2015-01-26 3:25 ` Joseph Lo
2015-01-26 3:25 ` Joseph Lo
[not found] ` <54C5B3B9.1040300-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-01-27 17:30 ` Robin Murphy
2015-01-27 17:30 ` Robin Murphy
2015-01-26 9:10 ` Joseph Lo [this message]
2015-01-26 9:10 ` Joseph Lo
2015-01-28 2:22 ` Joseph Lo
2015-01-28 2:22 ` Joseph Lo
2015-03-05 14:31 ` Marek Szyprowski
2015-03-05 14:31 ` Marek Szyprowski
2015-01-12 20:48 ` [RFC PATCH 5/5] arm64: hook up " Robin Murphy
2015-01-12 20:48 ` Robin Murphy
2015-01-13 11:08 ` [RFC PATCH 0/5] arm64: IOMMU-backed DMA mapping Stefano Stabellini
2015-01-13 11:08 ` Stefano Stabellini
[not found] ` <alpine.DEB.2.02.1501131102540.3058-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org>
2015-01-13 11:45 ` Robin Murphy
2015-01-13 11:45 ` Robin Murphy
2015-01-23 16:47 ` Catalin Marinas
2015-01-23 16:47 ` Catalin Marinas
[not found] ` <20150123164759.GF9557-M2fw3Uu6cmfZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2015-01-23 17:41 ` Robin Murphy
2015-01-23 17:41 ` Robin Murphy
2015-03-05 14:31 ` Marek Szyprowski
2015-03-05 14:31 ` Marek Szyprowski
[not found] ` <54F868A8.7070103-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-03-05 16:42 ` Robin Murphy
2015-03-05 16:42 ` 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=54C6047E.6070005@nvidia.com \
--to=josephl-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=robin.murphy-5wv7dgnIgG8@public.gmane.org \
--cc=stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org \
--cc=thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.