Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/chsc: fix packed-not-aligned warnings

Remove attribute packed where possible failing this add proper alignment
information to fix warnings like the one below:

drivers/s390/cio/chsc.c: In function 'chsc_siosl':
drivers/s390/cio/chsc.c:1287:2: warning: alignment 1 of 'struct <anonymous>' is less than 4 [-Wpacked-not-aligned]
} __attribute__ ((packed)) *siosl_area;

Note: this patch should be a nop since non of these structs use auto
storage but allocated pages. However there are changes to the generated
code because of additional padding at the end of some of the structs due
to alignment when memset(foo, 0, sizeof(*foo)) is used.

Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
ccaabeea d4f5d79e

+23 -23
+5 -5
arch/s390/include/uapi/asm/chsc.h
··· 23 23 __u32 key : 4; 24 24 __u32 : 28; 25 25 struct subchannel_id sid; 26 - } __attribute__ ((packed)); 26 + }; 27 27 28 28 struct chsc_async_area { 29 29 struct chsc_async_header header; 30 30 __u8 data[CHSC_SIZE - sizeof(struct chsc_async_header)]; 31 - } __attribute__ ((packed)); 31 + }; 32 32 33 33 struct chsc_header { 34 34 __u16 length; 35 35 __u16 code; 36 - } __attribute__ ((packed)); 36 + }; 37 37 38 38 struct chsc_sync_area { 39 39 struct chsc_header header; 40 40 __u8 data[CHSC_SIZE - sizeof(struct chsc_header)]; 41 - } __attribute__ ((packed)); 41 + }; 42 42 43 43 struct chsc_response_struct { 44 44 __u16 length; 45 45 __u16 code; 46 46 __u32 parms; 47 47 __u8 data[CHSC_SIZE - 2 * sizeof(__u16) - sizeof(__u32)]; 48 - } __attribute__ ((packed)); 48 + }; 49 49 50 50 struct chsc_chp_cd { 51 51 struct chp_id chpid;
+9 -9
drivers/s390/cio/chsc.c
··· 91 91 u16 sch; /* subchannel */ 92 92 u8 chpid[8]; /* chpids 0-7 */ 93 93 u16 fla[8]; /* full link addresses 0-7 */ 94 - } __attribute__ ((packed)); 94 + } __packed __aligned(PAGE_SIZE); 95 95 96 96 int chsc_get_ssd_info(struct subchannel_id schid, struct chsc_ssd_info *ssd) 97 97 { ··· 319 319 struct chsc_sei_nt2_area nt2_area; 320 320 u8 nt_area[PAGE_SIZE - 24]; 321 321 } u; 322 - } __packed; 322 + } __packed __aligned(PAGE_SIZE); 323 323 324 324 /* 325 325 * Node Descriptor as defined in SA22-7204, "Common I/O-Device Commands" ··· 841 841 u32 : 4; 842 842 u32 fmt : 4; 843 843 u32 : 16; 844 - } __attribute__ ((packed)) *secm_area; 844 + } *secm_area; 845 845 unsigned long flags; 846 846 int ret, ccode; 847 847 ··· 1014 1014 u32 cmg : 8; 1015 1015 u32 zeroes3; 1016 1016 u32 data[NR_MEASUREMENT_CHARS]; 1017 - } __attribute__ ((packed)) *scmc_area; 1017 + } *scmc_area; 1018 1018 1019 1019 chp->shared = -1; 1020 1020 chp->cmg = -1; ··· 1142 1142 u8 cssid; 1143 1143 u32 : 24; 1144 1144 } list[0]; 1145 - } __packed *sdcal_area; 1145 + } *sdcal_area; 1146 1146 int ret; 1147 1147 1148 1148 spin_lock_irq(&chsc_page_lock); ··· 1192 1192 u32 reserved4; 1193 1193 u32 general_char[510]; 1194 1194 u32 chsc_char[508]; 1195 - } __attribute__ ((packed)) *scsc_area; 1195 + } *scsc_area; 1196 1196 1197 1197 spin_lock_irqsave(&chsc_page_lock, flags); 1198 1198 memset(chsc_page, 0, PAGE_SIZE); ··· 1236 1236 unsigned int rsvd3[3]; 1237 1237 u64 clock_delta; 1238 1238 unsigned int rsvd4[2]; 1239 - } __attribute__ ((packed)) *rr; 1239 + } *rr; 1240 1240 int rc; 1241 1241 1242 1242 memset(page, 0, PAGE_SIZE); ··· 1261 1261 unsigned int rsvd0[3]; 1262 1262 struct chsc_header response; 1263 1263 char data[]; 1264 - } __attribute__ ((packed)) *rr; 1264 + } *rr; 1265 1265 int rc; 1266 1266 1267 1267 memset(page, 0, PAGE_SIZE); ··· 1284 1284 u32 word3; 1285 1285 struct chsc_header response; 1286 1286 u32 word[11]; 1287 - } __attribute__ ((packed)) *siosl_area; 1287 + } *siosl_area; 1288 1288 unsigned long flags; 1289 1289 int ccode; 1290 1290 int rc;
+9 -9
drivers/s390/cio/chsc.h
··· 15 15 #define NR_MEASUREMENT_CHARS 5 16 16 struct cmg_chars { 17 17 u32 values[NR_MEASUREMENT_CHARS]; 18 - } __attribute__ ((packed)); 18 + }; 19 19 20 20 #define NR_MEASUREMENT_ENTRIES 8 21 21 struct cmg_entry { 22 22 u32 values[NR_MEASUREMENT_ENTRIES]; 23 - } __attribute__ ((packed)); 23 + }; 24 24 25 25 struct channel_path_desc_fmt1 { 26 26 u8 flags; ··· 38 38 u8 s:1; 39 39 u8 f:1; 40 40 u32 zeros[2]; 41 - } __attribute__ ((packed)); 41 + }; 42 42 43 43 struct channel_path_desc_fmt3 { 44 44 struct channel_path_desc_fmt1 fmt1_desc; ··· 59 59 u32:7; 60 60 u32 pnso:1; /* bit 116 */ 61 61 u32:11; 62 - }__attribute__((packed)); 62 + } __packed; 63 63 64 64 extern struct css_chsc_char css_chsc_characteristics; 65 65 ··· 82 82 struct chsc_header response; 83 83 u32:32; 84 84 struct qdio_ssqd_desc qdio_ssqd; 85 - } __packed; 85 + } __packed __aligned(PAGE_SIZE); 86 86 87 87 struct chsc_scssc_area { 88 88 struct chsc_header request; ··· 102 102 u32 reserved[1004]; 103 103 struct chsc_header response; 104 104 u32:32; 105 - } __packed; 105 + } __packed __aligned(PAGE_SIZE); 106 106 107 107 struct chsc_scpd { 108 108 struct chsc_header request; ··· 120 120 struct chsc_header response; 121 121 u32:32; 122 122 u8 data[0]; 123 - } __packed; 123 + } __packed __aligned(PAGE_SIZE); 124 124 125 125 struct chsc_sda_area { 126 126 struct chsc_header request; ··· 199 199 u32 reserved2[10]; 200 200 u64 restok; 201 201 struct sale scmal[248]; 202 - } __packed; 202 + } __packed __aligned(PAGE_SIZE); 203 203 204 204 int chsc_scm_info(struct chsc_scm_info *scm_area, u64 token); 205 205 ··· 243 243 struct qdio_brinfo_entry_l3_ipv4 l3_ipv4[0]; 244 244 struct qdio_brinfo_entry_l2 l2[0]; 245 245 } entries; 246 - } __packed; 246 + } __packed __aligned(PAGE_SIZE); 247 247 248 248 int chsc_pnso_brinfo(struct subchannel_id schid, 249 249 struct chsc_pnso_area *brinfo_area,