From: alban.browaeys@gmail.com (Alban Browaeys)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 11/18] iommu: exynos: remove useless device_add/remove callbacks
Date: Wed, 22 Oct 2014 11:15:00 +0200 [thread overview]
Message-ID: <1413969300.31696.10.camel@gmail.com> (raw)
In-Reply-To: <1410868485-4143-12-git-send-email-m.szyprowski@samsung.com>
Le mardi 16 septembre 2014 ? 13:54 +0200, Marek Szyprowski a ?crit :
> The driver doesn't need to do anything important in device add/remove
> callbacks, because initialization will be done from device-tree specific
> callbacks added later. IOMMU groups created by current code were never
> used.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
The exyons iommu init fails if those are removed, that is it never reach
init_done:
1. exynos_iommu_setup
2. - exynos_iommu_init
3. ---bus_set_iommu
4. ------ add_iommu_group
that is (4) add_iommu_group returns ENODEV to bus_set_iommu, the latter
doing so to exynos_iommu_init. Which thus error out before the init_done
is set to true.
Mind restoring device_add/remove is not that easy. Either I did not and
modified add_iommu_group to return 0 if add_device was not defined. This
works.
Otherwise I did revert this patch but had to also move the iommu_init
from iommu.c before of_iommu_init in arch/arm/kernel/setup.c (switching
iommu_init to global namespace in the process). This to avoid use of not
yet initialized mutex iommu_group_mutex and crash that follow suit.
This mutex is used in iommu_group_add_device called by
exynos_iommu_add_device.
The logs of the first issue, ie exynos_iommo_init and bus_set_iommu
returns ENODEV
[ 0.602816] exynos_iommu_init: Failed to register exynos-iommu
driver.
[ 0.603358] platform 13620000.sysmmu: device is not dma coherent
[ 0.603384] platform 13620000.sysmmu: device is not behind an iommu
[ 0.605243] exynos-sysmmu 13620000.sysmmu: genpd_dev_pm_attach()
failed to find PM domain: -2
[ 0.606399] exynos_iommu_init: Failed to register exynos-iommu
driver.
[ 0.607263] platform 13630000.sysmmu: device is not dma coherent
[ 0.607290] platform 13630000.sysmmu: device is not behind an iommu
[ 0.609111] exynos-sysmmu 13620000.sysmmu: genpd_dev_pm_attach()
failed to find PM domain: -2
[ 0.609464] exynos-sysmmu 13620000.sysmmu: Unbalanced
pm_runtime_enable!
[ 0.609868] exynos-sysmmu 13630000.sysmmu: genpd_dev_pm_attach()
failed to find PM domain: -2
(...)
[ 0.946506] platform 10800000.g2d: device is not dma coherent
[ 0.946553] platform 10800000.g2d: device is not behind an iommu
(...)
Mind the power domain failure comes from me not finding a way to apply
the power domain registration this early yet .
Best regards,
Alban Broweys
> ---
> drivers/iommu/exynos-iommu.c | 28 ----------------------------
> 1 file changed, 28 deletions(-)
>
> diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
> index b271348a4ec1..1b3f00726cd4 100644
> --- a/drivers/iommu/exynos-iommu.c
> +++ b/drivers/iommu/exynos-iommu.c
> @@ -1055,32 +1055,6 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *domain,
> return phys;
> }
>
> -static int exynos_iommu_add_device(struct device *dev)
> -{
> - struct iommu_group *group;
> - int ret;
> -
> - group = iommu_group_get(dev);
> -
> - if (!group) {
> - group = iommu_group_alloc();
> - if (IS_ERR(group)) {
> - dev_err(dev, "Failed to allocate IOMMU group\n");
> - return PTR_ERR(group);
> - }
> - }
> -
> - ret = iommu_group_add_device(group, dev);
> - iommu_group_put(group);
> -
> - return ret;
> -}
> -
> -static void exynos_iommu_remove_device(struct device *dev)
> -{
> - iommu_group_remove_device(dev);
> -}
> -
> static const struct iommu_ops exynos_iommu_ops = {
> .domain_init = exynos_iommu_domain_init,
> .domain_destroy = exynos_iommu_domain_destroy,
> @@ -1089,8 +1063,6 @@ static const struct iommu_ops exynos_iommu_ops = {
> .map = exynos_iommu_map,
> .unmap = exynos_iommu_unmap,
> .iova_to_phys = exynos_iommu_iova_to_phys,
> - .add_device = exynos_iommu_add_device,
> - .remove_device = exynos_iommu_remove_device,
> .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE,
> };
>
next prev parent reply other threads:[~2014-10-22 9:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-16 11:54 [PATCH v2 00/18] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 01/18] arm: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size Marek Szyprowski
2014-09-24 17:06 ` Will Deacon
2014-09-25 10:43 ` Marek Szyprowski
2014-09-25 18:34 ` Will Deacon
2014-09-16 11:54 ` [PATCH v2 02/18] arm: exynos: bind power domains earlier, on device creation Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 03/18] drm: exynos: detach from default dma-mapping domain on init Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 04/18] clk: exynos: add missing smmu_g2d clock and update comments Marek Szyprowski
2014-09-22 12:09 ` Tomasz Figa
2014-09-16 11:54 ` [PATCH v2 05/18] ARM: DTS: Exynos4: add System MMU nodes Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 06/18] iommu: exynos: don't read version register on every tlb operation Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 07/18] iommu: exynos: remove unused functions Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 08/18] iommu: exynos: remove useless spinlock Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 09/18] iommu: exynos: refactor function parameters to simplify code Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 10/18] iommu: exynos: remove unused functions, part 2 Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 11/18] iommu: exynos: remove useless device_add/remove callbacks Marek Szyprowski
2014-10-21 10:59 ` Alban Browaeys
2014-10-22 9:15 ` Alban Browaeys [this message]
2014-10-22 9:26 ` Arnd Bergmann
2014-10-22 9:54 ` Marek Szyprowski
2014-10-23 14:02 ` Arnd Bergmann
2014-10-24 7:41 ` [PATCH] iommu: exynos: make driver multiarch friendly Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 12/18] iommu: exynos: add support for binding more than one sysmmu to master device Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 13/18] iommu: exynos: add support for runtime_pm Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 14/18] iommu: exynos: rename variables to reflect their purpose Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 15/18] iommu: exynos: document internal structures Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 16/18] iommu: exynos: remove excessive includes and sort others alphabetically Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 17/18] iommu: exynos: init from dt-specific callback instead of initcall Marek Szyprowski
2014-09-16 11:54 ` [PATCH v2 18/18] iommu: exynos: add callback for initializing devices from device tree Marek Szyprowski
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=1413969300.31696.10.camel@gmail.com \
--to=alban.browaeys@gmail.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).