From patchwork Wed May 3 10:24:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan Ramabadhran X-Patchwork-Id: 9709159 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C5D0F6021C for ; Wed, 3 May 2017 10:25:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC9C628469 for ; Wed, 3 May 2017 10:25:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A1042285EB; Wed, 3 May 2017 10:25:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E015828469 for ; Wed, 3 May 2017 10:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NXlWNTMrdCzAGcuNYT9coTVNpqmiGVobDsr+uWlrtXo=; b=YNTR7MUEwJrE3R HCe1mL6yMDqRIpGy/zutBwNTXQSXPsrH0UFKuZ4e90Cksx8ej6y2FozxbYJSHoU0e/r5fOcotm/sb qfMAdQREvNKKotVAWG1uLDazz5Iw0opel4b+dMwXv7h7fHoYKmmd0kAdOyYB1JpdWtvZSEJsN2rhN WIaK6V17jL0CTipEz/vqk0mU6ARb7FxqprQ5bvjwAww9qDMUPSGq2JodCHTR/YC5NXVStdj6Dyp5u CShIobFaIrSTLC0GUys7iXhWwrvXzNex4BpfB3NKcv96lFj6hzrdqQiPoaRRSX7GeKuuqfcsDcY3j OiPEbaPhB7RO2+C+DGsQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d5rTS-0007QM-Tw; Wed, 03 May 2017 10:25:34 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5rTP-0007Ns-7l for linux-arm-kernel@lists.infradead.org; Wed, 03 May 2017 10:25:33 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E6B07607CB; Wed, 3 May 2017 10:25:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1493807109; bh=C6G0IjoCgXsazxK94cm+Nz6I5u56nCJxy9eHu11NkKA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ES6YTgfaphFcJXKQw1hpclGKdIscaONOhLBMtbFxV0tabISwS9sKtGjmhZR50NTqH ntdOVB52f7aAt8e4snffvy6M1FbWCGvBx1Q1EjiUdWcMmikYYED32kZChzg2sdpdpS a4P6iHuaivIt9OROaaDocW+Q1yLwFunKAWt28NEs= Received: from [10.201.3.39] (unknown [202.46.23.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: sricharan@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 8064C60A00; Wed, 3 May 2017 10:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1493807107; bh=C6G0IjoCgXsazxK94cm+Nz6I5u56nCJxy9eHu11NkKA=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=ExxU3SIE2GakCfJ+y+LCCKZqHattVRY93KwbNrwVL4Zx6Muf39OY2/TFolgKzqC35 O3y7ZoY2B9g+ISvxhcOBEmNzceGcdlwmLDq5CRrbBJUcIWWD/qjZe5x/h7krYTHGN1 JQc97iiqcPmdREoK0bmA62D95pxKWMBR8BYZsyZE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 8064C60A00 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=sricharan@codeaurora.org Subject: Re: [PATCH V8 07/11] iommu: of: Handle IOMMU lookup failure with deferred probing or error To: Robin Murphy , Geert Uytterhoeven References: <1486136933-20328-1-git-send-email-sricharan@codeaurora.org> <1486136933-20328-8-git-send-email-sricharan@codeaurora.org> <2bfd11dc-9f94-2b69-7b03-c640e53155e1@arm.com> From: Sricharan R Message-ID: <26defadf-6380-4af4-6323-b51198376bc1@codeaurora.org> Date: Wed, 3 May 2017 15:54:59 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <2bfd11dc-9f94-2b69-7b03-c640e53155e1@arm.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170503_032531_332008_554F4494 X-CRM114-Status: GOOD ( 34.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux-Renesas , Lorenzo Pieralisi , Magnus Damm , "linux-arm-msm@vger.kernel.org" , Joerg Roedel , Will Deacon , okaya@codeaurora.org, ACPI Devel Maling List , iommu@lists.linux-foundation.org, Hanjun Guo , linux-pci , Bjorn Helgaas , tn@semihalf.com, "linux-arm-kernel@lists.infradead.org" , Marek Szyprowski Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Robin, On 5/3/2017 3:24 PM, Robin Murphy wrote: > Hi Geert, > > On 02/05/17 19:35, Geert Uytterhoeven wrote: >> Hi Sricharan, >> >> On Fri, Feb 3, 2017 at 4:48 PM, Sricharan R wrote: >>> From: Laurent Pinchart >>> >>> Failures to look up an IOMMU when parsing the DT iommus property need to >>> be handled separately from the .of_xlate() failures to support deferred >>> probing. >>> >>> The lack of a registered IOMMU can be caused by the lack of a driver for >>> the IOMMU, the IOMMU device probe not having been performed yet, having >>> been deferred, or having failed. >>> >>> The first case occurs when the device tree describes the bus master and >>> IOMMU topology correctly but no device driver exists for the IOMMU yet >>> or the device driver has not been compiled in. Return NULL, the caller >>> will configure the device without an IOMMU. >>> >>> The second and third cases are handled by deferring the probe of the bus >>> master device which will eventually get reprobed after the IOMMU. >>> >>> The last case is currently handled by deferring the probe of the bus >>> master device as well. A mechanism to either configure the bus master >>> device without an IOMMU or to fail the bus master device probe depending >>> on whether the IOMMU is optional or mandatory would be a good >>> enhancement. >>> >>> Tested-by: Marek Szyprowski >>> Signed-off-by: Laurent Pichart >>> Signed-off-by: Sricharan R >> >> This patch broke Renesas R-Car Gen3 platforms in renesas-drivers. >> As the IOMMU nodes in DT are not yet enabled, all devices having iommus >> properties in DT now fail to probe. > > How exactly do they fail to probe? Per d7b0558230e4, if there are no ops > registered then they should merely defer until we reach the point of > giving up and ignoring the IOMMU. Is it just that you have no other > late-probing drivers or post-init module loads to kick the deferred > queue after that point? I did try to find a way to explicitly kick it > from a suitably late initcall, but there didn't seem to be any obvious > public interface - anyone have any suggestions? > > I think that's more of a general problem with the probe deferral > mechanism itself (I've seen the same thing happen with some of the > CoreSight stuff on Juno due to the number of inter-component > dependencies) rather than any specific fault of this series. > I was thinking of an additional check like below to avoid the situation ? From 499b6e662f60f23740b8880882b0a16f16434501 Mon Sep 17 00:00:00 2001 From: Sricharan R Date: Wed, 3 May 2017 13:16:59 +0530 Subject: [PATCH] iommu: of: Fix check for returning EPROBE_DEFER While returning EPROBE_DEFER for iommu masters take in to account of iommu nodes that could be marked in DT as 'status=disabled', in which case simply return NULL and let the master's probe continue rather than deferring. Signed-off-by: Sricharan R Tested-by: Will Deacon Acked-by: Will Deacon --- drivers/iommu/of_iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 9f44ee8..e6e9bec 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -118,6 +118,7 @@ static bool of_iommu_driver_present(struct device_node *np) ops = iommu_ops_from_fwnode(fwnode); if ((ops && !ops->of_xlate) || + !of_device_is_available(iommu_spec->np) || (!ops && !of_iommu_driver_present(iommu_spec->np))) return NULL;