mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Neil Armstrong <neil.armstrong@linaro.org>
To: Connor Abbott <cwabbott0@gmail.com>
Cc: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Rob Clark <robin.clark@oss.qualcomm.com>,
	Sean Paul <sean@poorly.run>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Akhil P Oommen <akhilpo@oss.qualcomm.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/msm/a6xx: Use CX AO Counter register for timestamp on a750 GPUs
Date: Wed, 9 Sep 2026 16:29:45 +0200	[thread overview]
Message-ID: <6763c530-ffb6-4480-9a56-2594bfe8a010@linaro.org> (raw)
In-Reply-To: <CACu1E7Fs-=sKJ07Pcb_7BCTFaXLCMVGEu=yQ6+hfG3Vjc2Y_RQ@mail.gmail.com>

On 9/9/26 15:24, Connor Abbott wrote:
> On Wed, Sep 9, 2026 at 5:32 AM Neil Armstrong <neil.armstrong@linaro.org> wrote:
>>
>> On 9/9/26 11:06, Konrad Dybcio wrote:
>>> On 9/8/26 3:24 PM, Neil Armstrong wrote:
>>>> The a750 uses the CX AO Counters instead of the GMU_ALWAYS_ON_COUNTER
>>>> register on A6xx and other A7xx GPUs, use it when running a A750 GPU.
>>>>
>>>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>>>> ---
>>>>    drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 +++++++++---
>>>>    1 file changed, 9 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>> index f9de9329dee3..081e79ea4652 100644
>>>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>> @@ -23,9 +23,15 @@ static u64 a6xx_gmu_get_timestamp(struct msm_gpu *gpu)
>>>>       u64 count_hi, count_lo, temp;
>>>>
>>>>       do {
>>>> -            count_hi = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H);
>>>> -            count_lo = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L);
>>>> -            temp = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H);
>>>> +            if (adreno_is_a750_family(adreno_gpu)) {
>>>> +                    count_hi = gmu_read(&a6xx_gpu->gmu, REG_A7XX_GMU_CX_AO_COUNTER_H);
>>>> +                    count_lo = gmu_read(&a6xx_gpu->gmu, REG_A7XX_GMU_CX_AO_COUNTER_L);
>>>> +                    temp = gmu_read(&a6xx_gpu->gmu, REG_A7XX_GMU_CX_AO_COUNTER_H);
>>>
>>> KGSL apparently *writes* the system time to these registers, is that
>>> an idiosyncrasy regarding how the vendor userland drivers then use
>>> this counter?
>>
>> This is a GMU counter, no sure why & how KGSL or freedreno would write anything to it...
> 
> It is writeable. This is part of implementing
> VK_KHR_calibrated_timestamps. The idea is that when the GPU suspends
> and resumes, we keep track of how many ticks it would've taken and
> then pretend to advance the counter by writing the CX counter (after
> powering on CX but before powering on GX which initializes the normal
> GMU counter).
> 
> Note that VK_KHR_calibrated_timestamps worked initially on turnip but
> the tests started failing with v6.19. I haven't bisected yet but my
> guess is CX was never actually collapsing for whatever reason and we
> made it collapse hence breaking the tests. So we probably do need
> this.

OK thanks for the detail! Today it's only used for perfetto, but still
on A750 a different register is used for this purpose.

Neil

> 
> Connor
> 
>>
>>>
>>> Konrad
>>>
>>> P.S. looks like a8xx also has this counter
>>>
>>


  reply	other threads:[~2026-09-09 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 13:24 [PATCH 0/2] drm/msm/a6xx: use correct timestamp counter on A750 GPU Neil Armstrong
2026-09-08 13:24 ` [PATCH 1/2] drm/msm/a6xx: Add CX AO Counter registers used for a750 GPUs Neil Armstrong
2026-09-08 13:39   ` Neil Armstrong
2026-09-08 13:24 ` [PATCH 2/2] drm/msm/a6xx: Use CX AO Counter register for timestamp on " Neil Armstrong
2026-09-09  9:06   ` Konrad Dybcio
2026-09-09  9:32     ` Neil Armstrong
2026-09-09 13:24       ` Connor Abbott
2026-09-09 14:29         ` Neil Armstrong [this message]
2026-09-09 14:31           ` Connor Abbott
2026-09-09 18:31   ` Akhil P Oommen
2026-09-10  6:57     ` Neil Armstrong

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=6763c530-ffb6-4480-9a56-2594bfe8a010@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=akhilpo@oss.qualcomm.com \
    --cc=cwabbott0@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®