All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Rob Clark <robdclark@gmail.com>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Sean Paul <sean@poorly.run>, David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Konrad Dybcio <konrad.dybcio@linaro.org>
Subject: [PATCH 4/5] drm/msm/a4xx: Implement .gpu_busy
Date: Wed, 22 Feb 2023 22:47:13 +0100	[thread overview]
Message-ID: <20230222-konrad-longbois-next-v1-4-01021425781b@linaro.org> (raw)
In-Reply-To: <20230222-konrad-longbois-next-v1-0-01021425781b@linaro.org>

Add support for gpu_busy on a4xx, which is required for devfreq
support.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 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,

-- 
2.39.2


WARNING: multiple messages have this Message-ID (diff)
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Rob Clark <robdclark@gmail.com>,
	 Abhinav Kumar <quic_abhinavk@quicinc.com>,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Sean Paul <sean@poorly.run>,  David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel@ffwll.ch>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>,
	linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 4/5] drm/msm/a4xx: Implement .gpu_busy
Date: Wed, 22 Feb 2023 22:47:13 +0100	[thread overview]
Message-ID: <20230222-konrad-longbois-next-v1-4-01021425781b@linaro.org> (raw)
In-Reply-To: <20230222-konrad-longbois-next-v1-0-01021425781b@linaro.org>

Add support for gpu_busy on a4xx, which is required for devfreq
support.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 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,

-- 
2.39.2


  parent reply	other threads:[~2023-02-22 21:47 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-22 21:47 [PATCH 0/5] OPP and devfreq for all Adrenos Konrad Dybcio
2023-02-22 21:47 ` Konrad Dybcio
2023-02-22 21:47 ` [PATCH 1/5] drm/msm/adreno: Use OPP for every GPU generation Konrad Dybcio
2023-02-22 21:47   ` Konrad Dybcio
2023-02-22 22:38   ` Dmitry Baryshkov
2023-02-22 22:38     ` Dmitry Baryshkov
2023-02-22 22:40     ` Konrad Dybcio
2023-02-22 22:40       ` Konrad Dybcio
2023-02-22 23:16       ` Dmitry Baryshkov
2023-02-22 23:16         ` Dmitry Baryshkov
2023-02-23  1:02         ` Konrad Dybcio
2023-02-23  1:02           ` Konrad Dybcio
2023-02-22 21:47 ` [PATCH 2/5] drm/msm/a2xx: Implement .gpu_busy Konrad Dybcio
2023-02-22 21:47   ` Konrad Dybcio
2023-02-22 22:24   ` Dmitry Baryshkov
2023-02-22 22:24     ` Dmitry Baryshkov
2023-02-22 21:47 ` [PATCH 3/5] drm/msm/a3xx: " Konrad Dybcio
2023-02-22 21:47   ` Konrad Dybcio
2023-02-22 22:10   ` Dmitry Baryshkov
2023-02-22 22:10     ` Dmitry Baryshkov
2023-02-22 21:47 ` Konrad Dybcio [this message]
2023-02-22 21:47   ` [PATCH 4/5] drm/msm/a4xx: " Konrad Dybcio
2023-02-22 22:22   ` Dmitry Baryshkov
2023-02-22 22:22     ` Dmitry Baryshkov
2023-02-22 21:47 ` [PATCH 5/5] drm/msm/a5xx: Enable optional icc voting from OPP tables Konrad Dybcio
2023-02-22 21:47   ` Konrad Dybcio
2023-02-22 22:12   ` Dmitry Baryshkov
2023-02-22 22:12     ` Dmitry Baryshkov
2023-02-22 22:14     ` Konrad Dybcio
2023-02-22 22:14       ` Konrad Dybcio
2023-02-22 22:22       ` Dmitry Baryshkov
2023-02-22 22:22         ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230222-konrad-longbois-next-v1-4-01021425781b@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.