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=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 43BEBC433E6 for ; Mon, 20 Jul 2020 15:54:16 +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 13A382065E for ; Mon, 20 Jul 2020 15:54:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YqJAMj7A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="wTzb9Z1C" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13A382065E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.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: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=OsPqjyKlNhr2GhvCe7+wZOMhc1mcmRsot6/ALnzvVZI=; b=YqJAMj7AsDLFYAezpAiGbymkG V2KQt9ihO6g8gA/DEnaXgfA52zwZey6OxWZianqD21oQrE/CvZJOO8x6v9qA7pjuIysGsO/PYeUkL xPrGPdgdoELSD3xoyvSinTDoDPnrGr6/RVa984twW/MzgiRaWCpA80mWBH8gYdwdb5VuFVcFekdPS 5IBUo7NE+6zYvOjAE0k/U0aAgnszQECJO4URIu6mLYwOEXDroJtB70FgZHt4Q1jfqk2MMJ8dLLXYL ew2/VSJ83F5qT3yUf/5M4tjQTQNm44rLcDJclGMFDdmBWD3MNY+T36dxuPtUHebjwo41nEWWSqv/I QjRZugf8A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxY5s-0005RB-Lk; Mon, 20 Jul 2020 15:52:44 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jxY5j-0005PO-I2 for linux-arm-kernel@lists.infradead.org; Mon, 20 Jul 2020 15:52:42 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595260361; h=In-Reply-To: Content-Type: MIME-Version: References: Message-ID: Subject: Cc: To: From: Date: Sender; bh=xnVbQfIOaNQRuCHlcnsyb5PH1Ei/vPGEs+i3wjo8U3s=; b=wTzb9Z1C3XojCK+mCxv4Xp4QYVT+j++cn9jPKRsZXX21YxDmrxF+1OeiKA2IfQfReb6+8HMC xBWex7mTR9bE2qXHjXdbENB5VI8yD9PVbEb3YMEvYrM4V9c4ynfS/CW3paNhG0cr9OFlzYfq LhGzYzCozf2Bl8wqKHBVFSWMN44= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n15.prod.us-west-2.postgun.com with SMTP id 5f15bd7d5b75bcda60716721 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 20 Jul 2020 15:51:25 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 224EFC43452; Mon, 20 Jul 2020 15:51:24 +0000 (UTC) Received: from jcrouse1-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jcrouse) by smtp.codeaurora.org (Postfix) with ESMTPSA id 59B0EC43457; Mon, 20 Jul 2020 15:51:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 59B0EC43457 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jcrouse@codeaurora.org Date: Mon, 20 Jul 2020 09:51:16 -0600 From: Jordan Crouse To: Will Deacon Subject: Re: [PATCH v2 2/5] iommu/arm-smmu: Emulate bypass by using context banks Message-ID: <20200720155116.GA4243@jcrouse1-lnx.qualcomm.com> Mail-Followup-To: Will Deacon , Bjorn Andersson , Robin Murphy , Joerg Roedel , Thierry Reding , Laurentiu Tudor , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jonathan Marek , linux-arm-msm@vger.kernel.org, John Stultz , Vinod Koul References: <20200717001619.325317-3-bjorn.andersson@linaro.org> <20200720085841.GA11189@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200720085841.GA11189@willie-the-truck> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200720_115241_924608_F2C75FF6 X-CRM114-Status: GOOD ( 28.04 ) 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 , Jonathan Marek , linux-arm-msm@vger.kernel.org, Joerg Roedel , linux-kernel@vger.kernel.org, Bjorn Andersson , 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 Mon, Jul 20, 2020 at 09:58:42AM +0100, Will Deacon wrote: > 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. Here is what I have so far for the context bank allocator. I think its a good start, but it still feels a bit half baked, so comments definitely welcome. https://lists.linuxfoundation.org/pipermail/iommu/2020-July/046754.html https://lists.linuxfoundation.org/pipermail/iommu/2020-July/046752.html > Will > > [1] https://lore.kernel.org/r/20200716151625.GA14526@jcrouse1-lnx.qualcomm.com -- The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel