Skip to content

Commit 0044c5f

Browse files
ysunvinodkoul
authored andcommitted
dmaengine: idxd: Remove __packed from structures
The __packed attribute introduces potential unaligned memory accesses and endianness portability issues. Instead of relying on compiler-specific packing, it's much better to explicitly fill structure gaps using padding fields, ensuring natural alignment. Since all previously __packed structures already enforce proper alignment through manual padding, the __packed qualifiers are unnecessary and can be safely removed. Signed-off-by: Yi Sun <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Reviewed-by: Fenghua Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent ddf16e1 commit 0044c5f

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

drivers/dma/idxd/registers.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ union gen_cap_reg {
4545
u64 rsvd3:32;
4646
};
4747
u64 bits;
48-
} __packed;
48+
};
4949
#define IDXD_GENCAP_OFFSET 0x10
5050

5151
union wq_cap_reg {
@@ -65,7 +65,7 @@ union wq_cap_reg {
6565
u64 rsvd4:8;
6666
};
6767
u64 bits;
68-
} __packed;
68+
};
6969
#define IDXD_WQCAP_OFFSET 0x20
7070
#define IDXD_WQCFG_MIN 5
7171

@@ -79,7 +79,7 @@ union group_cap_reg {
7979
u64 rsvd:45;
8080
};
8181
u64 bits;
82-
} __packed;
82+
};
8383
#define IDXD_GRPCAP_OFFSET 0x30
8484

8585
union engine_cap_reg {
@@ -88,7 +88,7 @@ union engine_cap_reg {
8888
u64 rsvd:56;
8989
};
9090
u64 bits;
91-
} __packed;
91+
};
9292

9393
#define IDXD_ENGCAP_OFFSET 0x38
9494

@@ -114,7 +114,7 @@ union offsets_reg {
114114
u64 rsvd:48;
115115
};
116116
u64 bits[2];
117-
} __packed;
117+
};
118118

119119
#define IDXD_TABLE_MULT 0x100
120120

@@ -128,7 +128,7 @@ union gencfg_reg {
128128
u32 rsvd2:18;
129129
};
130130
u32 bits;
131-
} __packed;
131+
};
132132

133133
#define IDXD_GENCTRL_OFFSET 0x88
134134
union genctrl_reg {
@@ -139,7 +139,7 @@ union genctrl_reg {
139139
u32 rsvd:29;
140140
};
141141
u32 bits;
142-
} __packed;
142+
};
143143

144144
#define IDXD_GENSTATS_OFFSET 0x90
145145
union gensts_reg {
@@ -149,7 +149,7 @@ union gensts_reg {
149149
u32 rsvd:28;
150150
};
151151
u32 bits;
152-
} __packed;
152+
};
153153

154154
enum idxd_device_status_state {
155155
IDXD_DEVICE_STATE_DISABLED = 0,
@@ -183,7 +183,7 @@ union idxd_command_reg {
183183
u32 int_req:1;
184184
};
185185
u32 bits;
186-
} __packed;
186+
};
187187

188188
enum idxd_cmd {
189189
IDXD_CMD_ENABLE_DEVICE = 1,
@@ -213,7 +213,7 @@ union cmdsts_reg {
213213
u8 active:1;
214214
};
215215
u32 bits;
216-
} __packed;
216+
};
217217
#define IDXD_CMDSTS_ACTIVE 0x80000000
218218
#define IDXD_CMDSTS_ERR_MASK 0xff
219219
#define IDXD_CMDSTS_RES_SHIFT 8
@@ -284,7 +284,7 @@ union sw_err_reg {
284284
u64 rsvd5;
285285
};
286286
u64 bits[4];
287-
} __packed;
287+
};
288288

289289
union iaa_cap_reg {
290290
struct {
@@ -303,7 +303,7 @@ union iaa_cap_reg {
303303
u64 rsvd:52;
304304
};
305305
u64 bits;
306-
} __packed;
306+
};
307307

308308
#define IDXD_IAACAP_OFFSET 0x180
309309

@@ -320,7 +320,7 @@ union evlcfg_reg {
320320
u64 rsvd2:28;
321321
};
322322
u64 bits[2];
323-
} __packed;
323+
};
324324

