amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/pm: suppress compile warning about possible unaligned accesses
@ 2022-05-07  7:05 Evan Quan
  2022-05-09 14:47 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Evan Quan @ 2022-05-07  7:05 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Evan Quan, kernel test robot

Suppress the following compile warning:
   In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_0_ppt.c:39:
>> drivers/gpu/drm/amd/amdgpu/../pm/inc/smu_v13_0_0_pptable.h:194:39:
warning: field overdrive_table within 'struct smu_13_0_0_powerplay_table' is
less aligned than 'struct smu_13_0_0_overdrive_table' and is usually due to
'struct smu_13_0_0_powerplay_table' being packed,
which can lead to unaligned accesses [-Wunaligned-access]

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Change-Id: Ibba9dbfcc6440d0bdf0fbe0534ce6a82ab6d5d10
---
 drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h
index 670f2ef67868..566a0da59e53 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h
@@ -22,6 +22,8 @@
 #ifndef SMU_13_0_0_PPTABLE_H
 #define SMU_13_0_0_PPTABLE_H
 
+#pragma pack(push, 1)
+
 #define SMU_13_0_0_TABLE_FORMAT_REVISION 15
 
 //// POWERPLAYTABLE::ulPlatformCaps
@@ -194,7 +196,8 @@ struct smu_13_0_0_powerplay_table
     struct smu_13_0_0_overdrive_table overdrive_table;
     uint8_t padding1;
     PPTable_t smc_pptable; //PPTable_t in driver_if.h
-} __attribute__((packed));
+};
 
+#pragma pack(pop)
 
 #endif
-- 
2.29.0


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

* Re: [PATCH] drm/amd/pm: suppress compile warning about possible unaligned accesses
  2022-05-07  7:05 [PATCH] drm/amd/pm: suppress compile warning about possible unaligned accesses Evan Quan
@ 2022-05-09 14:47 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2022-05-09 14:47 UTC (permalink / raw)
  To: Evan Quan; +Cc: Deucher, Alexander, kernel test robot, amd-gfx list

On Sat, May 7, 2022 at 3:06 AM Evan Quan <evan.quan@amd.com> wrote:
>
> Suppress the following compile warning:
>    In file included from drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu13/smu_v13_0_0_ppt.c:39:
> >> drivers/gpu/drm/amd/amdgpu/../pm/inc/smu_v13_0_0_pptable.h:194:39:
> warning: field overdrive_table within 'struct smu_13_0_0_powerplay_table' is
> less aligned than 'struct smu_13_0_0_overdrive_table' and is usually due to
> 'struct smu_13_0_0_powerplay_table' being packed,
> which can lead to unaligned accesses [-Wunaligned-access]
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Evan Quan <evan.quan@amd.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> Change-Id: Ibba9dbfcc6440d0bdf0fbe0534ce6a82ab6d5d10
> ---
>  drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h
> index 670f2ef67868..566a0da59e53 100644
> --- a/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h
> +++ b/drivers/gpu/drm/amd/pm/inc/smu_v13_0_0_pptable.h
> @@ -22,6 +22,8 @@
>  #ifndef SMU_13_0_0_PPTABLE_H
>  #define SMU_13_0_0_PPTABLE_H
>
> +#pragma pack(push, 1)
> +
>  #define SMU_13_0_0_TABLE_FORMAT_REVISION 15
>
>  //// POWERPLAYTABLE::ulPlatformCaps
> @@ -194,7 +196,8 @@ struct smu_13_0_0_powerplay_table
>      struct smu_13_0_0_overdrive_table overdrive_table;
>      uint8_t padding1;
>      PPTable_t smc_pptable; //PPTable_t in driver_if.h
> -} __attribute__((packed));
> +};
>
> +#pragma pack(pop)
>
>  #endif
> --
> 2.29.0
>

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

end of thread, other threads:[~2022-05-09 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-07  7:05 [PATCH] drm/amd/pm: suppress compile warning about possible unaligned accesses Evan Quan
2022-05-09 14:47 ` 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).