dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Cc: rob.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 05/17] drm/msm/a6xx: Fix PDC sleep sequence
Date: Wed, 23 Jul 2025 14:11:52 +0300	[thread overview]
Message-ID: <rr6zxamm5oqebfc3zq7qzfjt327owlsjvh3todjzfzkqn6cd2b@sgsrdg7kfqa4> (raw)
In-Reply-To: <f1070069-7220-4351-845a-2929d1e65a71@oss.qualcomm.com>

On Wed, Jul 23, 2025 at 02:35:31AM +0530, Akhil P Oommen wrote:
> On 7/22/2025 10:56 PM, Rob Clark wrote:
> > On Tue, Jul 22, 2025 at 6:33 AM Dmitry Baryshkov
> > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >>
> >> On Sun, Jul 20, 2025 at 05:46:06PM +0530, Akhil P Oommen wrote:
> >>> Since the PDC resides out of the GPU subsystem and cannot be reset in
> >>> case it enters bad state, utmost care must be taken to trigger the PDC
> >>> wake/sleep routines in the correct order.
> >>>
> >>> The PDC wake sequence can be exercised only after a PDC sleep sequence.
> >>> Additionally, GMU firmware should initialize a few registers before the
> >>> KMD can trigger a PDC sleep sequence. So PDC sleep can't be done if the
> >>
> >> s/KMD/the driver/
> > 
> > IMHO for gpu things "KMD" makes sense, to differentiate between kernel
> > and user mode (UMD).. this is perhaps different from other areas where
> > there isn't a userspace component to the driver stack
> 
> Ack
> 
> > 
> > BR,
> > -R
> > 
> >>> GMU firmware has not initialized. Track these dependencies using a new
> >>> status variable and trigger PDC sleep/wake sequences appropriately.
> >>
> >> Again, it looks like there should be a Fixes tag here.
> 
> Ack. I guess it is not a bad idea to backport this one too.

Please add cc:stable to the patches that need to be backported and make
sure that all Fixes are at the start of the series.

