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=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FAKE_REPLY_C,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 EDC8AC433E1 for ; Mon, 20 Jul 2020 09:00:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 BE5C220672 for ; Mon, 20 Jul 2020 09:00:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="0gK6rw9S"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xgL1HXG5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE5C220672 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+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=merlin.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: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:References:List-Owner; bh=Evac0SqySbSoy6LJpofJpECpqPNi970jSGGMXkCFTbw=; b=0gK6rw9S3ymXIFkLfAh8gEYjU gv2POucTEt/pxUiUYL23b6EG8NjQVDbtAhBjVJ/DxZQvbPgJsRz2+gd7GilSz57nOZOYqvWjOXgBh Moegm9JO+EWflphZJmRtuo9bSi/RTt+sxvCtqv1YAuvBjZWslSCtPYruuuEHty9dp7dSHb+h0rfwy H7KTifU59k0kmiPa7KhRiZxQXJW8EYnhvDPz4xu3UnjqA2GX+BgnYG/bUmss82cVkPpKJThT5upvj sBFFPheYd9LCZYwWbS1ezpxU3ccBO16gta80To36FKRZrLdx0GpKEdefCm9xoGP3J1EVjtscxNJKk R7QvSrSJw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxRdQ-000093-LJ; Mon, 20 Jul 2020 08:58:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxRdI-00005k-V4 for linux-arm-kernel@lists.infradead.org; Mon, 20 Jul 2020 08:58:50 +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 628882080D; Mon, 20 Jul 2020 08:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595235527; bh=5dRm17x/4YmOg9N68msaTYgFDv010nts5Csj4JsnuNo=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=xgL1HXG5V4cFym6tqGx4SK3Zg1MNmAKtWRpSGhMqIhBBohFlDkQoTq230Hvd6SuYw w5wKTAdMcYJFzMnBoDGNZQdpgG3RMqInDwJCnWZWRhOSHxtTbnxoZOfI6U+8vb+A16 dZrt94iCFWjJhK+PR14gN9iFFGOQoq/bJjf98yfs= Date: Mon, 20 Jul 2020 09:58:42 +0100 From: Will Deacon To: Bjorn Andersson Subject: Re: [PATCH v2 2/5] iommu/arm-smmu: Emulate bypass by using context banks Message-ID: <20200720085841.GA11189@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200717001619.325317-3-bjorn.andersson@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200720_045849_208586_B52EA2E5 X-CRM114-Status: GOOD ( 21.84 ) 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: Vinod Koul , jcrouse@codeaurora.org, Jonathan Marek , linux-arm-msm@vger.kernel.org, Joerg Roedel , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Thierry Reding , John Stultz , Robin Murphy , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 16, 2020 at 05:16:16PM -0700, Bjorn Andersson wrote: > Some firmware found on various Qualcomm platforms traps writes to S2CR > of type BYPASS and writes FAULT into the register. This prevents us from > marking the streams for the display controller as BYPASS to allow > continued scanout of the screen through the initialization of the ARM > SMMU. > > This adds a Qualcomm specific cfg_probe function, which probes the > behavior of the S2CR registers and if found faulty enables the related > quirk. Based on this quirk context banks are allocated for IDENTITY > domains as well, but with ARM_SMMU_SCTLR_M omitted. > > The result is valid stream mappings, without translation. > > Tested-by: John Stultz > Tested-by: Vinod Koul > Signed-off-by: Bjorn Andersson > --- > > Changes since v1: > - Picked up tested-by > > drivers/iommu/arm-smmu-qcom.c | 21 +++++++++++++++++++++ > drivers/iommu/arm-smmu.c | 14 ++++++++++++-- > drivers/iommu/arm-smmu.h | 3 +++ > 3 files changed, 36 insertions(+), 2 deletions(-) [...] > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c > index fb85e716ae9a..5d5fe6741ed4 100644 > --- a/drivers/iommu/arm-smmu.c > +++ b/drivers/iommu/arm-smmu.c > @@ -654,7 +654,9 @@ static void arm_smmu_write_context_bank(struct arm_smmu_device *smmu, int idx) > > /* SCTLR */ > reg = ARM_SMMU_SCTLR_CFIE | ARM_SMMU_SCTLR_CFRE | ARM_SMMU_SCTLR_AFE | > - ARM_SMMU_SCTLR_TRE | ARM_SMMU_SCTLR_M; > + ARM_SMMU_SCTLR_TRE; > + if (cfg->m) > + reg |= ARM_SMMU_SCTLR_M; > if (stage1) > reg |= ARM_SMMU_SCTLR_S1_ASIDPNE; > if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) > @@ -678,7 +680,11 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, > if (smmu_domain->smmu) > goto out_unlock; > > - if (domain->type == IOMMU_DOMAIN_IDENTITY) { > + /* > + * Nothing to do for IDENTITY domains,unless disabled context banks are > + * used to emulate bypass mappings on Qualcomm platforms. > + */ > + if (domain->type == IOMMU_DOMAIN_IDENTITY && !smmu->qcom_bypass_quirk) { Given that the other thread [1] with Jordan (why haven't you cc'd him?! -- adding him now) has identified the need for a callback to allocate the context bank, why don't we use the same sort of idea here? If the impl provides a CB allocator function, call it irrespective of the domain type. If it allocates a domain even for an identity domain, then we can install if with SCTLR.M clear. Will [1] https://lore.kernel.org/r/20200716151625.GA14526@jcrouse1-lnx.qualcomm.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel