Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1144258pxv; Fri, 9 Jul 2021 19:24:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIBiSTF82Qb2J3GO+6yLOG6No2hv7bPiJfJPU25xI7KtDxU3An3EUVg3/ErAhJc7LHo0G7 X-Received: by 2002:aa7:d283:: with SMTP id w3mr34511588edq.153.1625883888462; Fri, 09 Jul 2021 19:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625883888; cv=none; d=google.com; s=arc-20160816; b=ZI0tmYceUm97qsgdR13VfFetjpKu/alh5JLtSCLVgKphMKLnIB/TT04x+4zHIx9VdX rLnCgeIbTTs5n2UXT4NOCAqLDmkhp88Rr+XkVadAg5lPWrbigWdZhXFYrA8ZSL6+uyWb mXKk6mQWSlF2q4pUsw36i3iFbB+sFKTnxpyMEmGDe3jheoykSEiGjmbuQTgUAQ/xWKyR 8a0cg0c1tglgSCVAnlRZ551i30tPn7skrGALh3KApnvfASzubtFiIRP4IQLnQbHzEIQD HxP1pVyLjgGCxXQ4vSqbAlnBsDIm8hgu9gDG/G5+CKfHoLcj8WUFC9vAiayx8KfeSIET E+AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EKHwpwyUeu5OTThYqXFgMT4UYvNyDfK4dlun7u6SneE=; b=ZaHGZxj6tJAFhlXgHOdvN1UD8hQ+K1ydEhaPzSpAWJd6SboLA943XuCZxS+rEACIqo A/tT3juQLwqjnhHC2YnIvcIHBEO6A8IFGKlX0UAZhAcyZwYi9+Uij+nkaE49r8vgrwcy G4QCFunWy7vIj+R57vCPej5r+uSNrbUQ+Wh86AeDzSf55h7Q+UDgccQtuMUQ2gTh+cDL pmj0O7ZGzeUZkgMLxEGi/cgBe5HZOtamk9vQbt9gFr5YBl809ud054JQos02xiEcF2ky 8QGLOQqndVuJJ1pvU3E+CL3qJEf021iP8A6XBqXqy4pHdu4T5RJbe4IhvBMAbvrQQj9c 4Ezw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=obThWvzh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s26si8870812ejr.465.2021.07.09.19.24.25; Fri, 09 Jul 2021 19:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=obThWvzh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232552AbhGJCXE (ORCPT + 99 others); Fri, 9 Jul 2021 22:23:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:38334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232689AbhGJCV6 (ORCPT ); Fri, 9 Jul 2021 22:21:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 317C8613E8; Sat, 10 Jul 2021 02:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883552; bh=6MAIkxHaPo+Yqp2Ff/ElNQYLdszBr4YG2QdZKdHUdtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=obThWvzh/oCyvB+1lY74H4CnZ8rwFc/tYD0uaxZrh3qsl9QuJs3Szy1FaATgyyVDJ rv6BhrE2A49NioBTcxgfWjXMJKUB2KR//VkSyBEyfDWuQ6ACJXXXNWNU+i+qZfk5F3 krYlGDKeXhitPuVe6gcknEJTr+gQjo6/7NX1CN6D+uGFy1JDsXKqBxi00zeEBu1pMV b/25w07D3VwS29Kkz4LbP8+k/CKvwApxk0NPhjXkcUT7I+FZJNwitzhYnbGVdAvF4g kh/0vaNcCIX2AtGD209jdlsBcD14VjgEOdNwLn4ILTUfA0eyEhTybkPzH7/tYrnf4Y Ze5tZOR9iRthQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Anholt , Bjorn Andersson , Will Deacon , Sasha Levin , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org Subject: [PATCH AUTOSEL 5.13 061/114] iommu/arm-smmu-qcom: Skip the TTBR1 quirk for db820c. Date: Fri, 9 Jul 2021 22:16:55 -0400 Message-Id: <20210710021748.3167666-61-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710021748.3167666-1-sashal@kernel.org> References: <20210710021748.3167666-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Anholt [ Upstream commit a242f4297cfe3f4589a7620dcd42cc503607fc6b ] db820c wants to use the qcom smmu path to get HUPCF set (which keeps the GPU from wedging and then sometimes wedging the kernel after a page fault), but it doesn't have separate pagetables support yet in drm/msm so we can't go all the way to the TTBR1 path. Signed-off-by: Eric Anholt Reviewed-by: Bjorn Andersson Link: https://lore.kernel.org/r/20210326231303.3071950-1-eric@anholt.net Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c index 98b3a1c2a181..44a427833385 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c @@ -130,6 +130,16 @@ static int qcom_adreno_smmu_alloc_context_bank(struct arm_smmu_domain *smmu_doma return __arm_smmu_alloc_bitmap(smmu->context_map, start, count); } +static bool qcom_adreno_can_do_ttbr1(struct arm_smmu_device *smmu) +{ + const struct device_node *np = smmu->dev->of_node; + + if (of_device_is_compatible(np, "qcom,msm8996-smmu-v2")) + return false; + + return true; +} + static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, struct io_pgtable_cfg *pgtbl_cfg, struct device *dev) { @@ -144,7 +154,8 @@ static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, * be AARCH64 stage 1 but double check because the arm-smmu code assumes * that is the case when the TTBR1 quirk is enabled */ - if ((smmu_domain->stage == ARM_SMMU_DOMAIN_S1) && + if (qcom_adreno_can_do_ttbr1(smmu_domain->smmu) && + (smmu_domain->stage == ARM_SMMU_DOMAIN_S1) && (smmu_domain->cfg.fmt == ARM_SMMU_CTX_FMT_AARCH64)) pgtbl_cfg->quirks |= IO_PGTABLE_QUIRK_ARM_TTBR1; -- 2.30.2