mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amd/ras: Adjust second parameter of mp1_v13_0_eeprom_send_msg()
@ 2026-09-03  7:15 Nathan Chancellor
  2026-09-08 21:41 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2026-09-03  7:15 UTC (permalink / raw)
  To: Alex Deucher, Christian König
  Cc: YiPeng Chai, Hawking Zhang, amd-gfx, dri-devel, linux-kernel,
	Nathan Chancellor

When building with -Wincompatible-function-pointer-types-strict, a
warning designed to catch kernel control flow integrity (kCFI) issues at
build time, there is an instance around mp1_v13_0_eeprom_send_msg():

  drivers/gpu/drm/amd/amdgpu/../ras/ras_mgr/amdgpu_ras_mp1_v13_0.c:157:25: error: incompatible function pointer types initializing 'int (*)(struct ras_core_context *, u32, uint32_t, uint32_t *)' (aka 'int (*)(struct ras_core_context *, unsigned int, unsigned int, unsigned int *)') with an expression of type 'int (struct ras_core_context *, enum ras_fw_eeprom_cmd, uint32_t, uint32_t *)' (aka 'int (struct ras_core_context *, enum ras_fw_eeprom_cmd, unsigned int, unsigned int *)') [-Werror,-Wincompatible-function-pointer-types-strict]
    157 |         .mp1_send_eeprom_msg = mp1_v13_0_eeprom_send_msg,
        |                                ^~~~~~~~~~~~~~~~~~~~~~~~~

While 'u32' and 'enum ras_fw_eeprom_cmd' are ABI compatible, hence no
regular warning from -Wincompatible-function-pointer-types, the mismatch
will trigger a kCFI violation when mp1_v13_0_eeprom_send_msg() is called
indirectly.

Update the second parameter of mp1_v13_0_eeprom_send_msg()' to be
'u32 msg_id' to match the prototype in 'struct ras_mp1_sys_func' (which
was recently changed to support mp1_v15_0), clearing up the warning and
kCFI violation.

Fixes: 11a948c7817b ("drm/amd/ras: Support retrieving bad page info from mp1_v15_0")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
index 7aa818a433f6..548594373d0b 100644
--- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
+++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
@@ -105,14 +105,14 @@ static int mp1_v13_0_dump_valid_bank(struct ras_core_context *ras_core,
 }
 
 static int mp1_v13_0_eeprom_send_msg(struct ras_core_context *ras_core,
-				enum ras_fw_eeprom_cmd index, uint32_t param, uint32_t *read_arg)
+				u32 msg_id, uint32_t param, uint32_t *read_arg)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev;
 	int ret = 0;
 
 	if (down_read_trylock(&adev->reset_domain->sem)) {
 		ret = mp1_v13_send_smu_msg(adev,
-			pmfw_eeprom_msgs[index], param, read_arg);
+			pmfw_eeprom_msgs[msg_id], param, read_arg);
 		up_read(&adev->reset_domain->sem);
 	} else {
 		ret = -RAS_CORE_GPU_IN_MODE1_RESET;

---
base-commit: 8fad652e7235dbf3bebfab1460610b0b0e75b199
change-id: 20260902-amdgpu-ras-wifpts-c8628642e565

Best regards,
--  
Cheers,
Nathan


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

* Re: [PATCH] drm/amd/ras: Adjust second parameter of mp1_v13_0_eeprom_send_msg()
  2026-09-03  7:15 [PATCH] drm/amd/ras: Adjust second parameter of mp1_v13_0_eeprom_send_msg() Nathan Chancellor
@ 2026-09-08 21:41 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2026-09-08 21:41 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Alex Deucher, Christian König, YiPeng Chai, Hawking Zhang,
	amd-gfx, dri-devel, linux-kernel

On Thu, Sep 3, 2026 at 3:40 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> When building with -Wincompatible-function-pointer-types-strict, a
> warning designed to catch kernel control flow integrity (kCFI) issues at
> build time, there is an instance around mp1_v13_0_eeprom_send_msg():
>
>   drivers/gpu/drm/amd/amdgpu/../ras/ras_mgr/amdgpu_ras_mp1_v13_0.c:157:25: error: incompatible function pointer types initializing 'int (*)(struct ras_core_context *, u32, uint32_t, uint32_t *)' (aka 'int (*)(struct ras_core_context *, unsigned int, unsigned int, unsigned int *)') with an expression of type 'int (struct ras_core_context *, enum ras_fw_eeprom_cmd, uint32_t, uint32_t *)' (aka 'int (struct ras_core_context *, enum ras_fw_eeprom_cmd, unsigned int, unsigned int *)') [-Werror,-Wincompatible-function-pointer-types-strict]
>     157 |         .mp1_send_eeprom_msg = mp1_v13_0_eeprom_send_msg,
>         |                                ^~~~~~~~~~~~~~~~~~~~~~~~~
>
> While 'u32' and 'enum ras_fw_eeprom_cmd' are ABI compatible, hence no
> regular warning from -Wincompatible-function-pointer-types, the mismatch
> will trigger a kCFI violation when mp1_v13_0_eeprom_send_msg() is called
> indirectly.
>
> Update the second parameter of mp1_v13_0_eeprom_send_msg()' to be
> 'u32 msg_id' to match the prototype in 'struct ras_mp1_sys_func' (which
> was recently changed to support mp1_v15_0), clearing up the warning and
> kCFI violation.
>
> Fixes: 11a948c7817b ("drm/amd/ras: Support retrieving bad page info from mp1_v15_0")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Applied.  Thanks!

Alex

> ---
>  drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
> index 7aa818a433f6..548594373d0b 100644
> --- a/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
> +++ b/drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mp1_v13_0.c
> @@ -105,14 +105,14 @@ static int mp1_v13_0_dump_valid_bank(struct ras_core_context *ras_core,
>  }
>
>  static int mp1_v13_0_eeprom_send_msg(struct ras_core_context *ras_core,
> -                               enum ras_fw_eeprom_cmd index, uint32_t param, uint32_t *read_arg)
> +                               u32 msg_id, uint32_t param, uint32_t *read_arg)
>  {
>         struct amdgpu_device *adev = (struct amdgpu_device *)ras_core->dev;
>         int ret = 0;
>
>         if (down_read_trylock(&adev->reset_domain->sem)) {
>                 ret = mp1_v13_send_smu_msg(adev,
> -                       pmfw_eeprom_msgs[index], param, read_arg);
> +                       pmfw_eeprom_msgs[msg_id], param, read_arg);
>                 up_read(&adev->reset_domain->sem);
>         } else {
>                 ret = -RAS_CORE_GPU_IN_MODE1_RESET;
>
> ---
> base-commit: 8fad652e7235dbf3bebfab1460610b0b0e75b199
> change-id: 20260902-amdgpu-ras-wifpts-c8628642e565
>
> Best regards,
> --
> Cheers,
> Nathan
>

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

end of thread, other threads:[~2026-09-08 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03  7:15 [PATCH] drm/amd/ras: Adjust second parameter of mp1_v13_0_eeprom_send_msg() Nathan Chancellor
2026-09-08 21:41 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®