amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE"
@ 2021-05-04 18:42 Alex Deucher
  2021-05-04 22:42 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 6+ messages in thread
From: Alex Deucher @ 2021-05-04 18:42 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher, Gustavo A . R . Silva

This reverts commit 96e27e8d919e52f30ea6b717e3cb70faa0b102cd.

This causes the SMU to fail to load the power state.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1583
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
---
 drivers/gpu/drm/radeon/si_dpm.c       |  5 +++--
 drivers/gpu/drm/radeon/sislands_smc.h | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 918609551804..91bfc4762767 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -5250,9 +5250,10 @@ static int si_upload_sw_state(struct radeon_device *rdev,
 	int ret;
 	u32 address = si_pi->state_table_start +
 		offsetof(SISLANDS_SMC_STATETABLE, driverState);
+	u32 state_size = sizeof(SISLANDS_SMC_SWSTATE) +
+		((new_state->performance_level_count - 1) *
+		 sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL));
 	SISLANDS_SMC_SWSTATE *smc_state = &si_pi->smc_statetable.driverState;
-	size_t state_size = struct_size(smc_state, levels,
-					new_state->performance_level_count);
 
 	memset(smc_state, 0, state_size);
 
diff --git a/drivers/gpu/drm/radeon/sislands_smc.h b/drivers/gpu/drm/radeon/sislands_smc.h
index fbd6589bdab9..966e3a556011 100644
--- a/drivers/gpu/drm/radeon/sislands_smc.h
+++ b/drivers/gpu/drm/radeon/sislands_smc.h
@@ -182,11 +182,11 @@ typedef struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL SISLANDS_SMC_HW_PERFORMANCE_LEV
 
 struct SISLANDS_SMC_SWSTATE
 {
-	uint8_t                             flags;
-	uint8_t                             levelCount;
-	uint8_t                             padding2;
-	uint8_t                             padding3;
-	SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[];
+    uint8_t                             flags;
+    uint8_t                             levelCount;
+    uint8_t                             padding2;
+    uint8_t                             padding3;
+    SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[1];
 };
 
 typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE;
