From patchwork Tue Aug 8 21:02:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 132946 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2439722vqr; Tue, 8 Aug 2023 15:49:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEY0nOIt7ZLQbYEahnWk5/yMtCgPurj5N4HUjzr0jtB4VbqPSgmcYl/GRRtvw+pcIn0EJZW X-Received: by 2002:aa7:c243:0:b0:522:4dd0:de6e with SMTP id y3-20020aa7c243000000b005224dd0de6emr877192edo.8.1691534984043; Tue, 08 Aug 2023 15:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691534984; cv=none; d=google.com; s=arc-20160816; b=vDxGm1Xf9icDi2F7Zl/TDtufm5V5SdYHMwBUfAp+qQDlp4IglDUb61Qs7T1HvFgWSf Gg1Zmlou7bIAWEhF/V+y5fXtrOfiqTUwMG1XQuy79HAXEkTb9T4k5upjoiP7Xeoq8IRD dm/bnq84XDOKJJK+NXF+PDKSmQUr/GzAHrkLhkBeM/CcJ4bDI556LLxTGuKQiWeKQyWj vt+ObKj0pIp65z9zl+qsLMS3bbIPvWKl2G610NucsyfvL/52EFAoFAz1td2PxHLxYMnE tCWBKgn0N5XHTWzmtpLxtZl43xxlSA6TwPpiJ5uVAcGlV33hx7tGXiy3sypjoytdt7xy Mf1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QHqFXZ6x0OPm4ZMw7WQeV7WZNp4cmRIh/Av5DgwSNhQ=; fh=3hwGaXu58rAZWOfog+OLn7auuhW/vtrcTPHDYtQJhEw=; b=nh5g9JLR/VO24BJ7UbY9bEvkmNZCqKRPnuwl4WMwMDAE+DBdu71aGoBWfquGrsei6W 2E4ZfkYwympf5g/EjYD6oYqKFGfIE8EzVRC42eE3Lcqg6c5mGJj2gZXDd96WiwgkchNs Pw8y1Hwzs38tLQxM4aASETtnc9f6yWAzT803lki4+eVHa41gAs5eeVmFH+uwiTuiZEyN IqozUgvpg1P0tuAL4/D4ndXJ7fOVKEGi0CZsspREk9jDhZPK0/1iHl/9Qtn022BsALea ZHZRkhJ81h9p9KgfC5390yrn7wozXBYQTUvWkeHIMMcLc3hX8wmN0sIC0GjFJQ1nXYbw EIKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GQUbyw4e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r23-20020aa7d597000000b005234f81bc79si378936edq.522.2023.08.08.15.49.20; Tue, 08 Aug 2023 15:49:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GQUbyw4e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235745AbjHHVEg (ORCPT + 99 others); Tue, 8 Aug 2023 17:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234998AbjHHVEN (ORCPT ); Tue, 8 Aug 2023 17:04:13 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 053476A69 for ; Tue, 8 Aug 2023 14:03:21 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4fe655796faso4960740e87.2 for ; Tue, 08 Aug 2023 14:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691528597; x=1692133397; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=QHqFXZ6x0OPm4ZMw7WQeV7WZNp4cmRIh/Av5DgwSNhQ=; b=GQUbyw4eRYjKwQkU5ZMU/yeNnQVDHGDQdMvp/qWJGIY57WAbwVGFi3beDujQ6DoFkD deiVVsvTtEZZT6uz3lACeVQkh5886v4aLsOAyuUfgqCdxir+SLFu3rEcv/obMnTgAxV6 yeT6l1GhG/sudeo/uTTdKZ6jai9Xn4aKc26RgdSxgq++VhsSyRGJvplJDSb6NoUkD/GT n7gasiqw7oDvjknFzGddWUp60RVM3W+FruMhz6u1/NVVghH+5FQtkH0QLVLDIku2uxVB KXS6GSjqoyok0rp9k5ki1PYoDqyKfqxCOF6v9cL4guXjzVK7F5scYE3AT77rYIwvzera R0dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691528597; x=1692133397; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QHqFXZ6x0OPm4ZMw7WQeV7WZNp4cmRIh/Av5DgwSNhQ=; b=GbUGAMj0IU0t2Ih/SUl4Gsf9VdEOSTtKk6Dh9+Ha2kTtAZ3d8J1TFoJoGkyblpwKlH 6qWFmPAegUxJj2hCWYVqMkYnFT13gXYzSQw2CyfmGxNiLhOZ6EXaiqO01KAhqErUWSA2 57q3hDhXnI8kWObMWv5ZlkWXcjuIB7Kuxa0iNXZNbAfDe9mAwGB/XLDjR/AGnM2Ve/+A scpCDj7Nyiv33DAajFPFHMaHJa3932OIQZ871LV7naqZfE5Mjbj0kxSczodK/s/vl48O QaDs84C6UepicHr7xHweKr6hWvGSlxQ/lf6k92Gv0ZqChQ2tl8tdm+1+6BQ6r8WNOST6 c6vQ== X-Gm-Message-State: AOJu0YzHrToIMNDd6TYgmXpWpRwfnB7zdRUAL1I271e/HlfcHZPcW50U X+8Yd7nLsh/O/PqQDIrIgjAMuQ== X-Received: by 2002:a2e:9d54:0:b0:2b9:dfd1:3808 with SMTP id y20-20020a2e9d54000000b002b9dfd13808mr460068ljj.25.1691528597563; Tue, 08 Aug 2023 14:03:17 -0700 (PDT) Received: from [192.168.1.101] (abxi185.neoplus.adsl.tpnet.pl. [83.9.2.185]) by smtp.gmail.com with ESMTPSA id h11-20020a2eb0eb000000b002b6cc17add3sm2431483ljl.25.2023.08.08.14.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Aug 2023 14:03:17 -0700 (PDT) From: Konrad Dybcio Date: Tue, 08 Aug 2023 23:02:52 +0200 Subject: [PATCH v2 14/14] drm/msm/a6xx: Poll for GBIF unhalt status in hw_init MIME-Version: 1.0 Message-Id: <20230628-topic-a7xx_drmmsm-v2-14-1439e1b2343f@linaro.org> References: <20230628-topic-a7xx_drmmsm-v2-0-1439e1b2343f@linaro.org> In-Reply-To: <20230628-topic-a7xx_drmmsm-v2-0-1439e1b2343f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Neil Armstrong X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1691528566; l=1394; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=adxhdr38vQ+H8w1ud+VW4JLIkAtv3z4AL0XqkuOgPHs=; b=XQDGBxuHYfbbYepOx78RUkDMexkbi9oIwe5G+gOBDPTNfeODBiBmltLstJo8wG7FOZvlbmixK dJY8My1JyIxAjexcNUki8A3SAwf+Ej9E7lDVtfvwQXhZtaZ6C1DidhH X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773702987266744173 X-GMAIL-MSGID: 1773702987266744173 Some GPUs - particularly A7xx ones - are really really stubborn and sometimes take a longer-than-expected time to finish unhalting GBIF. Note that this is not caused by the request a few lines above. Poll for the unhalt ack to make sure we're not trying to write bits to an essentially dead GPU that can't receive data on its end of the bus. Failing to do this will result in inexplicable GMU timeouts or worse. This is a rather ugly hack which introduces a whole lot of latency. Tested-by: Neil Armstrong # on SM8550-QRD Tested-by: Dmitry Baryshkov # sm8450 Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 2313620084b6..11cb410e0ac7 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1629,6 +1629,10 @@ static int hw_init(struct msm_gpu *gpu) mb(); } + /* Some GPUs are stubborn and take their sweet time to unhalt GBIF! */ + if (adreno_is_a7xx(adreno_gpu) && a6xx_has_gbif(adreno_gpu)) + spin_until(!gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK)); + gpu_write(gpu, REG_A6XX_RBBM_SECVID_TSB_CNTL, 0); if (adreno_is_a619_holi(adreno_gpu))