From patchwork Thu Feb 23 10:52:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 60902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp247675wrd; Thu, 23 Feb 2023 02:57:52 -0800 (PST) X-Google-Smtp-Source: AK7set/mR7vG28JHm4u9b/xNvwzj05U1f/qdHG1kvaLT4I6K9iLjVcDBkaGIouRCZejhlSOPQHoL X-Received: by 2002:a17:906:51ca:b0:8eb:fb1a:6970 with SMTP id v10-20020a17090651ca00b008ebfb1a6970mr3035734ejk.1.1677149872096; Thu, 23 Feb 2023 02:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677149872; cv=none; d=google.com; s=arc-20160816; b=v4DV2Ox+LtscWUcnRdo+orMsphD0SRqR6PDQypGBVldXjf7798786ScOXG+wbgIc8d 74NRYAfMw7ZaPVSlzs7J+2E0TUQ/rwiWHbDP3RKYZKJvApgokrF57jsdtCTc4aOP7eio NJHuwbDVD0xMl7wi8WtDPMTpscMbJzzMT+U691jJOGHKO9FQdTgO3b8zdbNGlTrKM/uN pCRf/NsZRaPXrhDxTeDIFrBqJ57ieajWjx3VdWWX5qJRiw+1dSl7zTmlu6QbeM+E4xTq 81fILKmCE/wBBTB9oT8HoACBR3+n2vLW0Mk8g4DKx79fU2reOqDkd0JTxRjy1H56PCqJ qelw== 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=GGhJ8k8BvYcG4UvdUcw3fi971zbE82bjXqWQD3F+nXY=; b=qVFHtgLrl5MmQ+aeBvaCpMzowYj3yVJvWcUNuEgZ1U/UVObHuSe/pH5vL531vlhw4j tKrjdNVAHs6wlOugjh3eAA9UE5dE7DwkeoEN01QCtokRN1EPAyIk1vE/vv7+LRWGkG0J oXfy1q5XeQnSr8wacENeli80eoTMLdbaUjUZevBs5ZmW8bjYt4kqELHx1QQZMKYFDmUz yIHM45Ksn9sUmFFdK7tkM5cPiySwDPTPKaP6EFHhp+S9s1Jg8wnpo1kgf2r8pBwCKVxk b/wiHE3ym6EhZAWcCgO3ESood99O2Ms+2C0VzNTBVBpvRDOBoKOxQhVj08gDLr0wHQP8 JJdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nwnpdMI6; 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 y17-20020a170906519100b008e6279ea507si6125090ejk.321.2023.02.23.02.57.29; Thu, 23 Feb 2023 02:57:52 -0800 (PST) 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=nwnpdMI6; 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 S233844AbjBWKw3 (ORCPT + 99 others); Thu, 23 Feb 2023 05:52:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233005AbjBWKwS (ORCPT ); Thu, 23 Feb 2023 05:52:18 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF7EE72E55 for ; Thu, 23 Feb 2023 02:52:11 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id n2so9999116lfb.12 for ; Thu, 23 Feb 2023 02:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=GGhJ8k8BvYcG4UvdUcw3fi971zbE82bjXqWQD3F+nXY=; b=nwnpdMI6fiACcnT6sDMZQnAaSHlzmaHJezhHhQQ2bSHQ4B4nl5tbH6A2q3diS3eX/m oG1jc6/dNoQHwRXZw0DrEoB0m4SAFkNi7i8gxOoyMKFs48ccXDkGqWjMY2xGxB8ifX5t B6iYN9uQKAzTk9XnEhjkO+lNnCUN93bTZChJ8C7iRl/LQ4O8cLRdYVZf1EK4bNBsG0r/ uR1TapxsbvlbBPaZD3CFeZWeIOJS6UqAH8A46G8oR/07ZrKAX3fxJRuj36RH3IG1kAme FyV3JUTbVVAhBECLWUIt5xKVpMSSY9EV57xo0g19GpFRJi6QGZ7VUbONhKiI9+stFIct Zy7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GGhJ8k8BvYcG4UvdUcw3fi971zbE82bjXqWQD3F+nXY=; b=Oxk6WQm/fSOrqfeu9pb3+23HmCo7GwEwLsPpYWUY0z7tMs5vAOOSs+0yJ5erKqCglU Q9EgJzePnxmu0FK8OfYIw7hCTPCLR9kZXPz7JWvpZ2b5ZYHjkQ39/kwkN5xyOIOdks8m Q98vZJniaHpaA6UGyFdC4dewgC1t7Ei1ug+HtjWumXXkWAjtdnO4h06AWgB/xuwISdAg oUG6kR6siMmy54wbYQIl8GcbEyS0oDlBSxNdXF1FZwoekOloip4bv208S7NHgiwjC3w+ TuhWKEqgTpOoiP3QSgV07BrmKZ9ksKxYcT9amHuVnVLw4OKHWPgPn3oN23rp1X2oDF9G cg9w== X-Gm-Message-State: AO0yUKUFFgvb8FlQuvpgRYyeADOtGpPk5LScGTstTxv/Ebbwed9Ex8zv UXI387xfFR/xAhJeKmKFMb5I3A== X-Received: by 2002:ac2:5ddc:0:b0:4b5:b7c3:8053 with SMTP id x28-20020ac25ddc000000b004b5b7c38053mr3513220lfq.42.1677149531482; Thu, 23 Feb 2023 02:52:11 -0800 (PST) Received: from [192.168.1.101] (abxi151.neoplus.adsl.tpnet.pl. [83.9.2.151]) by smtp.gmail.com with ESMTPSA id m25-20020ac24ad9000000b004cf07a0051csm262304lfp.228.2023.02.23.02.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 02:52:11 -0800 (PST) From: Konrad Dybcio Date: Thu, 23 Feb 2023 11:52:02 +0100 Subject: [PATCH v3 6/7] drm/msm/a4xx: Implement .gpu_busy MIME-Version: 1.0 Message-Id: <20230223-topic-opp-v3-6-5f22163cd1df@linaro.org> References: <20230223-topic-opp-v3-0-5f22163cd1df@linaro.org> In-Reply-To: <20230223-topic-opp-v3-0-5f22163cd1df@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1677149522; l=1379; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=Mfqjq6oPzn0mWycAv8UA9lcR+KDEDYvYmMvB7YZF6m4=; b=v+TXzHtZ4KeibeJvtAtSVkVKGunOe6Iu1g5H+gnK2w1JBEKFvxZTmXGxVramXBPr/Tj8NsK8Bi9k LEPBJc3jCmmBpymLrHmo0iWWUGGZz0RaGGJMjVYruwZq+Rrbi8gn 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 autolearn=ham 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?1758619104257880848?= X-GMAIL-MSGID: =?utf-8?q?1758619104257880848?= Add support for gpu_busy on a4xx, which is required for devfreq support. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c index 3e09d3a7a0ac..715436cb3996 100644 --- a/drivers/gpu/drm/msm/adreno/a4xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c @@ -611,6 +611,16 @@ static int a4xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) return 0; } +static u64 a4xx_gpu_busy(struct msm_gpu *gpu, unsigned long *out_sample_rate) +{ + u64 busy_cycles; + + busy_cycles = gpu_read64(gpu, REG_A4XX_RBBM_PERFCTR_RBBM_1_LO); + *out_sample_rate = clk_get_rate(gpu->core_clk); + + return busy_cycles; +} + static u32 a4xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring) { ring->memptrs->rptr = gpu_read(gpu, REG_A4XX_CP_RB_RPTR); @@ -632,6 +642,7 @@ static const struct adreno_gpu_funcs funcs = { #if defined(CONFIG_DEBUG_FS) || defined(CONFIG_DEV_COREDUMP) .show = adreno_show, #endif + .gpu_busy = a4xx_gpu_busy, .gpu_state_get = a4xx_gpu_state_get, .gpu_state_put = adreno_gpu_state_put, .create_address_space = adreno_create_address_space,