From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752634AbdHOOun (ORCPT ); Tue, 15 Aug 2017 10:50:43 -0400 Received: from 8bytes.org ([81.169.241.247]:42972 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752345AbdHOOul (ORCPT ); Tue, 15 Aug 2017 10:50:41 -0400 Date: Tue, 15 Aug 2017 16:50:33 +0200 From: Joerg Roedel To: Robin Murphy Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com Subject: Re: [PATCH v2] iommu/of: Fix of_iommu_configure() for disabled IOMMUs Message-ID: <20170815145033.GA25618@8bytes.org> References: <318c01e2f27ff892f3edbafa10972b75f45c8b74.1501863753.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <318c01e2f27ff892f3edbafa10972b75f45c8b74.1501863753.git.robin.murphy@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 04, 2017 at 05:29:06PM +0100, Robin Murphy wrote: > Sudeep reports that the logic got slightly broken when a PCI iommu-map > entry targets an IOMMU marked as disabled in DT, since of_pci_map_rid() > succeeds in following a phandle, and of_iommu_xlate() doesn't return an > error value, but we miss checking whether ops was actually non-NULL. > Whilst this could be solved with a point fix in of_pci_iommu_init(), it > suggests that all the juggling of ERR_PTR values through the ops pointer > is proving rather too complicated for its own good, so let's instead > simplify the whole flow (with a side-effect of eliminating the cause of > the bug). > > The fact that we now rely on iommu_fwspec means that we no longer need > to pass around an iommu_ops pointer at all - we can simply propagate a > regular int return value until we know whether we have a viable IOMMU, > then retrieve the ops from the fwspec if and when we actually need them. > This makes everything a bit more uniform and certainly easier to follow. > > Fixes: d87beb749281 ("iommu/of: Handle PCI aliases properly") > Reported-by: Sudeep Holla > Tested-by: Sudeep Holla > Signed-off-by: Robin Murphy > --- > > v2: Don't break the -EPROBE_DEFER case > > drivers/iommu/of_iommu.c | 59 ++++++++++++++++++++++++------------------------ > 1 file changed, 29 insertions(+), 30 deletions(-) Applied, thanks.