History

drm/amd/pm: suppress compile warnings about possible unaligned accesses

Suppress the following compile warnings: >> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/inc/smu_v11_0_pptable.h:163:17: warning: field smc_pptable within 'struct smu_11_0_powerplay_table' is less aligned than 'PPTable_t' and is usually due to 'struct smu_11_0_powerplay_table' being packed, which can lead to unaligned accesses [-Wunaligned-access] PPTable_t smc_pptable; //PPTable_t in smu11_driver_if.h ^ 1 warning generated. -- >> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/inc/smu_v11_0_7_pptable.h:193:17: warning: field smc_pptable within 'struct smu_11_0_7_powerplay_table' is less aligned than 'PPTable_t' and is usually due to 'struct smu_11_0_7_powerplay_table' being packed, which can lead to unaligned accesses [-Wunaligned-access] PPTable_t smc_pptable; //PPTable_t in smu11_driver_if.h ^ 1 warning generated. -- >> drivers/gpu/drm/amd/amdgpu/../pm/swsmu/inc/smu_v13_0_pptable.h:161:12: warning: field smc_pptable within 'struct smu_13_0_powerplay_table' is less aligned than 'PPTable_t' and is usually due to 'struct smu_13_0_powerplay_table' being packed, which can lead to unaligned accesses [-Wunaligned-access]

Evan Quan committed 4 years ago

Commit 4513edf1 parent 88467db4 files · +23 −10Browse files

Unified · Split

