Re: [PATCH v4 08/10] vfio: selftests: Add mlx5 driver - HW init and command interface
David Matlack <[email protected]>
| Newsgroups | dev.linux.lists.patches,org.kernel.vger.kvm,org.kernel.vger.linux-kselftest,org.kernel.vger.linux-rdma,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
On 2026-08-12 08:32 PM, Jason Gunthorpe wrote: > On Wed, Aug 12, 2026 at 09:41:28PM +0000, David Matlack wrote: > > On 2026-08-12 11:59 AM, Jason Gunthorpe wrote: > > > @@ -0,0 +1,108 @@ > > > +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ > > > +/* > > > + * mlx5 VFIO selftest driver - HW definitions > > > + * > > > + * Typed wrappers, constants, and helpers for programming mlx5 hardware > > > + * via the VFIO selftest framework. Most HW constants and all MLX5_SET/GET > > > + * macros come from the kernel headers (mlx5_ifc.h, mlx5_ifc_macros.h). > > > + */ > > > +#ifndef SELFTESTS_VFIO_MLX5_HW_H > > > +#define SELFTESTS_VFIO_MLX5_HW_H > > > + > > > +#include <linux/io.h> > > > +#include <linux/build_bug.h> > > > +#include <vdso/bits.h> > > > + > > > +#include "mlx5_ifc.h" > > > +#include "mlx5_ifc_macros.h" > > > > I'm getting a compiler warning here when building with clang which is > > getting upgraded to error from -Werror. > > I don't get that. My builds have -Wno-gnu-variable-sized-type-not-at-end > which comes from here: > > tools/testing/selftests/lib.mk: > > # gcc defaults to silence (off) for the following warnings, but clang defaults > # to the opposite. The warnings are not useful for the kernel itself, which is > # why they have remained disabled in gcc for the main kernel build. And it is > # only due to including kernel data structures in the selftests, that we get the > # warnings from clang. Therefore, disable the warnings for clang builds. > CFLAGS += -Wno-address-of-packed-member > CFLAGS += -Wno-gnu-variable-sized-type-not-at-end > > Why doesn't yours? Are you building it correctly? Ah I see the problem. I was building with this command: make CC=clang -C tools/testing/selftests/vfio But the correct way to build selftests with clang is to use: make LLVM=1 -C tools/testing/selftests/vfio LLVM=1 triggers the conditional logic to add -Wno-gnu-variable-sized-type-not-at-end to CFLAGS and the build works.