From: Tomasz Nowicki <tn@semihalf.com>
To: will.deacon@arm.com, robin.murphy@arm.com, mark.rutland@arm.com,
joro@8bytes.org
Cc: linux-arm-kernel@lists.infradead.org,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
Sunil.Goutham@cavium.com, Geethasowjanya.Akula@cavium.com,
Tirumalesh.Chalamarla@cavium.com, Prasun.Kapoor@cavium.com,
Tomasz Nowicki <tn@semihalf.com>
Subject: [PATCH 1/1] iommu/arm-smmu: Fix for ThunderX erratum #27704
Date: Wed, 11 Jan 2017 12:51:47 +0100 [thread overview]
Message-ID: <1484135507-24872-1-git-send-email-tn@semihalf.com> (raw)
The goal of erratum #27704 workaround was to make sure that ASIDs and VMIDs
are unique across all SMMU instances on affected Cavium systems.
Currently, the workaround code partitions ASIDs and VMIDs by increasing
global cavium_smmu_context_count which in turn becomes the base ASID and VMID
value for the given SMMU instance upon the context bank initialization.
For systems with multiple SMMU instances this approach implies the risk
of crossing 8-bit ASID, like for CN88xx capable of 4 SMMUv2, 128 context bank each:
SMMU_0 (0-127 ASID RANGE)
SMMU_1 (127-255 ASID RANGE)
SMMU_2 (256-383 ASID RANGE) <--- crossing 8-bit ASID
SMMU_3 (384-511 ASID RANGE) <--- crossing 8-bit ASID
Since we use 8-bit ASID now we effectively misconfigure ASID[15:8] bits for
SMMU_CBn_TTBRm register. Also, we still use non-zero ASID[15:8] bits
upon context invalidation. This patch adds 16-bit ASID support for stage-1
AArch64 contexts for Cavium SMMUv2 model so that we use ASIDs consistently.
Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
---
drivers/iommu/arm-smmu.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index a60cded..ae8f059 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -260,6 +260,7 @@ enum arm_smmu_s2cr_privcfg {
#define TTBCR2_SEP_SHIFT 15
#define TTBCR2_SEP_UPSTREAM (0x7 << TTBCR2_SEP_SHIFT)
+#define TTBCR2_AS (1 << 4)
#define TTBRn_ASID_SHIFT 48
@@ -778,6 +779,9 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain,
reg = pgtbl_cfg->arm_lpae_s1_cfg.tcr;
reg2 = pgtbl_cfg->arm_lpae_s1_cfg.tcr >> 32;
reg2 |= TTBCR2_SEP_UPSTREAM;
+ if (smmu->model == CAVIUM_SMMUV2 &&
+ cfg->fmt == ARM_SMMU_CTX_FMT_AARCH64)
+ reg2 |= TTBCR2_AS;
}
if (smmu->version > ARM_SMMU_V1)
writel_relaxed(reg2, cb_base + ARM_SMMU_CB_TTBCR2);
--
2.7.4
next reply other threads:[~2017-01-11 11:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-11 11:51 Tomasz Nowicki [this message]
2017-01-11 12:19 ` [PATCH 1/1] iommu/arm-smmu: Fix for ThunderX erratum #27704 Robin Murphy
2017-01-12 6:41 ` Tomasz Nowicki
2017-01-13 10:43 ` Tomasz Nowicki
2017-01-13 10:54 ` Robin Murphy
2017-01-16 7:16 Tomasz Nowicki
2017-01-16 7:25 ` Tomasz Nowicki
2017-01-19 16:16 ` 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=1484135507-24872-1-git-send-email-tn@semihalf.com \
--to=tn@semihalf.com \
--cc=Geethasowjanya.Akula@cavium.com \
--cc=Prasun.Kapoor@cavium.com \
--cc=Sunil.Goutham@cavium.com \
--cc=Tirumalesh.Chalamarla@cavium.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robin.murphy@arm.com \
--cc=will.deacon@arm.com \
/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).