dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Akhil P Oommen <akhilpo@oss.qualcomm.com>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Rob Clark <robin.clark@oss.qualcomm.com>,
	Sean Paul <sean@poorly.run>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jessica.zhang@oss.qualcomm.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 07/17] drm/msm/adreno: Add fenced regwrite support
Date: Tue, 29 Jul 2025 15:01:43 +0200	[thread overview]
Message-ID: <9e48ea8e-b59b-4620-9781-211cc1f7cc07@oss.qualcomm.com> (raw)
In-Reply-To: <3f58451a-9b5f-4697-9679-d549104e8312@oss.qualcomm.com>

On 7/24/25 6:54 PM, Akhil P Oommen wrote:
> On 7/24/2025 5:16 PM, Konrad Dybcio wrote:
>> On 7/23/25 11:06 PM, Akhil P Oommen wrote:
>>> On 7/22/2025 8:22 PM, Konrad Dybcio wrote:
>>>> On 7/22/25 3:39 PM, Dmitry Baryshkov wrote:
>>>>> On Sun, Jul 20, 2025 at 05:46:08PM +0530, Akhil P Oommen wrote:
>>>>>> There are some special registers which are accessible even when GX power
>>>>>> domain is collapsed during an IFPC sleep. Accessing these registers
>>>>>> wakes up GPU from power collapse and allow programming these registers
>>>>>> without additional handshake with GMU. This patch adds support for this
>>>>>> special register write sequence.
>>>>>>
>>>>>> Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
>>>>>> ---
>>>>>>  drivers/gpu/drm/msm/adreno/a6xx_gpu.c     | 63 ++++++++++++++++++++++++++++++-
>>>>>>  drivers/gpu/drm/msm/adreno/a6xx_gpu.h     |  1 +
>>>>>>  drivers/gpu/drm/msm/adreno/a6xx_preempt.c | 20 +++++-----
>>>>>>  3 files changed, 73 insertions(+), 11 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>>>> index 491fde0083a202bec7c6b3bca88d0e5a717a6560..8c004fc3abd2896d467a9728b34e99e4ed944dc4 100644
>>>>>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>>>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
>>>>>> @@ -16,6 +16,67 @@
>>>>>>  
>>>>>>  #define GPU_PAS_ID 13
>>>>>>  
>>>>>> +static bool fence_status_check(struct msm_gpu *gpu, u32 offset, u32 value, u32 status, u32 mask)
>>>>>> +{
>>>>>> +	/* Success if !writedropped0/1 */
>>>>>> +	if (!(status & mask))
>>>>>> +		return true;
>>>>>> +
>>>>>> +	udelay(10);
>>>>>
>>>>> Why do we need udelay() here? Why can't we use interval setting inside
>>>>> gmu_poll_timeout()?
>>>>
>>>> Similarly here:
>>>>
>>>> [...]
>>>>
>>>>>> +	if (!gmu_poll_timeout(gmu, REG_A6XX_GMU_AHB_FENCE_STATUS, status,
>>>>>> +			fence_status_check(gpu, offset, value, status, mask), 0, 1000))
>>>>>> +		return 0;
>>>>>> +
>>>>>> +	dev_err_ratelimited(gmu->dev, "delay in fenced register write (0x%x)\n",
>>>>>> +			offset);
>>>>>> +
>>>>>> +	/* Try again for another 1ms before failing */
>>>>>> +	gpu_write(gpu, offset, value);
>>>>>> +	if (!gmu_poll_timeout(gmu, REG_A6XX_GMU_AHB_FENCE_STATUS, status,
>>>>>> +			fence_status_check(gpu, offset, value, status, mask), 0, 1000))
>>>>>> +		return 0;
>>>>>> +
>>>>>> +	dev_err_ratelimited(gmu->dev, "fenced register write (0x%x) fail\n",
>>>>>> +			offset);
>>>>
>>>> We may want to combine the two, so as not to worry the user too much..
>>>>
>>>> If it's going to fail, I would assume it's going to fail both checks
>>>> (unless e.g. the bus is so congested a single write can't go through
>>>> to a sleepy GPU across 2 miliseconds, but that's another issue)
>>>
>>> In case of success, we cannot be sure if the first write went through.
>>> So we should poll separately.
>>
>> You're writing to it 2 (outside fence_status_check) + 2*1000/10 (inside)
>> == 202 times, it really better go through..
> 
> For the following sequence:
> 1. write reg1 <- suppose this is dropped
> 2. write reg2 <- and this went through
> 3. Check fence status <- This will show success

What I'm saying is that fence_status_check() does the same write you
execute inbetween the polling calls

Konrad
> 
>>
>> If it's just about the write reaching the GPU, you can write it once and
>> read back the register you've written to, this way you're sure that the
>> GPU can observe the write
> 
> This is a very unique hw behavior. We can't do posted write.
> 
> -Akhil
> 
>>
>> Konrad
> 

  reply	other threads:[~2025-07-29 13:01 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-20 12:16 [PATCH 00/17] drm/msm: Support for Inter Frame Power Collapse (IFPC) feature Akhil P Oommen
2025-07-20 12:16 ` [PATCH 01/17] drm/msm: Update GMU register xml Akhil P Oommen
2025-07-20 12:16 ` [PATCH 02/17] drm/msm: a6xx: Refactor a6xx_sptprac_enable() Akhil P Oommen
2025-07-22 14:30   ` Konrad Dybcio
2025-07-22 19:47     ` Akhil P Oommen
2025-07-23 10:13       ` Konrad Dybcio
2025-07-23 19:10         ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 03/17] drm/msm: a6xx: Fix gx_is_on check for a7x family Akhil P Oommen
2025-07-20 18:46   ` Dmitry Baryshkov
2025-07-22 14:33   ` Konrad Dybcio
2025-07-22 19:52     ` Akhil P Oommen
2025-07-23 11:10       ` Dmitry Baryshkov
2025-07-23 19:11         ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 04/17] drm/msm/a6xx: Poll additional DRV status Akhil P Oommen
2025-07-22 13:31   ` Dmitry Baryshkov
2025-07-22 19:55     ` Akhil P Oommen
2025-07-23 10:01   ` Konrad Dybcio
2025-07-23 19:28     ` Akhil P Oommen
2025-07-24 11:39       ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 05/17] drm/msm/a6xx: Fix PDC sleep sequence Akhil P Oommen
2025-07-22 13:33   ` Dmitry Baryshkov
2025-07-22 17:26     ` Rob Clark
2025-07-22 21:05       ` Akhil P Oommen
2025-07-23 11:11         ` Dmitry Baryshkov
2025-08-07 13:51   ` Konrad Dybcio
2025-08-08 17:22     ` Akhil P Oommen
2025-08-11  8:40       ` Konrad Dybcio
2025-08-13 21:15         ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 06/17] drm/msm: Add an ftrace for gpu register access Akhil P Oommen
2025-07-20 12:16 ` [PATCH 07/17] drm/msm/adreno: Add fenced regwrite support Akhil P Oommen
2025-07-22 13:39   ` Dmitry Baryshkov
2025-07-22 14:52     ` Konrad Dybcio
2025-07-23 21:06       ` Akhil P Oommen
2025-07-24 11:46         ` Konrad Dybcio
2025-07-24 16:54           ` Akhil P Oommen
2025-07-29 13:01             ` Konrad Dybcio [this message]
2025-07-29 21:40               ` Akhil P Oommen
2025-07-29 21:49                 ` Akhil P Oommen
2025-07-30  7:49                   ` Konrad Dybcio
2025-07-23 21:04     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 08/17] drm/msm/a6xx: Set Keep-alive votes to block IFPC Akhil P Oommen
2025-07-22 13:44   ` Dmitry Baryshkov
2025-07-22 21:24     ` Akhil P Oommen
2025-07-23 10:05       ` Konrad Dybcio
2025-07-23 21:22         ` Akhil P Oommen
2025-07-23 21:53           ` Dmitry Baryshkov
2025-07-23 11:13       ` Dmitry Baryshkov
2025-07-20 12:16 ` [PATCH 09/17] drm/msm/a6xx: Switch to GMU AO counter Akhil P Oommen
2025-07-23 10:19   ` Konrad Dybcio
2025-07-23 12:15     ` Rob Clark
2025-07-29 13:30       ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 10/17] drm/msm/a6xx: Poll AHB fence status in GPU IRQ handler Akhil P Oommen
2025-07-23 10:10   ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 11/17] drm/msm: Add support for IFPC Akhil P Oommen
2025-07-22 13:49   ` Dmitry Baryshkov
2025-07-22 21:27     ` Akhil P Oommen
2025-07-23 10:27       ` Konrad Dybcio
2025-07-23 21:43         ` Akhil P Oommen
2025-07-23 10:22   ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 12/17] drm/msm: Skip devfreq IDLE when possible Akhil P Oommen
2025-07-21  4:00   ` kernel test robot
2025-07-22 13:50   ` Dmitry Baryshkov
2025-07-22 15:38     ` Rob Clark
2025-07-22 19:23       ` Akhil P Oommen
2025-07-22 20:13         ` Rob Clark
2025-07-23 21:46           ` Akhil P Oommen
2025-07-23 10:28   ` Konrad Dybcio
2025-07-20 12:16 ` [PATCH 13/17] drm/msm/a6xx: Fix hangcheck for IFPC Akhil P Oommen
2025-07-22 13:52   ` Dmitry Baryshkov
2025-07-22 21:33     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 14/17] drm/msm/adreno: Disable IFPC when sysprof is active Akhil P Oommen
2025-07-20 12:16 ` [PATCH 15/17] drm/msm/a6xx: Make crashstate capture IFPC safe Akhil P Oommen
2025-07-23 10:32   ` Konrad Dybcio
2025-07-23 21:53     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 16/17] drm/msm/a6xx: Enable IFPC on Adreno X1-85 Akhil P Oommen
2025-07-22 13:55   ` Dmitry Baryshkov
2025-07-22 21:37     ` Akhil P Oommen
2025-07-23 10:33       ` Konrad Dybcio
2025-07-23 21:57         ` Akhil P Oommen
2025-07-22 14:55   ` Konrad Dybcio
2025-07-22 21:41     ` Akhil P Oommen
2025-07-29 14:06   ` neil.armstrong
2025-07-29 18:19     ` Akhil P Oommen
2025-07-20 12:16 ` [PATCH 17/17] drm/msm/adreno: Relax devfreq tunings Akhil P Oommen
2025-07-27  0:49   ` Anthony Ruhier

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=9e48ea8e-b59b-4620-9781-211cc1f7cc07@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=akhilpo@oss.qualcomm.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jessica.zhang@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;
as well as URLs for NNTP newsgroup(s).