On Mon, Aug 22, 2022 at 05:00:03PM +0200, Michal Prívozník wrote: > On 8/17/22 04:08, Chenyi Qiang wrote: > > commit 568035b01cfb107af8d2e4bd2fb9aea22cf5b868 > > > > Signed-off-by: Chenyi Qiang <chenyi.qiang@xxxxxxxxx> > > --- > > include/standard-headers/asm-x86/bootparam.h | 7 +- > > include/standard-headers/drm/drm_fourcc.h | 73 +++++++- > > include/standard-headers/linux/ethtool.h | 29 +-- > > include/standard-headers/linux/input.h | 12 +- > > include/standard-headers/linux/pci_regs.h | 30 ++- > > include/standard-headers/linux/vhost_types.h | 17 +- > > include/standard-headers/linux/virtio_9p.h | 2 +- > > .../standard-headers/linux/virtio_config.h | 7 +- > > include/standard-headers/linux/virtio_ids.h | 14 +- > > include/standard-headers/linux/virtio_net.h | 34 +++- > > include/standard-headers/linux/virtio_pci.h | 2 + > > linux-headers/asm-arm64/kvm.h | 27 +++ > > linux-headers/asm-generic/unistd.h | 4 +- > > linux-headers/asm-riscv/kvm.h | 22 +++ > > linux-headers/asm-riscv/unistd.h | 3 +- > > linux-headers/asm-s390/kvm.h | 1 + > > linux-headers/asm-x86/kvm.h | 33 ++-- > > linux-headers/asm-x86/mman.h | 14 -- > > linux-headers/linux/kvm.h | 172 +++++++++++++++++- > > linux-headers/linux/userfaultfd.h | 10 +- > > linux-headers/linux/vduse.h | 47 +++++ > > linux-headers/linux/vfio.h | 4 +- > > linux-headers/linux/vfio_zdev.h | 7 + > > linux-headers/linux/vhost.h | 35 +++- > > 24 files changed, 523 insertions(+), 83 deletions(-) > > > > > > diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h > > index bf6e96011d..46de10a809 100644 > > --- a/linux-headers/asm-x86/kvm.h > > +++ b/linux-headers/asm-x86/kvm.h > > @@ -198,13 +198,13 @@ struct kvm_msrs { > > __u32 nmsrs; /* number of msrs in entries */ > > __u32 pad; > > > > - struct kvm_msr_entry entries[0]; > > + struct kvm_msr_entry entries[]; > > }; > > > > I don't think it's this simple. I think this needs to go hand in hand with kvm_arch_get_supported_msr_feature(). > > Also, this breaks clang build: > > clang -m64 -mcx16 -Ilibqemu-x86_64-softmmu.fa.p -I. -I.. -Itarget/i386 -I../target/i386 -Iqapi -Itrace -Iui -Iui/shader -I/usr/include/pixman-1 -I/usr/include/spice-server -I/usr/include/spice-1 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -fcolor-diagnostics -Wall -Winvalid-pch -Werror -std=gnu11 -O0 -g -isystem /home/zippy/work/qemu/qemu.git/linux-headers -isystem linux-headers -iquote . -iquote /home/zippy/work/qemu/qemu.git -iquote /home/zippy/work/qemu/qemu.git/include -iquote /home/zippy/work/qemu/qemu.git/tcg/i386 -pthread -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -Wno-psabi -fstack-protector-strong -O0 -ggdb -fPIE -isystem../linux-headers -isystemlinux-headers -DNEED_CPU_H '-DCONFIG_TARGET="x86_64-softmmu-config-target.h"' '-DCONFIG_DEVICES="x86_64-softmmu-config-devices.h"' -MD -MQ libqemu-x86_64-softmmu.fa.p/target_i386_kvm_kvm.c.o -MF libqemu-x86_64-softmmu.fa.p/target_i386_kvm_kvm.c.o.d -o libqemu-x86_64-softmmu.fa.p/target_i386_kvm_kvm.c.o -c ../target/i386/kvm/kvm.c > ../target/i386/kvm/kvm.c:470:25: error: field 'info' with variable sized type 'struct kvm_msrs' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] > struct kvm_msrs info; > ^ > ../target/i386/kvm/kvm.c:1701:27: error: field 'cpuid' with variable sized type 'struct kvm_cpuid2' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] > struct kvm_cpuid2 cpuid; > ^ > ../target/i386/kvm/kvm.c:2868:25: error: field 'info' with variable sized type 'struct kvm_msrs' not at the end of a struct or class is a GNU extension [-Werror,-Wgnu-variable-sized-type-not-at-end] > struct kvm_msrs info; > ^ > 3 errors generated. We're perfectly OK with using GNU extensions in QEMU (eg the g_auto stuff), so IMHO just set -Wno-gnu-variable-sized-type-not-at-end to turn off this warning that's only relevant to people striving for fully portable C code. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|