diff mbox series

drm/msm/adreno: Add support for Adreno 505 GPU

Message ID 20240604-a505-v1-1-82ee1c04d200@gmail.com (mailing list archive)
State Superseded
Headers show
Series drm/msm/adreno: Add support for Adreno 505 GPU | expand

Commit Message

Barnabás Czémán June 4, 2024, 12:20 a.m. UTC
From: Daniil Titov <daniilt971@gmail.com>

This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
SDM439 (650 MHz).

Signed-off-by: Daniil Titov <daniilt971@gmail.com>
Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c      | 29 +++++++++++++++++------------
 drivers/gpu/drm/msm/adreno/adreno_device.c | 17 +++++++++++++++++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h    |  5 +++++
 3 files changed, 39 insertions(+), 12 deletions(-)


---
base-commit: 861a3cb5a2a8480d361fa6708da24747d6fa72fe
change-id: 20240603-a505-e57389b61d2a

Best regards,

Comments

Konrad Dybcio June 4, 2024, 11:55 a.m. UTC | #1
On 6/4/24 02:20, Barnabás Czémán wrote:
> From: Daniil Titov <daniilt971@gmail.com>
> 
> This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
> SDM439 (650 MHz).
> 
> Signed-off-by: Daniil Titov <daniilt971@gmail.com>
> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> ---

This all looks very good, just a nit

[...]

> +		/*
> +		 * Increase inactive period to 250 to avoid bouncing
> +		 * the GDSC which appears to make it grumpy
> +		 */
> +		.inactive_period = 250,

Are you sure this is actually necessary?

Konrad
Barnabás Czémán June 4, 2024, 12:27 p.m. UTC | #2
On Tue, Jun 4, 2024 at 1:55 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
>
>
> On 6/4/24 02:20, Barnabás Czémán wrote:
> > From: Daniil Titov <daniilt971@gmail.com>
> >
> > This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
> > SDM439 (650 MHz).
> >
> > Signed-off-by: Daniil Titov <daniilt971@gmail.com>
> > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > ---
>
> This all looks very good, just a nit
>
> [...]
>
> > +             /*
> > +              * Increase inactive period to 250 to avoid bouncing
> > +              * the GDSC which appears to make it grumpy
> > +              */
> > +             .inactive_period = 250,
>
> Are you sure this is actually necessary?
Every A5XX GPU is using the same value, but i have never tried with
DRM_MSM_INACTIVE_PERIOD.

>
> Konrad
Barnabás Czémán June 4, 2024, 4:45 p.m. UTC | #3
On Tue, Jun 4, 2024 at 2:27 PM Barnabás Czémán <trabarni@gmail.com> wrote:
>
> On Tue, Jun 4, 2024 at 1:55 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
> >
> >
> >
> > On 6/4/24 02:20, Barnabás Czémán wrote:
> > > From: Daniil Titov <daniilt971@gmail.com>
> > >
> > > This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
> > > SDM439 (650 MHz).
> > >
> > > Signed-off-by: Daniil Titov <daniilt971@gmail.com>
> > > Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> > > ---
> >
> > This all looks very good, just a nit
> >
> > [...]
> >
> > > +             /*
> > > +              * Increase inactive period to 250 to avoid bouncing
> > > +              * the GDSC which appears to make it grumpy
> > > +              */
> > > +             .inactive_period = 250,
> >
> > Are you sure this is actually necessary?
> Every A5XX GPU is using the same value, but i have never tried with
> DRM_MSM_INACTIVE_PERIOD.
This was the original patch
https://lore.kernel.org/all/20180507224750.9383-1-jcrouse@codeaurora.org/
where the inactive period was increased for a530. I cannot test
suspend on msm8937 yet.
I can check on msm8953 with a506 maybe if a506 works fine with
DRM_MSM_INACTIVE_PERIOD
then a505 would be fine with it also.
>
> >
> > Konrad
Konrad Dybcio June 4, 2024, 5:06 p.m. UTC | #4
On 6/4/24 18:45, Barnabás Czémán wrote:
> On Tue, Jun 4, 2024 at 2:27 PM Barnabás Czémán <trabarni@gmail.com> wrote:
>>
>> On Tue, Jun 4, 2024 at 1:55 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>>>
>>>
>>>
>>> On 6/4/24 02:20, Barnabás Czémán wrote:
>>>> From: Daniil Titov <daniilt971@gmail.com>
>>>>
>>>> This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
>>>> SDM439 (650 MHz).
>>>>
>>>> Signed-off-by: Daniil Titov <daniilt971@gmail.com>
>>>> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
>>>> ---
>>>
>>> This all looks very good, just a nit
>>>
>>> [...]
>>>
>>>> +             /*
>>>> +              * Increase inactive period to 250 to avoid bouncing
>>>> +              * the GDSC which appears to make it grumpy
>>>> +              */
>>>> +             .inactive_period = 250,
>>>
>>> Are you sure this is actually necessary?
>> Every A5XX GPU is using the same value, but i have never tried with
>> DRM_MSM_INACTIVE_PERIOD.
> This was the original patch
> https://lore.kernel.org/all/20180507224750.9383-1-jcrouse@codeaurora.org/
> where the inactive period was increased for a530. I cannot test
> suspend on msm8937 yet.

