Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH 0/2] vfio: selftests: Clean up <uapi/linux/types.h> includes
@ 2025-12-19 23:38 David Matlack
  2025-12-19 23:38 ` [PATCH 1/2] tools include: Add definitions for __aligned_{l,b}e64 David Matlack
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David Matlack @ 2025-12-19 23:38 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Alex Mastro, Andrew Morton, David Matlack, Josh Hilke, kvm,
	linux-kernel, linux-kselftest, Raghavendra Rao Ananta, Shuah Khan,
	Wei Yang, Yosry Ahmed

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 <yosryahmed@google.com>
Cc: Josh Hilke <jrhilke@google.com>

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
-- 
2.52.0.322.g1dd061c0dc-goog


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] tools include: Add definitions for __aligned_{l,b}e64
  2025-12-19 23:38 [PATCH 0/2] vfio: selftests: Clean up <uapi/linux/types.h> includes David Matlack
@ 2025-12-19 23:38 ` David Matlack
  2025-12-19 23:38 ` [PATCH 2/2] vfio: selftests: Drop <uapi/linux/types.h> includes David Matlack
  2025-12-23 23:42 ` [PATCH 0/2] vfio: selftests: Clean up " Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: David Matlack @ 2025-12-19 23:38 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Alex Mastro, Andrew Morton, David Matlack, Josh Hilke, kvm,
	linux-kernel, linux-kselftest, Raghavendra Rao Ananta, Shuah Khan,
	Wei Yang, Yosry Ahmed

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/.

Signed-off-by: David Matlack <dmatlack@google.com>
---
 tools/include/linux/types.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/include/linux/types.h b/tools/include/linux/types.h
index 4928e33d44ac..d41f8a261bce 100644
--- a/tools/include/linux/types.h
+++ b/tools/include/linux/types.h
@@ -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;
 };
-- 
2.52.0.322.g1dd061c0dc-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] vfio: selftests: Drop <uapi/linux/types.h> includes
  2025-12-19 23:38 [PATCH 0/2] vfio: selftests: Clean up <uapi/linux/types.h> includes David Matlack
  2025-12-19 23:38 ` [PATCH 1/2] tools include: Add definitions for __aligned_{l,b}e64 David Matlack
@ 2025-12-19 23:38 ` David Matlack
  2025-12-23 23:42 ` [PATCH 0/2] vfio: selftests: Clean up " Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: David Matlack @ 2025-12-19 23:38 UTC (permalink / raw)
  To: Alex Williamson
  Cc: Alex Mastro, Andrew Morton, David Matlack, Josh Hilke, kvm,
	linux-kernel, linux-kselftest, Raghavendra Rao Ananta, Shuah Khan,
	Wei Yang, Yosry Ahmed

Drop 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.

Signed-off-by: David Matlack <dmatlack@google.com>
---
 .../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(-)

diff --git a/tools/testing/selftests/vfio/lib/include/libvfio/iova_allocator.h b/tools/testing/selftests/vfio/lib/include/libvfio/iova_allocator.h
index 8f1d994e9ea2..c7c0796a757f 100644
--- a/tools/testing/selftests/vfio/lib/include/libvfio/iova_allocator.h
+++ b/tools/testing/selftests/vfio/lib/include/libvfio/iova_allocator.h
@@ -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>
diff --git a/tools/testing/selftests/vfio/lib/iommu.c b/tools/testing/selftests/vfio/lib/iommu.c
index 8079d43523f3..58b7fb7430d4 100644
--- a/tools/testing/selftests/vfio/lib/iommu.c
+++ b/tools/testing/selftests/vfio/lib/iommu.c
@@ -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>
diff --git a/tools/testing/selftests/vfio/lib/iova_allocator.c b/tools/testing/selftests/vfio/lib/iova_allocator.c
index a12b0a51e9e6..8c1cc86b70cd 100644
--- a/tools/testing/selftests/vfio/lib/iova_allocator.c
+++ b/tools/testing/selftests/vfio/lib/iova_allocator.c
@@ -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>
diff --git a/tools/testing/selftests/vfio/lib/vfio_pci_device.c b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
index 13fdb4b0b10f..0b335e4e0435 100644
--- a/tools/testing/selftests/vfio/lib/vfio_pci_device.c
+++ b/tools/testing/selftests/vfio/lib/vfio_pci_device.c
@@ -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>
diff --git a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
index 5397822c3dd4..41b8cae7a6ae 100644
--- a/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
+++ b/tools/testing/selftests/vfio/vfio_dma_mapping_test.c
@@ -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>
diff --git a/tools/testing/selftests/vfio/vfio_iommufd_setup_test.c b/tools/testing/selftests/vfio/vfio_iommufd_setup_test.c
index caf1c6291f3d..5d980b148d83 100644
--- a/tools/testing/selftests/vfio/vfio_iommufd_setup_test.c
+++ b/tools/testing/selftests/vfio/vfio_iommufd_setup_test.c
@@ -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>
-- 
2.52.0.322.g1dd061c0dc-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] vfio: selftests: Clean up <uapi/linux/types.h> includes
  2025-12-19 23:38 [PATCH 0/2] vfio: selftests: Clean up <uapi/linux/types.h> includes David Matlack
  2025-12-19 23:38 ` [PATCH 1/2] tools include: Add definitions for __aligned_{l,b}e64 David Matlack
  2025-12-19 23:38 ` [PATCH 2/2] vfio: selftests: Drop <uapi/linux/types.h> includes David Matlack
@ 2025-12-23 23:42 ` Alex Williamson
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2025-12-23 23:42 UTC (permalink / raw)
  To: David Matlack
  Cc: Alex Mastro, Andrew Morton, Josh Hilke, kvm, linux-kernel,
	linux-kselftest, Raghavendra Rao Ananta, Shuah Khan, Wei Yang,
	Yosry Ahmed

On Fri, 19 Dec 2025 23:38:16 +0000
David Matlack <dmatlack@google.com> 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 <yosryahmed@google.com>
> Cc: Josh Hilke <jrhilke@google.com>
> 
> 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

Applied to vfio for-linus branch for v6.19.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-23 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 23:38 [PATCH 0/2] vfio: selftests: Clean up <uapi/linux/types.h> includes David Matlack
2025-12-19 23:38 ` [PATCH 1/2] tools include: Add definitions for __aligned_{l,b}e64 David Matlack
2025-12-19 23:38 ` [PATCH 2/2] vfio: selftests: Drop <uapi/linux/types.h> includes David Matlack
2025-12-23 23:42 ` [PATCH 0/2] vfio: selftests: Clean up " Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox