From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F106AC3A589 for ; Tue, 20 Aug 2019 15:51:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C50C222CE3 for ; Tue, 20 Aug 2019 15:51:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FWqk2MuD"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="fTQS3qDi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C50C222CE3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gJ8fosLWtuApPhvw69z7gs/HlF5J3OmEA/sMhRjHGZU=; b=FWqk2MuD02jPQ/ DT1khaZuOBwDkD9tBisTA++dD34Fs+LD0Te2kaCoFD9oLv8sFAf0b7Fkz+iK/3Z6w3EvEKiXDIFLz yC9IAMo8GXPqiUQ8Fax/WLLhZOZkmQIoj+PBARLic5TwfLo3kkPtGMCHWde0FfOmMJ3fEzgXgXhDl q3fJd/LdzQxZ+iQ2jX7f29Bs3Bdfd1KRJyF6e/isJ61ERW67773iCUKWLj0SuMx2ECTC3/KYsiijB lmXZ/M0Ih0+Z8SlzqUv8IFsbv82b9Y38zpmSrlioCGzp543nhf2XytTWupyC53uHbSWSgkouruNCj 2GHpZ5j/gafkPIDwCihA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i06PV-0004Ci-2U; Tue, 20 Aug 2019 15:51:01 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i06PI-0003xn-Bc for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 15:50:51 +0000 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A2DCB22CE3; Tue, 20 Aug 2019 15:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566316247; bh=ANVTtr5Xsou0jrnOGs4/B/GU+B2WDK+TAYrfLomhjio=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fTQS3qDiX8U9XJEr4PxCXNlFxiDFBAS0nBEFkMdUxA8fn8j7Cm837FD7d4JmjcD1I tUCaZ92tiWPS7nJQVToZx3mwggI6hk62RIMxNJ+yP0IgNi0kLC1CXYoWBkSfymA/Kd e7OM4Itc9lTjZdoZYaRahocomAdfDh4af8+nErWY= Date: Tue, 20 Aug 2019 16:50:43 +0100 From: Will Deacon To: Robin Murphy Subject: Re: [PATCH 2/4] iommu/io-pgtable-arm: Rationalise TTBRn handling Message-ID: <20190820155042.t4a67qhzlglevo5a@willie-the-truck> References: <20190820101911.ndwtaf76kn3zplk2@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_085048_556889_CD415606 X-CRM114-Status: GOOD ( 22.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robdclark@gmail.com, joro@8bytes.org, jcrouse@codeaurora.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 20, 2019 at 03:17:19PM +0100, Robin Murphy wrote: > On 20/08/2019 11:19, Will Deacon wrote: > > On Mon, Aug 19, 2019 at 07:19:29PM +0100, Robin Murphy wrote: > > > TTBR1 values have so far been redundant since no users implement any > > > support for split address spaces. Crucially, though, one of the main > > > reasons for wanting to do so is to be able to manage each half entirely > > > independently, e.g. context-switching one set of mappings without > > > disturbing the other. Thus it seems unlikely that tying two tables > > > together in a single io_pgtable_cfg would ever be particularly desirable > > > or useful. > > > > > > Streamline the configs to just a single conceptual TTBR value > > > representing the allocated table. This paves the way for future users to > > > support split address spaces by simply allocating a table and dealing > > > with the detailed TTBRn logistics themselves. > > > > > > Signed-off-by: Robin Murphy > > > --- > > > drivers/iommu/arm-smmu-v3.c | 2 +- > > > drivers/iommu/arm-smmu.c | 9 ++++----- > > > drivers/iommu/io-pgtable-arm-v7s.c | 16 +++++++--------- > > > drivers/iommu/io-pgtable-arm.c | 7 +++---- > > > drivers/iommu/ipmmu-vmsa.c | 2 +- > > > drivers/iommu/msm_iommu.c | 4 ++-- > > > drivers/iommu/mtk_iommu.c | 4 ++-- > > > drivers/iommu/qcom_iommu.c | 3 +-- > > > include/linux/io-pgtable.h | 4 ++-- > > > 9 files changed, 23 insertions(+), 28 deletions(-) > > > > > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > > > index 2a8db896d698..2e50cf49c3c4 100644 > > > --- a/drivers/iommu/arm-smmu-v3.c > > > +++ b/drivers/iommu/arm-smmu-v3.c > > > @@ -1722,7 +1722,7 @@ static int arm_smmu_domain_finalise_s1(struct arm_smmu_domain *smmu_domain, > > > } > > > cfg->cd.asid = (u16)asid; > > > - cfg->cd.ttbr = pgtbl_cfg->arm_lpae_s1_cfg.ttbr[0]; > > > + cfg->cd.ttbr = pgtbl_cfg->arm_lpae_s1_cfg.ttbr; > > > cfg->cd.tcr = pgtbl_cfg->arm_lpae_s1_cfg.tcr; > > > cfg->cd.mair = pgtbl_cfg->arm_lpae_s1_cfg.mair; > > > return 0; > > > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > > > index 184ca41e9de7..19030c4b5904 100644 > > > --- a/drivers/iommu/arm-smmu.c > > > +++ b/drivers/iommu/arm-smmu.c > > > @@ -473,13 +473,12 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain, > > > /* TTBRs */ > > > if (stage1) { > > > if (cfg->fmt == ARM_SMMU_CTX_FMT_AARCH32_S) { > > > - cb->ttbr[0] = pgtbl_cfg->arm_v7s_cfg.ttbr[0]; > > > - cb->ttbr[1] = pgtbl_cfg->arm_v7s_cfg.ttbr[1]; > > > + cb->ttbr[0] = pgtbl_cfg->arm_v7s_cfg.ttbr; > > > + cb->ttbr[1] = 0; > > > } else { > > > - cb->ttbr[0] = pgtbl_cfg->arm_lpae_s1_cfg.ttbr[0]; > > > + cb->ttbr[0] = pgtbl_cfg->arm_lpae_s1_cfg.ttbr; > > > cb->ttbr[0] |= FIELD_PREP(TTBRn_ASID, cfg->asid); > > > - cb->ttbr[1] = pgtbl_cfg->arm_lpae_s1_cfg.ttbr[1]; > > > - cb->ttbr[1] |= FIELD_PREP(TTBRn_ASID, cfg->asid); > > > + cb->ttbr[1] = FIELD_PREP(TTBRn_ASID, cfg->asid); > > > > Why do you continue to put the ASID in here? > > For the same reason we put it there before ;) > > Although I guess if TCR.A1 were ever to get flipped accidentally then we're > still cool. Hmm, but we don't do this for other drivers, so I'd be inclined to zap it with 0 for consistency. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel