Re: [PATCH 2/2] drm/amdgpu: Pack nested ucode_info struct

Harry Wentland <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>

On 2026-07-09 18:33, Alex Hung wrote:
> Building for ARCH=um with W=1 C=1 makes the "amd_sriov_msg_vf2pf_info
> must be 1 KB" static assertion in amdgv_sriovmsg.h fail under sparse,
> exposed after UML builds were enabled.
> 
> Sparse does not honor #pragma pack(push, 1) for the nested ucode_info
> struct, so it sizes each element as 8 bytes instead of 5 and computes
> the surrounding structure as larger than 1 KB. The compilers get this
> right via the enclosing pragma, but the annotation should be explicit.
> 
> Fixes: af3f2f5db265 ("drm/amdgpu: Remove UML build exclusion from Kconfig")
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
> Cc: Harry Wentland <[email protected]>
> Assisted-by: Copilot:Claude-Opus-4.8
> Signed-off-by: Alex Hung <[email protected]>

Reviewed-by: Harry Wentland <[email protected]>

Harry

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
> index d80f01c0e754..b02561f41b58 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
> @@ -379,7 +379,7 @@ struct amd_sriov_msg_vf2pf_info {
>  	struct {
>  		uint8_t id;
>  		uint32_t version;
> -	} ucode_info[AMD_SRIOV_MSG_RESERVE_UCODE];
> +	} __packed ucode_info[AMD_SRIOV_MSG_RESERVE_UCODE];
>  	uint64_t dummy_page_addr;
>  	/* FB allocated for guest MES to record UQ info */
>  	uint64_t mes_info_addr;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.