Re: [PATCH 03/22] iommu: Propagate error in add_iommu_group
From: Heiko Stübner
Date: Mon Jun 29 2015 - 05:29:16 EST
Hi Joerg,
Am Donnerstag, 28. Mai 2015, 18:41:26 schrieb Joerg Roedel:
> From: Joerg Roedel <jroedel@xxxxxxx>
>
> Make sure any errors reported from the IOMMU drivers get
> progapated back to the IOMMU core.
>
> Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
sorry that this series slipped through my inbox without testing somehow.
Anyway, it seems to have now made its way in the merge-window and everything
on the Rockchip side still works - except this patch.
> ---
> drivers/iommu/iommu.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 755e488..9c9336a 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -750,9 +750,7 @@ static int add_iommu_group(struct device *dev, void
> *data)
>
> WARN_ON(dev->iommu_group);
>
> - ops->add_device(dev);
> -
> - return 0;
> + return ops->add_device(dev);
> }
>
> static int iommu_bus_notifier(struct notifier_block *nb,
The Rockchip iommu uses bus_set_ops to set its iommu-ops for the platform
bus and currently returns -ENODEV if it encounters a platform_devices that
does not have an iommu. As add_iommu_group ignored these returns
till now this worked, but of course starts to fail now.
All two invocations of the add_device callback ignored (or still ignore) the
return value so I've come with the following small patch to fix the breakage
that now exists in the 4.2 tree.
There is probably a better solution possible in the longer term, likely
similar to what Samsung does, but I'm not sure yet how this would work
with our drm device that needs an iommu mapping without having an
iommu (the iommus being attached to the crtc-components).
Heiko
------------- 8< ------------------
From: Heiko Stuebner <heiko@xxxxxxxxx>
Date: Sun, 28 Jun 2015 12:50:01 +0200
Subject: [PATCH] iommu/rockchip: ignore non-master devices in rk_iommu_add_device
During init we set the rockchip iommu ops as bus_ops for the platform bus.
While all Rockchip devices implementing an iommu use these same ops, there
are also platform devices without iommu. Until recently bus_set_iommu
ignored errors from the add_device callback and we simply returned -ENODEV
for devices without iommu. But we can also simply ignore devices without
iommu which simply ends up doing the same as before the iommu change that
began checking add_device return values.
Signed-off-by: Heiko Stuebner <heiko@xxxxxxxxx>
Fixes: 19762d7095e6 ("iommu: Propagate error in add_iommu_group")
---
drivers/iommu/rockchip-iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/rockchip-iommu.c b/drivers/iommu/rockchip-iommu.c
index ebf0adb..63bcf48 100644
--- a/drivers/iommu/rockchip-iommu.c
+++ b/drivers/iommu/rockchip-iommu.c
@@ -931,8 +931,9 @@ static int rk_iommu_add_device(struct device *dev)
struct iommu_group *group;
int ret;
+ /* nothing to do if device does not have an iommu */
if (!rk_iommu_is_dev_iommu_master(dev))
- return -ENODEV;
+ return 0;
group = iommu_group_get(dev);
if (!group) {
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/