The suspend here refers to device suspend, not system suspend. Adreno
goes into device suspend every time you stop using it, i.e. after the
rendering is done and there's no more work to do.

I suppose a good test scenario here would be to keep running and closing
kmscube in a rapid fashion and checking if the GPU starts crashing for
unknown reasons (the dmesg would denote that)

> I can check on msm8953 with a506 maybe if a506 works fine with
> DRM_MSM_INACTIVE_PERIOD
> then a505 would be fine with it also.

The more testing the merrier :)

Konrad
Barnabás Czémán June 4, 2024, 5:33 p.m. UTC | #5
On Tue, Jun 4, 2024 at 7:06 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
>
>
> On 6/4/24 18:45, Barnabás Czémán wrote:
> > On Tue, Jun 4, 2024 at 2:27 PM Barnabás Czémán <trabarni@gmail.com> wrote:
> >>
> >> On Tue, Jun 4, 2024 at 1:55 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
> >>>
> >>>
> >>>
> >>> On 6/4/24 02:20, Barnabás Czémán wrote:
> >>>> From: Daniil Titov <daniilt971@gmail.com>
> >>>>
> >>>> This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
> >>>> SDM439 (650 MHz).
> >>>>
> >>>> Signed-off-by: Daniil Titov <daniilt971@gmail.com>
> >>>> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> >>>> ---
> >>>
> >>> This all looks very good, just a nit
> >>>
> >>> [...]
> >>>
> >>>> +             /*
> >>>> +              * Increase inactive period to 250 to avoid bouncing
> >>>> +              * the GDSC which appears to make it grumpy
> >>>> +              */
> >>>> +             .inactive_period = 250,
> >>>
> >>> Are you sure this is actually necessary?
> >> Every A5XX GPU is using the same value, but i have never tried with
> >> DRM_MSM_INACTIVE_PERIOD.
> > This was the original patch
> > https://lore.kernel.org/all/20180507224750.9383-1-jcrouse@codeaurora.org/
> > where the inactive period was increased for a530. I cannot test
> > suspend on msm8937 yet.
>
> The suspend here refers to device suspend, not system suspend. Adreno
> goes into device suspend every time you stop using it, i.e. after the
> rendering is done and there's no more work to do.
>
> I suppose a good test scenario here would be to keep running and closing
> kmscube in a rapid fashion and checking if the GPU starts crashing for
> unknown reasons (the dmesg would denote that)
>
I have checked on a505 and a506 with this small script
while true; do kmscube; kill kmscube; done
none of them crashing, so i am going to change it.
> > I can check on msm8953 with a506 maybe if a506 works fine with
> > DRM_MSM_INACTIVE_PERIOD
> > then a505 would be fine with it also.
>
> The more testing the merrier :)
>
> Konrad
Konrad Dybcio June 4, 2024, 5:38 p.m. UTC | #6
On 6/4/24 19:33, Barnabás Czémán wrote:
> On Tue, Jun 4, 2024 at 7:06 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>>
>>
>>
>> On 6/4/24 18:45, Barnabás Czémán wrote:
>>> On Tue, Jun 4, 2024 at 2:27 PM Barnabás Czémán <trabarni@gmail.com> wrote:
>>>>
>>>> On Tue, Jun 4, 2024 at 1:55 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>>>>>
>>>>>
>>>>>
>>>>> On 6/4/24 02:20, Barnabás Czémán wrote:
>>>>>> From: Daniil Titov <daniilt971@gmail.com>
>>>>>>
>>>>>> This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
>>>>>> SDM439 (650 MHz).
>>>>>>
>>>>>> Signed-off-by: Daniil Titov <daniilt971@gmail.com>
>>>>>> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
>>>>>> ---
>>>>>
>>>>> This all looks very good, just a nit
>>>>>
>>>>> [...]
>>>>>
>>>>>> +             /*
>>>>>> +              * Increase inactive period to 250 to avoid bouncing
>>>>>> +              * the GDSC which appears to make it grumpy
>>>>>> +              */
>>>>>> +             .inactive_period = 250,
>>>>>
>>>>> Are you sure this is actually necessary?
>>>> Every A5XX GPU is using the same value, but i have never tried with
>>>> DRM_MSM_INACTIVE_PERIOD.
>>> This was the original patch
>>> https://lore.kernel.org/all/20180507224750.9383-1-jcrouse@codeaurora.org/
>>> where the inactive period was increased for a530. I cannot test
>>> suspend on msm8937 yet.
>>
>> The suspend here refers to device suspend, not system suspend. Adreno
>> goes into device suspend every time you stop using it, i.e. after the
>> rendering is done and there's no more work to do.
>>
>> I suppose a good test scenario here would be to keep running and closing
>> kmscube in a rapid fashion and checking if the GPU starts crashing for
>> unknown reasons (the dmesg would denote that)
>>
> I have checked on a505 and a506 with this small script
> while true; do kmscube; kill kmscube; done
> none of them crashing, so i am going to change it.

