linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drivers/of_iommu: ignore SMMU DT nodes with status 'disabled'
Date: Fri, 14 Apr 2017 13:43:15 +0100	[thread overview]
Message-ID: <20170414124315.2401-1-ard.biesheuvel@linaro.org> (raw)

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 at e0200000
 Failed to initialise IOMMU /smb/smmu at 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 at e0600000
 Failed to initialise IOMMU /smb/smmu at 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 <ard.biesheuvel@linaro.org>
---
 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));
 	}
-- 
2.9.3

             reply	other threads:[~2017-04-14 12:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-14 12:43 Ard Biesheuvel [this message]
2017-04-28 13:11 ` [PATCH] drivers/of_iommu: ignore SMMU DT nodes with status 'disabled' Will Deacon
2017-04-28 13:14   ` Ard Biesheuvel
2017-04-28 13:17     ` Will Deacon
2017-04-28 13:22       ` Ard Biesheuvel
2017-05-03 10:32         ` Robin Murphy
2017-05-03 10:58           ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170414124315.2401-1-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).