u64 alignment behaves differently depending on the architecture and so <uapi/linux/types.h> offers __aligned_u64 to achieve consistent behavior in kernel<->userspace ABIs. There are structs in <uapi/linux/vfio.h> that can trivially be updated to __aligned_u64 because the struct sizes are multiples of 8 bytes. There is no change in memory layout on any CPU architecture and therefore this change is safe. The commits that follow this one handle the trickier cases where explanation about ABI breakage is necessary.
Unified · Split
| @@ -277,8 +277,8 @@ struct vfio_region_info { · 276 unmodified lines | |||
| 277 | #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) /* Info supports caps */ | 277 | #define VFIO_REGION_INFO_FLAG_CAPS (1 << 3) /* Info supports caps */ |
| 278 | __u32 index; /* Region index */ | 278 | __u32 index; /* Region index */ |
| 279 | __u32 cap_offset; /* Offset within info struct of first cap */ | 279 | __u32 cap_offset; /* Offset within info struct of first cap */ |
| 280 | __u64 size; /* Region size (bytes) */ | 280 | __aligned_u64 size; /* Region size (bytes) */ |
| 281 | __u64 offset; /* Region offset from start of device fd */ | 281 | __aligned_u64 offset; /* Region offset from start of device fd */ |
| 282 | }; | 282 | }; |
| 283 | #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) | 283 | #define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8) |
| 284 | 284 | ||
| @@ -294,8 +294,8 @@ struct vfio_region_info { · 9 unmodified lines | |||
| 294 | #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 | 294 | #define VFIO_REGION_INFO_CAP_SPARSE_MMAP 1 |
| 295 | 295 | ||
| 296 | struct vfio_region_sparse_mmap_area { | 296 | struct vfio_region_sparse_mmap_area { |
| 297 | __u64 offset; /* Offset of mmap'able area within region */ | 297 | __aligned_u64 offset; /* Offset of mmap'able area within region */ |
| 298 | __u64 size; /* Size of mmap'able area */ | 298 | __aligned_u64 size; /* Size of mmap'able area */ |
| 299 | }; | 299 | }; |
| 300 | 300 | ||
| 301 | struct vfio_region_info_cap_sparse_mmap { | 301 | struct vfio_region_info_cap_sparse_mmap { |
| @@ -450,9 +450,9 @@ struct vfio_device_migration_info { · 148 unmodified lines | |||
| 450 | VFIO_DEVICE_STATE_V1_RESUMING) | 450 | VFIO_DEVICE_STATE_V1_RESUMING) |
| 451 | 451 | ||
| 452 | __u32 reserved; | 452 | __u32 reserved; |
| 453 | __u64 pending_bytes; | 453 | __aligned_u64 pending_bytes; |
| 454 | __u64 data_offset; | 454 | __aligned_u64 data_offset; |
| 455 | __u64 data_size; | 455 | __aligned_u64 data_size; |
| 456 | }; | 456 | }; |
| 457 | 457 | ||
| 458 | /* | 458 | /* |
| @@ -476,7 +476,7 @@ struct vfio_device_migration_info { · 17 unmodified lines | |||
| 476 | 476 | ||
| 477 | struct vfio_region_info_cap_nvlink2_ssatgt { | 477 | struct vfio_region_info_cap_nvlink2_ssatgt { |
| 478 | struct vfio_info_cap_header header; | 478 | struct vfio_info_cap_header header; |
| 479 | __u64 tgt; | 479 | __aligned_u64 tgt; |
| 480 | }; | 480 | }; |
| 481 | 481 | ||
| 482 | /* | 482 | /* |
| @@ -1470,7 +1470,7 @@ struct vfio_iommu_type1_info { · 987 unmodified lines | |||
| 1470 | __u32 flags; | 1470 | __u32 flags; |
| 1471 | #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ | 1471 | #define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */ |
| 1472 | #define VFIO_IOMMU_INFO_CAPS (1 << 1) /* Info supports caps */ | 1472 | #define VFIO_IOMMU_INFO_CAPS (1 << 1) /* Info supports caps */ |
| 1473 | __u64 iova_pgsizes; /* Bitmap of supported page sizes */ | 1473 | __aligned_u64 iova_pgsizes; /* Bitmap of supported page sizes */ |
| 1474 | __u32 cap_offset; /* Offset within info struct of first cap */ | 1474 | __u32 cap_offset; /* Offset within info struct of first cap */ |
| 1475 | __u32 pad; | 1475 | __u32 pad; |
| 1476 | }; | 1476 | }; |