Hmm.. not sure if it actually idled when tested in a tight loop.. If you're
running bash, try "while true; do kmscube &; sleep 0.08; pkill -f kmscube; sleep 0.08;done"

Konrad
Barnabás Czémán June 4, 2024, 5:45 p.m. UTC | #7
On Tue, Jun 4, 2024 at 7:38 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
>
>
> On 6/4/24 19:33, Barnabás Czémán wrote:
> > On Tue, Jun 4, 2024 at 7:06 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
> >>
> >>
> >>
> >> On 6/4/24 18:45, Barnabás Czémán wrote:
> >>> On Tue, Jun 4, 2024 at 2:27 PM Barnabás Czémán <trabarni@gmail.com> wrote:
> >>>>
> >>>> On Tue, Jun 4, 2024 at 1:55 PM Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>> On 6/4/24 02:20, Barnabás Czémán wrote:
> >>>>>> From: Daniil Titov <daniilt971@gmail.com>
> >>>>>>
> >>>>>> This GPU is found on SoCs such as MSM8937 (450 MHz), MSM8940 (475 MHz),
> >>>>>> SDM439 (650 MHz).
> >>>>>>
> >>>>>> Signed-off-by: Daniil Titov <daniilt971@gmail.com>
> >>>>>> Signed-off-by: Barnabás Czémán <trabarni@gmail.com>
> >>>>>> ---
> >>>>>
> >>>>> This all looks very good, just a nit
> >>>>>
> >>>>> [...]
> >>>>>
> >>>>>> +             /*
> >>>>>> +              * Increase inactive period to 250 to avoid bouncing
> >>>>>> +              * the GDSC which appears to make it grumpy
> >>>>>> +              */
> >>>>>> +             .inactive_period = 250,
> >>>>>
> >>>>> Are you sure this is actually necessary?
> >>>> Every A5XX GPU is using the same value, but i have never tried with
> >>>> DRM_MSM_INACTIVE_PERIOD.
> >>> This was the original patch
> >>> https://lore.kernel.org/all/20180507224750.9383-1-jcrouse@codeaurora.org/
> >>> where the inactive period was increased for a530. I cannot test
> >>> suspend on msm8937 yet.
> >>
> >> The suspend here refers to device suspend, not system suspend. Adreno
> >> goes into device suspend every time you stop using it, i.e. after the
> >> rendering is done and there's no more work to do.
> >>
> >> I suppose a good test scenario here would be to keep running and closing
> >> kmscube in a rapid fashion and checking if the GPU starts crashing for
> >> unknown reasons (the dmesg would denote that)
> >>
> > I have checked on a505 and a506 with this small script
> > while true; do kmscube; kill kmscube; done
> > none of them crashing, so i am going to change it.
>
> Hmm.. not sure if it actually idled when tested in a tight loop.. If you're
> running bash, try "while true; do kmscube &; sleep 0.08; pkill -f kmscube; sleep 0.08;done"
>
I see no crash
> Konrad
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index c003f970189b..c0b5373e90d7 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -439,7 +439,8 @@  void a5xx_set_hwcg(struct msm_gpu *gpu, bool state)
 	const struct adreno_five_hwcg_regs *regs;
 	unsigned int i, sz;
 