325325
#define IDXD_EVL_SIZE_MIN 0x0040
326326
#define IDXD_EVL_SIZE_MAX 0xffff
@@ -334,7 +334,7 @@ union msix_perm {
334334
u32 pasid:20;
335335
};
336336
u32 bits;
337-
} __packed;
337+
};
338338

339339
union group_flags {
340340
struct {
@@ -352,13 +352,13 @@ union group_flags {
352352
u64 rsvd5:26;
353353
};
354354
u64 bits;
355-
} __packed;
355+
};
356356

357357
struct grpcfg {
358358
u64 wqs[4];
359359
u64 engines;
360360
union group_flags flags;
361-
} __packed;
361+
};
362362

363363
union wqcfg {
364364
struct {
@@ -410,7 +410,7 @@ union wqcfg {
410410
u64 op_config[4];
411411
};
412412
u32 bits[16];
413-
} __packed;
413+
};
414414

415415
#define WQCFG_PASID_IDX 2
416416
#define WQCFG_PRIVL_IDX 2
@@ -474,7 +474,7 @@ union idxd_perfcap {
474474
u64 rsvd3:8;
475475
};
476476
u64 bits;
477-
} __packed;
477+
};
478478

479479
#define IDXD_EVNTCAP_OFFSET 0x80
480480
union idxd_evntcap {
@@ -483,7 +483,7 @@ union idxd_evntcap {
483483
u64 rsvd:36;
484484
};
485485
u64 bits;
486-
} __packed;
486+
};
487487

488488
struct idxd_event {
489489
union {
@@ -493,7 +493,7 @@ struct idxd_event {
493493
};
494494
u32 val;
495495
};
496-
} __packed;
496+
};
497497

498498
#define IDXD_CNTRCAP_OFFSET 0x800
499499
struct idxd_cntrcap {
@@ -506,7 +506,7 @@ struct idxd_cntrcap {
506506
u32 val;
507507
};
508508
struct idxd_event events[];
509-
} __packed;
509+
};
510510

511511
#define IDXD_PERFRST_OFFSET 0x10
512512
union idxd_perfrst {
@@ -516,7 +516,7 @@ union idxd_perfrst {
516516
u32 rsvd:30;
517517
};
518518
u32 val;
519-
} __packed;
519+
};
520520

521521
#define IDXD_OVFSTATUS_OFFSET 0x30
522522
#define IDXD_PERFFRZ_OFFSET 0x20
@@ -533,7 +533,7 @@ union idxd_cntrcfg {
533533
u64 rsvd3:4;
534534
};
535535
u64 val;
536-
} __packed;
536+
};
537537

538538
#define IDXD_FLTCFG_OFFSET 0x300
539539

@@ -543,15 +543,15 @@ union idxd_cntrdata {
543543
u64 event_count_value;
544544
};
545545
u64 val;
546-
} __packed;
546+
};
547547

548548
union event_cfg {
549549
struct {
550550
u64 event_cat:4;
551551
u64 event_enc:28;
552552
};
553553
u64 val;
554-
} __packed;
554+
};
555555

556556
union filter_cfg {
557557
struct {
@@ -562,7 +562,7 @@ union filter_cfg {
562562
u64 eng:8;
563563
};
564564
u64 val;
565-
} __packed;
565+
};
566566

567567
#define IDXD_EVLSTATUS_OFFSET 0xf0
568568

@@ -580,7 +580,7 @@ union evl_status_reg {
580580
u32 bits_upper32;
581581
};
582582
u64 bits;
583-
} __packed;
583+
};
584584

585585
#define IDXD_MAX_BATCH_IDENT 256
586586

@@ -620,17 +620,17 @@ struct __evl_entry {
620620
};
621621
u64 fault_addr;
622622
u64 rsvd5;
623-
} __packed;
623+
};
624624

625625
struct dsa_evl_entry {
626626
struct __evl_entry e;
627627
struct dsa_completion_record cr;
628-
} __packed;
628+
};
629629

630630
struct iax_evl_entry {
631631
struct __evl_entry e;
632632
u64 rsvd[4];
633633
struct iax_completion_record cr;
634-
} __packed;
634+
};
635635

636636
#endif

0 commit comments

Comments
 (0)