amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Alex Deucher <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"
Date: Tue, 4 May 2021 17:42:58 -0500	[thread overview]
Message-ID: <15cc0988-0446-5423-62d7-051ccaf2936e@embeddedor.com> (raw)
In-Reply-To: <20210504184233.2350976-1-alexander.deucher@amd.com>

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

  reply	other threads:[~2021-05-05  7:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=15cc0988-0446-5423-62d7-051ccaf2936e@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=gustavoars@kernel.org \
    /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).