4 files
  1. drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0_7_pptable.h +6 −3
  2. drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0_pptable.h +6 −3
  3. drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0_7_pptable.h +4 −1
  4. drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0_pptable.h +7 −3
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0_7_pptable.h+6−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #ifndef SMU_11_0_7_PPTABLE_H
2323 #define SMU_11_0_7_PPTABLE_H
2424
25+#pragma pack(push, 1)
2526
2627 #define SMU_11_0_7_TABLE_FORMAT_REVISION 15
2728
@@ -139,7 +140,7 @@ struct smu_11_0_7_overdrive_table · 111 unmodified lines
139140 uint32_t max[SMU_11_0_7_MAX_ODSETTING]; //default maximum settings
140141 uint32_t min[SMU_11_0_7_MAX_ODSETTING]; //default minimum settings
141142 int16_t pm_setting[SMU_11_0_7_MAX_PMSETTING]; //Optimized power mode feature settings
142−} __attribute__((packed));
143+};
143144
144145 enum SMU_11_0_7_PPCLOCK_ID {
145146 SMU_11_0_7_PPCLOCK_GFXCLK = 0,
@@ -166,7 +167,7 @@ struct smu_11_0_7_power_saving_clock_table · 20 unmodified lines
166167 uint32_t count; //power_saving_clock_count = SMU_11_0_7_PPCLOCK_COUNT
167168 uint32_t max[SMU_11_0_7_MAX_PPCLOCK]; //PowerSavingClock Mode Clock Maximum array In MHz
168169 uint32_t min[SMU_11_0_7_MAX_PPCLOCK]; //PowerSavingClock Mode Clock Minimum array In MHz
169−} __attribute__((packed));
170+};
170171
171172 struct smu_11_0_7_powerplay_table
172173 {
@@ -191,6 +192,8 @@ struct smu_11_0_7_powerplay_table · 18 unmodified lines
191192 struct smu_11_0_7_overdrive_table overdrive_table;
192193
193194 PPTable_t smc_pptable; //PPTable_t in smu11_driver_if.h
194−} __attribute__((packed));
195+};
196+
197+#pragma pack(pop)
195198
196199 #endif
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v11_0_pptable.h+6−3
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #ifndef SMU_11_0_PPTABLE_H
2323 #define SMU_11_0_PPTABLE_H
2424
25+#pragma pack(push, 1)
2526
2627 #define SMU_11_0_TABLE_FORMAT_REVISION 12
2728
@@ -109,7 +110,7 @@ struct smu_11_0_overdrive_table · 81 unmodified lines
109110 uint8_t cap[SMU_11_0_MAX_ODFEATURE]; //OD feature support flags
110111 uint32_t max[SMU_11_0_MAX_ODSETTING]; //default maximum settings
111112 uint32_t min[SMU_11_0_MAX_ODSETTING]; //default minimum settings
112−} __attribute__((packed));
113+};
113114
114115 enum SMU_11_0_PPCLOCK_ID {
115116 SMU_11_0_PPCLOCK_GFXCLK = 0,
@@ -133,7 +134,7 @@ struct smu_11_0_power_saving_clock_table · 17 unmodified lines
133134 uint32_t count; //power_saving_clock_count = SMU_11_0_PPCLOCK_COUNT
134135 uint32_t max[SMU_11_0_MAX_PPCLOCK]; //PowerSavingClock Mode Clock Maximum array In MHz
135136 uint32_t min[SMU_11_0_MAX_PPCLOCK]; //PowerSavingClock Mode Clock Minimum array In MHz
136−} __attribute__((packed));
137+};
137138
138139 struct smu_11_0_powerplay_table
139140 {
@@ -162,6 +163,8 @@ struct smu_11_0_powerplay_table · 22 unmodified lines
162163 #ifndef SMU_11_0_PARTIAL_PPTABLE
163164 PPTable_t smc_pptable; //PPTable_t in smu11_driver_if.h
164165 #endif
165−} __attribute__((packed));
166+};
167+
168+#pragma pack(pop)
166169
167170 #endif
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0_7_pptable.h+4−1
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #ifndef SMU_13_0_7_PPTABLE_H
2323 #define SMU_13_0_7_PPTABLE_H
2424
25+#pragma pack(push, 1)
26+
2527 #define SMU_13_0_7_TABLE_FORMAT_REVISION 15
2628
2729 //// POWERPLAYTABLE::ulPlatformCaps
@@ -194,7 +196,8 @@ struct smu_13_0_7_powerplay_table · 166 unmodified lines
194196 struct smu_13_0_7_overdrive_table overdrive_table;
195197 uint8_t padding1;
196198 PPTable_t smc_pptable; //PPTable_t in driver_if.h
197−} __attribute__((packed));
199+};
198200
201+#pragma pack(pop)
199202
200203 #endif
drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0_pptable.h+7−3
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #ifndef SMU_13_0_PPTABLE_H
2323 #define SMU_13_0_PPTABLE_H
2424
25+#pragma pack(push, 1)
26+
2527 #define SMU_13_0_TABLE_FORMAT_REVISION 1
2628
2729 //// POWERPLAYTABLE::ulPlatformCaps
@@ -109,7 +111,7 @@ struct smu_13_0_overdrive_table { · 81 unmodified lines
109111 uint8_t cap[SMU_13_0_MAX_ODFEATURE]; //OD feature support flags
110112 uint32_t max[SMU_13_0_MAX_ODSETTING]; //default maximum settings
111113 uint32_t min[SMU_13_0_MAX_ODSETTING]; //default minimum settings
112−} __attribute__((packed));
114+};
113115
114116 enum SMU_13_0_PPCLOCK_ID {
115117 SMU_13_0_PPCLOCK_GFXCLK = 0,
@@ -132,7 +134,7 @@ struct smu_13_0_power_saving_clock_table { · 16 unmodified lines
132134 uint32_t count; //power_saving_clock_count = SMU_11_0_PPCLOCK_COUNT
133135 uint32_t max[SMU_13_0_MAX_PPCLOCK]; //PowerSavingClock Mode Clock Maximum array In MHz
134136 uint32_t min[SMU_13_0_MAX_PPCLOCK]; //PowerSavingClock Mode Clock Minimum array In MHz
135−} __attribute__((packed));
137+};
136138
137139 struct smu_13_0_powerplay_table {
138140 struct atom_common_table_header header;
@@ -160,6 +162,8 @@ struct smu_13_0_powerplay_table { · 21 unmodified lines
160162 #ifndef SMU_13_0_PARTIAL_PPTABLE
161163 PPTable_t smc_pptable; //PPTable_t in driver_if.h
162164 #endif
163−} __attribute__((packed));
165+};
166+
167+#pragma pack(pop)
164168
165169 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t