-- 
2.30.2

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE"
  2021-05-04 18:42 [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE" Alex Deucher
@ 2021-05-04 22:42 ` Gustavo A. R. Silva
  2021-05-05 13:06   ` Deucher, Alexander
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2021-05-04 22:42 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx; +Cc: Gustavo A . R . Silva

Hi,

I thought it was this[1] the one causing problems[2].

--
Gustavo

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=434fb1e7444a2efc3a4ebd950c7f771ebfcffa31
[2] https://lore.kernel.org/dri-devel/3eedbe78-1fbd-4763-a7f3-ac5665e76a4a@xenosoft.de/

On 5/4/21 13:42, Alex Deucher wrote:
> This reverts commit 96e27e8d919e52f30ea6b717e3cb70faa0b102cd.
> 
> This causes the SMU to fail to load the power state.
> 
> Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1583
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
>  drivers/gpu/drm/radeon/si_dpm.c       |  5 +++--
>  drivers/gpu/drm/radeon/sislands_smc.h | 10 +++++-----
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index 918609551804..91bfc4762767 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -5250,9 +5250,10 @@ static int si_upload_sw_state(struct radeon_device *rdev,
>  	int ret;
>  	u32 address = si_pi->state_table_start +
>  		offsetof(SISLANDS_SMC_STATETABLE, driverState);
> +	u32 state_size = sizeof(SISLANDS_SMC_SWSTATE) +
> +		((new_state->performance_level_count - 1) *
> +		 sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL));
>  	SISLANDS_SMC_SWSTATE *smc_state = &si_pi->smc_statetable.driverState;
> -	size_t state_size = struct_size(smc_state, levels,
> -					new_state->performance_level_count);
>  
>  	memset(smc_state, 0, state_size);
>  
> diff --git a/drivers/gpu/drm/radeon/sislands_smc.h b/drivers/gpu/drm/radeon/sislands_smc.h
> index fbd6589bdab9..966e3a556011 100644
> --- a/drivers/gpu/drm/radeon/sislands_smc.h
> +++ b/drivers/gpu/drm/radeon/sislands_smc.h
> @@ -182,11 +182,11 @@ typedef struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL SISLANDS_SMC_HW_PERFORMANCE_LEV
>  
>  struct SISLANDS_SMC_SWSTATE
>  {
> -	uint8_t                             flags;
> -	uint8_t                             levelCount;
> -	uint8_t                             padding2;
> -	uint8_t                             padding3;
> -	SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[];
> +    uint8_t                             flags;
> +    uint8_t                             levelCount;
> +    uint8_t                             padding2;
> +    uint8_t                             padding3;
> +    SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[1];
>  };
>  
>  typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE;
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE"
  2021-05-04 22:42 ` Gustavo A. R. Silva
@ 2021-05-05 13:06   ` Deucher, Alexander
  2021-05-05 13:45     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 6+ messages in thread
From: Deucher, Alexander @ 2021-05-05 13:06 UTC (permalink / raw)
  To: Gustavo A. R. Silva, amd-gfx; +Cc: Gustavo A . R . Silva

[AMD Public Use]

> -----Original Message-----
> From: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Sent: Tuesday, May 4, 2021 6:43 PM
> To: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-
> gfx@lists.freedesktop.org
> Cc: Gustavo A . R . Silva <gustavoars@kernel.org>
> Subject: Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element
> array with flexible-array in struct SISLANDS_SMC_SWSTATE"
> 
> Hi,
> 
> I thought it was this[1] the one causing problems[2].

They are both causing problems.

Alex

> 
> --
> Gustavo
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.k
> ernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%
> 2Fcommit%2F%3Fid%3D434fb1e7444a2efc3a4ebd950c7f771ebfcffa31&amp;d
> ata=04%7C01%7Calexander.deucher%40amd.com%7C2e5ec39776404b9f1ad
> a08d90f4def14%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6375
> 57649665013301%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
> CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=ItE
> aD0%2FcD8SZYTdHFEzLqhAkz4u40VJ3b8jXmnKubYc%3D&amp;reserved=0
> [2]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.
> kernel.org%2Fdri-devel%2F3eedbe78-1fbd-4763-a7f3-
> ac5665e76a4a%40xenosoft.de%2F&amp;data=04%7C01%7Calexander.deuch
> er%40amd.com%7C2e5ec39776404b9f1ada08d90f4def14%7C3dd8961fe4884
> e608e11a82d994e183d%7C0%7C0%7C637557649665013301%7CUnknown%7C
> TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiL
> CJXVCI6Mn0%3D%7C1000&amp;sdata=oNDZm9xHuOWbelrUrXYXPoyXLlk2dI
> kRH75O43AFNcI%3D&amp;reserved=0
> 
> On 5/4/21 13:42, Alex Deucher wrote:
> > This reverts commit 96e27e8d919e52f30ea6b717e3cb70faa0b102cd.
> >
> > This causes the SMU to fail to load the power state.
> >
> > Bug:
> > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitl
> > ab.freedesktop.org%2Fdrm%2Famd%2F-
> %2Fissues%2F1583&amp;data=04%7C01%7C
> >
> alexander.deucher%40amd.com%7C2e5ec39776404b9f1ada08d90f4def14%7
> C3dd89
> >
> 61fe4884e608e11a82d994e183d%7C0%7C0%7C637557649665013301%7CUnkn
> own%7CT
> >
> WFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLC
> JXVCI
> >
> 6Mn0%3D%7C1000&amp;sdata=zo7mfnO2t%2BtQgPxIquuDYIsROlkqECjdX0r
> JOPyklyc
> > %3D&amp;reserved=0
> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> > Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
> > ---
> >  drivers/gpu/drm/radeon/si_dpm.c       |  5 +++--
> >  drivers/gpu/drm/radeon/sislands_smc.h | 10 +++++-----
> >  2 files changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/radeon/si_dpm.c
> > b/drivers/gpu/drm/radeon/si_dpm.c index 918609551804..91bfc4762767
> > 100644
> > --- a/drivers/gpu/drm/radeon/si_dpm.c
> > +++ b/drivers/gpu/drm/radeon/si_dpm.c
> > @@ -5250,9 +5250,10 @@ static int si_upload_sw_state(struct
> radeon_device *rdev,
> >  	int ret;
> >  	u32 address = si_pi->state_table_start +
> >  		offsetof(SISLANDS_SMC_STATETABLE, driverState);
> > +	u32 state_size = sizeof(SISLANDS_SMC_SWSTATE) +
> > +		((new_state->performance_level_count - 1) *
> > +		 sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL));
> >  	SISLANDS_SMC_SWSTATE *smc_state = &si_pi-
> >smc_statetable.driverState;
> > -	size_t state_size = struct_size(smc_state, levels,
> > -					new_state-
> >performance_level_count);
> >
> >  	memset(smc_state, 0, state_size);
> >
> > diff --git a/drivers/gpu/drm/radeon/sislands_smc.h
> > b/drivers/gpu/drm/radeon/sislands_smc.h
> > index fbd6589bdab9..966e3a556011 100644
> > --- a/drivers/gpu/drm/radeon/sislands_smc.h
> > +++ b/drivers/gpu/drm/radeon/sislands_smc.h
> > @@ -182,11 +182,11 @@ typedef struct
> SISLANDS_SMC_HW_PERFORMANCE_LEVEL
> > SISLANDS_SMC_HW_PERFORMANCE_LEV
> >
> >  struct SISLANDS_SMC_SWSTATE
> >  {
> > -	uint8_t                             flags;
> > -	uint8_t                             levelCount;
> > -	uint8_t                             padding2;
> > -	uint8_t                             padding3;
> > -	SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[];
> > +    uint8_t                             flags;
> > +    uint8_t                             levelCount;
> > +    uint8_t                             padding2;
> > +    uint8_t                             padding3;
> > +    SISLANDS_SMC_HW_PERFORMANCE_LEVEL   levels[1];
> >  };
> >
> >  typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE;
> >
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE"
  2021-05-05 13:06   ` Deucher, Alexander
@ 2021-05-05 13:45     ` Gustavo A. R. Silva
  2021-05-09 23:02       ` Gustavo A. R. Silva
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2021-05-05 13:45 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx; +Cc: Gustavo A . R . Silva



On 5/5/21 08:06, Deucher, Alexander wrote:
> [AMD Public Use]
> 
>> -----Original Message-----
>> From: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> Sent: Tuesday, May 4, 2021 6:43 PM
>> To: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-
>> gfx@lists.freedesktop.org
>> Cc: Gustavo A . R . Silva <gustavoars@kernel.org>
>> Subject: Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element
>> array with flexible-array in struct SISLANDS_SMC_SWSTATE"
>>
>> Hi,
>>
>> I thought it was this[1] the one causing problems[2].
> 
> They are both causing problems.

Yeah, I already know why and I'll work out a solution soon. In the meantime, both
should be reverted.

These other two[1][2] also seem to have the same issue and should be reverted, too.
I wonder why no one has reported any problems, yet... in particular regarding this[2].

Thanks
--
Gustavo

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0e1aa13ca3ffdd1e626532a3924ac80686939848
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4541ea81edde6ce9a1d9be082489aca7e8e7e1dc

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE"
  2021-05-05 13:45     ` Gustavo A. R. Silva
@ 2021-05-09 23:02       ` Gustavo A. R. Silva
  2021-05-10 21:20         ` Alex Deucher
  0 siblings, 1 reply; 6+ messages in thread
From: Gustavo A. R. Silva @ 2021-05-09 23:02 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx; +Cc: Gustavo A . R . Silva

Hi Alex,

I've just sent a couple of fixes for the recent radeon problems:

https://lore.kernel.org/lkml/20210509224926.GA31035@embeddedor/
https://lore.kernel.org/lkml/20210509225525.GA32045@embeddedor/

So, there is no need to revert the problematic patches for radeon anymore.

Sorry for the inconveniences.
Thanks!
--
Gustavo

On 5/5/21 08:45, Gustavo A. R. Silva wrote:
> 
> 
> On 5/5/21 08:06, Deucher, Alexander wrote:
>> [AMD Public Use]
>>
>>> -----Original Message-----
>>> From: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>> Sent: Tuesday, May 4, 2021 6:43 PM
>>> To: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-
>>> gfx@lists.freedesktop.org
>>> Cc: Gustavo A . R . Silva <gustavoars@kernel.org>
>>> Subject: Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element
>>> array with flexible-array in struct SISLANDS_SMC_SWSTATE"
>>>
>>> Hi,
>>>
>>> I thought it was this[1] the one causing problems[2].
>>
>> They are both causing problems.
> 
> Yeah, I already know why and I'll work out a solution soon. In the meantime, both
> should be reverted.
> 
> These other two[1][2] also seem to have the same issue and should be reverted, too.
> I wonder why no one has reported any problems, yet... in particular regarding this[2].
> 
> Thanks
> --
> Gustavo
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0e1aa13ca3ffdd1e626532a3924ac80686939848
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4541ea81edde6ce9a1d9be082489aca7e8e7e1dc
> 
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE"
  2021-05-09 23:02       ` Gustavo A. R. Silva
@ 2021-05-10 21:20         ` Alex Deucher
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Deucher @ 2021-05-10 21:20 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Deucher, Alexander, Gustavo A . R . Silva, amd-gfx

On Mon, May 10, 2021 at 4:26 AM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> Hi Alex,
>
> I've just sent a couple of fixes for the recent radeon problems:
>
> https://lore.kernel.org/lkml/20210509224926.GA31035@embeddedor/
> https://lore.kernel.org/lkml/20210509225525.GA32045@embeddedor/
>
> So, there is no need to revert the problematic patches for radeon anymore.
>
> Sorry for the inconveniences.

Thanks for fixing these up.

Alex

> Thanks!
> --
> Gustavo
>
> On 5/5/21 08:45, Gustavo A. R. Silva wrote:
> >
> >
> > On 5/5/21 08:06, Deucher, Alexander wrote:
> >> [AMD Public Use]
> >>
> >>> -----Original Message-----
> >>> From: Gustavo A. R. Silva <gustavo@embeddedor.com>
> >>> Sent: Tuesday, May 4, 2021 6:43 PM
> >>> To: Deucher, Alexander <Alexander.Deucher@amd.com>; amd-
> >>> gfx@lists.freedesktop.org
> >>> Cc: Gustavo A . R . Silva <gustavoars@kernel.org>
> >>> Subject: Re: [PATCH] Revert "drm/radeon/si_dpm: Replace one-element
> >>> array with flexible-array in struct SISLANDS_SMC_SWSTATE"
> >>>
> >>> Hi,
> >>>
> >>> I thought it was this[1] the one causing problems[2].
> >>
> >> They are both causing problems.
> >
> > Yeah, I already know why and I'll work out a solution soon. In the meantime, both
> > should be reverted.
> >
> > These other two[1][2] also seem to have the same issue and should be reverted, too.
> > I wonder why no one has reported any problems, yet... in particular regarding this[2].
> >
> > Thanks
> > --
> > Gustavo
> >
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0e1aa13ca3ffdd1e626532a3924ac80686939848
> > [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4541ea81edde6ce9a1d9be082489aca7e8e7e1dc
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-10 21:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 18:42 [PATCH] Revert "drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE" Alex Deucher
2021-05-04 22:42 ` Gustavo A. R. Silva
2021-05-05 13:06   ` Deucher, Alexander
2021-05-05 13:45     ` Gustavo A. R. Silva
2021-05-09 23:02       ` Gustavo A. R. Silva
2021-05-10 21:20         ` Alex Deucher

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).