-	if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu)) {
+	if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+	    adreno_is_a508(adreno_gpu)) {
 		regs = a50x_hwcg;
 		sz = ARRAY_SIZE(a50x_hwcg);
 	} else if (adreno_is_a509(adreno_gpu) || adreno_is_a512(adreno_gpu)) {
@@ -483,7 +484,8 @@  static int a5xx_me_init(struct msm_gpu *gpu)
 	OUT_RING(ring, 0x00000000);
 
 	/* Specify workarounds for various microcode issues */
-	if (adreno_is_a506(adreno_gpu) || adreno_is_a530(adreno_gpu)) {
+	if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+	    adreno_is_a530(adreno_gpu)) {
 		/* Workaround for token end syncs
 		 * Force a WFI after every direct-render 3D mode draw and every
 		 * 2D mode 3 draw
@@ -752,10 +754,11 @@  static int a5xx_hw_init(struct msm_gpu *gpu)
 		0x00100000 + adreno_gpu->info->gmem - 1);
 	gpu_write(gpu, REG_A5XX_UCHE_GMEM_RANGE_MAX_HI, 0x00000000);
 
-	if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu) ||
-	    adreno_is_a510(adreno_gpu)) {
+	if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+	    adreno_is_a508(adreno_gpu) || adreno_is_a510(adreno_gpu)) {
 		gpu_write(gpu, REG_A5XX_CP_MEQ_THRESHOLDS, 0x20);
-		if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu))
+		if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+			adreno_is_a508(adreno_gpu))
 			gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x400);
 		else
 			gpu_write(gpu, REG_A5XX_CP_MERCIU_SIZE, 0x20);
@@ -771,7 +774,8 @@  static int a5xx_hw_init(struct msm_gpu *gpu)
 		gpu_write(gpu, REG_A5XX_CP_ROQ_THRESHOLDS_1, 0x40201B16);
 	}
 
-	if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu))
+	if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+	    adreno_is_a508(adreno_gpu))
 		gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL,
 			  (0x100 << 11 | 0x100 << 22));
 	else if (adreno_is_a509(adreno_gpu) || adreno_is_a510(adreno_gpu) ||
@@ -789,8 +793,9 @@  static int a5xx_hw_init(struct msm_gpu *gpu)
 	 * Disable the RB sampler datapath DP2 clock gating optimization
 	 * for 1-SP GPUs, as it is enabled by default.
 	 */
-	if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu) ||
-	    adreno_is_a509(adreno_gpu) || adreno_is_a512(adreno_gpu))
+	if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+	    adreno_is_a508(adreno_gpu) || adreno_is_a509(adreno_gpu) ||
+	    adreno_is_a512(adreno_gpu))
 		gpu_rmw(gpu, REG_A5XX_RB_DBG_ECO_CNTL, 0, (1 << 9));
 
 	/* Disable UCHE global filter as SP can invalidate/flush independently */
