From patchwork Wed Feb 14 06:46:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 10218175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 328B96055C for ; Wed, 14 Feb 2018 08:43:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F62728988 for ; Wed, 14 Feb 2018 08:43:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13ED828C99; Wed, 14 Feb 2018 08:43:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8ACDF28988 for ; Wed, 14 Feb 2018 08:43:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E67206E3AD; Wed, 14 Feb 2018 08:42:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6D996E356 for ; Wed, 14 Feb 2018 06:47:02 +0000 (UTC) Received: by mail-pl0-x241.google.com with SMTP id o11so4414600pls.2 for ; Tue, 13 Feb 2018 22:47:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=KHggAL1Aj2Kl9uA+Qe2DcvOxpsLNc6LdZYqvXQe9c3o=; b=cpmKp9sVz6FZXQWmBn6L6odQvtGbtpz0vNf77T1RWhu0xoSRM7WjErr2FmmbWBekC8 KuZFwjZxNdgUDKguIOaV+RQ12hJW/YHO8rdWPwvrb891Aw88vFgVyPPhe0wq2AHnl5hA CKusEpV0eYgX51Sla3aWReHFtKR3T1AS2j10Y= 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; bh=KHggAL1Aj2Kl9uA+Qe2DcvOxpsLNc6LdZYqvXQe9c3o=; b=fC9ePzOnRsgap6Ehx1arp5yqCNq3yhGtFAdBwu4S+qwzmt0efkqifdFZ+cF9fq5gxM QTQEbEKhizFqmob3ZM+HV3LpUPf8EFtH4uCXg3xi7TDmbyKujgcCOs7PkSKAmPAwpKIx dLBcjhI0xyffYPSDz1MKoywFpF3Awi8uUDMFSpzKMj1haBdIzxo0Kp6Q0r+UcQKo4Alb 0RmtahdbofyRvutYntmGQUPHUSWz4VwZk54fM9MiHuTcE97jQGj2ZkWYtdkcrxiSiWDN 6Nbho4Qk581GrKCOHwdyhqO5LsZPCK/yN4xTTDePJeV7MHgbmP5T1gr+szhUwHoI/mwa nG/g== X-Gm-Message-State: APf1xPCBGo1/PGckwBy6FrxcPtjDaCey/R8WYRYkIjfxmCKUROaGYyl7 UJFmfqw7qeNctao6sl7jv/w30w== X-Google-Smtp-Source: AH8x227Qx37seBBtJ3aV2hvLNwxzpZG7EfiBSqNQWBSmayTC3GCpJ1IGwni4n3mgydCRpkHs48RsZw== X-Received: by 2002:a17:902:5a3:: with SMTP id f32-v6mr3545891plf.48.1518590821934; Tue, 13 Feb 2018 22:47:01 -0800 (PST) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id m4sm22891925pfh.150.2018.02.13.22.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 22:47:01 -0800 (PST) From: Bjorn Andersson To: Rob Clark , Jordan Crouse Subject: [RFT PATCH] drm/msm: Trigger fence completion from GPU Date: Tue, 13 Feb 2018 22:46:58 -0800 Message-Id: <20180214064658.15741-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.15.0 X-Mailman-Approved-At: Wed, 14 Feb 2018 08:42:49 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Interrupt commands causes the CP to trigger an interrupt as the command is processed, regardless of the GPU being done processing previous commands. This is seen by the interrupt being delivered before the fence is written on 8974 and is likely the cause of the additional CP_WAIT_FOR_IDLE workaround found for a306, which would cause the CP to wait for the GPU to go idle before triggering the interrupt. Instead we can set the (undocumented) BIT(31) of the CACHE_FLUSH_TS which will cause a special CACHE_FLUSH_TS interrupt to be triggered from the GPU as the write event is processed. Add CACHE_FLUSH_TS to the IRQ masks of A3xx and A4xx and remove the workaround for A306. Suggested-by: Jordan Crouse Signed-off-by: Bjorn Andersson --- This is only tested on 8974. drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 1 + drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 1 + drivers/gpu/drm/msm/adreno/adreno_gpu.c | 18 ++---------------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c index 4baef2738178..a3a43be920d0 100644 --- a/drivers/gpu/drm/msm/adreno/a3xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a3xx_gpu.c @@ -35,6 +35,7 @@ A3XX_INT0_CP_RB_INT | \ A3XX_INT0_CP_REG_PROTECT_FAULT | \ A3XX_INT0_CP_AHB_ERROR_HALT | \ + A3XX_INT0_CACHE_FLUSH_TS | \ A3XX_INT0_UCHE_OOB_ACCESS) extern bool hang_debug; diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c index 8199a4b9f2fa..b44cd0d90621 100644 --- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c @@ -27,6 +27,7 @@ A4XX_INT0_CP_RB_INT | \ A4XX_INT0_CP_REG_PROTECT_FAULT | \ A4XX_INT0_CP_AHB_ERROR_HALT | \ + A4XX_INT0_CACHE_FLUSH_TS | \ A4XX_INT0_UCHE_OOB_ACCESS) extern bool hang_debug; diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index de63ff26a062..5806f9942514 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -293,26 +293,12 @@ void adreno_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit, OUT_RING(ring, 0x00000000); } + /* BIT(31) of CACHE_FLUSH_TS triggers CACHE_FLUSH_TS IRQ from GPU */ OUT_PKT3(ring, CP_EVENT_WRITE, 3); - OUT_RING(ring, CACHE_FLUSH_TS); + OUT_RING(ring, CACHE_FLUSH_TS | BIT(31)); OUT_RING(ring, rbmemptr(ring, fence)); OUT_RING(ring, submit->seqno); - /* we could maybe be clever and only CP_COND_EXEC the interrupt: */ - OUT_PKT3(ring, CP_INTERRUPT, 1); - OUT_RING(ring, 0x80000000); - - /* Workaround for missing irq issue on 8x16/a306. Unsure if the - * root cause is a platform issue or some a306 quirk, but this - * keeps things humming along: - */ - if (adreno_is_a306(adreno_gpu)) { - OUT_PKT3(ring, CP_WAIT_FOR_IDLE, 1); - OUT_RING(ring, 0x00000000); - OUT_PKT3(ring, CP_INTERRUPT, 1); - OUT_RING(ring, 0x80000000); - } - #if 0 if (adreno_is_a3xx(adreno_gpu)) { /* Dummy set-constant to trigger context rollover */