vfio: selftests: Clean up <uapi/linux/types.h> includes
Subsystems (4)
David Matlack
maintainercover vfio: selftests: Clean up <uapi/linux/types.h> includes
Small clean up series to eliminate the extra includes of <uapi/linux/types.h> from various VFIO selftests files. This include is not causing any problems now, but it is causing benign typedef redifinitions. Those redifinitions will become a problem when the VFIO selftests library is built into KVM selftests, since KVM selftests build with -std=gnu99.
David Matlack (2):
tools include: Add definitions for __aligned_{l,b}e64
vfio: selftests: Drop <uapi/linux/types.h> includes
tools/include/linux/types.h | 8 ++++++++ .../selftests/vfio/lib/include/libvfio/iova_allocator.h | 1 - tools/testing/selftests/vfio/lib/iommu.c | 1 - tools/testing/selftests/vfio/lib/iova_allocator.c | 1 - tools/testing/selftests/vfio/lib/vfio_pci_device.c | 1 - tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 1 - tools/testing/selftests/vfio/vfio_iommufd_setup_test.c | 1 - 7 files changed, 8 insertions(+), 6 deletions(-)
base-commit: d721f52e31553a848e0e9947ca15a49c5674aef3
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
David Matlack
maintainerPATCH 1/2 tools include: Add definitions for __aligned_{l,b}e64
Add definitions for the missing __aligned_le64 and __aligned_be64 to tools/include/linux/types.h. The former is needed by <linux/iommufd.h> for builds where tools/include/ is on the include path ahead of usr/include/.
--- tools/include/linux/types.h | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/include/linux/types.h +8 -0
@@ -88,6 +88,14 @@ typedef struct {# define __aligned_u64 __u64 __attribute__((aligned(8)))#endif +#ifndef __aligned_be64 +# define __aligned_be64 __be64 __attribute__((aligned(8))) +#endif + +#ifndef __aligned_le64 +# define __aligned_le64 __le64 __attribute__((aligned(8))) +#endif +struct list_head {struct list_head *next, *prev; };
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
David Matlack
maintainerPATCH 2/2 vfio: selftests: Drop <uapi/linux/types.h> includes
In reply to David MatlackDrop the <uapi/linux/types.h> includes now that <linux/types.h> (tools/include/linux/types.h) has a definition for __aligned_le64, which is needed by <linux/iommufd.h>.
Including <uapi/linux/types.h> is harmless but causes benign typedef redifitions. This is not a problem for VFIO selftests but be an issue when the VFIO selftests library is built into KVM selftests, since they are built with -std=gnu99 which does not allow typedef redifitions.
No functional change intended.
--- .../testing/selftests/vfio/lib/include/libvfio/iova_allocator.h | 1 - tools/testing/selftests/vfio/lib/iommu.c | 1 - tools/testing/selftests/vfio/lib/iova_allocator.c | 1 - tools/testing/selftests/vfio/lib/vfio_pci_device.c | 1 - tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 1 - tools/testing/selftests/vfio/vfio_iommufd_setup_test.c | 1 - 6 files changed, 6 deletions(-)
tools/testing/selftests/vfio/lib/include/libvfio/iova_allocator.h +0 -1
@@ -2,7 +2,6 @@#ifndef SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_IOVA_ALLOCATOR_H #define SELFTESTS_VFIO_LIB_INCLUDE_LIBVFIO_IOVA_ALLOCATOR_H -#include <uapi/linux/types.h> #include <linux/list.h> #include <linux/types.h> #include <linux/iommufd.h>
tools/testing/selftests/vfio/lib/iommu.c +0 -1
@@ -11,7 +11,6 @@#include <sys/ioctl.h> #include <sys/mman.h> -#include <uapi/linux/types.h> #include <linux/limits.h> #include <linux/mman.h> #include <linux/types.h>
tools/testing/selftests/vfio/lib/iova_allocator.c +0 -1
@@ -11,7 +11,6 @@#include <sys/ioctl.h> #include <sys/mman.h> -#include <uapi/linux/types.h> #include <linux/iommufd.h> #include <linux/limits.h> #include <linux/mman.h>
tools/testing/selftests/vfio/lib/vfio_pci_device.c +0 -1
@@ -11,7 +11,6 @@#include <sys/ioctl.h> #include <sys/mman.h> -#include <uapi/linux/types.h> #include <linux/iommufd.h> #include <linux/limits.h> #include <linux/mman.h>
tools/testing/selftests/vfio/vfio_dma_mapping_test.c +0 -1
@@ -3,7 +3,6 @@#include <sys/mman.h> #include <unistd.h> -#include <uapi/linux/types.h> #include <linux/iommufd.h> #include <linux/limits.h> #include <linux/mman.h>
tools/testing/selftests/vfio/vfio_iommufd_setup_test.c +0 -1
@@ -1,5 +1,4 @@// SPDX-License-Identifier: GPL-2.0 -#include <uapi/linux/types.h> #include <linux/limits.h> #include <linux/sizes.h> #include <linux/vfio.h>
Signature · 1 line
2.52.0.322.g1dd061c0dc-goog
Quoted 24 lines · On Fri, 19 Dec 2025 23:38:16 +0000 David Matlack <[email protected]> wrote:
Small clean up series to eliminate the extra includes of <
uapi/linux/types.h> from various VFIO selftests files. This include is not causing any problems now, but it is causing benign typedef redifinitions. Those redifinitions will become a problem when the VFIO selftests library is built into KVM selftests, since KVM selftests build with -std=gnu99.Cc Yosry Ahmed <[email protected]>Cc Josh Hilke <[email protected]>David Matlack (2):
tools include: Add definitions for __aligned_{l,b}e64
vfio: selftests: Drop <uapi/linux/types.h> includestools/include/linux/types.h | 8 ++++++++ .../selftests/vfio/lib/include/libvfio/iova_allocator.h | 1 - tools/testing/selftests/vfio/lib/iommu.c | 1 - tools/testing/selftests/vfio/lib/iova_allocator.c | 1 - tools/testing/selftests/vfio/lib/vfio_pci_device.c | 1 - tools/testing/selftests/vfio/vfio_dma_mapping_test.c | 1 - tools/testing/selftests/vfio/vfio_iommufd_setup_test.c | 1 - 7 files changed, 8 insertions(+), 6 deletions(-)
Quoted 1 line
base-commit:
d721f52e31553a848e0e9947ca15a49c5674aef3
Applied to vfio for-linus branch for v6.19. Thanks,
Alex