drm/amdgpu/amdkfd: Avoid a couple hundred -Wflex-array-member-not-at-end warnings
Subsystems (3)
PATCH 1/1 drm/amdgpu/amdkfd: Avoid a couple hundred -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Move the conflicting declarations to the end of the corresponding structures. Notice that struct dev_pagemap is a flexible structure, this is a structure that contains a flexible-array member.
Fix 283 of the following type of warnings:
283 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:111:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -3
@@ -1155,9 +1155,6 @@ struct amdgpu_device {/* for userq and VM fences */ struct amdgpu_seq64 seq64; -/* KFD */ -struct amdgpu_kfd_dev kfd; -/* UMC */ struct amdgpu_umc umc;
@@ -1320,6 +1317,11 @@ struct amdgpu_device {struct mutex userq_mutex;bool userq_halt_for_enforce_isolation;struct amdgpu_uid *uid_info; + +/* KFD +* Must be last --ends in a flexible-array member. +*/ +struct amdgpu_kfd_dev kfd; }; static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +5 -3
@@ -107,11 +107,13 @@ struct amdgpu_kfd_dev {bool init_complete;struct work_struct reset_work; -/* HMM page migration MEMORY_DEVICE_PRIVATE mapping */ -struct dev_pagemap pgmap; -/* Client for KFD BO GEM handle allocations */ struct drm_client_dev client; + +/* HMM page migration MEMORY_DEVICE_PRIVATE mapping +* Must be last --ends in a flexible-array member. +*/ +struct dev_pagemap pgmap; };enum kgd_engine_type {
Signature · 1 line
2.43.0
Quoted 11 lines · Gustavo A. R. Silva
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Move the conflicting declarations to the end of the corresponding structures. Notice that
struct dev_pagemapis a flexible structure, this is a structure that contains a flexible-array member.Fix 283 of the following type of warnings:
283drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:111:28: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]Signed-off-by Gustavo A. R. Silva <[email protected]>
Thank you. I'll apply this to amd-staging-drm-next. I'll also add a note to the commit description that struct dev_pagemap always has space for at least one range, and that amdgpu only uses a single range. Therefore no changes are needed in the way struct amdgpu_device is allocated.
Quoted 52 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 8 +++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +5
-3@@ -1155,9 +1155,6 @@ struct amdgpu_device {/* for userq and VM fences */ struct amdgpu_seq64 seq64; -/* KFD */ -struct amdgpu_kfd_dev kfd; -/* UMC */ struct amdgpu_umc umc;@@ -1320,6 +1317,11 @@ struct amdgpu_device {struct mutex userq_mutex;bool userq_halt_for_enforce_isolation;struct amdgpu_uid *uid_info; + +/* KFD +* Must be last --ends in a flexible-array member. +*/ +struct amdgpu_kfd_dev kfd; }; static inline uint32_t amdgpu_ip_version(const struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +5
-3@@ -107,11 +107,13 @@ struct amdgpu_kfd_dev {bool init_complete;struct work_struct reset_work; -/* HMM page migration MEMORY_DEVICE_PRIVATE mapping */ -struct dev_pagemap pgmap; -/* Client for KFD BO GEM handle allocations */ struct drm_client_dev client; + +/* HMM page migration MEMORY_DEVICE_PRIVATE mapping +* Must be last --ends in a flexible-array member. +*/ +struct dev_pagemap pgmap; };enum kgd_engine_type {
Quoted 8 lines · Felix
Quoted 7 lines · Gustavo A. R. Silva
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally.
Move the conflicting declarations to the end of the corresponding structures. Notice that
struct dev_pagemapis a flexible structure, this is a structure that contains a flexible-array member.
Quoted 6 lines
Quoted 4 lines
Fix 283 of the following type of warnings:
283drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h:111:28: warning: structure containing a flexible array member is not at the end of another structure [- Wflex-array-member-not-at-end]Signed-off-by Gustavo A. R. Silva <[email protected]>Thank you. I'll apply this to amd-staging-drm-next. I'll also add a note to the commit description that struct
dev_pagemapalways has space for at least one range, and that amdgpu only uses a single range. Therefore no changes are needed in the way structamdgpu_deviceis allocated.
Yep, that's correct. Thank you! :)
-Gustavo