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


Groups > linux.kernel > #1559490

Re: [PATCH 1/1] iommu/arm-smmu: Fix for ThunderX erratum #27704

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Tomasz Nowicki <tn@semihalf.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] iommu/arm-smmu: Fix for ThunderX erratum #27704
Date Mon, 16 Jan 2017 08:30:01 +0100
Message-ID <t09TP-5nD-1@gated-at.bofh.it> (permalink)
References <t09K9-5jY-1@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Y0bu6MlkFZ/L7qV3+lznW6CJUPguFxvMFzI8+OCPvKo=; b=DuQxJb0chghMoC+P3Wc7HV1MsD1ikAsn8TXwR6WmeFbZkL7evZYQ09B7D9Di2y79Ca WQDf4jaoSediKic5pDmnOoG7Nr7q9hv3Xu8zQbJQOPJYZaab4nP9q/on2w0VSGompzE3 cQV9VCqCG5OV9+RYtoTBmQcLcezJ+/kN37AtICwcLe76r8mnSUDDKMog5cFY4K4BBlnh pMM95mC1lif8Fc3uQBIOswKbx8qXI3/nqNxS5drr4Yk8auREOFbejdNbQxTOXXnk7ltv z6EXDTdL4Fd6TgDqnm8+hTg0dmcDvV1pYQ2S11Zq5/ByGdL+SWTUhBlzDjVJJx9oQsB0 ygwg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Y0bu6MlkFZ/L7qV3+lznW6CJUPguFxvMFzI8+OCPvKo=; b=K5dVThdI4N80k0vAGyLPnMYbgNvyrDa2n/l+Cj5DO3TKpDXy8ZGvCX71MxGnjvQlVT y8UjA+odYNtbFR0R5hjDcOPBQOd6Q+kiYdyygpUW4saRjlgLcROU+1IL2g92yTWxucT3 yBX1MZfoZ05dL593rGIbuzojqztPa5IeGvrQj9BaT+B3ZWOXxzWS6pbliu6Vtr9xerJ3 cF0RIeL6t1zU7V/ItFquzRoU4KsfxLsGcGw6mBDb6f4GRPPbCj7qV3iDnYF8GphFWIeN 6tSFNpAmisLUPtkNVpwT17oNR/wJmjpehrI4csJx94A7GBjiLYyGOa9b9H8GmgTt1wBC 4gaA==
X-Gm-Message-State AIkVDXKkyuNxn5rp0zC2WsRC5/ZVR9zChsxTBjsMDskaChA+x6NcctcaW+g4Kb0wMzwMeg==
X-Received by 10.46.69.215 with SMTP id s206mr12642898lja.26.1484551521665; Sun, 15 Jan 2017 23:25:21 -0800 (PST)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Thunderbird/45.5.1
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 60
Organization linux.* mail to news gateway
X-Original-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
X-Original-Date Mon, 16 Jan 2017 08:25:20 +0100
X-Original-Message-ID <dfc80917-7c13-1240-a359-68ee186d5db7@semihalf.com>
X-Original-References <1484550967-6328-1-git-send-email-tn@semihalf.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1559490

Show key headers only | View raw


My apologise for not adding 2nd version info of this patch to mail subject.

Thanks,
Tomasz

On 16.01.2017 08:16, Tomasz Nowicki wrote:
> 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 1-socket CN88xx capable of 4 SMMUv2,
> 128 context banks 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 now we use 8-bit ASID (SMMU_CBn_TCR2.AS = 0) we effectively misconfigure
> ASID[15:8] bits of SMMU_CBn_TTBRm register for SMMU_2/3. Moreover, we still
> assume non-zero ASID[15:8] bits upon context invalidation. In the end,
> except SMMU_0/1 devices all other devices under other SMMUs will fail on guest
> power off/on. Since we try to invalidate TLB with 16-bit ASID but we actually
> have 8-bit zero padded 16-bit entry.
>
> This patch adds 16-bit ASID support for stage-1 AArch64 contexts so that
> we use ASIDs consistently for all SMMU instances.
>
> Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
> Reviewed-by: Tirumalesh Chalamarla  <Tirumalesh.Chalamarla@cavium.com>
> ---
>  drivers/iommu/arm-smmu.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> index a60cded..476fab9 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,8 @@ 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 (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);
>

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


Thread

[PATCH 1/1] iommu/arm-smmu: Fix for ThunderX erratum #27704 Tomasz Nowicki <tn@semihalf.com> - 2017-01-16 08:20 +0100
  Re: [PATCH 1/1] iommu/arm-smmu: Fix for ThunderX erratum #27704 Tomasz Nowicki <tn@semihalf.com> - 2017-01-16 08:30 +0100

csiph-web