Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp2153761ybm; Thu, 23 May 2019 12:14:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0/wO7iAoKesX8mZ3ZZot2adgZ8O5ju91gerv+ub1qgCOhdT7kzniVR7SfjRqjNqZO+Uqk X-Received: by 2002:a17:90a:a27:: with SMTP id o36mr3549551pjo.95.1558638882313; Thu, 23 May 2019 12:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558638882; cv=none; d=google.com; s=arc-20160816; b=fAb6KWmjIsK6+b4CBusaMTwGS0n7Xo2LcjbqaDwVr6wMjA5fozxLs4qCnUt6DiZ5vD 0/aKf6OG8FGUDCK0JTTHBgJ68hUVnvlJAjyRJ6nZYS1jRWx2vOoKk6KYOQczZ8qTCWoF 7kIQl+IqlTHCjtdSYrp4jCnfwhAwFD7MbeLRtIHwH1o2ubrAzVf6h0V5KkEMpwcGB+Uj 8Cn/1uPjQMvdazOdAZua/ayjEd9DGQO6Hj3stMr0knBwi26Mgeq+aqgrg9rP8/xd5afr D+sPo6D9pZPtFN+j84IS5gh0HDLGFB17RdMQ4hzd2frFYts6NmMtAm3quRifNM1Obb3x tV+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cLDIC5Htl/bnHMFdibfHrvx0wkGrowjhW9pZPSzWLWE=; b=wsbOK06s7uJc3tRZx6k9t1SVe75IQQkvOUNCtgK+5sAdBMo6JGCJxMmW/mMjtlvoLz Zk5LRrREcaNp1wM72A3kWrNXQumj6GKfEJe7S12dZ1d847WvoT7ioCqRKBtY7PprHAS5 jUoqn+2tk6ad9TTeBN/qzom5irL82bHn8scqbv6JT2hDNefqrxjvWsbMDXALZx/zkZHg 1QwEbsXs7tKeZY63UUnJSZAY+jd9JiIuCzaJ1jEnEa0ekWBdZqfKzkqBdJGBhlZpf4ZQ 5TlzDITqqTijtZE9tCqtLF3Vc0GjlGoGmpdr7mnJbzvavl/n4xd2pi5TsP6FV6rv+xhP mcjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=di2M9o8W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s20si597578pgj.63.2019.05.23.12.14.26; Thu, 23 May 2019 12:14:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=di2M9o8W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388229AbfEWTLg (ORCPT + 99 others); Thu, 23 May 2019 15:11:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:45010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388217AbfEWTLe (ORCPT ); Thu, 23 May 2019 15:11:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7151C2184B; Thu, 23 May 2019 19:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558638694; bh=WOEa1ws4HotOoIA7LVTMovEkyc6zTE+JoWJkweKPueU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=di2M9o8WkZsOJ5lautEsGesnH/VMsxKgreCaWlIH/B1IBTLhJfDku413q5P54SlIj oN2E7DX6+q2z+YP9I/oQRcicKH4MoZdXD5fqX8noVT3RvpSPNZA5m5tuCrRV0TPoiv uIfDBU4qsx2dUF0Pp+CQIB6bbD9RI2qdWpYDv7XA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Thierry Reding , Joerg Roedel Subject: [PATCH 4.14 30/77] iommu/tegra-smmu: Fix invalid ASID bits on Tegra30/114 Date: Thu, 23 May 2019 21:05:48 +0200 Message-Id: <20190523181724.380491661@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181719.982121681@linuxfoundation.org> References: <20190523181719.982121681@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 43a0541e312f7136e081e6bf58f6c8a2e9672688 upstream. Both Tegra30 and Tegra114 have 4 ASID's and the corresponding bitfield of the TLB_FLUSH register differs from later Tegra generations that have 128 ASID's. In a result the PTE's are now flushed correctly from TLB and this fixes problems with graphics (randomly failing tests) on Tegra30. Cc: stable Signed-off-by: Dmitry Osipenko Acked-by: Thierry Reding Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman --- drivers/iommu/tegra-smmu.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -94,7 +94,6 @@ static inline u32 smmu_readl(struct tegr #define SMMU_TLB_FLUSH_VA_MATCH_ALL (0 << 0) #define SMMU_TLB_FLUSH_VA_MATCH_SECTION (2 << 0) #define SMMU_TLB_FLUSH_VA_MATCH_GROUP (3 << 0) -#define SMMU_TLB_FLUSH_ASID(x) (((x) & 0x7f) << 24) #define SMMU_TLB_FLUSH_VA_SECTION(addr) ((((addr) & 0xffc00000) >> 12) | \ SMMU_TLB_FLUSH_VA_MATCH_SECTION) #define SMMU_TLB_FLUSH_VA_GROUP(addr) ((((addr) & 0xffffc000) >> 12) | \ @@ -197,8 +196,12 @@ static inline void smmu_flush_tlb_asid(s { u32 value; - value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) | - SMMU_TLB_FLUSH_VA_MATCH_ALL; + if (smmu->soc->num_asids == 4) + value = (asid & 0x3) << 29; + else + value = (asid & 0x7f) << 24; + + value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_MATCH_ALL; smmu_writel(smmu, value, SMMU_TLB_FLUSH); } @@ -208,8 +211,12 @@ static inline void smmu_flush_tlb_sectio { u32 value; - value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) | - SMMU_TLB_FLUSH_VA_SECTION(iova); + if (smmu->soc->num_asids == 4) + value = (asid & 0x3) << 29; + else + value = (asid & 0x7f) << 24; + + value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_SECTION(iova); smmu_writel(smmu, value, SMMU_TLB_FLUSH); } @@ -219,8 +226,12 @@ static inline void smmu_flush_tlb_group( { u32 value; - value = SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_ASID(asid) | - SMMU_TLB_FLUSH_VA_GROUP(iova); + if (smmu->soc->num_asids == 4) + value = (asid & 0x3) << 29; + else + value = (asid & 0x7f) << 24; + + value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_GROUP(iova); smmu_writel(smmu, value, SMMU_TLB_FLUSH); }