All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/7] iommu/arm-smmu: allow translation stage to be forced on the cmdline
Date: Thu,  4 Sep 2014 17:49:59 +0100	[thread overview]
Message-ID: <1409849405-17347-2-git-send-email-will.deacon@arm.com> (raw)
In-Reply-To: <1409849405-17347-1-git-send-email-will.deacon@arm.com>

When debugging and testing code on an SMMU that supports nested
translation, it can be useful to restrict the driver to a particular
stage of translation.

This patch adds a module parameter to the ARM SMMU driver to allow this
by restricting the ability of the probe() code to detect support for
only the specified stage.

Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 drivers/iommu/arm-smmu.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a83cc2a2a2ca..958ae8194afe 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -326,6 +326,11 @@
 
 #define FSYNR0_WNR			(1 << 4)
 
+static int force_stage;
+module_param_named(force_stage, force_stage, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(force_stage,
+	"Force SMMU mappings to be installed@a particular stage of translation. A value of '1' or '2' forces the corresponding stage. All other values are ignored (i.e. no stage is forced). Note that selecting a specific stage will disable support for nested translation.");
+
 struct arm_smmu_smr {
 	u8				idx;
 	u16				mask;
@@ -1716,6 +1721,13 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 		return -ENODEV;
 	}
 #endif
+
+	/* Restrict available stages based on module parameter */
+	if (force_stage == 1)
+		id &= ~(ID0_S2TS | ID0_NTS);
+	else if (force_stage == 2)
+		id &= ~(ID0_S1TS | ID0_NTS);
+
 	if (id & ID0_S1TS) {
 		smmu->features |= ARM_SMMU_FEAT_TRANS_S1;
 		dev_notice(smmu->dev, "\tstage 1 translation\n");
@@ -1732,8 +1744,7 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu)
 	}
 
 	if (!(smmu->features &
-		(ARM_SMMU_FEAT_TRANS_S1 | ARM_SMMU_FEAT_TRANS_S2 |
-		 ARM_SMMU_FEAT_TRANS_NESTED))) {
+		(ARM_SMMU_FEAT_TRANS_S1 | ARM_SMMU_FEAT_TRANS_S2))) {
 		dev_err(smmu->dev, "\tno translation support!\n");
 		return -ENODEV;
 	}
-- 
2.1.0

  reply	other threads:[~2014-09-04 16:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-04 16:49 [PATCH 0/7] iommu/arm-smmu: misc. driver updates targetting 3.18 Will Deacon
2014-09-04 16:49 ` Will Deacon [this message]
2014-09-04 16:50 ` [PATCH 2/7] iommu/arm-smmu: add support for multi-master iommu groups Will Deacon
     [not found]   ` <1409849405-17347-3-git-send-email-will.deacon-5wv7dgnIgG8@public.gmane.org>
2014-09-15 15:22     ` Joerg Roedel
2014-09-15 15:22       ` Joerg Roedel
     [not found]       ` <20140915152257.GX28786-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2014-09-15 18:36         ` Will Deacon
2014-09-15 18:36           ` Will Deacon
2014-09-04 16:50 ` [PATCH 3/7] iommu/arm-smmu: put iommu_domain pointer in dev->archdata.iommu Will Deacon
2014-09-04 16:50 ` [PATCH 4/7] iommu/arm-smmu: use page shift instead of page size to avoid division Will Deacon
2014-09-04 16:50 ` [PATCH 5/7] iommu/arm-smmu: don't bother truncating the s1 output size to VA_BITS Will Deacon
2014-12-01 20:39   ` Andreas Schwab
     [not found]     ` <87mw77cdft.fsf-hBGjKatGTSWzQB+pC5nmwQ@public.gmane.org>
2014-12-02  9:26       ` Will Deacon
2014-12-02  9:26         ` Will Deacon
     [not found]   ` <1409849405-17347-6-git-send-email-will.deacon-5wv7dgnIgG8@public.gmane.org>
2014-12-01 20:39     ` Andreas Schwab
2014-09-04 16:50 ` [PATCH 6/7] iommu/arm-smmu: fix architecture version detection Will Deacon
2014-09-04 16:50 ` [PATCH 7/7] iommu/arm-smmu: support MMU-401 Will Deacon

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=1409849405-17347-2-git-send-email-will.deacon@arm.com \
    --to=will.deacon@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.