tools/testing/selftests/vfio/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+)
Only build vfio self-tests on arm64 and x86_64; these are the only
architectures where the vfio self-tests are run. Addresses compiler
warnings for format and conversions on i386.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202601211830.aBEjmEFD-lkp@intel.com/
Signed-off-by: Ted Logan <tedlogan@fb.com>
---
Do not build vfio self-tests for 32-bit architectures, where they're
untested and unmaintained. Only build these tests for arm64 and x86_64,
where they're regularly tested.
Compiler warning fixed by patch:
In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6:
tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:49:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
49 | VFIO_ASSERT_EQ(__iommu_unmap(iommu, region, NULL), 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
| ~~~~
27 | (u64)__lhs, #_op, (u64)__rhs); \
| ^~~~~~~~~~
---
tools/testing/selftests/vfio/Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile
index ead27892ab65..eeb63ea2b4da 100644
--- a/tools/testing/selftests/vfio/Makefile
+++ b/tools/testing/selftests/vfio/Makefile
@@ -1,3 +1,10 @@
+ARCH ?= $(shell uname -m 2>/dev/null || echo not)
+
+ifeq (,$(filter $(ARCH),arm64 x86_64))
+nothing:
+.PHONY: all clean run_tests install
+.SILENT:
+else
CFLAGS = $(KHDR_INCLUDES)
TEST_GEN_PROGS += vfio_dma_mapping_test
TEST_GEN_PROGS += vfio_dma_mapping_mmio_test
@@ -28,3 +35,4 @@ TEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_PROGS_O) $(LIBVFIO_O))
-include $(TEST_DEP_FILES)
EXTRA_CLEAN += $(TEST_GEN_PROGS_O) $(TEST_DEP_FILES)
+endif
---
base-commit: c3cbc276c2a33b04fc78a86cdb2ddce094cb3614
change-id: 20260130-vfio-selftest-only-64bit-422518bdeba7
Best regards,
--
Ted Logan <tedlogan@fb.com>
On 2026-01-30 04:02 PM, Ted Logan wrote: > Only build vfio self-tests on arm64 and x86_64; these are the only > architectures where the vfio self-tests are run. Addresses compiler > warnings for format and conversions on i386. > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202601211830.aBEjmEFD-lkp@intel.com/ > Signed-off-by: Ted Logan <tedlogan@fb.com> > --- > Do not build vfio self-tests for 32-bit architectures, where they're > untested and unmaintained. Only build these tests for arm64 and x86_64, > where they're regularly tested. > > Compiler warning fixed by patch: > > In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6: > tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:49:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat] > 49 | VFIO_ASSERT_EQ(__iommu_unmap(iommu, region, NULL), 0); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ' > 32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP' > 26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \ > | ~~~~ > 27 | (u64)__lhs, #_op, (u64)__rhs); \ > | ^~~~~~~~~~ > --- > tools/testing/selftests/vfio/Makefile | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile > index ead27892ab65..eeb63ea2b4da 100644 > --- a/tools/testing/selftests/vfio/Makefile > +++ b/tools/testing/selftests/vfio/Makefile > @@ -1,3 +1,10 @@ > +ARCH ?= $(shell uname -m 2>/dev/null || echo not) What's the reason for the stderr redirection and "echo not"? > + > +ifeq (,$(filter $(ARCH),arm64 x86_64)) > +nothing: > +.PHONY: all clean run_tests install > +.SILENT: I think you can just add the following line so that this is a valid empty selftest Makefile on unsupported architectures, without having to define all those targets: include ../lib.mk Also I would recommend spacing things out a little so that the unsupported architecture handling is more "off to the side". e.g. diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile index ead27892ab65..9386f75b590d 100644 --- a/tools/testing/selftests/vfio/Makefile +++ b/tools/testing/selftests/vfio/Makefile @@ -1,3 +1,10 @@ +ARCH ?= $(shell uname -m) + +ifeq (,$(filter $(ARCH),arm64 x86_64)) +# Do nothing on unsupported architectures. +include ../lib.mk +else + CFLAGS = $(KHDR_INCLUDES) TEST_GEN_PROGS += vfio_dma_mapping_test TEST_GEN_PROGS += vfio_dma_mapping_mmio_test @@ -28,3 +35,5 @@ TEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_PROGS_O) $(LIBVFIO_O)) -include $(TEST_DEP_FILES) EXTRA_CLEAN += $(TEST_GEN_PROGS_O) $(TEST_DEP_FILES) + +endif > +else > CFLAGS = $(KHDR_INCLUDES) > TEST_GEN_PROGS += vfio_dma_mapping_test > TEST_GEN_PROGS += vfio_dma_mapping_mmio_test > @@ -28,3 +35,4 @@ TEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_PROGS_O) $(LIBVFIO_O)) > -include $(TEST_DEP_FILES) > > EXTRA_CLEAN += $(TEST_GEN_PROGS_O) $(TEST_DEP_FILES) > +endif > > --- > base-commit: c3cbc276c2a33b04fc78a86cdb2ddce094cb3614 > change-id: 20260130-vfio-selftest-only-64bit-422518bdeba7 > > Best regards, > -- > Ted Logan <tedlogan@fb.com> >
On Mon, Feb 02, 2026 at 11:33:21PM +0000, David Matlack wrote: > On 2026-01-30 04:02 PM, Ted Logan wrote: > > Only build vfio self-tests on arm64 and x86_64; these are the only > > architectures where the vfio self-tests are run. Addresses compiler > > warnings for format and conversions on i386. > > > > Reported-by: kernel test robot <lkp@intel.com> > > Closes: https://lore.kernel.org/oe-kbuild-all/202601211830.aBEjmEFD-lkp@intel.com/ > > Signed-off-by: Ted Logan <tedlogan@fb.com> > > --- > > Do not build vfio self-tests for 32-bit architectures, where they're > > untested and unmaintained. Only build these tests for arm64 and x86_64, > > where they're regularly tested. > > > > Compiler warning fixed by patch: > > > > In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6: > > tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:49:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat] > > 49 | VFIO_ASSERT_EQ(__iommu_unmap(iommu, region, NULL), 0); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ' > > 32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__) > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP' > > 26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \ > > | ~~~~ > > 27 | (u64)__lhs, #_op, (u64)__rhs); \ > > | ^~~~~~~~~~ > > --- > > tools/testing/selftests/vfio/Makefile | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile > > index ead27892ab65..eeb63ea2b4da 100644 > > --- a/tools/testing/selftests/vfio/Makefile > > +++ b/tools/testing/selftests/vfio/Makefile > > @@ -1,3 +1,10 @@ > > +ARCH ?= $(shell uname -m 2>/dev/null || echo not) > > What's the reason for the stderr redirection and "echo not"? I got that from tools/testing/selftests/arm64/Makefile but it's probably not all that useful. I guess the idea is to allow for the possibility that uname could fail, but I don't really know if that's really useful. > I think you can just add the following line so that this is a valid > empty selftest Makefile on unsupported architectures, without having to > define all those targets: > > include ../lib.mk > > Also I would recommend spacing things out a little so that the > unsupported architecture handling is more "off to the side". Thanks for the suggestion, I'll post an updated patch shortly. - Ted
On Fri, 30 Jan 2026 16:02:16 -0800
Ted Logan <tedlogan@fb.com> wrote:
> Only build vfio self-tests on arm64 and x86_64; these are the only
> architectures where the vfio self-tests are run. Addresses compiler
> warnings for format and conversions on i386.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202601211830.aBEjmEFD-lkp@intel.com/
> Signed-off-by: Ted Logan <tedlogan@fb.com>
> ---
> Do not build vfio self-tests for 32-bit architectures, where they're
> untested and unmaintained. Only build these tests for arm64 and x86_64,
> where they're regularly tested.
>
> Compiler warning fixed by patch:
>
> In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6:
> tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:49:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
> 49 | VFIO_ASSERT_EQ(__iommu_unmap(iommu, region, NULL), 0);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
> 32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
> 26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
> | ~~~~
> 27 | (u64)__lhs, #_op, (u64)__rhs); \
> | ^~~~~~~~~~
> ---
> tools/testing/selftests/vfio/Makefile | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile
> index ead27892ab65..eeb63ea2b4da 100644
> --- a/tools/testing/selftests/vfio/Makefile
> +++ b/tools/testing/selftests/vfio/Makefile
> @@ -1,3 +1,10 @@
> +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
> +
> +ifeq (,$(filter $(ARCH),arm64 x86_64))
> +nothing:
> +.PHONY: all clean run_tests install
> +.SILENT:
> +else
> CFLAGS = $(KHDR_INCLUDES)
> TEST_GEN_PROGS += vfio_dma_mapping_test
> TEST_GEN_PROGS += vfio_dma_mapping_mmio_test
> @@ -28,3 +35,4 @@ TEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_PROGS_O) $(LIBVFIO_O))
> -include $(TEST_DEP_FILES)
>
> EXTRA_CLEAN += $(TEST_GEN_PROGS_O) $(TEST_DEP_FILES)
> +endif
I see other Makefiles include tools/scripts/Makefile.arch which would
then just let us test for 'ifeq (${IS_64_BIT}, 1)'. Would that more
directly address what we're trying to solve here? Thanks,
Alex
On Mon, Feb 2, 2026 at 1:46 PM Alex Williamson <alex@shazbot.org> wrote:
>
> On Fri, 30 Jan 2026 16:02:16 -0800
> Ted Logan <tedlogan@fb.com> wrote:
>
> > Only build vfio self-tests on arm64 and x86_64; these are the only
> > architectures where the vfio self-tests are run. Addresses compiler
> > warnings for format and conversions on i386.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202601211830.aBEjmEFD-lkp@intel.com/
> > Signed-off-by: Ted Logan <tedlogan@fb.com>
> > ---
> > Do not build vfio self-tests for 32-bit architectures, where they're
> > untested and unmaintained. Only build these tests for arm64 and x86_64,
> > where they're regularly tested.
> >
> > Compiler warning fixed by patch:
> >
> > In file included from tools/testing/selftests/vfio/lib/include/libvfio.h:6:
> > tools/testing/selftests/vfio/lib/include/libvfio/iommu.h:49:2: warning: format specifies type 'unsigned long' but the argument has type 'u64' (aka 'unsigned long long') [-Wformat]
> > 49 | VFIO_ASSERT_EQ(__iommu_unmap(iommu, region, NULL), 0);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > tools/testing/selftests/vfio/lib/include/libvfio/assert.h:32:37: note: expanded from macro 'VFIO_ASSERT_EQ'
> > 32 | #define VFIO_ASSERT_EQ(_a, _b, ...) VFIO_ASSERT_OP(_a, _b, ==, ##__VA_ARGS__)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > tools/testing/selftests/vfio/lib/include/libvfio/assert.h:27:22: note: expanded from macro 'VFIO_ASSERT_OP'
> > 26 | fprintf(stderr, " Observed: %#lx %s %#lx\n", \
> > | ~~~~
> > 27 | (u64)__lhs, #_op, (u64)__rhs); \
> > | ^~~~~~~~~~
> > ---
> > tools/testing/selftests/vfio/Makefile | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/tools/testing/selftests/vfio/Makefile b/tools/testing/selftests/vfio/Makefile
> > index ead27892ab65..eeb63ea2b4da 100644
> > --- a/tools/testing/selftests/vfio/Makefile
> > +++ b/tools/testing/selftests/vfio/Makefile
> > @@ -1,3 +1,10 @@
> > +ARCH ?= $(shell uname -m 2>/dev/null || echo not)
> > +
> > +ifeq (,$(filter $(ARCH),arm64 x86_64))
> > +nothing:
> > +.PHONY: all clean run_tests install
> > +.SILENT:
> > +else
> > CFLAGS = $(KHDR_INCLUDES)
> > TEST_GEN_PROGS += vfio_dma_mapping_test
> > TEST_GEN_PROGS += vfio_dma_mapping_mmio_test
> > @@ -28,3 +35,4 @@ TEST_DEP_FILES = $(patsubst %.o, %.d, $(TEST_GEN_PROGS_O) $(LIBVFIO_O))
> > -include $(TEST_DEP_FILES)
> >
> > EXTRA_CLEAN += $(TEST_GEN_PROGS_O) $(TEST_DEP_FILES)
> > +endif
>
> I see other Makefiles include tools/scripts/Makefile.arch which would
> then just let us test for 'ifeq (${IS_64_BIT}, 1)'. Would that more
> directly address what we're trying to solve here? Thanks,
I gave this a try but it seems like it results in a tricky situation.
We must include tools/testing/selftests/lib.mk before
tools/scripts/Makefile.arch so that $(CC) and $(CFLAGS) is set
correctly. But TEST_GEN_* variables have to be defined before the
include of tools/testing/selftests/lib.mk, which is what Ted is trying
to avoid :(.
© 2016 - 2026 Red Hat, Inc.