Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3152256pxk; Mon, 28 Sep 2020 09:33:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWgPcvne2x8ZxKngfIvrbXjKVIBENTpdiYLPw1uYPUW0P4s+8C3tsds4x97JAk40Hgwxqm X-Received: by 2002:a17:906:6158:: with SMTP id p24mr2429800ejl.35.1601310839117; Mon, 28 Sep 2020 09:33:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601310839; cv=none; d=google.com; s=arc-20160816; b=Uoh09Famxx1AlZhCElJuIWaU5DRR7i7NXgZc2PXvcO0fxhNg7iB/PHAyOZ9uvn+Hn2 Dck56s6eBdMUUc5T4H1p7QNrgW7T3I07eAOcWpJbRijqVWAICwtyCdV/A5KFEzGuUkR8 zswtCWJ6m2CPlm7GWi6yAmaKHvC4LUD4ZyO2yUmUrDauquRB1fPQ9kyZmxst37ie+rYz FBMwDxtG6RU4ioerqgHIEZ6ETyLfTAB62kgaOLrhdcQI5bXR9xyMZdRG8LdxVp2DxwHK f2WnUjX53bsY8wTYW5dFdVtVQBN8RUx4iCISit0z5R/wpGNPXLV33inXa8oQCxh6ot8e CvLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :sender:dkim-signature; bh=SAmnBQWegwIwm9Xn+KJtdwofE2MDCDVVlnjeJizgtgQ=; b=oOysSO1idy68ZuOzx9KIXt26hASdPG2IWEUyVWu3wAdlooz9uqDB0+jjRG9h5V6zv/ XGlScLX7VkHFH0mcV3M4VMA4ckGiQb8BAuDra2p5da5p/9mCEsBriOBo0+4wl1bmOdwX MqhPI9RDz2jnLSuWClOlRHVMiiZWmv6HnlI+S6uul++CRGgtspIzEtc1ZjSvBubAF0O1 DMgw9nxUOjeEiIWJ3wmGdFxgmjUtGoNS/PWT3mi29/g9MRQdfBqFmXhGvLXxL+QzGOob UXDa9Lh7uoxU64g+WdppJv8891aURBSq5vFC6xLUGukx/veolRgRgJ2eMIe4j/F1Pfx4 zL8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=WzhNVOdn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si978855edq.156.2020.09.28.09.33.35; Mon, 28 Sep 2020 09:33:59 -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=@mg.codeaurora.org header.s=smtp header.b=WzhNVOdn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726711AbgI1QaV (ORCPT + 99 others); Mon, 28 Sep 2020 12:30:21 -0400 Received: from m42-4.mailgun.net ([69.72.42.4]:24700 "EHLO m42-4.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726281AbgI1QaV (ORCPT ); Mon, 28 Sep 2020 12:30:21 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1601310620; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=SAmnBQWegwIwm9Xn+KJtdwofE2MDCDVVlnjeJizgtgQ=; b=WzhNVOdnZbqaMzNDLCEFBC0ocWF1M6Riq9OkW6tOPz1htnjQcQ4gw/87JB+Z4FNebRnlIx2U IHHQabmq9cZsKNnT27i2l6IwHJ1sQ1YzLuOLKA7bPVduR/7ksiV1iFqw36faGipeozEUSFq8 b9ux/j+/KdgdU2PEXWCyk86821o= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 5f720f9b7e9d6827ec7f785a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 28 Sep 2020 16:30:19 GMT Sender: saiprakash.ranjan=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id A5797C433CA; Mon, 28 Sep 2020 16:30:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1C0E8C433CB; Mon, 28 Sep 2020 16:30:18 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 28 Sep 2020 22:00:17 +0530 From: Sai Prakash Ranjan To: Jordan Crouse Cc: Will Deacon , Robin Murphy , Joerg Roedel , Rob Clark , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Akhil P Oommen , Bjorn Andersson , freedreno@lists.freedesktop.org, "Kristian H . Kristensen" , dri-devel@lists.freedesktop.org, Sharat Masetty , Jonathan Marek , jcrouse=codeaurora.org@codeaurora.org Subject: Re: [PATCHv5 4/6] drm/msm/a6xx: Add support for using system cache(LLC) In-Reply-To: <20200928161125.GA29832@jcrouse1-lnx.qualcomm.com> References: <889a32458cec92ed110b94f393aa1c2f0d64dca5.1600754909.git.saiprakash.ranjan@codeaurora.org> <20200923150320.GD31425@jcrouse1-lnx.qualcomm.com> <800c2108606cb921fef1ffc27569ffb2@codeaurora.org> <20200928161125.GA29832@jcrouse1-lnx.qualcomm.com> Message-ID: <4bac115897afae4fac4401c57201424e@codeaurora.org> X-Sender: saiprakash.ranjan@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-09-28 21:41, Jordan Crouse wrote: > On Mon, Sep 28, 2020 at 05:56:55PM +0530, Sai Prakash Ranjan wrote: >> Hi Jordan, >> >> On 2020-09-23 20:33, Jordan Crouse wrote: >> >On Tue, Sep 22, 2020 at 11:48:17AM +0530, Sai Prakash Ranjan wrote: >> >>From: Sharat Masetty >> >> >> >>The last level system cache can be partitioned to 32 different >> >>slices of which GPU has two slices preallocated. One slice is >> >>used for caching GPU buffers and the other slice is used for >> >>caching the GPU SMMU pagetables. This talks to the core system >> >>cache driver to acquire the slice handles, configure the SCID's >> >>to those slices and activates and deactivates the slices upon >> >>GPU power collapse and restore. >> >> >> >>Some support from the IOMMU driver is also needed to make use >> >>of the system cache to set the right TCR attributes. GPU then >> >>has the ability to override a few cacheability parameters which >> >>it does to override write-allocate to write-no-allocate as the >> >>GPU hardware does not benefit much from it. >> >> >> >>DOMAIN_ATTR_SYS_CACHE is another domain level attribute used by the >> >>IOMMU driver to set the right attributes to cache the hardware >> >>pagetables into the system cache. >> >> >> >>Signed-off-by: Sharat Masetty >> >>[saiprakash.ranjan: fix to set attr before device attach to iommu and >> >>rebase] >> >>Signed-off-by: Sai Prakash Ranjan >> >>--- >> >> drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 83 +++++++++++++++++++++++++ >> >> drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 4 ++ >> >> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 17 +++++ >> >> 3 files changed, 104 insertions(+) >> >> >> >>diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c >> >>b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c >> >>index 8915882e4444..151190ff62f7 100644 >> >>--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c >> >>+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c >> >>@@ -8,7 +8,9 @@ >> >> #include "a6xx_gpu.h" >> >> #include "a6xx_gmu.xml.h" >> >> >> >>+#include >> >> #include >> >>+#include >> >> >> >> #define GPU_PAS_ID 13 >> >> >> >>@@ -1022,6 +1024,79 @@ static irqreturn_t a6xx_irq(struct msm_gpu *gpu) >> >> return IRQ_HANDLED; >> >> } >> >> >> >>+static void a6xx_llc_rmw(struct a6xx_gpu *a6xx_gpu, u32 reg, u32 mask, >> >>u32 or) >> >>+{ >> >>+ return msm_rmw(a6xx_gpu->llc_mmio + (reg << 2), mask, or); >> >>+} >> >>+ >> >>+static void a6xx_llc_write(struct a6xx_gpu *a6xx_gpu, u32 reg, u32 >> >>value) >> >>+{ >> >>+ return msm_writel(value, a6xx_gpu->llc_mmio + (reg << 2)); >> >>+} >> >>+ >> >>+static void a6xx_llc_deactivate(struct a6xx_gpu *a6xx_gpu) >> >>+{ >> >>+ llcc_slice_deactivate(a6xx_gpu->llc_slice); >> >>+ llcc_slice_deactivate(a6xx_gpu->htw_llc_slice); >> >>+} >> >>+ >> >>+static void a6xx_llc_activate(struct a6xx_gpu *a6xx_gpu) >> >>+{ >> >>+ u32 cntl1_regval = 0; >> >>+ >> >>+ if (IS_ERR(a6xx_gpu->llc_mmio)) >> >>+ return; >> >>+ >> >>+ if (!llcc_slice_activate(a6xx_gpu->llc_slice)) { >> >>+ u32 gpu_scid = llcc_get_slice_id(a6xx_gpu->llc_slice); >> >>+ >> >>+ gpu_scid &= 0x1f; >> >>+ cntl1_regval = (gpu_scid << 0) | (gpu_scid << 5) | (gpu_scid << 10) | >> >>+ (gpu_scid << 15) | (gpu_scid << 20); >> >>+ } >> >>+ >> >>+ if (!llcc_slice_activate(a6xx_gpu->htw_llc_slice)) { >> >>+ u32 gpuhtw_scid = llcc_get_slice_id(a6xx_gpu->htw_llc_slice); >> >>+ >> >>+ gpuhtw_scid &= 0x1f; >> >>+ cntl1_regval |= FIELD_PREP(GENMASK(29, 25), gpuhtw_scid); >> >>+ } >> >>+ >> >>+ if (cntl1_regval) { >> >>+ /* >> >>+ * Program the slice IDs for the various GPU blocks and GPU MMU >> >>+ * pagetables >> >>+ */ >> >>+ a6xx_llc_write(a6xx_gpu, REG_A6XX_CX_MISC_SYSTEM_CACHE_CNTL_1, >> >>cntl1_regval); >> >>+ >> >>+ /* >> >>+ * Program cacheability overrides to not allocate cache lines on >> >>+ * a write miss >> >>+ */ >> >>+ a6xx_llc_rmw(a6xx_gpu, REG_A6XX_CX_MISC_SYSTEM_CACHE_CNTL_0, 0xF, >> >>0x03); >> >>+ } >> >>+} >> > >> >This code has been around long enough that it pre-dates a650. On a650 and >> >other >> >MMU-500 targets the htw_llc is configured by the firmware and the >> >llc_slice is >> >configured in a different register. >> > >> >I don't think we need to pause everything and add support for the MMU-500 >> >path, >> >but we do need a way to disallow LLCC on affected targets until such time >> >that >> >we can get it fixed up. >> > >> >> Thanks for taking a close look, does something like below look ok or >> something >> else is needed here? >> >> + /* Till the time we get in LLCC support for A650 */ >> + if (!(info && info->revn == 650)) >> + a6xx_llc_slices_init(pdev, a6xx_gpu); > > It doesn't look like Rob picked this up for 5.10, so we have some time > to do it > right. Would you like me to give you an add-on patch for mmu-500 > targets? > Yes that will be great. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation