From: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: Krzysztof Kozlowski <k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>, Bartlomiej Zolnierkiewicz <b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>, Inki Dae <inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>, Kukjin Kim <kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> Subject: [PATCH 01/11] iommu: exynos: rework iommu group initialization Date: Tue, 16 Feb 2016 15:56:54 +0100 [thread overview] Message-ID: <1455634624-18130-2-git-send-email-m.szyprowski@samsung.com> (raw) In-Reply-To: <1455634624-18130-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> This patch replaces custom code in add_device implementation with iommu_group_get_for_dev() call and provides the needed callback. Signed-off-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> --- drivers/iommu/exynos-iommu.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 97c41b8..4fc0790 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1114,28 +1114,32 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain, return phys; } +static struct iommu_group *get_device_iommu_group(struct device *dev) +{ + struct iommu_group *group; + + group = iommu_group_get(dev); + if (!group) + group = iommu_group_alloc(); + + return group; +} + static int exynos_iommu_add_device(struct device *dev) { struct iommu_group *group; - int ret; if (!has_sysmmu(dev)) return -ENODEV; - group = iommu_group_get(dev); + group = iommu_group_get_for_dev(dev); - if (!group) { - group = iommu_group_alloc(); - if (IS_ERR(group)) { - dev_err(dev, "Failed to allocate IOMMU group\n"); - return PTR_ERR(group); - } - } + if (IS_ERR(group)) + return PTR_ERR(group); - ret = iommu_group_add_device(group, dev); iommu_group_put(group); - return ret; + return 0; } static void exynos_iommu_remove_device(struct device *dev) @@ -1182,6 +1186,7 @@ static struct iommu_ops exynos_iommu_ops = { .unmap = exynos_iommu_unmap, .map_sg = default_iommu_map_sg, .iova_to_phys = exynos_iommu_iova_to_phys, + .device_group = get_device_iommu_group, .add_device = exynos_iommu_add_device, .remove_device = exynos_iommu_remove_device, .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, -- 1.9.2
WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 01/11] iommu: exynos: rework iommu group initialization Date: Tue, 16 Feb 2016 15:56:54 +0100 [thread overview] Message-ID: <1455634624-18130-2-git-send-email-m.szyprowski@samsung.com> (raw) In-Reply-To: <1455634624-18130-1-git-send-email-m.szyprowski@samsung.com> This patch replaces custom code in add_device implementation with iommu_group_get_for_dev() call and provides the needed callback. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> --- drivers/iommu/exynos-iommu.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 97c41b8..4fc0790 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1114,28 +1114,32 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain, return phys; } +static struct iommu_group *get_device_iommu_group(struct device *dev) +{ + struct iommu_group *group; + + group = iommu_group_get(dev); + if (!group) + group = iommu_group_alloc(); + + return group; +} + static int exynos_iommu_add_device(struct device *dev) { struct iommu_group *group; - int ret; if (!has_sysmmu(dev)) return -ENODEV; - group = iommu_group_get(dev); + group = iommu_group_get_for_dev(dev); - if (!group) { - group = iommu_group_alloc(); - if (IS_ERR(group)) { - dev_err(dev, "Failed to allocate IOMMU group\n"); - return PTR_ERR(group); - } - } + if (IS_ERR(group)) + return PTR_ERR(group); - ret = iommu_group_add_device(group, dev); iommu_group_put(group); - return ret; + return 0; } static void exynos_iommu_remove_device(struct device *dev) @@ -1182,6 +1186,7 @@ static struct iommu_ops exynos_iommu_ops = { .unmap = exynos_iommu_unmap, .map_sg = default_iommu_map_sg, .iova_to_phys = exynos_iommu_iova_to_phys, + .device_group = get_device_iommu_group, .add_device = exynos_iommu_add_device, .remove_device = exynos_iommu_remove_device, .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, -- 1.9.2
next prev parent reply other threads:[~2016-02-16 14:56 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-02-16 14:56 [PATCH 00/11] SYSMMU driver update and support for Exynos 5433 Marek Szyprowski 2016-02-16 14:56 ` Marek Szyprowski 2016-02-16 14:56 ` [PATCH 02/11] iommu: exynos: add support for IOMMU_DOMAIN_DMA domain type Marek Szyprowski 2016-02-16 14:56 ` Marek Szyprowski 2016-02-16 14:56 ` [PATCH 05/11] iommu: exynos: refactor code (no direct register access) Marek Szyprowski 2016-02-16 14:56 ` Marek Szyprowski 2016-02-16 14:56 ` [PATCH 06/11] iommu: exynos: refactor fault handling code Marek Szyprowski 2016-02-16 14:56 ` Marek Szyprowski 2016-02-16 14:57 ` [PATCH 07/11] iommu: exynos: refactor init config code Marek Szyprowski 2016-02-16 14:57 ` Marek Szyprowski [not found] ` <1455634624-18130-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 2016-02-16 14:56 ` Marek Szyprowski [this message] 2016-02-16 14:56 ` [PATCH 01/11] iommu: exynos: rework iommu group initialization Marek Szyprowski 2016-02-16 14:56 ` [PATCH 03/11] iommu: exynos: remove ARM-specific cache flush interface Marek Szyprowski 2016-02-16 14:56 ` Marek Szyprowski 2016-02-16 14:56 ` [PATCH 04/11] iommu: exynos: simplify master clock operations Marek Szyprowski 2016-02-16 14:56 ` Marek Szyprowski 2016-02-16 14:57 ` [PATCH 08/11] iommu: exynos: unify code for fldp cache invalidation Marek Szyprowski 2016-02-16 14:57 ` Marek Szyprowski 2016-02-16 14:57 ` [PATCH 09/11] iommu: exynos: update device tree documentation Marek Szyprowski 2016-02-16 14:57 ` Marek Szyprowski 2016-02-16 14:57 ` [PATCH 10/11] iommu: exynos: add support for v5 SYSMMU Marek Szyprowski 2016-02-16 14:57 ` Marek Szyprowski 2016-02-16 14:57 ` [PATCH 11/11] iommu: exynos: add Maintainers entry for Exynos SYSMMU driver Marek Szyprowski 2016-02-16 14:57 ` Marek Szyprowski 2016-02-17 2:02 ` Krzysztof Kozlowski 2016-02-17 2:02 ` Krzysztof Kozlowski
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=1455634624-18130-2-git-send-email-m.szyprowski@samsung.com \ --to=m.szyprowski-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \ --cc=b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \ --cc=inki.dae-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \ --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \ --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \ --cc=kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@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: linkBe 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.