From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752507AbdHDM46 (ORCPT ); Fri, 4 Aug 2017 08:56:58 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:52692 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240AbdHDM45 (ORCPT ); Fri, 4 Aug 2017 08:56:57 -0400 Cc: Sudeep Holla , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/of: Fix of_iommu_configure() for disabled IOMMUs To: Robin Murphy , joro@8bytes.org References: <3841a5f51df422578abf297a9bc426bbe9ac8e01.1501844911.git.robin.murphy@arm.com> From: Sudeep Holla Organization: ARM Message-ID: Date: Fri, 4 Aug 2017 13:57:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <3841a5f51df422578abf297a9bc426bbe9ac8e01.1501844911.git.robin.murphy@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/08/17 12:16, Robin Murphy wrote: > Sudeep reports that the logic is 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. > > Reported-by: Sudeep Holla Tested-by: Sudeep Holla -- Regards, Sudeep