> 
> >>
> >>>
> >>> Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
> >>> ---
> >>>  drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 30 +++++++++++++++++++-----------
> >>>  drivers/gpu/drm/msm/adreno/a6xx_gmu.h |  6 ++++++
> >>>  2 files changed, 25 insertions(+), 11 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> >>> index 3bebb6dd7059782ceca29f2efd2acee24d3fc930..4d6c70735e0892ed87d6a68d64f24bda844e5e16 100644
> >>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> >>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
> >>> @@ -279,6 +279,8 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu)
> >>>       if (ret)
> >>>               DRM_DEV_ERROR(gmu->dev, "GMU firmware initialization timed out\n");
> >>>
> >>> +     set_bit(GMU_STATUS_FW_START, &gmu->status);
> >>> +
> >>>       return ret;
> >>>  }
> >>>
> >>> @@ -528,6 +530,9 @@ static int a6xx_rpmh_start(struct a6xx_gmu *gmu)
> >>>       int ret;
> >>>       u32 val;
> >>>
> >>> +     if (!test_and_clear_bit(GMU_STATUS_PDC_SLEEP, &gmu->status))
> >>> +             return 0;
> >>> +
> >>>       gmu_write(gmu, REG_A6XX_GMU_RSCC_CONTROL_REQ, BIT(1));
> >>>
> >>>       ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_RSCC_CONTROL_ACK, val,
> >>> @@ -555,6 +560,11 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
> >>>       int ret;
> >>>       u32 val;
> >>>
> >>> +     if (test_and_clear_bit(GMU_STATUS_FW_START, &gmu->status))
> >>> +             return;
> >>> +
> >>> +     /* TODO: should we skip if IFPC is not enabled */
> >>
> >> Is this a question or a statement?
> 
> It was a reminder to myself which I forgot to revisit later. Will
> addresss this in the next revision.
> 
> -Akhil.
> 
> >>
> >>> +
> >>>       gmu_write(gmu, REG_A6XX_GMU_RSCC_CONTROL_REQ, 1);
> >>>
> >>>       ret = gmu_poll_timeout_rscc(gmu, REG_A6XX_GPU_RSCC_RSC_STATUS0_DRV0,
> >>> @@ -563,6 +573,8 @@ static void a6xx_rpmh_stop(struct a6xx_gmu *gmu)
> >>>               DRM_DEV_ERROR(gmu->dev, "Unable to power off the GPU RSC\n");
> >>>
> >>>       gmu_write(gmu, REG_A6XX_GMU_RSCC_CONTROL_REQ, 0);
> >>> +
> >>> +     set_bit(GMU_STATUS_PDC_SLEEP, &gmu->status);
> >>>  }
> >>>
> >>>  static inline void pdc_write(void __iomem *ptr, u32 offset, u32 value)
> >>> @@ -691,8 +703,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
> >>>       /* ensure no writes happen before the uCode is fully written */
> >>>       wmb();
> >>>
> >>> -     a6xx_rpmh_stop(gmu);
> >>> -
> >>>  err:
> >>>       if (!IS_ERR_OR_NULL(pdcptr))
> >>>               iounmap(pdcptr);
> >>> @@ -852,19 +862,15 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned int state)
> >>>       else
> >>>               gmu_write(gmu, REG_A6XX_GMU_GENERAL_7, 1);
> >>>
> >>> -     if (state == GMU_WARM_BOOT) {
> >>> -             ret = a6xx_rpmh_start(gmu);
> >>> -             if (ret)
> >>> -                     return ret;
> >>> -     } else {
> >>> +     ret = a6xx_rpmh_start(gmu);
> >>> +     if (ret)
> >>> +             return ret;
> >>> +
> >>> +     if (state == GMU_COLD_BOOT) {
> >>>               if (WARN(!adreno_gpu->fw[ADRENO_FW_GMU],
> >>>                       "GMU firmware is not loaded\n"))
> >>>                       return -ENOENT;
> >>>
> >>> -             ret = a6xx_rpmh_start(gmu);
> >>> -             if (ret)
> >>> -                     return ret;
> >>> -
> >>>               ret = a6xx_gmu_fw_load(gmu);
> >>>               if (ret)
> >>>                       return ret;
> >>> @@ -1046,6 +1052,8 @@ static void a6xx_gmu_force_off(struct a6xx_gmu *gmu)
> >>>
> >>>       /* Reset GPU core blocks */
> >>>       a6xx_gpu_sw_reset(gpu, true);
> >>> +
> >>> +     a6xx_rpmh_stop(gmu);
> >>>  }
> >>>
> >>>  static void a6xx_gmu_set_initial_freq(struct msm_gpu *gpu, struct a6xx_gmu *gmu)
> >>> diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
> >>> index b2d4489b40249b1916ab4a42c89e3f4bdc5c4af9..034f1b4e5a3fb9cd601bfbe6d06d64e5ace3b6e7 100644
> >>> --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
> >>> +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
> >>> @@ -117,6 +117,12 @@ struct a6xx_gmu {
> >>>
> >>>       struct qmp *qmp;
> >>>       struct a6xx_hfi_msg_bw_table *bw_table;
> >>> +
> >>> +/* To check if we can trigger sleep seq at PDC. Cleared in a6xx_rpmh_stop() */
> >>> +#define GMU_STATUS_FW_START  0
> >>> +/* To track if PDC sleep seq was done */
> >>> +#define GMU_STATUS_PDC_SLEEP 1
> >>> +     unsigned long status;
> >>>  };
> >>>
> >>>  static inline u32 gmu_read(struct a6xx_gmu *gmu, u32 offset)
> >>>
> >>> --
> >>> 2.50.1
> >>>
> >>
> >> --
> >> With best wishes
> >> Dmitry
> 

-- 
With best wishes
Dmitry

  reply	other threads:[~2025-07-23 11:11 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 [this message]
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
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=rr6zxamm5oqebfc3zq7qzfjt327owlsjvh3todjzfzkqn6cd2b@sgsrdg7kfqa4 \
    --to=dmitry.baryshkov@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=akhilpo@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=rob.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).