From patchwork Fri Apr 14 12:43:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9681211 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 3B2EB60132 for ; Fri, 14 Apr 2017 12:44:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22F3C27F90 for ; Fri, 14 Apr 2017 12:44:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 159412864C; Fri, 14 Apr 2017 12:44:03 +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=ham 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 B594027F90 for ; Fri, 14 Apr 2017 12:44:02 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=SpPB7IDY1DP1hh1KhLjcOoTfzsvS3QyxPgfZCzKsuz0=; b=V25 zTUwWn/z9oDyxt3w24fF7SkB/QMLSbvBektTCfTs/n/rFtQ8zgMwZLpzqiUmibJABWMBc+QytamWn BoIeJtcNvWGVOUUfrYIUlfQh8krXG12Qnu2cdwRhOF/bCT/CB1rRdVTMP4ZGh4sh3zpqOGf+Xe87o hmBlqcM3iIpVS1DQvdA89HskGQuK6BYV0ELfKZe8B64nwqioSSQmNb2UQgrl6ClW49znmDayNsSav DulU6FDAHf4NumTzmedTjYPsdil/JhX0YfbP5Pu/VfLytwqiGMmFWyUIF0ekQV1Gh2vgjja0OGtBu 1+WW5oSetDgW8u/s7hQTXQjIBYBcOQw==; 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 1cz0a1-0001ey-4j; Fri, 14 Apr 2017 12:44:01 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cz0Zx-0001d4-Qj for linux-arm-kernel@lists.infradead.org; Fri, 14 Apr 2017 12:43:59 +0000 Received: by mail-wm0-x22c.google.com with SMTP id t189so64798765wmt.1 for ; Fri, 14 Apr 2017 05:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=6wdhXer2UZ7OOLSwQFRlVlrNZxItsWxnZ9kkEKkY1MI=; b=P0sA1jmB2GGjY5EPvyoPOEZC6Ut/uRcvuWjpu5ulwrSfxjwqGuVlk+A2CLonRU9l1w rSOK2CJ3TFI2TzQeqkkXDkmuTgbwOGwDajGTRSGdXMsO9eGVN6cnCx2wpcrI7b26Ob/5 I3qcuRRQ6tGn5hI7GduWahhs/ZsA27K7D+NMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=6wdhXer2UZ7OOLSwQFRlVlrNZxItsWxnZ9kkEKkY1MI=; b=s1Kpp5agGJkO43XE4Rt/ZZsrudpEg2z3jaHMQIkJCj7m/7vSfmNUxQwDlmXUiTr9m5 gJjqknvb+zUeUtYiebB56ZPyo5ZMBrb5EYfNeerU4+01sr/rseaEZvfO8YQhInprrMTh hVS3dGjGbAkTP/IUfR5pr2CEtXNNRdSUN06Jc/hDLiuAjqvNNinVsfrEdjLvEeZL2Zd3 f2tDEIJmoQpsQqvQ34hwjwYL+9XsFgrAauQiVubQyYOlS4NUbdEdvHQldHLMu4NdYHs9 DMQ5FzcKuHUfnEl1PiTBTdzjSng9QX8bnloRbdDN/MrK2nTeNtRQaH4JairEozWSKcdX Iacg== X-Gm-Message-State: AN3rC/7M7l7gY1ETkGwWeAKVajwTWseAO9uOcvYFuwdrHMXBdhKxfJrs wrYk2AHAE+O9JE7j X-Received: by 10.28.29.88 with SMTP id d85mr7342981wmd.56.1492173813296; Fri, 14 Apr 2017 05:43:33 -0700 (PDT) Received: from localhost.localdomain ([105.150.28.134]) by smtp.gmail.com with ESMTPSA id q130sm14340868wmd.29.2017.04.14.05.43.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2017 05:43:32 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, joro@8bytes.org Subject: [PATCH] drivers/of_iommu: ignore SMMU DT nodes with status 'disabled' Date: Fri, 14 Apr 2017 13:43:15 +0100 Message-Id: <20170414124315.2401-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170414_054358_151105_DAE0D1B1 X-CRM114-Status: GOOD ( 11.78 ) 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: robin.murphy@arm.com, will.deacon@arm.com, Ard Biesheuvel MIME-Version: 1.0 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 DT nodes may have a status property, and if they do, such nodes should only be considered present if the status property is set to 'okay'. Currently, we call the init function of IOMMUs described by the device tree without taking this into account, which may result in the output below on systems where some SMMUs may be legally disabled. Failed to initialise IOMMU /smb/smmu@e0200000 Failed to initialise IOMMU /smb/smmu@e0c00000 arm-smmu e0a00000.smmu: probing hardware configuration... arm-smmu e0a00000.smmu: SMMUv1 with: arm-smmu e0a00000.smmu: stage 2 translation arm-smmu e0a00000.smmu: coherent table walk arm-smmu e0a00000.smmu: stream matching with 32 register groups, mask 0x7fff arm-smmu e0a00000.smmu: 8 context banks (8 stage-2 only) arm-smmu e0a00000.smmu: Supported page sizes: 0x60211000 arm-smmu e0a00000.smmu: Stage-2: 40-bit IPA -> 40-bit PA Failed to initialise IOMMU /smb/smmu@e0600000 Failed to initialise IOMMU /smb/smmu@e0800000 Since this is not an error condition, only call the init function if the device is enabled, which also inhibits the spurious error messages. Signed-off-by: Ard Biesheuvel --- drivers/iommu/of_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index 2683e9fc0dcf..2dd1206e6c0d 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -183,7 +183,7 @@ static int __init of_iommu_init(void) for_each_matching_node_and_match(np, matches, &match) { const of_iommu_init_fn init_fn = match->data; - if (init_fn(np)) + if (of_device_is_available(np) && init_fn(np)) pr_err("Failed to initialise IOMMU %s\n", of_node_full_name(np)); }