Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1440800

[PATCH] iommu/arm-smmu-v3: limit use of 2-level stream tables

From Nate Watterson <nwatters@codeaurora.org>
Newsgroups linux.kernel
Subject [PATCH] iommu/arm-smmu-v3: limit use of 2-level stream tables
Date 2016-07-11 20:10 +0200
Message-ID <rTNOx-29b-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


In the current arm-smmu-v3 driver, all smmus that support 2-level
stream tables are being forced to use them. This is suboptimal for
smmus that support fewer stream id bits than would fill in a single
second level table. This patch limits the use of 2-level tables to
smmus that both support the feature and whose first level table can
possibly contain more than a single entry.

Signed-off-by: Nate Watterson <nwatters@codeaurora.org>
---
 drivers/iommu/arm-smmu-v3.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 5f6b3bc..742254c 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2531,6 +2531,17 @@ static int arm_smmu_device_probe(struct arm_smmu_device *smmu)
 	smmu->ssid_bits = reg >> IDR1_SSID_SHIFT & IDR1_SSID_MASK;
 	smmu->sid_bits = reg >> IDR1_SID_SHIFT & IDR1_SID_MASK;
 
+	/*
+	 * If the SMMU supports fewer bits than would fill a single L2 stream
+	 * table, use a linear table instead.
+	 */
+	if (smmu->sid_bits <= STRTAB_SPLIT &&
+	    smmu->features & ARM_SMMU_FEAT_2_LVL_STRTAB) {
+		smmu->features &= ~ARM_SMMU_FEAT_2_LVL_STRTAB;
+		dev_info(smmu->dev, "SIDSIZE (%d) <= STRTAB_SPLIT (%d) : disabling 2-level stream tables\n",
+			 smmu->sid_bits, STRTAB_SPLIT);
+	}
+
 	/* IDR5 */
 	reg = readl_relaxed(smmu->base + ARM_SMMU_IDR5);
 
-- 
Qualcomm Technologies, Inc. on behalf
of the Qualcomm Innovation Center, Inc.  The Qualcomm Innovation Center, Inc. 
is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] iommu/arm-smmu-v3: limit use of 2-level stream tables Nate Watterson <nwatters@codeaurora.org> - 2016-07-11 20:10 +0200
  Re: [PATCH] iommu/arm-smmu-v3: limit use of 2-level stream tables Robin Murphy <robin.murphy@arm.com> - 2016-07-12 11:40 +0200
  [PATCH v2] iommu/arm-smmu-v3: limit use of 2-level stream tables Nate Watterson <nwatters@codeaurora.org> - 2016-07-12 20:30 +0200
    Re: [PATCH v2] iommu/arm-smmu-v3: limit use of 2-level stream tables Will Deacon <will.deacon@arm.com> - 2016-07-14 15:40 +0200
      Re: [PATCH v2] iommu/arm-smmu-v3: limit use of 2-level stream tables nwatters@codeaurora.org - 2016-07-14 19:40 +0200

csiph-web