From patchwork Wed Jun 28 20:35:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 114043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp9194615vqr; Wed, 28 Jun 2023 13:37:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFKCmSiYoe+cyJdISlm1ci1b528+k0rhOLT6npZoRFZUR5l9qJXVLvs2pRChGbYrPZumyn4 X-Received: by 2002:a17:90a:5a0b:b0:25c:1ad3:a4a1 with SMTP id b11-20020a17090a5a0b00b0025c1ad3a4a1mr884987pjd.1.1687984657924; Wed, 28 Jun 2023 13:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687984657; cv=none; d=google.com; s=arc-20160816; b=Lte/6GxQxQC5nmXWMcdt7cXtsJ08ddPTBCI3p0MlQXHBa4Ss/aQzP6lukjpaSkmF85 J/5IwWlVbbQm/d+e3MKoNEg+2HpwaUG9CxqVD5VEPeQByOJbgDPjt0nKJuWYav2TldT4 lMNo2V18p7AjBdaJ0Ad7zWkg/TKfnm+i8qgxKMjfF74OFRMrr9n3hh8xfOEAwkBlnloK XH+W/dv+1fJu5yE7lA27++Rsphw9y4DzW5b6Ts0x3rQPAr2vgp9Qb5bgF9YzDJb0m9fy wyTAJI+AyAKjJDYE17ufgrQvDVVxxSMjX38tOrZeBvmz5lm4f3PHH2UVvFL0sPPB3GP4 p3wQ== 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=xum1FmervGOJztlBk+C1bmHU51hjupT71OA70zaOm4M=; fh=y5CufWdCvRG/D46wPUQAs6a5TaO9Xg7IL+UXm/FDyGE=; b=jbUa7BMOJ3Zk0KmtbdJGctZe/F/QYPtQWx97gmr/L9X0tNYlFtxMmHB885ao4LUttz ZtPmL5kg0aLuQzXcYwp/eda+2Wl6qKHLX9gBihCGHbgqLt6BdwWR0hKiY4IFZ3diRQjw /PUQ476GIyIk8onx+xNjHi/WISruo1CQ6p6opZgIvsyjMuXspO7xSYAFNsbI0ur8OHEE nFLbil8vBzM3oBev7ioX1MIAmiWr9hDbIU68iIYDmmo4BkjJXd6YuuhEegUjAWHyxckY 72fBee4U9JmnuW10s0DVuAxImQCfGMtzE29+nptdwSSmCPNKpiY3JKrL9GAUI+EWYcBt pbzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l2GxzOqZ; 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 mh7-20020a17090b4ac700b00262e3c1c1efsi8078694pjb.79.2023.06.28.13.37.23; Wed, 28 Jun 2023 13:37:37 -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=l2GxzOqZ; 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 S229873AbjF1UgU (ORCPT + 99 others); Wed, 28 Jun 2023 16:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232063AbjF1Ufn (ORCPT ); Wed, 28 Jun 2023 16:35:43 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A31A91FF6 for ; Wed, 28 Jun 2023 13:35:40 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-4f76a0a19d4so85735e87.2 for ; Wed, 28 Jun 2023 13:35:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1687984539; x=1690576539; 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=xum1FmervGOJztlBk+C1bmHU51hjupT71OA70zaOm4M=; b=l2GxzOqZH5S1/wNCuTgxdNfeAJ9LkJDOKkyEkUO+wng/hiC01RHCT2NWJFs4ToYzZh OiY+ojar4DTojCwg2v/JLSwjIyvMor3nTaNZ/4B00fSTDYDFbUekjEUyM5F4s55s7gYD JEklaZmjUEQlHZzEWYFWepF0rsfzxgrPjqKgsulfBFfztClaqXhSdNm7rFkZZQlKevr6 GpLq5mxat0HJHc8OamQPVJvbnv9CBdnAeqwT1/2mT8x/8UwhTWHueg0pgWSZxfnIN59c MvrA22qb2F/Jkin7OgN+oYztdly5tdAeN7jLhGQqZFLLQXM23xqi9hXPFX01LnzHpOCr hkbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687984539; x=1690576539; 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=xum1FmervGOJztlBk+C1bmHU51hjupT71OA70zaOm4M=; b=RTQJZEc+XUh7u0sAtOXwUW07l5tGRINMv33cU3oJcvQln8By9lZxM2ANRpEWsoqJ7q ZVa1WgffQCrcwpsF6pRGyTKIif3I9Cbm7F7EyXhcVsC767lMoKdkSULJN3rIX521BgCL Yb+AX3MpWGTppe2kVbzU7hD6e+HhwxG5b3B6eaN6/uLHsOe3QMyGcV50bJMnqfCmNORG 1HvusreylLUBdtH1rnp2MXKOV/zbMANvIrIsnMJx65NNQ2Hophf+skxltmRLAOcstx/G +pcPaqURZh5H9CiHvN6QIOjl3DYmBq6DssZoGRam5rua/Whzbb2a1r+RHDAFlrvKZLym FB5Q== X-Gm-Message-State: AC+VfDySuai7PY8I6rurKqJIa+x0XNikAE8S+3ETM2IzhEzF8GQe+1qW UQ/8QCbI/04z+LlT2bsFwrRc3A== X-Received: by 2002:a05:6512:3483:b0:4fb:78a0:dd34 with SMTP id v3-20020a056512348300b004fb78a0dd34mr5568317lfr.42.1687984538874; Wed, 28 Jun 2023 13:35:38 -0700 (PDT) Received: from [192.168.1.101] (abyk82.neoplus.adsl.tpnet.pl. [83.9.30.82]) by smtp.gmail.com with ESMTPSA id m25-20020a056512015900b004fb86c89fa1sm753363lfo.135.2023.06.28.13.35.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 13:35:38 -0700 (PDT) From: Konrad Dybcio Date: Wed, 28 Jun 2023 22:35:09 +0200 Subject: [PATCH 09/14] drm/msm/a6xx: Send ACD state to QMP at GMU resume MIME-Version: 1.0 Message-Id: <20230628-topic-a7xx_drmmsm-v1-9-a7f4496e0c12@linaro.org> References: <20230628-topic-a7xx_drmmsm-v1-0-a7f4496e0c12@linaro.org> In-Reply-To: <20230628-topic-a7xx_drmmsm-v1-0-a7f4496e0c12@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley 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 X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1687984524; l=3025; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=K7btdnJ3TF737HFTzRStzC87Yz1YWN6DeQhBOZrTry0=; b=GT0khEyNUJRJIkFtvtGDd/ThAKre9KhiJr6hnM9L5HWG/YRe3lIcnRgDBv5Q8+UCLmrj7LcB4 2Csx6nJSY15DWGYaqKFBcIw9r2EioMmz3uGEjWkxuCksEeiGbDFFdpd 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_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769980200181078775?= X-GMAIL-MSGID: =?utf-8?q?1769980200181078775?= The QMP mailbox expects to be notified of the ACD (Adaptive Clock Distribution) state. Get a handle to the mailbox at probe time and poke it at GMU resume. Since we don't fully support ACD yet, hardcode the message to "val: 0" (state = disabled). Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 21 +++++++++++++++++++++ drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 6476fcc240a0..9593a4e216d6 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -974,11 +974,13 @@ static void a6xx_gmu_set_initial_bw(struct msm_gpu *gpu, struct a6xx_gmu *gmu) dev_pm_opp_put(gpu_opp); } +#define GMU_ACD_STATE_MSG_LEN 36 int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) { struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; struct msm_gpu *gpu = &adreno_gpu->base; struct a6xx_gmu *gmu = &a6xx_gpu->gmu; + char buf[GMU_ACD_STATE_MSG_LEN]; int status, ret; if (WARN(!gmu->initialized, "The GMU is not set up yet\n")) @@ -986,6 +988,18 @@ int a6xx_gmu_resume(struct a6xx_gpu *a6xx_gpu) gmu->hung = false; + /* Notify AOSS about the ACD state (unimplemented for now => disable it ) */ + if (!IS_ERR(gmu->qmp)) { + ret = snprintf(buf, sizeof(buf), + "{class: gpu, res: acd, val: %d}", + 0 /* Hardcode ACD to be disabled for now */); + WARN_ON(ret >= GMU_ACD_STATE_MSG_LEN); + + ret = qmp_send(gmu->qmp, buf, sizeof(buf)); + if (ret) + dev_err(gmu->dev, "failed to send GPU ACD state\n"); + } + /* Turn on the resources */ pm_runtime_get_sync(gmu->dev); @@ -1733,6 +1747,10 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) goto detach_cxpd; } + gmu->qmp = qmp_get(gmu->dev); + if (IS_ERR(gmu->qmp) && adreno_is_a7xx(adreno_gpu)) + return PTR_ERR(gmu->qmp); + init_completion(&gmu->pd_gate); complete_all(&gmu->pd_gate); gmu->pd_nb.notifier_call = cxpd_notifier_cb; @@ -1756,6 +1774,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) return 0; + if (!IS_ERR_OR_NULL(gmu->qmp)) + qmp_put(gmu->qmp); + detach_cxpd: dev_pm_domain_detach(gmu->cxpd, false); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h index 236f81a43caa..592b296aab22 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "msm_drv.h" #include "a6xx_hfi.h" @@ -96,6 +97,8 @@ struct a6xx_gmu { /* For power domain callback */ struct notifier_block pd_nb; struct completion pd_gate; + + struct qmp *qmp; }; static inline u32 gmu_read(struct a6xx_gmu *gmu, u32 offset)