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

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 <yi.sun@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
Link: https://lore.kernel.org/r/20250404053614.3096769-1-yi.sun@intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Yi Sun and committed by
Vinod Koul
0044c5fc ddf16e16

+30 -30
+30 -30
drivers/dma/idxd/registers.h
··· 45 45 u64 rsvd3:32; 46 46 }; 47 47 u64 bits; 48 - } __packed; 48 + }; 49 49 #define IDXD_GENCAP_OFFSET 0x10 50 50 51 51 union wq_cap_reg { ··· 65 65 u64 rsvd4:8; 66 66 }; 67 67 u64 bits; 68 - } __packed; 68 + }; 69 69 #define IDXD_WQCAP_OFFSET 0x20 70 70 #define IDXD_WQCFG_MIN 5 71 71 ··· 79 79 u64 rsvd:45; 80 80 }; 81 81 u64 bits; 82 - } __packed; 82 + }; 83 83 #define IDXD_GRPCAP_OFFSET 0x30 84 84 85 85 union engine_cap_reg { ··· 88 88 u64 rsvd:56; 89 89 }; 90 90 u64 bits; 91 - } __packed; 91 + }; 92 92 93 93 #define IDXD_ENGCAP_OFFSET 0x38 94 94 ··· 114 114 u64 rsvd:48; 115 115 }; 116 116 u64 bits[2]; 117 - } __packed; 117 + }; 118 118 119 119 #define IDXD_TABLE_MULT 0x100 120 120 ··· 128 128 u32 rsvd2:18; 129 129 }; 130 130 u32 bits; 131 - } __packed; 131 + }; 132 132 133 133 #define IDXD_GENCTRL_OFFSET 0x88 134 134 union genctrl_reg { ··· 139 139 u32 rsvd:29; 140 140 }; 141 141 u32 bits; 142 - } __packed; 142 + }; 143 143 144 144 #define IDXD_GENSTATS_OFFSET 0x90 145 145 union gensts_reg { ··· 149 149 u32 rsvd:28; 150 150 }; 151 151 u32 bits; 152 - } __packed; 152 + }; 153 153 154 154 enum idxd_device_status_state { 155 155 IDXD_DEVICE_STATE_DISABLED = 0, ··· 183 183 u32 int_req:1; 184 184 }; 185 185 u32 bits; 186 - } __packed; 186 + }; 187 187 188 188 enum idxd_cmd { 189 189 IDXD_CMD_ENABLE_DEVICE = 1, ··· 213 213 u8 active:1; 214 214 }; 215 215 u32 bits; 216 - } __packed; 216 + }; 217 217 #define IDXD_CMDSTS_ACTIVE 0x80000000 218 218 #define IDXD_CMDSTS_ERR_MASK 0xff 219 219 #define IDXD_CMDSTS_RES_SHIFT 8 ··· 284 284 u64 rsvd5; 285 285 }; 286 286 u64 bits[4]; 287 - } __packed; 287 + }; 288 288 289 289 union iaa_cap_reg { 290 290 struct { ··· 303 303 u64 rsvd:52; 304 304 }; 305 305 u64 bits; 306 - } __packed; 306 + }; 307 307 308 308 #define IDXD_IAACAP_OFFSET 0x180 309 309 ··· 320 320 u64 rsvd2:28; 321 321 }; 322 322 u64 bits[2]; 323 - } __packed; 323 + }; 324 324 325 325 #define IDXD_EVL_SIZE_MIN 0x0040 326 326 #define IDXD_EVL_SIZE_MAX 0xffff ··· 334 334 u32 pasid:20; 335 335 }; 336 336 u32 bits; 337 - } __packed; 337 + }; 338 338 339 339 union group_flags { 340 340 struct { ··· 352 352 u64 rsvd5:26; 353 353 }; 354 354 u64 bits; 355 - } __packed; 355 + }; 356 356 357 357 struct grpcfg { 358 358 u64 wqs[4]; 359 359 u64 engines; 360 360 union group_flags flags; 361 - } __packed; 361 + }; 362 362 363 363 union wqcfg { 364 364 struct { ··· 410 410 u64 op_config[4]; 411 411 }; 412 412 u32 bits[16]; 413 - } __packed; 413 + }; 414 414 415 415 #define WQCFG_PASID_IDX 2 416 416 #define WQCFG_PRIVL_IDX 2 ··· 474 474 u64 rsvd3:8; 475 475 }; 476 476 u64 bits; 477 - } __packed; 477 + }; 478 478 479 479 #define IDXD_EVNTCAP_OFFSET 0x80 480 480 union idxd_evntcap { ··· 483 483 u64 rsvd:36; 484 484 }; 485 485 u64 bits; 486 - } __packed; 486 + }; 487 487 488 488 struct idxd_event { 489 489 union { ··· 493 493 }; 494 494 u32 val; 495 495 }; 496 - } __packed; 496 + }; 497 497 498 498 #define IDXD_CNTRCAP_OFFSET 0x800 499 499 struct idxd_cntrcap { ··· 506 506 u32 val; 507 507 }; 508 508 struct idxd_event events[]; 509 - } __packed; 509 + }; 510 510 511 511 #define IDXD_PERFRST_OFFSET 0x10 512 512 union idxd_perfrst { ··· 516 516 u32 rsvd:30; 517 517 }; 518 518 u32 val; 519 - } __packed; 519 + }; 520 520 521 521 #define IDXD_OVFSTATUS_OFFSET 0x30 522 522 #define IDXD_PERFFRZ_OFFSET 0x20 ··· 533 533 u64 rsvd3:4; 534 534 }; 535 535 u64 val; 536 - } __packed; 536 + }; 537 537 538 538 #define IDXD_FLTCFG_OFFSET 0x300 539 539 ··· 543 543 u64 event_count_value; 544 544 }; 545 545 u64 val; 546 - } __packed; 546 + }; 547 547 548 548 union event_cfg { 549 549 struct { ··· 551 551 u64 event_enc:28; 552 552 }; 553 553 u64 val; 554 - } __packed; 554 + }; 555 555 556 556 union filter_cfg { 557 557 struct { ··· 562 562 u64 eng:8; 563 563 }; 564 564 u64 val; 565 - } __packed; 565 + }; 566 566 567 567 #define IDXD_EVLSTATUS_OFFSET 0xf0 568 568 ··· 580 580 u32 bits_upper32; 581 581 }; 582 582 u64 bits; 583 - } __packed; 583 + }; 584 584 585 585 #define IDXD_MAX_BATCH_IDENT 256 586 586 ··· 620 620 }; 621 621 u64 fault_addr; 622 622 u64 rsvd5; 623 - } __packed; 623 + }; 624 624 625 625 struct dsa_evl_entry { 626 626 struct __evl_entry e; 627 627 struct dsa_completion_record cr; 628 - } __packed; 628 + }; 629 629 630 630 struct iax_evl_entry { 631 631 struct __evl_entry e; 632 632 u64 rsvd[4]; 633 633 struct iax_completion_record cr; 634 - } __packed; 634 + }; 635 635 636 636 #endif