@@ -1345,7 +1350,7 @@  static int a5xx_pm_resume(struct msm_gpu *gpu)
 	if (ret)
 		return ret;
 
-	/* Adreno 506, 508, 509, 510, 512 needs manual RBBM sus/res control */
+	/* Adreno 505, 506, 508, 509, 510, 512 needs manual RBBM sus/res control */
 	if (!(adreno_is_a530(adreno_gpu) || adreno_is_a540(adreno_gpu))) {
 		/* Halt the sp_input_clk at HM level */
 		gpu_write(gpu, REG_A5XX_RBBM_CLOCK_CNTL, 0x00000055);
@@ -1388,9 +1393,9 @@  static int a5xx_pm_suspend(struct msm_gpu *gpu)
 	u32 mask = 0xf;
 	int i, ret;
 
-	/* A506, A508, A510 have 3 XIN ports in VBIF */
-	if (adreno_is_a506(adreno_gpu) || adreno_is_a508(adreno_gpu) ||
-	    adreno_is_a510(adreno_gpu))
+	/* A505, A506, A508, A510 have 3 XIN ports in VBIF */
+	if (adreno_is_a505(adreno_gpu) || adreno_is_a506(adreno_gpu) ||
+	    adreno_is_a508(adreno_gpu) || adreno_is_a510(adreno_gpu))
 		mask = 0x7;
 
 	/* Clear the VBIF pipe before shutting down */
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index c3703a51287b..7e1ff091acaf 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -149,6 +149,23 @@  static const struct adreno_info gpulist[] = {
 		.gmem  = (SZ_1M + SZ_512K),
 		.inactive_period = DRM_MSM_INACTIVE_PERIOD,
 		.init  = a4xx_gpu_init,
+	}, {
+		.chip_ids = ADRENO_CHIP_IDS(0x05000500),
+		.family = ADRENO_5XX,
+		.revn = 505,
+		.fw = {
+			[ADRENO_FW_PM4] = "a530_pm4.fw",
+			[ADRENO_FW_PFP] = "a530_pfp.fw",
+		},
+		.gmem = (SZ_128K + SZ_8K),
+		/*
+		 * Increase inactive period to 250 to avoid bouncing
+		 * the GDSC which appears to make it grumpy
+		 */
+		.inactive_period = 250,
+		.quirks = ADRENO_QUIRK_TWO_PASS_USE_WFI |
+			  ADRENO_QUIRK_LMLOADKILL_DISABLE,
+		.init = a5xx_gpu_init,
 	}, {
 		.chip_ids = ADRENO_CHIP_IDS(0x05000600),
 		.family = ADRENO_5XX,
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index 77526892eb8c..b80cc4772cc0 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -298,6 +298,11 @@  static inline int adreno_is_a430(const struct adreno_gpu *gpu)
 	return adreno_is_revn(gpu, 430);
 }
 
+static inline int adreno_is_a505(const struct adreno_gpu *gpu)
+{
+	return adreno_is_revn(gpu, 505);
+}
+
 static inline int adreno_is_a506(const struct adreno_gpu *gpu)
 {
 	return adreno_is_revn(gpu, 506);