Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753198AbbF2J3N (ORCPT ); Mon, 29 Jun 2015 05:29:13 -0400 Received: from gloria.sntech.de ([95.129.55.99]:58418 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753630AbbF2J27 (ORCPT ); Mon, 29 Jun 2015 05:28:59 -0400 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Joerg Roedel , djkurtz@chromium.org, Tomasz Figa Cc: iommu@lists.linux-foundation.org, Will Deacon , Kukjin Kim , David Woodhouse , Hiroshi Doyu , Thierry Reding , Alex Williamson , Robin Murphy , Laurent Pinchart , Oded Gabbay , jroedel@suse.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/22] iommu: Propagate error in add_iommu_group Date: Mon, 29 Jun 2015 11:28:40 +0200 Message-ID: <7180470.n5cCZefX9d@diego> User-Agent: KMail/4.14.1 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; ) In-Reply-To: <1432831305-11126-4-git-send-email-joro@8bytes.org> References: <1432831305-11126-1-git-send-email-joro@8bytes.org> <1432831305-11126-4-git-send-email-joro@8bytes.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3334 Lines: 97 Hi Joerg, Am Donnerstag, 28. Mai 2015, 18:41:26 schrieb Joerg Roedel: > From: Joerg Roedel > > Make sure any errors reported from the IOMMU drivers get > progapated back to the IOMMU core. > > Signed-off-by: Joerg Roedel 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 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 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/