From patchwork Mon Aug 17 22:01:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11719407 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7649613B1 for ; Mon, 17 Aug 2020 22:04:00 +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 4F7AC2072E for ; Mon, 17 Aug 2020 22:04:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="t88eKlqY"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X4bVwiFX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F7AC2072E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.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:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aqQNj/Ticq6Xdi7azWhzNYaSrJa7bRe5uqu67d/Pmi8=; b=t88eKlqYQyp1DPNQltcDNSjZh bv+4mlTxlrH8UuHkX67ZHCyyNH83bbFKvaz4LhB6CXY/W8TfNt6W4paLkrBxdQ4V4t/O2bjH4VejC 0NjwJkw2ZpCBhKOlDxXvLfEtElUqgnDPv5ddhnxmhloRIxi0HeZG3USyrieBkEUnE8l/lq+sHF3Cz 0eXab8gdyMvZneXhyYXHleVsiMHuQQnejznWfWeTpCRh6OgqVNQeSmtAQgs6gC7WA69T/FeYFvVHd WnPyLUKeH5QbYX7BKGMr5ksO8WeLnNAmPPLFpFP1bGIppGXUS7mKkcbky+wdIYyKG2oTsx+0HncGf bDAglCBvw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7nEJ-0006JN-Kx; Mon, 17 Aug 2020 22:03:47 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k7nEF-0006H8-BC for linux-arm-kernel@lists.infradead.org; Mon, 17 Aug 2020 22:03:44 +0000 Received: by mail-pl1-x644.google.com with SMTP id bh1so8223764plb.12 for ; Mon, 17 Aug 2020 15:03:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ORHfJz2e9TNUi11ClButtEprelkWs9RC+Iw7WuZZvQo=; b=X4bVwiFXIYP3pjm4BndZ9t5PEtfduyy+1Eg8SV5jmWoPE1NR9Q528uXmAJ8Xq/aw02 Fb/A8+InhFyRuVyPVeIhvHuzbmQqZO6yNt3nI2qB4b+bwrkcpwMTBUMAEbIePxjt9ghT vjhzd8HP5MCwwqA7GYy1YCpZxo27d/OGOFoQJYac0HtTs5RPf5ieoXAEjTZbyRJpwR/v 3OKr+KutVpYE8YKExSRNvSUNKdDCZ349THLmOClKm/4Nkfhhhx1Myxr8UUJ0ADLueoAt k5mOnTCypWDgOhKf/636IGGgx4BSRmEPzFTc8DY1opht+9Bxhy4MF8q+3hcLouQL3jra wzUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ORHfJz2e9TNUi11ClButtEprelkWs9RC+Iw7WuZZvQo=; b=PmkI9oGDCbfz+/SxGsYYoIa3oSySZVFpDhT6pD1w/zDO6qiOQapyS56ClOfSImFWW3 eDui9zF2IKzNwGoS+OYYIRc8U5NJ10kEpLFdoYX+RiM9FTtewGr37qgRj2bROicpd3e7 YPVHYt8m7SDIfEkbIq7niO2++0RjAhr84Xv+GIJ5Q1go/aEzMsxzdwvmNaCYx0OTS+I9 XeFw9pNrWbq3I2zH7/B0MxAearERg4Bp4qYQGObpDHppFvw4oBqjZNHBcGIe7eIU7z7d OpTfQJ150NpasLsSFvCl1o2+nES/941dwwmlxMGA/r1Xt3LKl/J17JvV+1SPZjIy1hhL yLxg== X-Gm-Message-State: AOAM5315vRv75C5j6S9eSqSJ7kKQNGdnwGtwitUmTLoQTUaOkj18LepR G3VEuA4N1hrHZAezdiNOX1M= X-Google-Smtp-Source: ABdhPJyZZBDtUDzS1snMtRd7gsIy93ErC4rI1+onxuuUyw9PTg/NTPn+htukEfuFogsHKr46nbNsTQ== X-Received: by 2002:a17:902:9787:: with SMTP id q7mr13413513plp.0.1597701821220; Mon, 17 Aug 2020 15:03:41 -0700 (PDT) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id h5sm22008353pfk.0.2020.08.17.15.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 15:03:40 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 19/20] iommu/arm-smmu: add a way for implementations to influence SCTLR Date: Mon, 17 Aug 2020 15:01:44 -0700 Message-Id: <20200817220238.603465-20-robdclark@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200817220238.603465-1-robdclark@gmail.com> References: <20200817220238.603465-1-robdclark@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200817_180343_410824_969CA941 X-CRM114-Status: GOOD ( 15.24 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:644 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [robdclark[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 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: Rob Clark , Sai Prakash Ranjan , open list , Will Deacon , Joerg Roedel , Robin Murphy , Bjorn Andersson , Jordan Crouse , Sibi Sankar , Vivek Gautam , Greg Kroah-Hartman , Jon Hunter , Stephen Boyd , freedreno@lists.freedesktop.org, "moderated list:ARM SMMU DRIVERS" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Rob Clark For the Adreno GPU's SMMU, we want SCTLR.HUPCF set to ensure that pending translations are not terminated on iova fault. Otherwise a terminated CP read could hang the GPU by returning invalid command-stream data. Signed-off-by: Rob Clark --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 6 ++++++ drivers/iommu/arm/arm-smmu/arm-smmu.c | 3 +++ drivers/iommu/arm/arm-smmu/arm-smmu.h | 3 +++ 3 files changed, 12 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index 5640d9960610..2aa6249050ff 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -127,6 +127,12 @@ static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, (smmu_domain->cfg.fmt == ARM_SMMU_CTX_FMT_AARCH64)) pgtbl_cfg->quirks |= IO_PGTABLE_QUIRK_ARM_TTBR1; + /* + * On the GPU device we want to process subsequent transactions after a + * fault to keep the GPU from hanging + */ + smmu_domain->cfg.sctlr_set |= ARM_SMMU_SCTLR_HUPCF; + /* * Initialize private interface with GPU: */ diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index e63a480d7f71..bbec5793faf8 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -617,6 +617,9 @@ void arm_smmu_write_context_bank(struct arm_smmu_device *smmu, int idx) if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) reg |= ARM_SMMU_SCTLR_E; + reg |= cfg->sctlr_set; + reg &= ~cfg->sctlr_clr; + arm_smmu_cb_write(smmu, idx, ARM_SMMU_CB_SCTLR, reg); } diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h b/drivers/iommu/arm/arm-smmu/arm-smmu.h index cd75a33967bb..2df3a70a8a41 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.h +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h @@ -144,6 +144,7 @@ enum arm_smmu_cbar_type { #define ARM_SMMU_CB_SCTLR 0x0 #define ARM_SMMU_SCTLR_S1_ASIDPNE BIT(12) #define ARM_SMMU_SCTLR_CFCFG BIT(7) +#define ARM_SMMU_SCTLR_HUPCF BIT(8) #define ARM_SMMU_SCTLR_CFIE BIT(6) #define ARM_SMMU_SCTLR_CFRE BIT(5) #define ARM_SMMU_SCTLR_E BIT(4) @@ -341,6 +342,8 @@ struct arm_smmu_cfg { u16 asid; u16 vmid; }; + u32 sctlr_set; /* extra bits to set in SCTLR */ + u32 sctlr_clr; /* bits to mask in SCTLR */ enum arm_smmu_cbar_type cbar; enum arm_smmu_context_fmt fmt; };