Re: [PATCH v5 1/3] Update linux headers to 6.0-rc1

2022-08-23 Thread Daniel P . Berrangé
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 
> > ---
> >  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

Re: [PATCH v5 1/3] Update linux headers to 6.0-rc1

2022-08-23 Thread Chenyi Qiang



On 8/22/2022 11:00 PM, Michal Prívozník wrote:

On 8/17/22 04:08, Chenyi Qiang wrote:

commit 568035b01cfb107af8d2e4bd2fb9aea22cf5b868

Signed-off-by: Chenyi Qiang 
---
  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.



OK, I only generated this patch with update-linux-headers.sh and built 
it with gcc. It seems clang requires some other adjustment. I'll have a 
check. Thanks for pointing it out.




Michal



Re: [PATCH v5 1/3] Update linux headers to 6.0-rc1

2022-08-22 Thread Michal Prívozník
On 8/17/22 04:08, Chenyi Qiang wrote:
> commit 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
> 
> Signed-off-by: Chenyi Qiang 
> ---
>  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.


Michal




[PATCH v5 1/3] Update linux headers to 6.0-rc1

2022-08-16 Thread Chenyi Qiang
commit 568035b01cfb107af8d2e4bd2fb9aea22cf5b868

Signed-off-by: Chenyi Qiang 
---
 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/include/standard-headers/asm-x86/bootparam.h 
b/include/standard-headers/asm-x86/bootparam.h
index b2aaad10e5..0b06d2bff1 100644
--- a/include/standard-headers/asm-x86/bootparam.h
+++ b/include/standard-headers/asm-x86/bootparam.h
@@ -10,12 +10,13 @@
 #define SETUP_EFI  4
 #define SETUP_APPLE_PROPERTIES 5
 #define SETUP_JAILHOUSE6
+#define SETUP_CC_BLOB  7
+#define SETUP_IMA  8
 #define SETUP_RNG_SEED 9
+#define SETUP_ENUM_MAX SETUP_RNG_SEED
 
 #define SETUP_INDIRECT (1<<31)
-
-/* SETUP_INDIRECT | max(SETUP_*) */
-#define SETUP_TYPE_MAX (SETUP_INDIRECT | SETUP_JAILHOUSE)
+#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT)
 
 /* ram_size flags */
 #define RAMDISK_IMAGE_START_MASK   0x07FF
diff --git a/include/standard-headers/drm/drm_fourcc.h 
b/include/standard-headers/drm/drm_fourcc.h
index 4888f85f69..48b620cbef 100644
--- a/include/standard-headers/drm/drm_fourcc.h
+++ b/include/standard-headers/drm/drm_fourcc.h
@@ -558,7 +558,7 @@ extern "C" {
  *
  * The main surface is Y-tiled and is at plane index 0 whereas CCS is linear
  * and at index 1. The clear color is stored at index 2, and the pitch should
- * be ignored. The clear color structure is 256 bits. The first 128 bits
+ * be 64 bytes aligned. The clear color structure is 256 bits. The first 128 
bits
  * represents Raw Clear Color Red, Green, Blue and Alpha color each represented
  * by 32 bits. The raw clear color is consumed by the 3d engine and generates
  * the converted clear color of size 64 bits. The first 32 bits store the Lower
@@ -571,6 +571,53 @@ extern "C" {
  */
 #define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8)
 
+/*
+ * Intel Tile 4 layout
+ *
+ * This is a tiled layout using 4KB tiles in a row-major layout. It has the 
same
+ * shape as Tile Y at two granularities: 4KB (128B x 32) and 64B (16B x 4). It
+ * only differs from Tile Y at the 256B granularity in between. At this
+ * granularity, Tile Y has a shape of 16B x 32 rows, but this tiling has a 
shape
+ * of 64B x 8 rows.
+ */
+#define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9)
+
+/*
+ * Intel color control surfaces (CCS) for DG2 render compression.
+ *
+ * The main surface is Tile 4 and at plane index 0. The CCS data is stored
+ * outside of the GEM object in a reserved memory area dedicated for the
+ * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The
+ * main surface pitch is required to be a multiple of four Tile 4 widths.
+ */
+#define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS fourcc_mod_code(INTEL, 10)
+
+/*
+ * Intel color control surfaces (CCS) for DG2 media compression.
+ *
+ * The main surface is Tile 4 and at plane index 0. For semi-planar formats
+ * like NV12, the Y and UV planes are Tile 4 and are located at plane indices
+ * 0 and 1, respectively. The CCS for all planes are stored outside of the
+ * GEM object in a reserved memory area dedicated for the storage of the
+ * CCS data for all RC/RC_CC/MC compressible GEM objects. The main surface
+ * pitch is required to be a multiple of four Tile 4 widths.
+ */
+#define I915_FORMAT_MOD_4_TILED_DG2_MC_CCS fourcc_mod_code(INTEL, 11)
+
+/*
+ * Intel Color Control Surface with Clear Color (CCS) for DG2 render 
compression.
+ *
+ * The main surface is Tile 4 and at plane index 0. The CCS data i