Merge ~sergiodj/ubuntu/+source/qemu:enhanced-interpretation-pci-functions-jammy into ubuntu/+source/qemu:ubuntu/jammy-devel

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 90405aa6dc8e150f0bb97cb903f7ae95b66d2435
Proposed branch: ~sergiodj/ubuntu/+source/qemu:enhanced-interpretation-pci-functions-jammy
Merge into: ubuntu/+source/qemu:ubuntu/jammy-devel
Diff against target: 6704 lines (+6556/-0)
24 files modified
debian/changelog (+7/-0)
debian/patches/series (+22/-0)
debian/patches/ubuntu/lp-1853307-Update-linux-headers-to-v6.0-rc4.patch (+1400/-0)
debian/patches/ubuntu/lp-1853307-configure-Add-Wno-gnu-variable-sized-type-not-at-end.patch (+69/-0)
debian/patches/ubuntu/lp-1853307-hw-i386-pass-RNG-seed-via-setup_data-entry.patch (+53/-0)
debian/patches/ubuntu/lp-1853307-kvm-add-support-for-boolean-statistics.patch (+34/-0)
debian/patches/ubuntu/lp-1853307-linux-headers-Add-vduse.h.patch (+347/-0)
debian/patches/ubuntu/lp-1853307-linux-headers-Update-headers-to-v5.17-rc1.patch (+1212/-0)
debian/patches/ubuntu/lp-1853307-linux-headers-Update-to-v5.18-rc6.patch (+1009/-0)
debian/patches/ubuntu/lp-1853307-linux-headers-include-missing-changes-from-5.17.patch (+50/-0)
debian/patches/ubuntu/lp-1853307-linux-headers-update-to-5.16-rc1.patch (+717/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-RPCIT-second-pass-when-mappings-exhausted.patch (+103/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-add-routine-to-get-host-function-handle-fr.patch (+167/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-add-supported-DT-information-to-clp-respon.patch (+88/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-don-t-fence-interpreted-devices-without-MS.patch (+48/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-enable-adapter-event-notification-for-inte.patch (+254/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-enable-for-load-store-interpretation.patch (+306/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-let-intercept-devices-have-separate-PCI-gr.patch (+180/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-reflect-proper-maxstbl-for-groups-of-inter.patch (+41/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-reset-ISM-passthrough-devices-on-shutdown-.patch (+136/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-shrink-DMA-aperture-to-be-bound-by-vfio-DM.patch (+79/-0)
debian/patches/ubuntu/lp-1853307-s390x-pci-use-a-reserved-ID-for-the-default-PCI-grou.patch (+38/-0)
debian/patches/ubuntu/lp-1853307-update-linux-headers-Add-asm-riscv-kvm.h.patch (+156/-0)
debian/patches/ubuntu/lp-1853307-virtio-gpu-do-not-byteswap-padding.patch (+40/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Lucas Kanashiro (community) Approve
Canonical Server Reporter Pending
Review via email: mp+446081@code.launchpad.net

Description of the change

This is the backport of multiple upstream patches to implement the support for "Enhanced Interpretation for PCI Functions" on Jammy.

PPA: https://launchpad.net/~sergiodj/+archive/ubuntu/qemu/+packages

dep8 tests are still running; I'll post their results when they finish.

qemu-migration-test results so far:

prep (x86_64) : Pass 30 F/S/N 0/0/0 - RC 0 (20 min 63526 lin)
migrate (x86_64) : Pass 33 F/S/N 16/0/0 - RC 999 (81 min 70737 lin)
cross (x86_64) : Pass 80 F/S/N 0/0/0 - RC 0 (164 min 134751 lin)
misc (x86_64) : Pass 16 F/S/N 0/0/0 - RC 999 (7 min 6548 lin)

prep (s390x) : Pass 30 F/S/N 0/0/0 - RC 0 (12 min 41074 lin)
migrate (s390x) : Pass 260 F/S/N 0/5/0 - RC 0 (67 min 162299 lin)
cross (s390x) : Pass 80 F/S/N 0/0/0 - RC 0 (143 min 117002 lin)
misc (s390x) : Pass 67 F/S/N 0/0/0 - RC 0 (26 min 32766 lin)

I'll rerun the amd64 test after checking what went wrong, but I'm happy to see that s390x passed because that's the architecture affected by the backport.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Second run on amd64:

prep (x86_64) : Pass 30 F/S/N 0/0/0 - RC 0 (20 min 63971 lin)
migrate (x86_64) : Pass 126 F/S/N 0/0/0 - RC 999 (44 min 100551 lin)
misc (x86_64) : Pass 73 F/S/N 0/0/0 - RC 0 (35 min 42966 lin)

Everything passed; the RC 999 on migrate happened because the script failed to stop the test containers.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Results: (from http://autopkgtest.ubuntu.com/results/autopkgtest-jammy-sergiodj-qemu/?format=plain)
  qemu @ amd64:
    05.07.23 22:58:21 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.13~ppa1
  qemu @ arm64:
    05.07.23 23:28:01 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.13~ppa1
  qemu @ armhf:
    05.07.23 22:56:43 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.13~ppa1
  qemu @ ppc64el:
    05.07.23 22:57:52 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.13~ppa1
  qemu @ s390x:
    06.07.23 01:41:45 Log 🗒️ ✅ Triggers: qemu/1:6.2+dfsg-2ubuntu6.13~ppa1

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for this MP Sergio! I reviewed just the packaging changes, and those look good to me, +1.

Just to be clear, I did not test the feature itself.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: sergiodj, lucaskanashiro
Uploaders: sergiodj, lucaskanashiro
MP auto-approved

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

On Friday, July 07 2023, Lucas Kanashiro wrote:

> Thanks for this MP Sergio! I reviewed just the packaging changes, and those look good to me, +1.
>
> Just to be clear, I did not test the feature itself.

Thanks, Lucas.

The feature itself will be tested by the IBM folks, so I'll follow up
with them.

Uploaded:

$ dput qemu_6.2+dfsg-2ubuntu6.13_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/qemu/qemu_6.2+dfsg-2ubuntu6.13_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/qemu/qemu_6.2+dfsg-2ubuntu6.13.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading qemu_6.2+dfsg-2ubuntu6.13.dsc: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.13.debian.tar.xz: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.13_source.buildinfo: done.
  Uploading qemu_6.2+dfsg-2ubuntu6.13_source.changes: done.
Successfully uploaded packages.

--
Sergio
GPG key ID: E92F D0B3 6B14 F1F4 D8E0 EB2F 106D A1C8 C3CB BF14

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 4a8e1c2..0a8434d 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+qemu (1:6.2+dfsg-2ubuntu6.13) jammy; urgency=medium
7+
8+ * d/p/u/lp-1853307-*.patch: Backport patches to implement Enhanced
9+ Interpretation for PCI Functions (s390x). (LP: #1853307)
10+
11+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Wed, 05 Jul 2023 10:47:05 -0400
12+
13 qemu (1:6.2+dfsg-2ubuntu6.12) jammy; urgency=medium
14
15 [ Chengen Du ]
16diff --git a/debian/patches/series b/debian/patches/series
17index a3c005c..d7cebc7 100644
18--- a/debian/patches/series
19+++ b/debian/patches/series
20@@ -66,3 +66,25 @@ CVE-2022-4144-4.patch
21 CVE-2022-4144-5.patch
22 CVE-2023-0330.patch
23 ubuntu/lp2025591-block-use-the-request-length-for-iov-alignment.patch
24+ubuntu/lp-1853307-virtio-gpu-do-not-byteswap-padding.patch
25+ubuntu/lp-1853307-linux-headers-update-to-5.16-rc1.patch
26+ubuntu/lp-1853307-update-linux-headers-Add-asm-riscv-kvm.h.patch
27+ubuntu/lp-1853307-linux-headers-Update-headers-to-v5.17-rc1.patch
28+ubuntu/lp-1853307-linux-headers-include-missing-changes-from-5.17.patch
29+ubuntu/lp-1853307-linux-headers-Update-to-v5.18-rc6.patch
30+ubuntu/lp-1853307-linux-headers-Add-vduse.h.patch
31+ubuntu/lp-1853307-kvm-add-support-for-boolean-statistics.patch
32+ubuntu/lp-1853307-hw-i386-pass-RNG-seed-via-setup_data-entry.patch
33+ubuntu/lp-1853307-s390x-pci-use-a-reserved-ID-for-the-default-PCI-grou.patch
34+ubuntu/lp-1853307-s390x-pci-add-supported-DT-information-to-clp-respon.patch
35+ubuntu/lp-1853307-configure-Add-Wno-gnu-variable-sized-type-not-at-end.patch
36+ubuntu/lp-1853307-Update-linux-headers-to-v6.0-rc4.patch
37+ubuntu/lp-1853307-s390x-pci-add-routine-to-get-host-function-handle-fr.patch
38+ubuntu/lp-1853307-s390x-pci-enable-for-load-store-interpretation.patch
39+ubuntu/lp-1853307-s390x-pci-don-t-fence-interpreted-devices-without-MS.patch
40+ubuntu/lp-1853307-s390x-pci-enable-adapter-event-notification-for-inte.patch
41+ubuntu/lp-1853307-s390x-pci-let-intercept-devices-have-separate-PCI-gr.patch
42+ubuntu/lp-1853307-s390x-pci-reflect-proper-maxstbl-for-groups-of-inter.patch
43+ubuntu/lp-1853307-s390x-pci-RPCIT-second-pass-when-mappings-exhausted.patch
44+ubuntu/lp-1853307-s390x-pci-shrink-DMA-aperture-to-be-bound-by-vfio-DM.patch
45+ubuntu/lp-1853307-s390x-pci-reset-ISM-passthrough-devices-on-shutdown-.patch
46diff --git a/debian/patches/ubuntu/lp-1853307-Update-linux-headers-to-v6.0-rc4.patch b/debian/patches/ubuntu/lp-1853307-Update-linux-headers-to-v6.0-rc4.patch
47new file mode 100644
48index 0000000..73dc627
49--- /dev/null
50+++ b/debian/patches/ubuntu/lp-1853307-Update-linux-headers-to-v6.0-rc4.patch
51@@ -0,0 +1,1400 @@
52+From d525f73f9186a5bc641b8caf0b2c9bb94e5aa963 Mon Sep 17 00:00:00 2001
53+From: Chenyi Qiang <chenyi.qiang@intel.com>
54+Date: Thu, 15 Sep 2022 17:10:35 +0800
55+Subject: [PATCH] Update linux headers to v6.0-rc4
56+
57+commit 7e18e42e4b280c85b76967a9106a13ca61c16179
58+
59+Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
60+Reviewed-by: Cornelia Huck <cohuck@redhat.com>
61+Message-Id: <20220915091035.3897-3-chenyi.qiang@intel.com>
62+Signed-off-by: Thomas Huth <thuth@redhat.com>
63+
64+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/d525f73f91
65+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
66+Last-Update: 2023-07-04
67+
68+---
69+ include/standard-headers/asm-x86/bootparam.h | 7 +-
70+ include/standard-headers/drm/drm_fourcc.h | 73 +++++++-
71+ include/standard-headers/linux/ethtool.h | 29 +--
72+ include/standard-headers/linux/input.h | 12 +-
73+ include/standard-headers/linux/pci_regs.h | 30 ++-
74+ include/standard-headers/linux/vhost_types.h | 17 +-
75+ include/standard-headers/linux/virtio_9p.h | 2 +-
76+ .../standard-headers/linux/virtio_config.h | 7 +-
77+ include/standard-headers/linux/virtio_ids.h | 14 +-
78+ include/standard-headers/linux/virtio_net.h | 34 +++-
79+ include/standard-headers/linux/virtio_pci.h | 2 +
80+ include/standard-headers/linux/virtio_ring.h | 16 +-
81+ linux-headers/asm-arm64/kvm.h | 33 +++-
82+ linux-headers/asm-generic/unistd.h | 4 +-
83+ linux-headers/asm-riscv/kvm.h | 22 +++
84+ linux-headers/asm-riscv/unistd.h | 3 +-
85+ linux-headers/asm-s390/kvm.h | 1 +
86+ linux-headers/asm-x86/kvm.h | 33 ++--
87+ linux-headers/asm-x86/mman.h | 14 --
88+ linux-headers/linux/kvm.h | 172 +++++++++++++++++-
89+ linux-headers/linux/userfaultfd.h | 10 +-
90+ linux-headers/linux/vduse.h | 47 +++++
91+ linux-headers/linux/vfio.h | 4 +-
92+ linux-headers/linux/vfio_zdev.h | 7 +
93+ linux-headers/linux/vhost.h | 35 +++-
94+ 25 files changed, 538 insertions(+), 90 deletions(-)
95+
96+Index: qemu/include/standard-headers/asm-x86/bootparam.h
97+===================================================================
98+--- qemu.orig/include/standard-headers/asm-x86/bootparam.h 2023-07-04 20:49:59.000000000 -0400
99++++ qemu/include/standard-headers/asm-x86/bootparam.h 2023-07-04 20:49:59.000000000 -0400
100+@@ -10,12 +10,13 @@
101+ #define SETUP_EFI 4
102+ #define SETUP_APPLE_PROPERTIES 5
103+ #define SETUP_JAILHOUSE 6
104++#define SETUP_CC_BLOB 7
105++#define SETUP_IMA 8
106+ #define SETUP_RNG_SEED 9
107++#define SETUP_ENUM_MAX SETUP_RNG_SEED
108+
109+ #define SETUP_INDIRECT (1<<31)
110+-
111+-/* SETUP_INDIRECT | max(SETUP_*) */
112+-#define SETUP_TYPE_MAX (SETUP_INDIRECT | SETUP_JAILHOUSE)
113++#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT)
114+
115+ /* ram_size flags */
116+ #define RAMDISK_IMAGE_START_MASK 0x07FF
117+Index: qemu/include/standard-headers/drm/drm_fourcc.h
118+===================================================================
119+--- qemu.orig/include/standard-headers/drm/drm_fourcc.h 2023-07-04 20:49:59.000000000 -0400
120++++ qemu/include/standard-headers/drm/drm_fourcc.h 2023-07-04 20:49:59.000000000 -0400
121+@@ -558,7 +558,7 @@
122+ *
123+ * The main surface is Y-tiled and is at plane index 0 whereas CCS is linear
124+ * and at index 1. The clear color is stored at index 2, and the pitch should
125+- * be ignored. The clear color structure is 256 bits. The first 128 bits
126++ * be 64 bytes aligned. The clear color structure is 256 bits. The first 128 bits
127+ * represents Raw Clear Color Red, Green, Blue and Alpha color each represented
128+ * by 32 bits. The raw clear color is consumed by the 3d engine and generates
129+ * the converted clear color of size 64 bits. The first 32 bits store the Lower
130+@@ -572,6 +572,53 @@
131+ #define I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC fourcc_mod_code(INTEL, 8)
132+
133+ /*
134++ * Intel Tile 4 layout
135++ *
136++ * This is a tiled layout using 4KB tiles in a row-major layout. It has the same
137++ * shape as Tile Y at two granularities: 4KB (128B x 32) and 64B (16B x 4). It
138++ * only differs from Tile Y at the 256B granularity in between. At this
139++ * granularity, Tile Y has a shape of 16B x 32 rows, but this tiling has a shape
140++ * of 64B x 8 rows.
141++ */
142++#define I915_FORMAT_MOD_4_TILED fourcc_mod_code(INTEL, 9)
143++
144++/*
145++ * Intel color control surfaces (CCS) for DG2 render compression.
146++ *
147++ * The main surface is Tile 4 and at plane index 0. The CCS data is stored
148++ * outside of the GEM object in a reserved memory area dedicated for the
149++ * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The
150++ * main surface pitch is required to be a multiple of four Tile 4 widths.
151++ */
152++#define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS fourcc_mod_code(INTEL, 10)
153++
154++/*
155++ * Intel color control surfaces (CCS) for DG2 media compression.
156++ *
157++ * The main surface is Tile 4 and at plane index 0. For semi-planar formats
158++ * like NV12, the Y and UV planes are Tile 4 and are located at plane indices
159++ * 0 and 1, respectively. The CCS for all planes are stored outside of the
160++ * GEM object in a reserved memory area dedicated for the storage of the
161++ * CCS data for all RC/RC_CC/MC compressible GEM objects. The main surface
162++ * pitch is required to be a multiple of four Tile 4 widths.
163++ */
164++#define I915_FORMAT_MOD_4_TILED_DG2_MC_CCS fourcc_mod_code(INTEL, 11)
165++
166++/*
167++ * Intel Color Control Surface with Clear Color (CCS) for DG2 render compression.
168++ *
169++ * The main surface is Tile 4 and at plane index 0. The CCS data is stored
170++ * outside of the GEM object in a reserved memory area dedicated for the
171++ * storage of the CCS data for all RC/RC_CC/MC compressible GEM objects. The
172++ * main surface pitch is required to be a multiple of four Tile 4 widths. The
173++ * clear color is stored at plane index 1 and the pitch should be 64 bytes
174++ * aligned. The format of the 256 bits of clear color data matches the one used
175++ * for the I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC modifier, see its description
176++ * for details.
177++ */
178++#define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC fourcc_mod_code(INTEL, 12)
179++
180++/*
181+ * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
182+ *
183+ * Macroblocks are laid in a Z-shape, and each pixel data is following the
184+@@ -608,6 +655,28 @@
185+ */
186+ #define DRM_FORMAT_MOD_QCOM_COMPRESSED fourcc_mod_code(QCOM, 1)
187+
188++/*
189++ * Qualcomm Tiled Format
190++ *
191++ * Similar to DRM_FORMAT_MOD_QCOM_COMPRESSED but not compressed.
192++ * Implementation may be platform and base-format specific.
193++ *
194++ * Each macrotile consists of m x n (mostly 4 x 4) tiles.
195++ * Pixel data pitch/stride is aligned with macrotile width.
196++ * Pixel data height is aligned with macrotile height.
197++ * Entire pixel data buffer is aligned with 4k(bytes).
198++ */
199++#define DRM_FORMAT_MOD_QCOM_TILED3 fourcc_mod_code(QCOM, 3)
200++
201++/*
202++ * Qualcomm Alternate Tiled Format
203++ *
204++ * Alternate tiled format typically only used within GMEM.
205++ * Implementation may be platform and base-format specific.
206++ */
207++#define DRM_FORMAT_MOD_QCOM_TILED2 fourcc_mod_code(QCOM, 2)
208++
209++
210+ /* Vivante framebuffer modifiers */
211+
212+ /*
213+@@ -1293,6 +1362,7 @@
214+ #define AMD_FMT_MOD_TILE_VER_GFX9 1
215+ #define AMD_FMT_MOD_TILE_VER_GFX10 2
216+ #define AMD_FMT_MOD_TILE_VER_GFX10_RBPLUS 3
217++#define AMD_FMT_MOD_TILE_VER_GFX11 4
218+
219+ /*
220+ * 64K_S is the same for GFX9/GFX10/GFX10_RBPLUS and hence has GFX9 as canonical
221+@@ -1308,6 +1378,7 @@
222+ #define AMD_FMT_MOD_TILE_GFX9_64K_S_X 25
223+ #define AMD_FMT_MOD_TILE_GFX9_64K_D_X 26
224+ #define AMD_FMT_MOD_TILE_GFX9_64K_R_X 27
225++#define AMD_FMT_MOD_TILE_GFX11_256K_R_X 31
226+
227+ #define AMD_FMT_MOD_DCC_BLOCK_64B 0
228+ #define AMD_FMT_MOD_DCC_BLOCK_128B 1
229+Index: qemu/include/standard-headers/linux/ethtool.h
230+===================================================================
231+--- qemu.orig/include/standard-headers/linux/ethtool.h 2023-07-04 20:49:59.000000000 -0400
232++++ qemu/include/standard-headers/linux/ethtool.h 2023-07-04 20:49:59.000000000 -0400
233+@@ -257,7 +257,7 @@
234+ uint32_t id;
235+ uint32_t type_id;
236+ uint32_t len;
237+- void *data[0];
238++ void *data[];
239+ };
240+
241+ #define DOWNSHIFT_DEV_DEFAULT_COUNT 0xff
242+@@ -322,7 +322,7 @@
243+ uint32_t cmd;
244+ uint32_t version;
245+ uint32_t len;
246+- uint8_t data[0];
247++ uint8_t data[];
248+ };
249+
250+ /**
251+@@ -348,7 +348,7 @@
252+ uint32_t magic;
253+ uint32_t offset;
254+ uint32_t len;
255+- uint8_t data[0];
256++ uint8_t data[];
257+ };
258+
259+ /**
260+@@ -752,7 +752,7 @@
261+ uint32_t cmd;
262+ uint32_t string_set;
263+ uint32_t len;
264+- uint8_t data[0];
265++ uint8_t data[];
266+ };
267+
268+ /**
269+@@ -777,7 +777,7 @@
270+ uint32_t cmd;
271+ uint32_t reserved;
272+ uint64_t sset_mask;
273+- uint32_t data[0];
274++ uint32_t data[];
275+ };
276+
277+ /**
278+@@ -817,7 +817,7 @@
279+ uint32_t flags;
280+ uint32_t reserved;
281+ uint32_t len;
282+- uint64_t data[0];
283++ uint64_t data[];
284+ };
285+
286+ /**
287+@@ -834,7 +834,7 @@
288+ struct ethtool_stats {
289+ uint32_t cmd;
290+ uint32_t n_stats;
291+- uint64_t data[0];
292++ uint64_t data[];
293+ };
294+
295+ /**
296+@@ -851,7 +851,7 @@
297+ struct ethtool_perm_addr {
298+ uint32_t cmd;
299+ uint32_t size;
300+- uint8_t data[0];
301++ uint8_t data[];
302+ };
303+
304+ /* boolean flags controlling per-interface behavior characteristics.
305+@@ -1160,7 +1160,7 @@
306+ struct ethtool_rxfh_indir {
307+ uint32_t cmd;
308+ uint32_t size;
309+- uint32_t ring_index[0];
310++ uint32_t ring_index[];
311+ };
312+
313+ /**
314+@@ -1201,7 +1201,7 @@
315+ uint8_t hfunc;
316+ uint8_t rsvd8[3];
317+ uint32_t rsvd32;
318+- uint32_t rss_config[0];
319++ uint32_t rss_config[];
320+ };
321+ #define ETH_RXFH_CONTEXT_ALLOC 0xffffffff
322+ #define ETH_RXFH_INDIR_NO_CHANGE 0xffffffff
323+@@ -1286,7 +1286,7 @@
324+ uint32_t version;
325+ uint32_t flag;
326+ uint32_t len;
327+- uint8_t data[0];
328++ uint8_t data[];
329+ };
330+
331+ #define ETH_FW_DUMP_DISABLE 0
332+@@ -1318,7 +1318,7 @@
333+ struct ethtool_gfeatures {
334+ uint32_t cmd;
335+ uint32_t size;
336+- struct ethtool_get_features_block features[0];
337++ struct ethtool_get_features_block features[];
338+ };
339+
340+ /**
341+@@ -1340,7 +1340,7 @@
342+ struct ethtool_sfeatures {
343+ uint32_t cmd;
344+ uint32_t size;
345+- struct ethtool_set_features_block features[0];
346++ struct ethtool_set_features_block features[];
347+ };
348+
349+ /**
350+@@ -1691,6 +1691,7 @@
351+ ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89,
352+ ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90,
353+ ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91,
354++ ETHTOOL_LINK_MODE_10baseT1L_Full_BIT = 92,
355+ /* must be last entry */
356+ __ETHTOOL_LINK_MODE_MASK_NBITS
357+ };
358+@@ -2086,7 +2087,7 @@
359+ uint8_t master_slave_state;
360+ uint8_t reserved1[1];
361+ uint32_t reserved[7];
362+- uint32_t link_mode_masks[0];
363++ uint32_t link_mode_masks[];
364+ /* layout of link_mode_masks fields:
365+ * uint32_t map_supported[link_mode_masks_nwords];
366+ * uint32_t map_advertising[link_mode_masks_nwords];
367+Index: qemu/include/standard-headers/linux/input.h
368+===================================================================
369+--- qemu.orig/include/standard-headers/linux/input.h 2023-07-04 20:38:39.000000000 -0400
370++++ qemu/include/standard-headers/linux/input.h 2023-07-04 20:49:59.000000000 -0400
371+@@ -75,10 +75,13 @@
372+ * Note that input core does not clamp reported values to the
373+ * [minimum, maximum] limits, such task is left to userspace.
374+ *
375+- * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z)
376+- * is reported in units per millimeter (units/mm), resolution
377+- * for rotational axes (ABS_RX, ABS_RY, ABS_RZ) is reported
378+- * in units per radian.
379++ * The default resolution for main axes (ABS_X, ABS_Y, ABS_Z,
380++ * ABS_MT_POSITION_X, ABS_MT_POSITION_Y) is reported in units
381++ * per millimeter (units/mm), resolution for rotational axes
382++ * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
383++ * The resolution for the size axes (ABS_MT_TOUCH_MAJOR,
384++ * ABS_MT_TOUCH_MINOR, ABS_MT_WIDTH_MAJOR, ABS_MT_WIDTH_MINOR)
385++ * is reported in units per millimeter (units/mm).
386+ * When INPUT_PROP_ACCELEROMETER is set the resolution changes.
387+ * The main axes (ABS_X, ABS_Y, ABS_Z) are then reported in
388+ * units per g (units/g) and in units per degree per second
389+@@ -268,6 +271,7 @@
390+ #define BUS_RMI 0x1D
391+ #define BUS_CEC 0x1E
392+ #define BUS_INTEL_ISHTP 0x1F
393++#define BUS_AMD_SFH 0x20
394+
395+ /*
396+ * MT_TOOL types
397+Index: qemu/include/standard-headers/linux/pci_regs.h
398+===================================================================
399+--- qemu.orig/include/standard-headers/linux/pci_regs.h 2023-07-04 20:49:59.000000000 -0400
400++++ qemu/include/standard-headers/linux/pci_regs.h 2023-07-04 20:49:59.000000000 -0400
401+@@ -616,6 +616,7 @@
402+ #define PCI_EXP_SLTCTL_PWR_OFF 0x0400 /* Power Off */
403+ #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */
404+ #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */
405++#define PCI_EXP_SLTCTL_ASPL_DISABLE 0x2000 /* Auto Slot Power Limit Disable */
406+ #define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000 /* In-band PD disable */
407+ #define PCI_EXP_SLTSTA 0x1a /* Slot Status */
408+ #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */
409+@@ -736,7 +737,8 @@
410+ #define PCI_EXT_CAP_ID_DVSEC 0x23 /* Designated Vendor-Specific */
411+ #define PCI_EXT_CAP_ID_DLF 0x25 /* Data Link Feature */
412+ #define PCI_EXT_CAP_ID_PL_16GT 0x26 /* Physical Layer 16.0 GT/s */
413+-#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
414++#define PCI_EXT_CAP_ID_DOE 0x2E /* Data Object Exchange */
415++#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_DOE
416+
417+ #define PCI_EXT_CAP_DSN_SIZEOF 12
418+ #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
419+@@ -1102,4 +1104,30 @@
420+ #define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK 0x000000F0
421+ #define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_SHIFT 4
422+
423++/* Data Object Exchange */
424++#define PCI_DOE_CAP 0x04 /* DOE Capabilities Register */
425++#define PCI_DOE_CAP_INT_SUP 0x00000001 /* Interrupt Support */
426++#define PCI_DOE_CAP_INT_MSG_NUM 0x00000ffe /* Interrupt Message Number */
427++#define PCI_DOE_CTRL 0x08 /* DOE Control Register */
428++#define PCI_DOE_CTRL_ABORT 0x00000001 /* DOE Abort */
429++#define PCI_DOE_CTRL_INT_EN 0x00000002 /* DOE Interrupt Enable */
430++#define PCI_DOE_CTRL_GO 0x80000000 /* DOE Go */
431++#define PCI_DOE_STATUS 0x0c /* DOE Status Register */
432++#define PCI_DOE_STATUS_BUSY 0x00000001 /* DOE Busy */
433++#define PCI_DOE_STATUS_INT_STATUS 0x00000002 /* DOE Interrupt Status */
434++#define PCI_DOE_STATUS_ERROR 0x00000004 /* DOE Error */
435++#define PCI_DOE_STATUS_DATA_OBJECT_READY 0x80000000 /* Data Object Ready */
436++#define PCI_DOE_WRITE 0x10 /* DOE Write Data Mailbox Register */
437++#define PCI_DOE_READ 0x14 /* DOE Read Data Mailbox Register */
438++
439++/* DOE Data Object - note not actually registers */
440++#define PCI_DOE_DATA_OBJECT_HEADER_1_VID 0x0000ffff
441++#define PCI_DOE_DATA_OBJECT_HEADER_1_TYPE 0x00ff0000
442++#define PCI_DOE_DATA_OBJECT_HEADER_2_LENGTH 0x0003ffff
443++
444++#define PCI_DOE_DATA_OBJECT_DISC_REQ_3_INDEX 0x000000ff
445++#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_VID 0x0000ffff
446++#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_PROTOCOL 0x00ff0000
447++#define PCI_DOE_DATA_OBJECT_DISC_RSP_3_NEXT_INDEX 0xff000000
448++
449+ #endif /* LINUX_PCI_REGS_H */
450+Index: qemu/include/standard-headers/linux/vhost_types.h
451+===================================================================
452+--- qemu.orig/include/standard-headers/linux/vhost_types.h 2023-07-04 20:38:39.000000000 -0400
453++++ qemu/include/standard-headers/linux/vhost_types.h 2023-07-04 20:49:59.000000000 -0400
454+@@ -87,7 +87,7 @@
455+
456+ struct vhost_msg_v2 {
457+ uint32_t type;
458+- uint32_t reserved;
459++ uint32_t asid;
460+ union {
461+ struct vhost_iotlb_msg iotlb;
462+ uint8_t padding[64];
463+@@ -107,7 +107,7 @@
464+ struct vhost_memory {
465+ uint32_t nregions;
466+ uint32_t padding;
467+- struct vhost_memory_region regions[0];
468++ struct vhost_memory_region regions[];
469+ };
470+
471+ /* VHOST_SCSI specific definitions */
472+@@ -135,7 +135,7 @@
473+ struct vhost_vdpa_config {
474+ uint32_t off;
475+ uint32_t len;
476+- uint8_t buf[0];
477++ uint8_t buf[];
478+ };
479+
480+ /* vhost vdpa IOVA range
481+@@ -153,4 +153,15 @@
482+ /* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
483+ #define VHOST_NET_F_VIRTIO_NET_HDR 27
484+
485++/* Use message type V2 */
486++#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
487++/* IOTLB can accept batching hints */
488++#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
489++/* IOTLB can accept address space identifier through V2 type of IOTLB
490++ * message
491++ */
492++#define VHOST_BACKEND_F_IOTLB_ASID 0x3
493++/* Device can be suspended */
494++#define VHOST_BACKEND_F_SUSPEND 0x4
495++
496+ #endif
497+Index: qemu/include/standard-headers/linux/virtio_9p.h
498+===================================================================
499+--- qemu.orig/include/standard-headers/linux/virtio_9p.h 2023-07-04 20:38:39.000000000 -0400
500++++ qemu/include/standard-headers/linux/virtio_9p.h 2023-07-04 20:49:59.000000000 -0400
501+@@ -38,7 +38,7 @@
502+ /* length of the tag name */
503+ __virtio16 tag_len;
504+ /* non-NULL terminated tag name */
505+- uint8_t tag[0];
506++ uint8_t tag[];
507+ } QEMU_PACKED;
508+
509+ #endif /* _LINUX_VIRTIO_9P_H */
510+Index: qemu/include/standard-headers/linux/virtio_config.h
511+===================================================================
512+--- qemu.orig/include/standard-headers/linux/virtio_config.h 2023-07-04 20:49:59.000000000 -0400
513++++ qemu/include/standard-headers/linux/virtio_config.h 2023-07-04 20:49:59.000000000 -0400
514+@@ -52,7 +52,7 @@
515+ * rest are per-device feature bits.
516+ */
517+ #define VIRTIO_TRANSPORT_F_START 28
518+-#define VIRTIO_TRANSPORT_F_END 38
519++#define VIRTIO_TRANSPORT_F_END 41
520+
521+ #ifndef VIRTIO_CONFIG_NO_LEGACY
522+ /* Do we get callbacks when the ring is completely used, even if we've
523+@@ -96,4 +96,9 @@
524+ * Does the device support Single Root I/O Virtualization?
525+ */
526+ #define VIRTIO_F_SR_IOV 37
527++
528++/*
529++ * This feature indicates that the driver can reset a queue individually.
530++ */
531++#define VIRTIO_F_RING_RESET 40
532+ #endif /* _LINUX_VIRTIO_CONFIG_H */
533+Index: qemu/include/standard-headers/linux/virtio_ids.h
534+===================================================================
535+--- qemu.orig/include/standard-headers/linux/virtio_ids.h 2023-07-04 20:49:59.000000000 -0400
536++++ qemu/include/standard-headers/linux/virtio_ids.h 2023-07-04 20:49:59.000000000 -0400
537+@@ -73,12 +73,12 @@
538+ * Virtio Transitional IDs
539+ */
540+
541+-#define VIRTIO_TRANS_ID_NET 1000 /* transitional virtio net */
542+-#define VIRTIO_TRANS_ID_BLOCK 1001 /* transitional virtio block */
543+-#define VIRTIO_TRANS_ID_BALLOON 1002 /* transitional virtio balloon */
544+-#define VIRTIO_TRANS_ID_CONSOLE 1003 /* transitional virtio console */
545+-#define VIRTIO_TRANS_ID_SCSI 1004 /* transitional virtio SCSI */
546+-#define VIRTIO_TRANS_ID_RNG 1005 /* transitional virtio rng */
547+-#define VIRTIO_TRANS_ID_9P 1009 /* transitional virtio 9p console */
548++#define VIRTIO_TRANS_ID_NET 0x1000 /* transitional virtio net */
549++#define VIRTIO_TRANS_ID_BLOCK 0x1001 /* transitional virtio block */
550++#define VIRTIO_TRANS_ID_BALLOON 0x1002 /* transitional virtio balloon */
551++#define VIRTIO_TRANS_ID_CONSOLE 0x1003 /* transitional virtio console */
552++#define VIRTIO_TRANS_ID_SCSI 0x1004 /* transitional virtio SCSI */
553++#define VIRTIO_TRANS_ID_RNG 0x1005 /* transitional virtio rng */
554++#define VIRTIO_TRANS_ID_9P 0x1009 /* transitional virtio 9p console */
555+
556+ #endif /* _LINUX_VIRTIO_IDS_H */
557+Index: qemu/include/standard-headers/linux/virtio_net.h
558+===================================================================
559+--- qemu.orig/include/standard-headers/linux/virtio_net.h 2023-07-04 20:38:39.000000000 -0400
560++++ qemu/include/standard-headers/linux/virtio_net.h 2023-07-04 20:49:59.000000000 -0400
561+@@ -56,7 +56,7 @@
562+ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
563+ * Steering */
564+ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
565+-
566++#define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */
567+ #define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */
568+ #define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */
569+ #define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */
570+@@ -355,4 +355,36 @@
571+ #define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
572+ #define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
573+
574++/*
575++ * Control notifications coalescing.
576++ *
577++ * Request the device to change the notifications coalescing parameters.
578++ *
579++ * Available with the VIRTIO_NET_F_NOTF_COAL feature bit.
580++ */
581++#define VIRTIO_NET_CTRL_NOTF_COAL 6
582++/*
583++ * Set the tx-usecs/tx-max-packets parameters.
584++ */
585++struct virtio_net_ctrl_coal_tx {
586++ /* Maximum number of packets to send before a TX notification */
587++ uint32_t tx_max_packets;
588++ /* Maximum number of usecs to delay a TX notification */
589++ uint32_t tx_usecs;
590++};
591++
592++#define VIRTIO_NET_CTRL_NOTF_COAL_TX_SET 0
593++
594++/*
595++ * Set the rx-usecs/rx-max-packets parameters.
596++ */
597++struct virtio_net_ctrl_coal_rx {
598++ /* Maximum number of packets to receive before a RX notification */
599++ uint32_t rx_max_packets;
600++ /* Maximum number of usecs to delay a RX notification */
601++ uint32_t rx_usecs;
602++};
603++
604++#define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1
605++
606+ #endif /* _LINUX_VIRTIO_NET_H */
607+Index: qemu/include/standard-headers/linux/virtio_pci.h
608+===================================================================
609+--- qemu.orig/include/standard-headers/linux/virtio_pci.h 2023-07-04 20:38:39.000000000 -0400
610++++ qemu/include/standard-headers/linux/virtio_pci.h 2023-07-04 20:49:59.000000000 -0400
611+@@ -202,6 +202,8 @@
612+ #define VIRTIO_PCI_COMMON_Q_AVAILHI 44
613+ #define VIRTIO_PCI_COMMON_Q_USEDLO 48
614+ #define VIRTIO_PCI_COMMON_Q_USEDHI 52
615++#define VIRTIO_PCI_COMMON_Q_NDATA 56
616++#define VIRTIO_PCI_COMMON_Q_RESET 58
617+
618+ #endif /* VIRTIO_PCI_NO_MODERN */
619+
620+Index: qemu/include/standard-headers/linux/virtio_ring.h
621+===================================================================
622+--- qemu.orig/include/standard-headers/linux/virtio_ring.h 2023-07-04 20:38:39.000000000 -0400
623++++ qemu/include/standard-headers/linux/virtio_ring.h 2023-07-04 20:49:59.000000000 -0400
624+@@ -91,15 +91,21 @@
625+ #define VRING_USED_ALIGN_SIZE 4
626+ #define VRING_DESC_ALIGN_SIZE 16
627+
628+-/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
629++/**
630++ * struct vring_desc - Virtio ring descriptors,
631++ * 16 bytes long. These can chain together via @next.
632++ *
633++ * @addr: buffer address (guest-physical)
634++ * @len: buffer length
635++ * @flags: descriptor flags
636++ * @next: index of the next descriptor in the chain,
637++ * if the VRING_DESC_F_NEXT flag is set. We chain unused
638++ * descriptors via this, too.
639++ */
640+ struct vring_desc {
641+- /* Address (guest-physical). */
642+ __virtio64 addr;
643+- /* Length. */
644+ __virtio32 len;
645+- /* The flags as indicated above. */
646+ __virtio16 flags;
647+- /* We chain unused descriptors via this, too */
648+ __virtio16 next;
649+ };
650+
651+Index: qemu/linux-headers/asm-arm64/kvm.h
652+===================================================================
653+--- qemu.orig/linux-headers/asm-arm64/kvm.h 2023-07-04 20:49:59.000000000 -0400
654++++ qemu/linux-headers/asm-arm64/kvm.h 2023-07-04 20:49:59.000000000 -0400
655+@@ -75,9 +75,11 @@
656+
657+ /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
658+ #define KVM_ARM_DEVICE_TYPE_SHIFT 0
659+-#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
660++#define KVM_ARM_DEVICE_TYPE_MASK GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, \
661++ KVM_ARM_DEVICE_TYPE_SHIFT)
662+ #define KVM_ARM_DEVICE_ID_SHIFT 16
663+-#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
664++#define KVM_ARM_DEVICE_ID_MASK GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, \
665++ KVM_ARM_DEVICE_ID_SHIFT)
666+
667+ /* Supported device IDs */
668+ #define KVM_ARM_DEVICE_VGIC_V2 0
669+@@ -139,8 +141,10 @@
670+ __u64 dbg_wvr[KVM_ARM_MAX_DBG_REGS];
671+ };
672+
673++#define KVM_DEBUG_ARCH_HSR_HIGH_VALID (1 << 0)
674+ struct kvm_debug_exit_arch {
675+ __u32 hsr;
676++ __u32 hsr_high; /* ESR_EL2[61:32] */
677+ __u64 far; /* used for watchpoints */
678+ };
679+
680+@@ -332,6 +336,31 @@
681+ #define KVM_ARM64_SVE_VLS_WORDS \
682+ ((KVM_ARM64_SVE_VQ_MAX - KVM_ARM64_SVE_VQ_MIN) / 64 + 1)
683+
684++/* Bitmap feature firmware registers */
685++#define KVM_REG_ARM_FW_FEAT_BMAP (0x0016 << KVM_REG_ARM_COPROC_SHIFT)
686++#define KVM_REG_ARM_FW_FEAT_BMAP_REG(r) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \
687++ KVM_REG_ARM_FW_FEAT_BMAP | \
688++ ((r) & 0xffff))
689++
690++#define KVM_REG_ARM_STD_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(0)
691++
692++enum {
693++ KVM_REG_ARM_STD_BIT_TRNG_V1_0 = 0,
694++};
695++
696++#define KVM_REG_ARM_STD_HYP_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(1)
697++
698++enum {
699++ KVM_REG_ARM_STD_HYP_BIT_PV_TIME = 0,
700++};
701++
702++#define KVM_REG_ARM_VENDOR_HYP_BMAP KVM_REG_ARM_FW_FEAT_BMAP_REG(2)
703++
704++enum {
705++ KVM_REG_ARM_VENDOR_HYP_BIT_FUNC_FEAT = 0,
706++ KVM_REG_ARM_VENDOR_HYP_BIT_PTP = 1,
707++};
708++
709+ /* Device Control API: ARM VGIC */
710+ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0
711+ #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
712+Index: qemu/linux-headers/asm-generic/unistd.h
713+===================================================================
714+--- qemu.orig/linux-headers/asm-generic/unistd.h 2023-07-04 20:49:59.000000000 -0400
715++++ qemu/linux-headers/asm-generic/unistd.h 2023-07-04 20:49:59.000000000 -0400
716+@@ -383,7 +383,7 @@
717+
718+ /* kernel/ptrace.c */
719+ #define __NR_ptrace 117
720+-__SYSCALL(__NR_ptrace, sys_ptrace)
721++__SC_COMP(__NR_ptrace, sys_ptrace, compat_sys_ptrace)
722+
723+ /* kernel/sched/core.c */
724+ #define __NR_sched_setparam 118
725+@@ -779,7 +779,7 @@
726+ #define __NR_kexec_file_load 294
727+ __SYSCALL(__NR_kexec_file_load, sys_kexec_file_load)
728+ /* 295 through 402 are unassigned to sync up with generic numbers, don't use */
729+-#if __BITS_PER_LONG == 32
730++#if defined(__SYSCALL_COMPAT) || __BITS_PER_LONG == 32
731+ #define __NR_clock_gettime64 403
732+ __SYSCALL(__NR_clock_gettime64, sys_clock_gettime)
733+ #define __NR_clock_settime64 404
734+Index: qemu/linux-headers/asm-riscv/kvm.h
735+===================================================================
736+--- qemu.orig/linux-headers/asm-riscv/kvm.h 2023-07-04 20:49:59.000000000 -0400
737++++ qemu/linux-headers/asm-riscv/kvm.h 2023-07-04 20:49:59.000000000 -0400
738+@@ -82,6 +82,25 @@
739+ __u64 state;
740+ };
741+
742++/*
743++ * ISA extension IDs specific to KVM. This is not the same as the host ISA
744++ * extension IDs as that is internal to the host and should not be exposed
745++ * to the guest. This should always be contiguous to keep the mapping simple
746++ * in KVM implementation.
747++ */
748++enum KVM_RISCV_ISA_EXT_ID {
749++ KVM_RISCV_ISA_EXT_A = 0,
750++ KVM_RISCV_ISA_EXT_C,
751++ KVM_RISCV_ISA_EXT_D,
752++ KVM_RISCV_ISA_EXT_F,
753++ KVM_RISCV_ISA_EXT_H,
754++ KVM_RISCV_ISA_EXT_I,
755++ KVM_RISCV_ISA_EXT_M,
756++ KVM_RISCV_ISA_EXT_SVPBMT,
757++ KVM_RISCV_ISA_EXT_SSTC,
758++ KVM_RISCV_ISA_EXT_MAX,
759++};
760++
761+ /* Possible states for kvm_riscv_timer */
762+ #define KVM_RISCV_TIMER_STATE_OFF 0
763+ #define KVM_RISCV_TIMER_STATE_ON 1
764+@@ -123,6 +142,9 @@
765+ #define KVM_REG_RISCV_FP_D_REG(name) \
766+ (offsetof(struct __riscv_d_ext_state, name) / sizeof(__u64))
767+
768++/* ISA Extension registers are mapped as type 7 */
769++#define KVM_REG_RISCV_ISA_EXT (0x07 << KVM_REG_RISCV_TYPE_SHIFT)
770++
771+ #endif
772+
773+ #endif /* __LINUX_KVM_RISCV_H */
774+Index: qemu/linux-headers/asm-riscv/unistd.h
775+===================================================================
776+--- qemu.orig/linux-headers/asm-riscv/unistd.h 2023-07-04 20:49:59.000000000 -0400
777++++ qemu/linux-headers/asm-riscv/unistd.h 2023-07-04 20:49:59.000000000 -0400
778+@@ -15,12 +15,13 @@
779+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
780+ */
781+
782+-#ifdef __LP64__
783++#if defined(__LP64__) && !defined(__SYSCALL_COMPAT)
784+ #define __ARCH_WANT_NEW_STAT
785+ #define __ARCH_WANT_SET_GET_RLIMIT
786+ #endif /* __LP64__ */
787+
788+ #define __ARCH_WANT_SYS_CLONE3
789++#define __ARCH_WANT_MEMFD_SECRET
790+
791+ #include <asm-generic/unistd.h>
792+
793+Index: qemu/linux-headers/asm-s390/kvm.h
794+===================================================================
795+--- qemu.orig/linux-headers/asm-s390/kvm.h 2023-07-04 20:38:39.000000000 -0400
796++++ qemu/linux-headers/asm-s390/kvm.h 2023-07-04 20:49:59.000000000 -0400
797+@@ -74,6 +74,7 @@
798+ #define KVM_S390_VM_CRYPTO 2
799+ #define KVM_S390_VM_CPU_MODEL 3
800+ #define KVM_S390_VM_MIGRATION 4
801++#define KVM_S390_VM_CPU_TOPOLOGY 5
802+
803+ /* kvm attributes for mem_ctrl */
804+ #define KVM_S390_VM_MEM_ENABLE_CMMA 0
805+Index: qemu/linux-headers/asm-x86/kvm.h
806+===================================================================
807+--- qemu.orig/linux-headers/asm-x86/kvm.h 2023-07-04 20:49:59.000000000 -0400
808++++ qemu/linux-headers/asm-x86/kvm.h 2023-07-04 20:49:59.000000000 -0400
809+@@ -198,13 +198,13 @@
810+ __u32 nmsrs; /* number of msrs in entries */
811+ __u32 pad;
812+
813+- struct kvm_msr_entry entries[0];
814++ struct kvm_msr_entry entries[];
815+ };
816+
817+ /* for KVM_GET_MSR_INDEX_LIST */
818+ struct kvm_msr_list {
819+ __u32 nmsrs; /* number of msrs in entries */
820+- __u32 indices[0];
821++ __u32 indices[];
822+ };
823+
824+ /* Maximum size of any access bitmap in bytes */
825+@@ -241,7 +241,7 @@
826+ struct kvm_cpuid {
827+ __u32 nent;
828+ __u32 padding;
829+- struct kvm_cpuid_entry entries[0];
830++ struct kvm_cpuid_entry entries[];
831+ };
832+
833+ struct kvm_cpuid_entry2 {
834+@@ -263,7 +263,7 @@
835+ struct kvm_cpuid2 {
836+ __u32 nent;
837+ __u32 padding;
838+- struct kvm_cpuid_entry2 entries[0];
839++ struct kvm_cpuid_entry2 entries[];
840+ };
841+
842+ /* for KVM_GET_PIT and KVM_SET_PIT */
843+@@ -306,7 +306,8 @@
844+ struct kvm_pit_channel_state channels[3];
845+ };
846+
847+-#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
848++#define KVM_PIT_FLAGS_HPET_LEGACY 0x00000001
849++#define KVM_PIT_FLAGS_SPEAKER_DATA_ON 0x00000002
850+
851+ struct kvm_pit_state2 {
852+ struct kvm_pit_channel_state channels[3];
853+@@ -325,6 +326,7 @@
854+ #define KVM_VCPUEVENT_VALID_SHADOW 0x00000004
855+ #define KVM_VCPUEVENT_VALID_SMM 0x00000008
856+ #define KVM_VCPUEVENT_VALID_PAYLOAD 0x00000010
857++#define KVM_VCPUEVENT_VALID_TRIPLE_FAULT 0x00000020
858+
859+ /* Interrupt shadow states */
860+ #define KVM_X86_SHADOW_INT_MOV_SS 0x01
861+@@ -359,7 +361,10 @@
862+ __u8 smm_inside_nmi;
863+ __u8 latched_init;
864+ } smi;
865+- __u8 reserved[27];
866++ struct {
867++ __u8 pending;
868++ } triple_fault;
869++ __u8 reserved[26];
870+ __u8 exception_has_payload;
871+ __u64 exception_payload;
872+ };
873+@@ -389,7 +394,7 @@
874+ * the contents of CPUID leaf 0xD on the host.
875+ */
876+ __u32 region[1024];
877+- __u32 extra[0];
878++ __u32 extra[];
879+ };
880+
881+ #define KVM_MAX_XCRS 16
882+@@ -428,11 +433,13 @@
883+ struct kvm_vcpu_events events;
884+ };
885+
886+-#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
887+-#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
888+-#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
889+-#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
890+-#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
891++#define KVM_X86_QUIRK_LINT0_REENABLED (1 << 0)
892++#define KVM_X86_QUIRK_CD_NW_CLEARED (1 << 1)
893++#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE (1 << 2)
894++#define KVM_X86_QUIRK_OUT_7E_INC_RIP (1 << 3)
895++#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT (1 << 4)
896++#define KVM_X86_QUIRK_FIX_HYPERCALL_INSN (1 << 5)
897++#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS (1 << 6)
898+
899+ #define KVM_STATE_NESTED_FORMAT_VMX 0
900+ #define KVM_STATE_NESTED_FORMAT_SVM 1
901+@@ -515,7 +522,7 @@
902+ __u32 fixed_counter_bitmap;
903+ __u32 flags;
904+ __u32 pad[4];
905+- __u64 events[0];
906++ __u64 events[];
907+ };
908+
909+ #define KVM_PMU_EVENT_ALLOW 0
910+Index: qemu/linux-headers/asm-x86/mman.h
911+===================================================================
912+--- qemu.orig/linux-headers/asm-x86/mman.h 2023-07-04 20:38:39.000000000 -0400
913++++ qemu/linux-headers/asm-x86/mman.h 2023-07-04 20:49:59.000000000 -0400
914+@@ -5,20 +5,6 @@
915+ #define MAP_32BIT 0x40 /* only give out 32bit addresses */
916+
917+ #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
918+-/*
919+- * Take the 4 protection key bits out of the vma->vm_flags
920+- * value and turn them in to the bits that we can put in
921+- * to a pte.
922+- *
923+- * Only override these if Protection Keys are available
924+- * (which is only on 64-bit).
925+- */
926+-#define arch_vm_get_page_prot(vm_flags) __pgprot( \
927+- ((vm_flags) & VM_PKEY_BIT0 ? _PAGE_PKEY_BIT0 : 0) | \
928+- ((vm_flags) & VM_PKEY_BIT1 ? _PAGE_PKEY_BIT1 : 0) | \
929+- ((vm_flags) & VM_PKEY_BIT2 ? _PAGE_PKEY_BIT2 : 0) | \
930+- ((vm_flags) & VM_PKEY_BIT3 ? _PAGE_PKEY_BIT3 : 0))
931+-
932+ #define arch_calc_vm_prot_bits(prot, key) ( \
933+ ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \
934+ ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \
935+Index: qemu/linux-headers/linux/kvm.h
936+===================================================================
937+--- qemu.orig/linux-headers/linux/kvm.h 2023-07-04 20:49:59.000000000 -0400
938++++ qemu/linux-headers/linux/kvm.h 2023-07-04 20:49:59.000000000 -0400
939+@@ -270,6 +270,8 @@
940+ #define KVM_EXIT_X86_BUS_LOCK 33
941+ #define KVM_EXIT_XEN 34
942+ #define KVM_EXIT_RISCV_SBI 35
943++#define KVM_EXIT_RISCV_CSR 36
944++#define KVM_EXIT_NOTIFY 37
945+
946+ /* For KVM_EXIT_INTERNAL_ERROR */
947+ /* Emulate instruction failed. */
948+@@ -444,6 +446,9 @@
949+ #define KVM_SYSTEM_EVENT_SHUTDOWN 1
950+ #define KVM_SYSTEM_EVENT_RESET 2
951+ #define KVM_SYSTEM_EVENT_CRASH 3
952++#define KVM_SYSTEM_EVENT_WAKEUP 4
953++#define KVM_SYSTEM_EVENT_SUSPEND 5
954++#define KVM_SYSTEM_EVENT_SEV_TERM 6
955+ __u32 type;
956+ __u32 ndata;
957+ union {
958+@@ -491,6 +496,18 @@
959+ unsigned long args[6];
960+ unsigned long ret[2];
961+ } riscv_sbi;
962++ /* KVM_EXIT_RISCV_CSR */
963++ struct {
964++ unsigned long csr_num;
965++ unsigned long new_value;
966++ unsigned long write_mask;
967++ unsigned long ret_value;
968++ } riscv_csr;
969++ /* KVM_EXIT_NOTIFY */
970++ struct {
971++#define KVM_NOTIFY_CONTEXT_INVALID (1 << 0)
972++ __u32 flags;
973++ } notify;
974+ /* Fix the size of the union. */
975+ char padding[256];
976+ };
977+@@ -537,7 +554,7 @@
978+
979+ struct kvm_coalesced_mmio_ring {
980+ __u32 first, last;
981+- struct kvm_coalesced_mmio coalesced_mmio[0];
982++ struct kvm_coalesced_mmio coalesced_mmio[];
983+ };
984+
985+ #define KVM_COALESCED_MMIO_MAX \
986+@@ -616,7 +633,7 @@
987+ /* for KVM_SET_SIGNAL_MASK */
988+ struct kvm_signal_mask {
989+ __u32 len;
990+- __u8 sigset[0];
991++ __u8 sigset[];
992+ };
993+
994+ /* for KVM_TPR_ACCESS_REPORTING */
995+@@ -644,6 +661,7 @@
996+ #define KVM_MP_STATE_OPERATING 7
997+ #define KVM_MP_STATE_LOAD 8
998+ #define KVM_MP_STATE_AP_RESET_HOLD 9
999++#define KVM_MP_STATE_SUSPENDED 10
1000+
1001+ struct kvm_mp_state {
1002+ __u32 mp_state;
1003+@@ -1148,8 +1166,15 @@
1004+ #define KVM_CAP_S390_MEM_OP_EXTENSION 211
1005+ #define KVM_CAP_PMU_CAPABILITY 212
1006+ #define KVM_CAP_DISABLE_QUIRKS2 213
1007+-/* #define KVM_CAP_VM_TSC_CONTROL 214 */
1008++#define KVM_CAP_VM_TSC_CONTROL 214
1009+ #define KVM_CAP_SYSTEM_EVENT_DATA 215
1010++#define KVM_CAP_ARM_SYSTEM_SUSPEND 216
1011++#define KVM_CAP_S390_PROTECTED_DUMP 217
1012++#define KVM_CAP_X86_TRIPLE_FAULT_EVENT 218
1013++#define KVM_CAP_X86_NOTIFY_VMEXIT 219
1014++#define KVM_CAP_VM_DISABLE_NX_HUGE_PAGES 220
1015++#define KVM_CAP_S390_ZPCI_OP 221
1016++#define KVM_CAP_S390_CPU_TOPOLOGY 222
1017+
1018+ #ifdef KVM_CAP_IRQ_ROUTING
1019+
1020+@@ -1214,7 +1239,7 @@
1021+ struct kvm_irq_routing {
1022+ __u32 nr;
1023+ __u32 flags;
1024+- struct kvm_irq_routing_entry entries[0];
1025++ struct kvm_irq_routing_entry entries[];
1026+ };
1027+
1028+ #endif
1029+@@ -1238,6 +1263,7 @@
1030+ #define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2)
1031+ #define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3)
1032+ #define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
1033++#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
1034+
1035+ struct kvm_xen_hvm_config {
1036+ __u32 flags;
1037+@@ -1333,7 +1359,7 @@
1038+
1039+ struct kvm_reg_list {
1040+ __u64 n; /* number of regs */
1041+- __u64 reg[0];
1042++ __u64 reg[];
1043+ };
1044+
1045+ struct kvm_one_reg {
1046+@@ -1476,7 +1502,8 @@
1047+ #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2)
1048+ /* Available with KVM_CAP_PPC_GET_PVINFO */
1049+ #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo)
1050+-/* Available with KVM_CAP_TSC_CONTROL */
1051++/* Available with KVM_CAP_TSC_CONTROL for a vCPU, or with
1052++* KVM_CAP_VM_TSC_CONTROL to set defaults for a VM */
1053+ #define KVM_SET_TSC_KHZ _IO(KVMIO, 0xa2)
1054+ #define KVM_GET_TSC_KHZ _IO(KVMIO, 0xa3)
1055+ /* Available with KVM_CAP_PCI_2_3 */
1056+@@ -1651,6 +1678,55 @@
1057+ __u64 tweak;
1058+ };
1059+
1060++enum pv_cmd_dmp_id {
1061++ KVM_PV_DUMP_INIT,
1062++ KVM_PV_DUMP_CONFIG_STOR_STATE,
1063++ KVM_PV_DUMP_COMPLETE,
1064++ KVM_PV_DUMP_CPU,
1065++};
1066++
1067++struct kvm_s390_pv_dmp {
1068++ __u64 subcmd;
1069++ __u64 buff_addr;
1070++ __u64 buff_len;
1071++ __u64 gaddr; /* For dump storage state */
1072++ __u64 reserved[4];
1073++};
1074++
1075++enum pv_cmd_info_id {
1076++ KVM_PV_INFO_VM,
1077++ KVM_PV_INFO_DUMP,
1078++};
1079++
1080++struct kvm_s390_pv_info_dump {
1081++ __u64 dump_cpu_buffer_len;
1082++ __u64 dump_config_mem_buffer_per_1m;
1083++ __u64 dump_config_finalize_len;
1084++};
1085++
1086++struct kvm_s390_pv_info_vm {
1087++ __u64 inst_calls_list[4];
1088++ __u64 max_cpus;
1089++ __u64 max_guests;
1090++ __u64 max_guest_addr;
1091++ __u64 feature_indication;
1092++};
1093++
1094++struct kvm_s390_pv_info_header {
1095++ __u32 id;
1096++ __u32 len_max;
1097++ __u32 len_written;
1098++ __u32 reserved;
1099++};
1100++
1101++struct kvm_s390_pv_info {
1102++ struct kvm_s390_pv_info_header header;
1103++ union {
1104++ struct kvm_s390_pv_info_dump dump;
1105++ struct kvm_s390_pv_info_vm vm;
1106++ };
1107++};
1108++
1109+ enum pv_cmd_id {
1110+ KVM_PV_ENABLE,
1111+ KVM_PV_DISABLE,
1112+@@ -1659,6 +1735,8 @@
1113+ KVM_PV_VERIFY,
1114+ KVM_PV_PREP_RESET,
1115+ KVM_PV_UNSHARE_ALL,
1116++ KVM_PV_INFO,
1117++ KVM_PV_DUMP,
1118+ };
1119+
1120+ struct kvm_pv_cmd {
1121+@@ -1692,6 +1770,32 @@
1122+ struct {
1123+ __u64 gfn;
1124+ } shared_info;
1125++ struct {
1126++ __u32 send_port;
1127++ __u32 type; /* EVTCHNSTAT_ipi / EVTCHNSTAT_interdomain */
1128++ __u32 flags;
1129++#define KVM_XEN_EVTCHN_DEASSIGN (1 << 0)
1130++#define KVM_XEN_EVTCHN_UPDATE (1 << 1)
1131++#define KVM_XEN_EVTCHN_RESET (1 << 2)
1132++ /*
1133++ * Events sent by the guest are either looped back to
1134++ * the guest itself (potentially on a different port#)
1135++ * or signalled via an eventfd.
1136++ */
1137++ union {
1138++ struct {
1139++ __u32 port;
1140++ __u32 vcpu;
1141++ __u32 priority;
1142++ } port;
1143++ struct {
1144++ __u32 port; /* Zero for eventfd */
1145++ __s32 fd;
1146++ } eventfd;
1147++ __u32 padding[4];
1148++ } deliver;
1149++ } evtchn;
1150++ __u32 xen_version;
1151+ __u64 pad[8];
1152+ } u;
1153+ };
1154+@@ -1700,11 +1804,17 @@
1155+ #define KVM_XEN_ATTR_TYPE_LONG_MODE 0x0
1156+ #define KVM_XEN_ATTR_TYPE_SHARED_INFO 0x1
1157+ #define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR 0x2
1158++/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_EVTCHN_SEND */
1159++#define KVM_XEN_ATTR_TYPE_EVTCHN 0x3
1160++#define KVM_XEN_ATTR_TYPE_XEN_VERSION 0x4
1161+
1162+ /* Per-vCPU Xen attributes */
1163+ #define KVM_XEN_VCPU_GET_ATTR _IOWR(KVMIO, 0xca, struct kvm_xen_vcpu_attr)
1164+ #define KVM_XEN_VCPU_SET_ATTR _IOW(KVMIO, 0xcb, struct kvm_xen_vcpu_attr)
1165+
1166++/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_EVTCHN_SEND */
1167++#define KVM_XEN_HVM_EVTCHN_SEND _IOW(KVMIO, 0xd0, struct kvm_irq_routing_xen_evtchn)
1168++
1169+ #define KVM_GET_SREGS2 _IOR(KVMIO, 0xcc, struct kvm_sregs2)
1170+ #define KVM_SET_SREGS2 _IOW(KVMIO, 0xcd, struct kvm_sregs2)
1171+
1172+@@ -1722,6 +1832,13 @@
1173+ __u64 time_blocked;
1174+ __u64 time_offline;
1175+ } runstate;
1176++ __u32 vcpu_id;
1177++ struct {
1178++ __u32 port;
1179++ __u32 priority;
1180++ __u64 expires_ns;
1181++ } timer;
1182++ __u8 vector;
1183+ } u;
1184+ };
1185+
1186+@@ -1732,6 +1849,10 @@
1187+ #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT 0x3
1188+ #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA 0x4
1189+ #define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST 0x5
1190++/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_EVTCHN_SEND */
1191++#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID 0x6
1192++#define KVM_XEN_VCPU_ATTR_TYPE_TIMER 0x7
1193++#define KVM_XEN_VCPU_ATTR_TYPE_UPCALL_VECTOR 0x8
1194+
1195+ /* Secure Encrypted Virtualization command */
1196+ enum sev_cmd_id {
1197+@@ -2032,7 +2153,7 @@
1198+ #define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT)
1199+ #define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT)
1200+ #define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT)
1201+-#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES
1202++#define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_BOOLEAN
1203+
1204+ #define KVM_STATS_BASE_SHIFT 8
1205+ #define KVM_STATS_BASE_MASK (0xF << KVM_STATS_BASE_SHIFT)
1206+@@ -2067,4 +2188,41 @@
1207+ /* Available with KVM_CAP_XSAVE2 */
1208+ #define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
1209+
1210++/* Available with KVM_CAP_S390_PROTECTED_DUMP */
1211++#define KVM_S390_PV_CPU_COMMAND _IOWR(KVMIO, 0xd0, struct kvm_pv_cmd)
1212++
1213++/* Available with KVM_CAP_X86_NOTIFY_VMEXIT */
1214++#define KVM_X86_NOTIFY_VMEXIT_ENABLED (1ULL << 0)
1215++#define KVM_X86_NOTIFY_VMEXIT_USER (1ULL << 1)
1216++
1217++/* Available with KVM_CAP_S390_ZPCI_OP */
1218++#define KVM_S390_ZPCI_OP _IOW(KVMIO, 0xd1, struct kvm_s390_zpci_op)
1219++
1220++struct kvm_s390_zpci_op {
1221++ /* in */
1222++ __u32 fh; /* target device */
1223++ __u8 op; /* operation to perform */
1224++ __u8 pad[3];
1225++ union {
1226++ /* for KVM_S390_ZPCIOP_REG_AEN */
1227++ struct {
1228++ __u64 ibv; /* Guest addr of interrupt bit vector */
1229++ __u64 sb; /* Guest addr of summary bit */
1230++ __u32 flags;
1231++ __u32 noi; /* Number of interrupts */
1232++ __u8 isc; /* Guest interrupt subclass */
1233++ __u8 sbo; /* Offset of guest summary bit vector */
1234++ __u16 pad;
1235++ } reg_aen;
1236++ __u64 reserved[8];
1237++ } u;
1238++};
1239++
1240++/* types for kvm_s390_zpci_op->op */
1241++#define KVM_S390_ZPCIOP_REG_AEN 0
1242++#define KVM_S390_ZPCIOP_DEREG_AEN 1
1243++
1244++/* flags for kvm_s390_zpci_op->u.reg_aen.flags */
1245++#define KVM_S390_ZPCIOP_REGAEN_HOST (1 << 0)
1246++
1247+ #endif /* __LINUX_KVM_H */
1248+Index: qemu/linux-headers/linux/userfaultfd.h
1249+===================================================================
1250+--- qemu.orig/linux-headers/linux/userfaultfd.h 2023-07-04 20:49:59.000000000 -0400
1251++++ qemu/linux-headers/linux/userfaultfd.h 2023-07-04 20:49:59.000000000 -0400
1252+@@ -33,7 +33,8 @@
1253+ UFFD_FEATURE_THREAD_ID | \
1254+ UFFD_FEATURE_MINOR_HUGETLBFS | \
1255+ UFFD_FEATURE_MINOR_SHMEM | \
1256+- UFFD_FEATURE_EXACT_ADDRESS)
1257++ UFFD_FEATURE_EXACT_ADDRESS | \
1258++ UFFD_FEATURE_WP_HUGETLBFS_SHMEM)
1259+ #define UFFD_API_IOCTLS \
1260+ ((__u64)1 << _UFFDIO_REGISTER | \
1261+ (__u64)1 << _UFFDIO_UNREGISTER | \
1262+@@ -47,7 +48,8 @@
1263+ #define UFFD_API_RANGE_IOCTLS_BASIC \
1264+ ((__u64)1 << _UFFDIO_WAKE | \
1265+ (__u64)1 << _UFFDIO_COPY | \
1266+- (__u64)1 << _UFFDIO_CONTINUE)
1267++ (__u64)1 << _UFFDIO_CONTINUE | \
1268++ (__u64)1 << _UFFDIO_WRITEPROTECT)
1269+
1270+ /*
1271+ * Valid ioctl command number range with this API is from 0x00 to
1272+@@ -194,6 +196,9 @@
1273+ * UFFD_FEATURE_EXACT_ADDRESS indicates that the exact address of page
1274+ * faults would be provided and the offset within the page would not be
1275+ * masked.
1276++ *
1277++ * UFFD_FEATURE_WP_HUGETLBFS_SHMEM indicates that userfaultfd
1278++ * write-protection mode is supported on both shmem and hugetlbfs.
1279+ */
1280+ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
1281+ #define UFFD_FEATURE_EVENT_FORK (1<<1)
1282+@@ -207,6 +212,7 @@
1283+ #define UFFD_FEATURE_MINOR_HUGETLBFS (1<<9)
1284+ #define UFFD_FEATURE_MINOR_SHMEM (1<<10)
1285+ #define UFFD_FEATURE_EXACT_ADDRESS (1<<11)
1286++#define UFFD_FEATURE_WP_HUGETLBFS_SHMEM (1<<12)
1287+ __u64 features;
1288+
1289+ __u64 ioctls;
1290+Index: qemu/linux-headers/linux/vduse.h
1291+===================================================================
1292+--- qemu.orig/linux-headers/linux/vduse.h 2023-07-04 20:49:59.000000000 -0400
1293++++ qemu/linux-headers/linux/vduse.h 2023-07-04 20:49:59.000000000 -0400
1294+@@ -210,6 +210,53 @@
1295+ */
1296+ #define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
1297+
1298++/**
1299++ * struct vduse_iova_umem - userspace memory configuration for one IOVA region
1300++ * @uaddr: start address of userspace memory, it must be aligned to page size
1301++ * @iova: start of the IOVA region
1302++ * @size: size of the IOVA region
1303++ * @reserved: for future use, needs to be initialized to zero
1304++ *
1305++ * Structure used by VDUSE_IOTLB_REG_UMEM and VDUSE_IOTLB_DEREG_UMEM
1306++ * ioctls to register/de-register userspace memory for IOVA regions
1307++ */
1308++struct vduse_iova_umem {
1309++ __u64 uaddr;
1310++ __u64 iova;
1311++ __u64 size;
1312++ __u64 reserved[3];
1313++};
1314++
1315++/* Register userspace memory for IOVA regions */
1316++#define VDUSE_IOTLB_REG_UMEM _IOW(VDUSE_BASE, 0x18, struct vduse_iova_umem)
1317++
1318++/* De-register the userspace memory. Caller should set iova and size field. */
1319++#define VDUSE_IOTLB_DEREG_UMEM _IOW(VDUSE_BASE, 0x19, struct vduse_iova_umem)
1320++
1321++/**
1322++ * struct vduse_iova_info - information of one IOVA region
1323++ * @start: start of the IOVA region
1324++ * @last: last of the IOVA region
1325++ * @capability: capability of the IOVA regsion
1326++ * @reserved: for future use, needs to be initialized to zero
1327++ *
1328++ * Structure used by VDUSE_IOTLB_GET_INFO ioctl to get information of
1329++ * one IOVA region.
1330++ */
1331++struct vduse_iova_info {
1332++ __u64 start;
1333++ __u64 last;
1334++#define VDUSE_IOVA_CAP_UMEM (1 << 0)
1335++ __u64 capability;
1336++ __u64 reserved[3];
1337++};
1338++
1339++/*
1340++ * Find the first IOVA region that overlaps with the range [start, last]
1341++ * and return some information on it. Caller should set start and last fields.
1342++ */
1343++#define VDUSE_IOTLB_GET_INFO _IOWR(VDUSE_BASE, 0x1a, struct vduse_iova_info)
1344++
1345+ /* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */
1346+
1347+ /**
1348+Index: qemu/linux-headers/linux/vfio.h
1349+===================================================================
1350+--- qemu.orig/linux-headers/linux/vfio.h 2023-07-04 20:49:59.000000000 -0400
1351++++ qemu/linux-headers/linux/vfio.h 2023-07-04 20:49:59.000000000 -0400
1352+@@ -643,7 +643,7 @@
1353+ };
1354+
1355+ /**
1356+- * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IORW(VFIO_TYPE, VFIO_BASE + 12,
1357++ * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12,
1358+ * struct vfio_pci_hot_reset_info)
1359+ *
1360+ * Return: 0 on success, -errno on failure:
1361+@@ -770,7 +770,7 @@
1362+ #define VFIO_DEVICE_IOEVENTFD _IO(VFIO_TYPE, VFIO_BASE + 16)
1363+
1364+ /**
1365+- * VFIO_DEVICE_FEATURE - _IORW(VFIO_TYPE, VFIO_BASE + 17,
1366++ * VFIO_DEVICE_FEATURE - _IOWR(VFIO_TYPE, VFIO_BASE + 17,
1367+ * struct vfio_device_feature)
1368+ *
1369+ * Get, set, or probe feature data of the device. The feature is selected
1370+Index: qemu/linux-headers/linux/vfio_zdev.h
1371+===================================================================
1372+--- qemu.orig/linux-headers/linux/vfio_zdev.h 2023-07-04 20:38:39.000000000 -0400
1373++++ qemu/linux-headers/linux/vfio_zdev.h 2023-07-04 20:49:59.000000000 -0400
1374+@@ -29,6 +29,9 @@
1375+ __u16 fmb_length; /* Measurement Block Length (in bytes) */
1376+ __u8 pft; /* PCI Function Type */
1377+ __u8 gid; /* PCI function group ID */
1378++ /* End of version 1 */
1379++ __u32 fh; /* PCI function handle */
1380++ /* End of version 2 */
1381+ };
1382+
1383+ /**
1384+@@ -47,6 +50,10 @@
1385+ __u16 noi; /* Maximum number of MSIs */
1386+ __u16 maxstbl; /* Maximum Store Block Length */
1387+ __u8 version; /* Supported PCI Version */
1388++ /* End of version 1 */
1389++ __u8 reserved;
1390++ __u16 imaxstbl; /* Maximum Interpreted Store Block Length */
1391++ /* End of version 2 */
1392+ };
1393+
1394+ /**
1395+Index: qemu/linux-headers/linux/vhost.h
1396+===================================================================
1397+--- qemu.orig/linux-headers/linux/vhost.h 2023-07-04 20:49:59.000000000 -0400
1398++++ qemu/linux-headers/linux/vhost.h 2023-07-04 20:49:59.000000000 -0400
1399+@@ -89,11 +89,6 @@
1400+
1401+ /* Set or get vhost backend capability */
1402+
1403+-/* Use message type V2 */
1404+-#define VHOST_BACKEND_F_IOTLB_MSG_V2 0x1
1405+-/* IOTLB can accept batching hints */
1406+-#define VHOST_BACKEND_F_IOTLB_BATCH 0x2
1407+-
1408+ #define VHOST_SET_BACKEND_FEATURES _IOW(VHOST_VIRTIO, 0x25, __u64)
1409+ #define VHOST_GET_BACKEND_FEATURES _IOR(VHOST_VIRTIO, 0x26, __u64)
1410+
1411+@@ -150,11 +145,39 @@
1412+ /* Get the valid iova range */
1413+ #define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \
1414+ struct vhost_vdpa_iova_range)
1415+-
1416+ /* Get the config size */
1417+ #define VHOST_VDPA_GET_CONFIG_SIZE _IOR(VHOST_VIRTIO, 0x79, __u32)
1418+
1419+ /* Get the count of all virtqueues */
1420+ #define VHOST_VDPA_GET_VQS_COUNT _IOR(VHOST_VIRTIO, 0x80, __u32)
1421+
1422++/* Get the number of virtqueue groups. */
1423++#define VHOST_VDPA_GET_GROUP_NUM _IOR(VHOST_VIRTIO, 0x81, __u32)
1424++
1425++/* Get the number of address spaces. */
1426++#define VHOST_VDPA_GET_AS_NUM _IOR(VHOST_VIRTIO, 0x7A, unsigned int)
1427++
1428++/* Get the group for a virtqueue: read index, write group in num,
1429++ * The virtqueue index is stored in the index field of
1430++ * vhost_vring_state. The group for this specific virtqueue is
1431++ * returned via num field of vhost_vring_state.
1432++ */
1433++#define VHOST_VDPA_GET_VRING_GROUP _IOWR(VHOST_VIRTIO, 0x7B, \
1434++ struct vhost_vring_state)
1435++/* Set the ASID for a virtqueue group. The group index is stored in
1436++ * the index field of vhost_vring_state, the ASID associated with this
1437++ * group is stored at num field of vhost_vring_state.
1438++ */
1439++#define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \
1440++ struct vhost_vring_state)
1441++
1442++/* Suspend a device so it does not process virtqueue requests anymore
1443++ *
1444++ * After the return of ioctl the device must preserve all the necessary state
1445++ * (the virtqueue vring base plus the possible device specific states) that is
1446++ * required for restoring in the future. The device must not change its
1447++ * configuration after that point.
1448++ */
1449++#define VHOST_VDPA_SUSPEND _IO(VHOST_VIRTIO, 0x7D)
1450++
1451+ #endif
1452diff --git a/debian/patches/ubuntu/lp-1853307-configure-Add-Wno-gnu-variable-sized-type-not-at-end.patch b/debian/patches/ubuntu/lp-1853307-configure-Add-Wno-gnu-variable-sized-type-not-at-end.patch
1453new file mode 100644
1454index 0000000..3ab96c1
1455--- /dev/null
1456+++ b/debian/patches/ubuntu/lp-1853307-configure-Add-Wno-gnu-variable-sized-type-not-at-end.patch
1457@@ -0,0 +1,69 @@
1458+From 28d01b1d69e947a50b9ab9b45113fda1c4f96ac9 Mon Sep 17 00:00:00 2001
1459+From: Chenyi Qiang <chenyi.qiang@intel.com>
1460+Date: Thu, 15 Sep 2022 17:10:34 +0800
1461+Subject: [PATCH] configure: Add -Wno-gnu-variable-sized-type-not-at-end
1462+MIME-Version: 1.0
1463+Content-Type: text/plain; charset=UTF-8
1464+Content-Transfer-Encoding: 8bit
1465+
1466+A Linux headers update to v6.0-rc switches some definitions from GNU
1467+'zero-length-array' extension to the C-standard-defined flexible array
1468+member. e.g.
1469+
1470+struct kvm_msrs {
1471+ __u32 nmsrs; /* number of msrs in entries */
1472+ __u32 pad;
1473+
1474+- struct kvm_msr_entry entries[0];
1475++ struct kvm_msr_entry entries[];
1476+};
1477+
1478+Those (unlike the GNU zero-length-array) have some extra restrictions like
1479+'this must be put at the end of a struct', which clang build would complain
1480+about. e.g. the current code
1481+
1482+struct {
1483+ struct kvm_msrs info;
1484+ struct kvm_msr_entry entries[1];
1485+} msr_data = { }
1486+
1487+generates the warning like:
1488+
1489+target/i386/kvm/kvm.c:2868:25: error: field 'info' with variable sized
1490+type 'struct kvm_msrs' not at the end of a struct or class is a GNU
1491+extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
1492+ struct kvm_msrs info;
1493+ ^
1494+In fact, the variable length 'entries[]' field in 'info' is zero-sized in
1495+GNU defined semantics, which can give predictable offset for 'entries[1]'
1496+in local msr_data. The local defined struct is just there to force a stack
1497+allocation large enough for 1 kvm_msr_entry, a clever trick but requires to
1498+turn off this clang warning.
1499+
1500+Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
1501+Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
1502+Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
1503+Reviewed-by: Cornelia Huck <cohuck@redhat.com>
1504+Message-Id: <20220915091035.3897-2-chenyi.qiang@intel.com>
1505+Signed-off-by: Thomas Huth <thuth@redhat.com>
1506+
1507+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/28d01b1d69
1508+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
1509+Last-Update: 2023-07-04
1510+
1511+---
1512+ configure | 1 +
1513+ 1 file changed, 1 insertion(+)
1514+
1515+Index: qemu/configure
1516+===================================================================
1517+--- qemu.orig/configure 2023-07-04 20:38:39.000000000 -0400
1518++++ qemu/configure 2023-07-04 20:49:59.000000000 -0400
1519+@@ -1641,6 +1641,7 @@
1520+ add_to nowarn_flags -Wno-typedef-redefinition
1521+ add_to nowarn_flags -Wno-tautological-type-limit-compare
1522+ add_to nowarn_flags -Wno-psabi
1523++add_to nowarn_flags -Wno-gnu-variable-sized-type-not-at-end
1524+
1525+ gcc_flags="$warn_flags $nowarn_flags"
1526+
1527diff --git a/debian/patches/ubuntu/lp-1853307-hw-i386-pass-RNG-seed-via-setup_data-entry.patch b/debian/patches/ubuntu/lp-1853307-hw-i386-pass-RNG-seed-via-setup_data-entry.patch
1528new file mode 100644
1529index 0000000..c17c3c8
1530--- /dev/null
1531+++ b/debian/patches/ubuntu/lp-1853307-hw-i386-pass-RNG-seed-via-setup_data-entry.patch
1532@@ -0,0 +1,53 @@
1533+From 94abf6cf290d849681a6d374c73fff1032a4c672 Mon Sep 17 00:00:00 2001
1534+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
1535+Date: Thu, 21 Jul 2022 14:56:36 +0200
1536+Subject: [PATCH 2/2] hw/i386: pass RNG seed via setup_data entry
1537+MIME-Version: 1.0
1538+Content-Type: text/plain; charset=UTF-8
1539+Content-Transfer-Encoding: 8bit
1540+
1541+Tiny machines optimized for fast boot time generally don't use EFI,
1542+which means a random seed has to be supplied some other way. For this
1543+purpose, Linux (≥5.20) supports passing a seed in the setup_data table
1544+with SETUP_RNG_SEED, specially intended for hypervisors, kexec, and
1545+specialized bootloaders. The linked commit shows the upstream kernel
1546+implementation.
1547+
1548+At Paolo's request, we don't pass these to versioned machine types ≤7.0.
1549+
1550+Link: https://git.kernel.org/tip/tip/c/68b8e9713c8
1551+Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
1552+Cc: Paolo Bonzini <pbonzini@redhat.com>
1553+Cc: Richard Henderson <richard.henderson@linaro.org>
1554+Cc: Eduardo Habkost <eduardo@habkost.net>
1555+Cc: Peter Maydell <peter.maydell@linaro.org>
1556+Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
1557+Cc: Laurent Vivier <laurent@vivier.eu>
1558+Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
1559+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
1560+Message-Id: <20220721125636.446842-1-Jason@zx2c4.com>
1561+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1562+(backported from commit 67f7e426e53833a5db75b0d813e8d537b8a75bd2)
1563+[MR: only backport the standard-headers change]
1564+Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
1565+
1566+Origin: backport, https://gitlab.com/qemu-project/qemu/commit/67f7e426e5
1567+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
1568+Last-Update: 2023-07-04
1569+
1570+---
1571+ include/standard-headers/asm-x86/bootparam.h | 1 +
1572+ 1 file changed, 1 insertion(+)
1573+
1574+Index: qemu/include/standard-headers/asm-x86/bootparam.h
1575+===================================================================
1576+--- qemu.orig/include/standard-headers/asm-x86/bootparam.h 2023-07-04 20:38:39.000000000 -0400
1577++++ qemu/include/standard-headers/asm-x86/bootparam.h 2023-07-04 20:51:04.000000000 -0400
1578+@@ -10,6 +10,7 @@
1579+ #define SETUP_EFI 4
1580+ #define SETUP_APPLE_PROPERTIES 5
1581+ #define SETUP_JAILHOUSE 6
1582++#define SETUP_RNG_SEED 9
1583+
1584+ #define SETUP_INDIRECT (1<<31)
1585+
1586diff --git a/debian/patches/ubuntu/lp-1853307-kvm-add-support-for-boolean-statistics.patch b/debian/patches/ubuntu/lp-1853307-kvm-add-support-for-boolean-statistics.patch
1587new file mode 100644
1588index 0000000..93dc181
1589--- /dev/null
1590+++ b/debian/patches/ubuntu/lp-1853307-kvm-add-support-for-boolean-statistics.patch
1591@@ -0,0 +1,34 @@
1592+From f36271513241b0df0b78e15c9774bcf63f2d929e Mon Sep 17 00:00:00 2001
1593+From: Paolo Bonzini <pbonzini@redhat.com>
1594+Date: Thu, 14 Jul 2022 14:10:22 +0200
1595+Subject: [PATCH 1/2] kvm: add support for boolean statistics
1596+
1597+The next version of Linux will introduce boolean statistics, which
1598+can only have 0 or 1 values. Convert them to the new QAPI fields
1599+added in the previous commit.
1600+
1601+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1602+(backported from commit 105bb7cdbe9b60129034410e228535f5ea5648ea)
1603+[MR: only backport linux-header changes]
1604+Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
1605+
1606+Origin: backport, https://gitlab.com/qemu-project/qemu/commit/105bb7cdbe
1607+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
1608+Last-Update: 2023-07-04
1609+
1610+---
1611+ linux-headers/linux/kvm.h | 1 +
1612+ 1 file changed, 1 insertion(+)
1613+
1614+Index: qemu/linux-headers/linux/kvm.h
1615+===================================================================
1616+--- qemu.orig/linux-headers/linux/kvm.h 2023-07-04 20:49:59.000000000 -0400
1617++++ qemu/linux-headers/linux/kvm.h 2023-07-04 20:51:04.000000000 -0400
1618+@@ -2031,6 +2031,7 @@
1619+ #define KVM_STATS_UNIT_BYTES (0x1 << KVM_STATS_UNIT_SHIFT)
1620+ #define KVM_STATS_UNIT_SECONDS (0x2 << KVM_STATS_UNIT_SHIFT)
1621+ #define KVM_STATS_UNIT_CYCLES (0x3 << KVM_STATS_UNIT_SHIFT)
1622++#define KVM_STATS_UNIT_BOOLEAN (0x4 << KVM_STATS_UNIT_SHIFT)
1623+ #define KVM_STATS_UNIT_MAX KVM_STATS_UNIT_CYCLES
1624+
1625+ #define KVM_STATS_BASE_SHIFT 8
1626diff --git a/debian/patches/ubuntu/lp-1853307-linux-headers-Add-vduse.h.patch b/debian/patches/ubuntu/lp-1853307-linux-headers-Add-vduse.h.patch
1627new file mode 100644
1628index 0000000..7b398b8
1629--- /dev/null
1630+++ b/debian/patches/ubuntu/lp-1853307-linux-headers-Add-vduse.h.patch
1631@@ -0,0 +1,347 @@
1632+From 92e879505feb70d141acdb78c0331c796fda8f96 Mon Sep 17 00:00:00 2001
1633+From: Xie Yongji <xieyongji@bytedance.com>
1634+Date: Mon, 23 May 2022 16:46:07 +0800
1635+Subject: [PATCH] linux-headers: Add vduse.h
1636+
1637+This adds vduse header to linux headers so that the
1638+relevant VDUSE API can be used in subsequent patches.
1639+
1640+Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
1641+Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
1642+Message-Id: <20220523084611.91-5-xieyongji@bytedance.com>
1643+Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1644+
1645+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/92e879505f
1646+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
1647+Last-Update: 2023-07-04
1648+
1649+---
1650+ linux-headers/linux/vduse.h | 306 ++++++++++++++++++++++++++++++++
1651+ scripts/update-linux-headers.sh | 2 +-
1652+ 2 files changed, 307 insertions(+), 1 deletion(-)
1653+ create mode 100644 linux-headers/linux/vduse.h
1654+
1655+Index: qemu/linux-headers/linux/vduse.h
1656+===================================================================
1657+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1658++++ qemu/linux-headers/linux/vduse.h 2023-07-04 20:51:04.000000000 -0400
1659+@@ -0,0 +1,306 @@
1660++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1661++#ifndef _VDUSE_H_
1662++#define _VDUSE_H_
1663++
1664++#include <linux/types.h>
1665++
1666++#define VDUSE_BASE 0x81
1667++
1668++/* The ioctls for control device (/dev/vduse/control) */
1669++
1670++#define VDUSE_API_VERSION 0
1671++
1672++/*
1673++ * Get the version of VDUSE API that kernel supported (VDUSE_API_VERSION).
1674++ * This is used for future extension.
1675++ */
1676++#define VDUSE_GET_API_VERSION _IOR(VDUSE_BASE, 0x00, __u64)
1677++
1678++/* Set the version of VDUSE API that userspace supported. */
1679++#define VDUSE_SET_API_VERSION _IOW(VDUSE_BASE, 0x01, __u64)
1680++
1681++/**
1682++ * struct vduse_dev_config - basic configuration of a VDUSE device
1683++ * @name: VDUSE device name, needs to be NUL terminated
1684++ * @vendor_id: virtio vendor id
1685++ * @device_id: virtio device id
1686++ * @features: virtio features
1687++ * @vq_num: the number of virtqueues
1688++ * @vq_align: the allocation alignment of virtqueue's metadata
1689++ * @reserved: for future use, needs to be initialized to zero
1690++ * @config_size: the size of the configuration space
1691++ * @config: the buffer of the configuration space
1692++ *
1693++ * Structure used by VDUSE_CREATE_DEV ioctl to create VDUSE device.
1694++ */
1695++struct vduse_dev_config {
1696++#define VDUSE_NAME_MAX 256
1697++ char name[VDUSE_NAME_MAX];
1698++ __u32 vendor_id;
1699++ __u32 device_id;
1700++ __u64 features;
1701++ __u32 vq_num;
1702++ __u32 vq_align;
1703++ __u32 reserved[13];
1704++ __u32 config_size;
1705++ __u8 config[];
1706++};
1707++
1708++/* Create a VDUSE device which is represented by a char device (/dev/vduse/$NAME) */
1709++#define VDUSE_CREATE_DEV _IOW(VDUSE_BASE, 0x02, struct vduse_dev_config)
1710++
1711++/*
1712++ * Destroy a VDUSE device. Make sure there are no more references
1713++ * to the char device (/dev/vduse/$NAME).
1714++ */
1715++#define VDUSE_DESTROY_DEV _IOW(VDUSE_BASE, 0x03, char[VDUSE_NAME_MAX])
1716++
1717++/* The ioctls for VDUSE device (/dev/vduse/$NAME) */
1718++
1719++/**
1720++ * struct vduse_iotlb_entry - entry of IOTLB to describe one IOVA region [start, last]
1721++ * @offset: the mmap offset on returned file descriptor
1722++ * @start: start of the IOVA region
1723++ * @last: last of the IOVA region
1724++ * @perm: access permission of the IOVA region
1725++ *
1726++ * Structure used by VDUSE_IOTLB_GET_FD ioctl to find an overlapped IOVA region.
1727++ */
1728++struct vduse_iotlb_entry {
1729++ __u64 offset;
1730++ __u64 start;
1731++ __u64 last;
1732++#define VDUSE_ACCESS_RO 0x1
1733++#define VDUSE_ACCESS_WO 0x2
1734++#define VDUSE_ACCESS_RW 0x3
1735++ __u8 perm;
1736++};
1737++
1738++/*
1739++ * Find the first IOVA region that overlaps with the range [start, last]
1740++ * and return the corresponding file descriptor. Return -EINVAL means the
1741++ * IOVA region doesn't exist. Caller should set start and last fields.
1742++ */
1743++#define VDUSE_IOTLB_GET_FD _IOWR(VDUSE_BASE, 0x10, struct vduse_iotlb_entry)
1744++
1745++/*
1746++ * Get the negotiated virtio features. It's a subset of the features in
1747++ * struct vduse_dev_config which can be accepted by virtio driver. It's
1748++ * only valid after FEATURES_OK status bit is set.
1749++ */
1750++#define VDUSE_DEV_GET_FEATURES _IOR(VDUSE_BASE, 0x11, __u64)
1751++
1752++/**
1753++ * struct vduse_config_data - data used to update configuration space
1754++ * @offset: the offset from the beginning of configuration space
1755++ * @length: the length to write to configuration space
1756++ * @buffer: the buffer used to write from
1757++ *
1758++ * Structure used by VDUSE_DEV_SET_CONFIG ioctl to update device
1759++ * configuration space.
1760++ */
1761++struct vduse_config_data {
1762++ __u32 offset;
1763++ __u32 length;
1764++ __u8 buffer[];
1765++};
1766++
1767++/* Set device configuration space */
1768++#define VDUSE_DEV_SET_CONFIG _IOW(VDUSE_BASE, 0x12, struct vduse_config_data)
1769++
1770++/*
1771++ * Inject a config interrupt. It's usually used to notify virtio driver
1772++ * that device configuration space has changed.
1773++ */
1774++#define VDUSE_DEV_INJECT_CONFIG_IRQ _IO(VDUSE_BASE, 0x13)
1775++
1776++/**
1777++ * struct vduse_vq_config - basic configuration of a virtqueue
1778++ * @index: virtqueue index
1779++ * @max_size: the max size of virtqueue
1780++ * @reserved: for future use, needs to be initialized to zero
1781++ *
1782++ * Structure used by VDUSE_VQ_SETUP ioctl to setup a virtqueue.
1783++ */
1784++struct vduse_vq_config {
1785++ __u32 index;
1786++ __u16 max_size;
1787++ __u16 reserved[13];
1788++};
1789++
1790++/*
1791++ * Setup the specified virtqueue. Make sure all virtqueues have been
1792++ * configured before the device is attached to vDPA bus.
1793++ */
1794++#define VDUSE_VQ_SETUP _IOW(VDUSE_BASE, 0x14, struct vduse_vq_config)
1795++
1796++/**
1797++ * struct vduse_vq_state_split - split virtqueue state
1798++ * @avail_index: available index
1799++ */
1800++struct vduse_vq_state_split {
1801++ __u16 avail_index;
1802++};
1803++
1804++/**
1805++ * struct vduse_vq_state_packed - packed virtqueue state
1806++ * @last_avail_counter: last driver ring wrap counter observed by device
1807++ * @last_avail_idx: device available index
1808++ * @last_used_counter: device ring wrap counter
1809++ * @last_used_idx: used index
1810++ */
1811++struct vduse_vq_state_packed {
1812++ __u16 last_avail_counter;
1813++ __u16 last_avail_idx;
1814++ __u16 last_used_counter;
1815++ __u16 last_used_idx;
1816++};
1817++
1818++/**
1819++ * struct vduse_vq_info - information of a virtqueue
1820++ * @index: virtqueue index
1821++ * @num: the size of virtqueue
1822++ * @desc_addr: address of desc area
1823++ * @driver_addr: address of driver area
1824++ * @device_addr: address of device area
1825++ * @split: split virtqueue state
1826++ * @packed: packed virtqueue state
1827++ * @ready: ready status of virtqueue
1828++ *
1829++ * Structure used by VDUSE_VQ_GET_INFO ioctl to get virtqueue's information.
1830++ */
1831++struct vduse_vq_info {
1832++ __u32 index;
1833++ __u32 num;
1834++ __u64 desc_addr;
1835++ __u64 driver_addr;
1836++ __u64 device_addr;
1837++ union {
1838++ struct vduse_vq_state_split split;
1839++ struct vduse_vq_state_packed packed;
1840++ };
1841++ __u8 ready;
1842++};
1843++
1844++/* Get the specified virtqueue's information. Caller should set index field. */
1845++#define VDUSE_VQ_GET_INFO _IOWR(VDUSE_BASE, 0x15, struct vduse_vq_info)
1846++
1847++/**
1848++ * struct vduse_vq_eventfd - eventfd configuration for a virtqueue
1849++ * @index: virtqueue index
1850++ * @fd: eventfd, -1 means de-assigning the eventfd
1851++ *
1852++ * Structure used by VDUSE_VQ_SETUP_KICKFD ioctl to setup kick eventfd.
1853++ */
1854++struct vduse_vq_eventfd {
1855++ __u32 index;
1856++#define VDUSE_EVENTFD_DEASSIGN -1
1857++ int fd;
1858++};
1859++
1860++/*
1861++ * Setup kick eventfd for specified virtqueue. The kick eventfd is used
1862++ * by VDUSE kernel module to notify userspace to consume the avail vring.
1863++ */
1864++#define VDUSE_VQ_SETUP_KICKFD _IOW(VDUSE_BASE, 0x16, struct vduse_vq_eventfd)
1865++
1866++/*
1867++ * Inject an interrupt for specific virtqueue. It's used to notify virtio driver
1868++ * to consume the used vring.
1869++ */
1870++#define VDUSE_VQ_INJECT_IRQ _IOW(VDUSE_BASE, 0x17, __u32)
1871++
1872++/* The control messages definition for read(2)/write(2) on /dev/vduse/$NAME */
1873++
1874++/**
1875++ * enum vduse_req_type - request type
1876++ * @VDUSE_GET_VQ_STATE: get the state for specified virtqueue from userspace
1877++ * @VDUSE_SET_STATUS: set the device status
1878++ * @VDUSE_UPDATE_IOTLB: Notify userspace to update the memory mapping for
1879++ * specified IOVA range via VDUSE_IOTLB_GET_FD ioctl
1880++ */
1881++enum vduse_req_type {
1882++ VDUSE_GET_VQ_STATE,
1883++ VDUSE_SET_STATUS,
1884++ VDUSE_UPDATE_IOTLB,
1885++};
1886++
1887++/**
1888++ * struct vduse_vq_state - virtqueue state
1889++ * @index: virtqueue index
1890++ * @split: split virtqueue state
1891++ * @packed: packed virtqueue state
1892++ */
1893++struct vduse_vq_state {
1894++ __u32 index;
1895++ union {
1896++ struct vduse_vq_state_split split;
1897++ struct vduse_vq_state_packed packed;
1898++ };
1899++};
1900++
1901++/**
1902++ * struct vduse_dev_status - device status
1903++ * @status: device status
1904++ */
1905++struct vduse_dev_status {
1906++ __u8 status;
1907++};
1908++
1909++/**
1910++ * struct vduse_iova_range - IOVA range [start, last]
1911++ * @start: start of the IOVA range
1912++ * @last: last of the IOVA range
1913++ */
1914++struct vduse_iova_range {
1915++ __u64 start;
1916++ __u64 last;
1917++};
1918++
1919++/**
1920++ * struct vduse_dev_request - control request
1921++ * @type: request type
1922++ * @request_id: request id
1923++ * @reserved: for future use
1924++ * @vq_state: virtqueue state, only index field is available
1925++ * @s: device status
1926++ * @iova: IOVA range for updating
1927++ * @padding: padding
1928++ *
1929++ * Structure used by read(2) on /dev/vduse/$NAME.
1930++ */
1931++struct vduse_dev_request {
1932++ __u32 type;
1933++ __u32 request_id;
1934++ __u32 reserved[4];
1935++ union {
1936++ struct vduse_vq_state vq_state;
1937++ struct vduse_dev_status s;
1938++ struct vduse_iova_range iova;
1939++ __u32 padding[32];
1940++ };
1941++};
1942++
1943++/**
1944++ * struct vduse_dev_response - response to control request
1945++ * @request_id: corresponding request id
1946++ * @result: the result of request
1947++ * @reserved: for future use, needs to be initialized to zero
1948++ * @vq_state: virtqueue state
1949++ * @padding: padding
1950++ *
1951++ * Structure used by write(2) on /dev/vduse/$NAME.
1952++ */
1953++struct vduse_dev_response {
1954++ __u32 request_id;
1955++#define VDUSE_REQ_RESULT_OK 0x00
1956++#define VDUSE_REQ_RESULT_FAILED 0x01
1957++ __u32 result;
1958++ __u32 reserved[4];
1959++ union {
1960++ struct vduse_vq_state vq_state;
1961++ __u32 padding[32];
1962++ };
1963++};
1964++
1965++#endif /* _VDUSE_H_ */
1966+Index: qemu/scripts/update-linux-headers.sh
1967+===================================================================
1968+--- qemu.orig/scripts/update-linux-headers.sh 2023-07-04 20:38:39.000000000 -0400
1969++++ qemu/scripts/update-linux-headers.sh 2023-07-04 20:49:59.000000000 -0400
1970+@@ -145,7 +145,7 @@
1971+ rm -rf "$output/linux-headers/linux"
1972+ mkdir -p "$output/linux-headers/linux"
1973+ for header in kvm.h vfio.h vfio_ccw.h vfio_zdev.h vhost.h \
1974+- psci.h psp-sev.h userfaultfd.h mman.h; do
1975++ psci.h psp-sev.h userfaultfd.h mman.h vduse.h; do
1976+ cp "$tmpdir/include/linux/$header" "$output/linux-headers/linux"
1977+ done
1978+
1979diff --git a/debian/patches/ubuntu/lp-1853307-linux-headers-Update-headers-to-v5.17-rc1.patch b/debian/patches/ubuntu/lp-1853307-linux-headers-Update-headers-to-v5.17-rc1.patch
1980new file mode 100644
1981index 0000000..19f8a7f
1982--- /dev/null
1983+++ b/debian/patches/ubuntu/lp-1853307-linux-headers-Update-headers-to-v5.17-rc1.patch
1984@@ -0,0 +1,1212 @@
1985+From ef17dd6a8e6b6e3aeb29233996d44dfcb736d515 Mon Sep 17 00:00:00 2001
1986+From: Vivek Goyal <vgoyal@redhat.com>
1987+Date: Tue, 8 Feb 2022 15:48:05 -0500
1988+Subject: [PATCH] linux-headers: Update headers to v5.17-rc1
1989+
1990+Update headers to 5.17-rc1. I need latest fuse changes.
1991+
1992+Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1993+Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
1994+Message-Id: <20220208204813.682906-3-vgoyal@redhat.com>
1995+Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1996+
1997+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/ef17dd6a8e
1998+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
1999+Last-Update: 2023-07-04
2000+
2001+---
2002+ include/standard-headers/asm-x86/kvm_para.h | 1 +
2003+ include/standard-headers/drm/drm_fourcc.h | 11 ++
2004+ include/standard-headers/linux/ethtool.h | 1 +
2005+ include/standard-headers/linux/fuse.h | 60 +++++++-
2006+ include/standard-headers/linux/pci_regs.h | 142 +++++++++---------
2007+ include/standard-headers/linux/virtio_gpio.h | 72 +++++++++
2008+ include/standard-headers/linux/virtio_i2c.h | 47 ++++++
2009+ include/standard-headers/linux/virtio_iommu.h | 8 +-
2010+ .../standard-headers/linux/virtio_pcidev.h | 65 ++++++++
2011+ include/standard-headers/linux/virtio_scmi.h | 24 +++
2012+ linux-headers/asm-generic/unistd.h | 5 +-
2013+ linux-headers/asm-mips/unistd_n32.h | 2 +
2014+ linux-headers/asm-mips/unistd_n64.h | 2 +
2015+ linux-headers/asm-mips/unistd_o32.h | 2 +
2016+ linux-headers/asm-powerpc/unistd_32.h | 2 +
2017+ linux-headers/asm-powerpc/unistd_64.h | 2 +
2018+ linux-headers/asm-riscv/bitsperlong.h | 14 ++
2019+ linux-headers/asm-riscv/mman.h | 1 +
2020+ linux-headers/asm-riscv/unistd.h | 44 ++++++
2021+ linux-headers/asm-s390/unistd_32.h | 2 +
2022+ linux-headers/asm-s390/unistd_64.h | 2 +
2023+ linux-headers/asm-x86/kvm.h | 16 +-
2024+ linux-headers/asm-x86/unistd_32.h | 1 +
2025+ linux-headers/asm-x86/unistd_64.h | 1 +
2026+ linux-headers/asm-x86/unistd_x32.h | 1 +
2027+ linux-headers/linux/kvm.h | 17 +++
2028+ 26 files changed, 469 insertions(+), 76 deletions(-)
2029+ create mode 100644 include/standard-headers/linux/virtio_gpio.h
2030+ create mode 100644 include/standard-headers/linux/virtio_i2c.h
2031+ create mode 100644 include/standard-headers/linux/virtio_pcidev.h
2032+ create mode 100644 include/standard-headers/linux/virtio_scmi.h
2033+ create mode 100644 linux-headers/asm-riscv/bitsperlong.h
2034+ create mode 100644 linux-headers/asm-riscv/mman.h
2035+ create mode 100644 linux-headers/asm-riscv/unistd.h
2036+
2037+Index: qemu/include/standard-headers/asm-x86/kvm_para.h
2038+===================================================================
2039+--- qemu.orig/include/standard-headers/asm-x86/kvm_para.h 2023-07-04 20:38:39.000000000 -0400
2040++++ qemu/include/standard-headers/asm-x86/kvm_para.h 2023-07-04 20:49:59.000000000 -0400
2041+@@ -8,6 +8,7 @@
2042+ * should be used to determine that a VM is running under KVM.
2043+ */
2044+ #define KVM_CPUID_SIGNATURE 0x40000000
2045++#define KVM_SIGNATURE "KVMKVMKVM\0\0\0"
2046+
2047+ /* This CPUID returns two feature bitmaps in eax, edx. Before enabling
2048+ * a particular paravirtualization, the appropriate feature bit should
2049+Index: qemu/include/standard-headers/drm/drm_fourcc.h
2050+===================================================================
2051+--- qemu.orig/include/standard-headers/drm/drm_fourcc.h 2023-07-04 20:49:59.000000000 -0400
2052++++ qemu/include/standard-headers/drm/drm_fourcc.h 2023-07-04 20:51:04.000000000 -0400
2053+@@ -313,6 +313,13 @@
2054+ */
2055+ #define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */
2056+
2057++/* 2 plane YCbCr420.
2058++ * 3 10 bit components and 2 padding bits packed into 4 bytes.
2059++ * index 0 = Y plane, [31:0] x:Y2:Y1:Y0 2:10:10:10 little endian
2060++ * index 1 = Cr:Cb plane, [63:0] x:Cr2:Cb2:Cr1:x:Cb1:Cr0:Cb0 [2:10:10:10:2:10:10:10] little endian
2061++ */
2062++#define DRM_FORMAT_P030 fourcc_code('P', '0', '3', '0') /* 2x2 subsampled Cr:Cb plane 10 bits per channel packed */
2063++
2064+ /* 3 plane non-subsampled (444) YCbCr
2065+ * 16 bits per component, but only 10 bits are used and 6 bits are padded
2066+ * index 0: Y plane, [15:0] Y:x [10:6] little endian
2067+@@ -853,6 +860,10 @@
2068+ * and UV. Some SAND-using hardware stores UV in a separate tiled
2069+ * image from Y to reduce the column height, which is not supported
2070+ * with these modifiers.
2071++ *
2072++ * The DRM_FORMAT_MOD_BROADCOM_SAND128_COL_HEIGHT modifier is also
2073++ * supported for DRM_FORMAT_P030 where the columns remain as 128 bytes
2074++ * wide, but as this is a 10 bpp format that translates to 96 pixels.
2075+ */
2076+
2077+ #define DRM_FORMAT_MOD_BROADCOM_SAND32_COL_HEIGHT(v) \
2078+Index: qemu/include/standard-headers/linux/ethtool.h
2079+===================================================================
2080+--- qemu.orig/include/standard-headers/linux/ethtool.h 2023-07-04 20:49:59.000000000 -0400
2081++++ qemu/include/standard-headers/linux/ethtool.h 2023-07-04 20:51:04.000000000 -0400
2082+@@ -231,6 +231,7 @@
2083+ ETHTOOL_RX_COPYBREAK,
2084+ ETHTOOL_TX_COPYBREAK,
2085+ ETHTOOL_PFC_PREVENTION_TOUT, /* timeout in msecs */
2086++ ETHTOOL_TX_COPYBREAK_BUF_SIZE,
2087+ /*
2088+ * Add your fresh new tunable attribute above and remember to update
2089+ * tunable_strings[] in net/ethtool/common.c
2090+Index: qemu/include/standard-headers/linux/fuse.h
2091+===================================================================
2092+--- qemu.orig/include/standard-headers/linux/fuse.h 2023-07-04 20:49:59.000000000 -0400
2093++++ qemu/include/standard-headers/linux/fuse.h 2023-07-04 20:49:59.000000000 -0400
2094+@@ -184,6 +184,16 @@
2095+ *
2096+ * 7.34
2097+ * - add FUSE_SYNCFS
2098++ *
2099++ * 7.35
2100++ * - add FOPEN_NOFLUSH
2101++ *
2102++ * 7.36
2103++ * - extend fuse_init_in with reserved fields, add FUSE_INIT_EXT init flag
2104++ * - add flags2 to fuse_init_in and fuse_init_out
2105++ * - add FUSE_SECURITY_CTX init flag
2106++ * - add security context to create, mkdir, symlink, and mknod requests
2107++ * - add FUSE_HAS_INODE_DAX, FUSE_ATTR_DAX
2108+ */
2109+
2110+ #ifndef _LINUX_FUSE_H
2111+@@ -215,7 +225,7 @@
2112+ #define FUSE_KERNEL_VERSION 7
2113+
2114+ /** Minor version number of this interface */
2115+-#define FUSE_KERNEL_MINOR_VERSION 34
2116++#define FUSE_KERNEL_MINOR_VERSION 36
2117+
2118+ /** The node ID of the root inode */
2119+ #define FUSE_ROOT_ID 1
2120+@@ -286,12 +296,14 @@
2121+ * FOPEN_NONSEEKABLE: the file is not seekable
2122+ * FOPEN_CACHE_DIR: allow caching this directory
2123+ * FOPEN_STREAM: the file is stream-like (no file position at all)
2124++ * FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE)
2125+ */
2126+ #define FOPEN_DIRECT_IO (1 << 0)
2127+ #define FOPEN_KEEP_CACHE (1 << 1)
2128+ #define FOPEN_NONSEEKABLE (1 << 2)
2129+ #define FOPEN_CACHE_DIR (1 << 3)
2130+ #define FOPEN_STREAM (1 << 4)
2131++#define FOPEN_NOFLUSH (1 << 5)
2132+
2133+ /**
2134+ * INIT request/reply flags
2135+@@ -332,6 +344,11 @@
2136+ * write/truncate sgid is killed only if file has group
2137+ * execute permission. (Same as Linux VFS behavior).
2138+ * FUSE_SETXATTR_EXT: Server supports extended struct fuse_setxattr_in
2139++ * FUSE_INIT_EXT: extended fuse_init_in request
2140++ * FUSE_INIT_RESERVED: reserved, do not use
2141++ * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and
2142++ * mknod
2143++ * FUSE_HAS_INODE_DAX: use per inode DAX
2144+ */
2145+ #define FUSE_ASYNC_READ (1 << 0)
2146+ #define FUSE_POSIX_LOCKS (1 << 1)
2147+@@ -363,6 +380,11 @@
2148+ #define FUSE_SUBMOUNTS (1 << 27)
2149+ #define FUSE_HANDLE_KILLPRIV_V2 (1 << 28)
2150+ #define FUSE_SETXATTR_EXT (1 << 29)
2151++#define FUSE_INIT_EXT (1 << 30)
2152++#define FUSE_INIT_RESERVED (1 << 31)
2153++/* bits 32..63 get shifted down 32 bits into the flags2 field */
2154++#define FUSE_SECURITY_CTX (1ULL << 32)
2155++#define FUSE_HAS_INODE_DAX (1ULL << 33)
2156+
2157+ /**
2158+ * CUSE INIT request/reply flags
2159+@@ -445,8 +467,10 @@
2160+ * fuse_attr flags
2161+ *
2162+ * FUSE_ATTR_SUBMOUNT: Object is a submount root
2163++ * FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode
2164+ */
2165+ #define FUSE_ATTR_SUBMOUNT (1 << 0)
2166++#define FUSE_ATTR_DAX (1 << 1)
2167+
2168+ /**
2169+ * Open flags
2170+@@ -732,6 +756,8 @@
2171+ uint32_t minor;
2172+ uint32_t max_readahead;
2173+ uint32_t flags;
2174++ uint32_t flags2;
2175++ uint32_t unused[11];
2176+ };
2177+
2178+ #define FUSE_COMPAT_INIT_OUT_SIZE 8
2179+@@ -748,7 +774,8 @@
2180+ uint32_t time_gran;
2181+ uint16_t max_pages;
2182+ uint16_t map_alignment;
2183+- uint32_t unused[8];
2184++ uint32_t flags2;
2185++ uint32_t unused[7];
2186+ };
2187+
2188+ #define CUSE_INIT_INFO_MAX 4096
2189+@@ -856,9 +883,12 @@
2190+ char name[];
2191+ };
2192+
2193+-#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
2194+-#define FUSE_DIRENT_ALIGN(x) \
2195++/* Align variable length records to 64bit boundary */
2196++#define FUSE_REC_ALIGN(x) \
2197+ (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
2198++
2199++#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
2200++#define FUSE_DIRENT_ALIGN(x) FUSE_REC_ALIGN(x)
2201+ #define FUSE_DIRENT_SIZE(d) \
2202+ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
2203+
2204+@@ -975,4 +1005,26 @@
2205+ uint64_t padding;
2206+ };
2207+
2208++/*
2209++ * For each security context, send fuse_secctx with size of security context
2210++ * fuse_secctx will be followed by security context name and this in turn
2211++ * will be followed by actual context label.
2212++ * fuse_secctx, name, context
2213++ */
2214++struct fuse_secctx {
2215++ uint32_t size;
2216++ uint32_t padding;
2217++};
2218++
2219++/*
2220++ * Contains the information about how many fuse_secctx structures are being
2221++ * sent and what's the total size of all security contexts (including
2222++ * size of fuse_secctx_header).
2223++ *
2224++ */
2225++struct fuse_secctx_header {
2226++ uint32_t size;
2227++ uint32_t nr_secctx;
2228++};
2229++
2230+ #endif /* _LINUX_FUSE_H */
2231+Index: qemu/include/standard-headers/linux/pci_regs.h
2232+===================================================================
2233+--- qemu.orig/include/standard-headers/linux/pci_regs.h 2023-07-04 20:49:59.000000000 -0400
2234++++ qemu/include/standard-headers/linux/pci_regs.h 2023-07-04 20:51:04.000000000 -0400
2235+@@ -301,23 +301,23 @@
2236+ #define PCI_SID_ESR_FIC 0x20 /* First In Chassis Flag */
2237+ #define PCI_SID_CHASSIS_NR 3 /* Chassis Number */
2238+
2239+-/* Message Signalled Interrupt registers */
2240++/* Message Signaled Interrupt registers */
2241+
2242+-#define PCI_MSI_FLAGS 2 /* Message Control */
2243++#define PCI_MSI_FLAGS 0x02 /* Message Control */
2244+ #define PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */
2245+ #define PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available */
2246+ #define PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured */
2247+ #define PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */
2248+ #define PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking capable */
2249+ #define PCI_MSI_RFU 3 /* Rest of capability flags */
2250+-#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
2251+-#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
2252+-#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
2253+-#define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */
2254+-#define PCI_MSI_PENDING_32 16 /* Pending intrs for 32-bit devices */
2255+-#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
2256+-#define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */
2257+-#define PCI_MSI_PENDING_64 20 /* Pending intrs for 64-bit devices */
2258++#define PCI_MSI_ADDRESS_LO 0x04 /* Lower 32 bits */
2259++#define PCI_MSI_ADDRESS_HI 0x08 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
2260++#define PCI_MSI_DATA_32 0x08 /* 16 bits of data for 32-bit devices */
2261++#define PCI_MSI_MASK_32 0x0c /* Mask bits register for 32-bit devices */
2262++#define PCI_MSI_PENDING_32 0x10 /* Pending intrs for 32-bit devices */
2263++#define PCI_MSI_DATA_64 0x0c /* 16 bits of data for 64-bit devices */
2264++#define PCI_MSI_MASK_64 0x10 /* Mask bits register for 64-bit devices */
2265++#define PCI_MSI_PENDING_64 0x14 /* Pending intrs for 64-bit devices */
2266+
2267+ /* MSI-X registers (in MSI-X capability) */
2268+ #define PCI_MSIX_FLAGS 2 /* Message Control */
2269+@@ -335,10 +335,10 @@
2270+
2271+ /* MSI-X Table entry format (in memory mapped by a BAR) */
2272+ #define PCI_MSIX_ENTRY_SIZE 16
2273+-#define PCI_MSIX_ENTRY_LOWER_ADDR 0 /* Message Address */
2274+-#define PCI_MSIX_ENTRY_UPPER_ADDR 4 /* Message Upper Address */
2275+-#define PCI_MSIX_ENTRY_DATA 8 /* Message Data */
2276+-#define PCI_MSIX_ENTRY_VECTOR_CTRL 12 /* Vector Control */
2277++#define PCI_MSIX_ENTRY_LOWER_ADDR 0x0 /* Message Address */
2278++#define PCI_MSIX_ENTRY_UPPER_ADDR 0x4 /* Message Upper Address */
2279++#define PCI_MSIX_ENTRY_DATA 0x8 /* Message Data */
2280++#define PCI_MSIX_ENTRY_VECTOR_CTRL 0xc /* Vector Control */
2281+ #define PCI_MSIX_ENTRY_CTRL_MASKBIT 0x00000001
2282+
2283+ /* CompactPCI Hotswap Register */
2284+@@ -470,7 +470,7 @@
2285+
2286+ /* PCI Express capability registers */
2287+
2288+-#define PCI_EXP_FLAGS 2 /* Capabilities register */
2289++#define PCI_EXP_FLAGS 0x02 /* Capabilities register */
2290+ #define PCI_EXP_FLAGS_VERS 0x000f /* Capability version */
2291+ #define PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */
2292+ #define PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */
2293+@@ -484,7 +484,7 @@
2294+ #define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
2295+ #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
2296+ #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
2297+-#define PCI_EXP_DEVCAP 4 /* Device capabilities */
2298++#define PCI_EXP_DEVCAP 0x04 /* Device capabilities */
2299+ #define PCI_EXP_DEVCAP_PAYLOAD 0x00000007 /* Max_Payload_Size */
2300+ #define PCI_EXP_DEVCAP_PHANTOM 0x00000018 /* Phantom functions */
2301+ #define PCI_EXP_DEVCAP_EXT_TAG 0x00000020 /* Extended tags */
2302+@@ -497,7 +497,7 @@
2303+ #define PCI_EXP_DEVCAP_PWR_VAL 0x03fc0000 /* Slot Power Limit Value */
2304+ #define PCI_EXP_DEVCAP_PWR_SCL 0x0c000000 /* Slot Power Limit Scale */
2305+ #define PCI_EXP_DEVCAP_FLR 0x10000000 /* Function Level Reset */
2306+-#define PCI_EXP_DEVCTL 8 /* Device Control */
2307++#define PCI_EXP_DEVCTL 0x08 /* Device Control */
2308+ #define PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
2309+ #define PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
2310+ #define PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */
2311+@@ -522,7 +522,7 @@
2312+ #define PCI_EXP_DEVCTL_READRQ_2048B 0x4000 /* 2048 Bytes */
2313+ #define PCI_EXP_DEVCTL_READRQ_4096B 0x5000 /* 4096 Bytes */
2314+ #define PCI_EXP_DEVCTL_BCR_FLR 0x8000 /* Bridge Configuration Retry / FLR */
2315+-#define PCI_EXP_DEVSTA 10 /* Device Status */
2316++#define PCI_EXP_DEVSTA 0x0a /* Device Status */
2317+ #define PCI_EXP_DEVSTA_CED 0x0001 /* Correctable Error Detected */
2318+ #define PCI_EXP_DEVSTA_NFED 0x0002 /* Non-Fatal Error Detected */
2319+ #define PCI_EXP_DEVSTA_FED 0x0004 /* Fatal Error Detected */
2320+@@ -530,7 +530,7 @@
2321+ #define PCI_EXP_DEVSTA_AUXPD 0x0010 /* AUX Power Detected */
2322+ #define PCI_EXP_DEVSTA_TRPND 0x0020 /* Transactions Pending */
2323+ #define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V1 12 /* v1 endpoints without link end here */
2324+-#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
2325++#define PCI_EXP_LNKCAP 0x0c /* Link Capabilities */
2326+ #define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
2327+ #define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001 /* LNKCAP2 SLS Vector bit 0 */
2328+ #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */
2329+@@ -549,7 +549,7 @@
2330+ #define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */
2331+ #define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */
2332+ #define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */
2333+-#define PCI_EXP_LNKCTL 16 /* Link Control */
2334++#define PCI_EXP_LNKCTL 0x10 /* Link Control */
2335+ #define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */
2336+ #define PCI_EXP_LNKCTL_ASPM_L0S 0x0001 /* L0s Enable */
2337+ #define PCI_EXP_LNKCTL_ASPM_L1 0x0002 /* L1 Enable */
2338+@@ -562,7 +562,7 @@
2339+ #define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */
2340+ #define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */
2341+ #define PCI_EXP_LNKCTL_LABIE 0x0800 /* Link Autonomous Bandwidth Interrupt Enable */
2342+-#define PCI_EXP_LNKSTA 18 /* Link Status */
2343++#define PCI_EXP_LNKSTA 0x12 /* Link Status */
2344+ #define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
2345+ #define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */
2346+ #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */
2347+@@ -582,7 +582,7 @@
2348+ #define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */
2349+ #define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */
2350+ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V1 20 /* v1 endpoints with link end here */
2351+-#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
2352++#define PCI_EXP_SLTCAP 0x14 /* Slot Capabilities */
2353+ #define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */
2354+ #define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */
2355+ #define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */
2356+@@ -595,7 +595,7 @@
2357+ #define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */
2358+ #define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */
2359+ #define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */
2360+-#define PCI_EXP_SLTCTL 24 /* Slot Control */
2361++#define PCI_EXP_SLTCTL 0x18 /* Slot Control */
2362+ #define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */
2363+ #define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */
2364+ #define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */
2365+@@ -617,7 +617,7 @@
2366+ #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */
2367+ #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */
2368+ #define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000 /* In-band PD disable */
2369+-#define PCI_EXP_SLTSTA 26 /* Slot Status */
2370++#define PCI_EXP_SLTSTA 0x1a /* Slot Status */
2371+ #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */
2372+ #define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */
2373+ #define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */
2374+@@ -627,15 +627,15 @@
2375+ #define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */
2376+ #define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */
2377+ #define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */
2378+-#define PCI_EXP_RTCTL 28 /* Root Control */
2379++#define PCI_EXP_RTCTL 0x1c /* Root Control */
2380+ #define PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */
2381+ #define PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */
2382+ #define PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */
2383+ #define PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */
2384+ #define PCI_EXP_RTCTL_CRSSVE 0x0010 /* CRS Software Visibility Enable */
2385+-#define PCI_EXP_RTCAP 30 /* Root Capabilities */
2386++#define PCI_EXP_RTCAP 0x1e /* Root Capabilities */
2387+ #define PCI_EXP_RTCAP_CRSVIS 0x0001 /* CRS Software Visibility capability */
2388+-#define PCI_EXP_RTSTA 32 /* Root Status */
2389++#define PCI_EXP_RTSTA 0x20 /* Root Status */
2390+ #define PCI_EXP_RTSTA_PME 0x00010000 /* PME status */
2391+ #define PCI_EXP_RTSTA_PENDING 0x00020000 /* PME pending */
2392+ /*
2393+@@ -646,7 +646,7 @@
2394+ * Use pcie_capability_read_word() and similar interfaces to use them
2395+ * safely.
2396+ */
2397+-#define PCI_EXP_DEVCAP2 36 /* Device Capabilities 2 */
2398++#define PCI_EXP_DEVCAP2 0x24 /* Device Capabilities 2 */
2399+ #define PCI_EXP_DEVCAP2_COMP_TMOUT_DIS 0x00000010 /* Completion Timeout Disable supported */
2400+ #define PCI_EXP_DEVCAP2_ARI 0x00000020 /* Alternative Routing-ID */
2401+ #define PCI_EXP_DEVCAP2_ATOMIC_ROUTE 0x00000040 /* Atomic Op routing */
2402+@@ -658,7 +658,7 @@
2403+ #define PCI_EXP_DEVCAP2_OBFF_MSG 0x00040000 /* New message signaling */
2404+ #define PCI_EXP_DEVCAP2_OBFF_WAKE 0x00080000 /* Re-use WAKE# for OBFF */
2405+ #define PCI_EXP_DEVCAP2_EE_PREFIX 0x00200000 /* End-End TLP Prefix */
2406+-#define PCI_EXP_DEVCTL2 40 /* Device Control 2 */
2407++#define PCI_EXP_DEVCTL2 0x28 /* Device Control 2 */
2408+ #define PCI_EXP_DEVCTL2_COMP_TIMEOUT 0x000f /* Completion Timeout Value */
2409+ #define PCI_EXP_DEVCTL2_COMP_TMOUT_DIS 0x0010 /* Completion Timeout Disable */
2410+ #define PCI_EXP_DEVCTL2_ARI 0x0020 /* Alternative Routing-ID */
2411+@@ -670,9 +670,9 @@
2412+ #define PCI_EXP_DEVCTL2_OBFF_MSGA_EN 0x2000 /* Enable OBFF Message type A */
2413+ #define PCI_EXP_DEVCTL2_OBFF_MSGB_EN 0x4000 /* Enable OBFF Message type B */
2414+ #define PCI_EXP_DEVCTL2_OBFF_WAKE_EN 0x6000 /* OBFF using WAKE# signaling */
2415+-#define PCI_EXP_DEVSTA2 42 /* Device Status 2 */
2416+-#define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V2 44 /* v2 endpoints without link end here */
2417+-#define PCI_EXP_LNKCAP2 44 /* Link Capabilities 2 */
2418++#define PCI_EXP_DEVSTA2 0x2a /* Device Status 2 */
2419++#define PCI_CAP_EXP_RC_ENDPOINT_SIZEOF_V2 0x2c /* end of v2 EPs w/o link */
2420++#define PCI_EXP_LNKCAP2 0x2c /* Link Capabilities 2 */
2421+ #define PCI_EXP_LNKCAP2_SLS_2_5GB 0x00000002 /* Supported Speed 2.5GT/s */
2422+ #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004 /* Supported Speed 5GT/s */
2423+ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008 /* Supported Speed 8GT/s */
2424+@@ -680,7 +680,7 @@
2425+ #define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020 /* Supported Speed 32GT/s */
2426+ #define PCI_EXP_LNKCAP2_SLS_64_0GB 0x00000040 /* Supported Speed 64GT/s */
2427+ #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100 /* Crosslink supported */
2428+-#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
2429++#define PCI_EXP_LNKCTL2 0x30 /* Link Control 2 */
2430+ #define PCI_EXP_LNKCTL2_TLS 0x000f
2431+ #define PCI_EXP_LNKCTL2_TLS_2_5GT 0x0001 /* Supported Speed 2.5GT/s */
2432+ #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */
2433+@@ -691,12 +691,12 @@
2434+ #define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010 /* Enter Compliance */
2435+ #define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */
2436+ #define PCI_EXP_LNKCTL2_HASD 0x0020 /* HW Autonomous Speed Disable */
2437+-#define PCI_EXP_LNKSTA2 50 /* Link Status 2 */
2438+-#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */
2439+-#define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */
2440++#define PCI_EXP_LNKSTA2 0x32 /* Link Status 2 */
2441++#define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 0x32 /* end of v2 EPs w/ link */
2442++#define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities 2 */
2443+ #define PCI_EXP_SLTCAP2_IBPD 0x00000001 /* In-band PD Disable Supported */
2444+-#define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */
2445+-#define PCI_EXP_SLTSTA2 58 /* Slot Status 2 */
2446++#define PCI_EXP_SLTCTL2 0x38 /* Slot Control 2 */
2447++#define PCI_EXP_SLTSTA2 0x3a /* Slot Status 2 */
2448+
2449+ /* Extended Capabilities (PCI-X 2.0 and Express) */
2450+ #define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
2451+@@ -742,7 +742,7 @@
2452+ #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
2453+
2454+ /* Advanced Error Reporting */
2455+-#define PCI_ERR_UNCOR_STATUS 4 /* Uncorrectable Error Status */
2456++#define PCI_ERR_UNCOR_STATUS 0x04 /* Uncorrectable Error Status */
2457+ #define PCI_ERR_UNC_UND 0x00000001 /* Undefined */
2458+ #define PCI_ERR_UNC_DLP 0x00000010 /* Data Link Protocol */
2459+ #define PCI_ERR_UNC_SURPDN 0x00000020 /* Surprise Down */
2460+@@ -760,11 +760,11 @@
2461+ #define PCI_ERR_UNC_MCBTLP 0x00800000 /* MC blocked TLP */
2462+ #define PCI_ERR_UNC_ATOMEG 0x01000000 /* Atomic egress blocked */
2463+ #define PCI_ERR_UNC_TLPPRE 0x02000000 /* TLP prefix blocked */
2464+-#define PCI_ERR_UNCOR_MASK 8 /* Uncorrectable Error Mask */
2465++#define PCI_ERR_UNCOR_MASK 0x08 /* Uncorrectable Error Mask */
2466+ /* Same bits as above */
2467+-#define PCI_ERR_UNCOR_SEVER 12 /* Uncorrectable Error Severity */
2468++#define PCI_ERR_UNCOR_SEVER 0x0c /* Uncorrectable Error Severity */
2469+ /* Same bits as above */
2470+-#define PCI_ERR_COR_STATUS 16 /* Correctable Error Status */
2471++#define PCI_ERR_COR_STATUS 0x10 /* Correctable Error Status */
2472+ #define PCI_ERR_COR_RCVR 0x00000001 /* Receiver Error Status */
2473+ #define PCI_ERR_COR_BAD_TLP 0x00000040 /* Bad TLP Status */
2474+ #define PCI_ERR_COR_BAD_DLLP 0x00000080 /* Bad DLLP Status */
2475+@@ -773,20 +773,20 @@
2476+ #define PCI_ERR_COR_ADV_NFAT 0x00002000 /* Advisory Non-Fatal */
2477+ #define PCI_ERR_COR_INTERNAL 0x00004000 /* Corrected Internal */
2478+ #define PCI_ERR_COR_LOG_OVER 0x00008000 /* Header Log Overflow */
2479+-#define PCI_ERR_COR_MASK 20 /* Correctable Error Mask */
2480++#define PCI_ERR_COR_MASK 0x14 /* Correctable Error Mask */
2481+ /* Same bits as above */
2482+-#define PCI_ERR_CAP 24 /* Advanced Error Capabilities */
2483+-#define PCI_ERR_CAP_FEP(x) ((x) & 31) /* First Error Pointer */
2484++#define PCI_ERR_CAP 0x18 /* Advanced Error Capabilities & Ctrl*/
2485++#define PCI_ERR_CAP_FEP(x) ((x) & 0x1f) /* First Error Pointer */
2486+ #define PCI_ERR_CAP_ECRC_GENC 0x00000020 /* ECRC Generation Capable */
2487+ #define PCI_ERR_CAP_ECRC_GENE 0x00000040 /* ECRC Generation Enable */
2488+ #define PCI_ERR_CAP_ECRC_CHKC 0x00000080 /* ECRC Check Capable */
2489+ #define PCI_ERR_CAP_ECRC_CHKE 0x00000100 /* ECRC Check Enable */
2490+-#define PCI_ERR_HEADER_LOG 28 /* Header Log Register (16 bytes) */
2491+-#define PCI_ERR_ROOT_COMMAND 44 /* Root Error Command */
2492++#define PCI_ERR_HEADER_LOG 0x1c /* Header Log Register (16 bytes) */
2493++#define PCI_ERR_ROOT_COMMAND 0x2c /* Root Error Command */
2494+ #define PCI_ERR_ROOT_CMD_COR_EN 0x00000001 /* Correctable Err Reporting Enable */
2495+ #define PCI_ERR_ROOT_CMD_NONFATAL_EN 0x00000002 /* Non-Fatal Err Reporting Enable */
2496+ #define PCI_ERR_ROOT_CMD_FATAL_EN 0x00000004 /* Fatal Err Reporting Enable */
2497+-#define PCI_ERR_ROOT_STATUS 48
2498++#define PCI_ERR_ROOT_STATUS 0x30
2499+ #define PCI_ERR_ROOT_COR_RCV 0x00000001 /* ERR_COR Received */
2500+ #define PCI_ERR_ROOT_MULTI_COR_RCV 0x00000002 /* Multiple ERR_COR */
2501+ #define PCI_ERR_ROOT_UNCOR_RCV 0x00000004 /* ERR_FATAL/NONFATAL */
2502+@@ -795,52 +795,52 @@
2503+ #define PCI_ERR_ROOT_NONFATAL_RCV 0x00000020 /* Non-Fatal Received */
2504+ #define PCI_ERR_ROOT_FATAL_RCV 0x00000040 /* Fatal Received */
2505+ #define PCI_ERR_ROOT_AER_IRQ 0xf8000000 /* Advanced Error Interrupt Message Number */
2506+-#define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */
2507++#define PCI_ERR_ROOT_ERR_SRC 0x34 /* Error Source Identification */
2508+
2509+ /* Virtual Channel */
2510+-#define PCI_VC_PORT_CAP1 4
2511++#define PCI_VC_PORT_CAP1 0x04
2512+ #define PCI_VC_CAP1_EVCC 0x00000007 /* extended VC count */
2513+ #define PCI_VC_CAP1_LPEVCC 0x00000070 /* low prio extended VC count */
2514+ #define PCI_VC_CAP1_ARB_SIZE 0x00000c00
2515+-#define PCI_VC_PORT_CAP2 8
2516++#define PCI_VC_PORT_CAP2 0x08
2517+ #define PCI_VC_CAP2_32_PHASE 0x00000002
2518+ #define PCI_VC_CAP2_64_PHASE 0x00000004
2519+ #define PCI_VC_CAP2_128_PHASE 0x00000008
2520+ #define PCI_VC_CAP2_ARB_OFF 0xff000000
2521+-#define PCI_VC_PORT_CTRL 12
2522++#define PCI_VC_PORT_CTRL 0x0c
2523+ #define PCI_VC_PORT_CTRL_LOAD_TABLE 0x00000001
2524+-#define PCI_VC_PORT_STATUS 14
2525++#define PCI_VC_PORT_STATUS 0x0e
2526+ #define PCI_VC_PORT_STATUS_TABLE 0x00000001
2527+-#define PCI_VC_RES_CAP 16
2528++#define PCI_VC_RES_CAP 0x10
2529+ #define PCI_VC_RES_CAP_32_PHASE 0x00000002
2530+ #define PCI_VC_RES_CAP_64_PHASE 0x00000004
2531+ #define PCI_VC_RES_CAP_128_PHASE 0x00000008
2532+ #define PCI_VC_RES_CAP_128_PHASE_TB 0x00000010
2533+ #define PCI_VC_RES_CAP_256_PHASE 0x00000020
2534+ #define PCI_VC_RES_CAP_ARB_OFF 0xff000000
2535+-#define PCI_VC_RES_CTRL 20
2536++#define PCI_VC_RES_CTRL 0x14
2537+ #define PCI_VC_RES_CTRL_LOAD_TABLE 0x00010000
2538+ #define PCI_VC_RES_CTRL_ARB_SELECT 0x000e0000
2539+ #define PCI_VC_RES_CTRL_ID 0x07000000
2540+ #define PCI_VC_RES_CTRL_ENABLE 0x80000000
2541+-#define PCI_VC_RES_STATUS 26
2542++#define PCI_VC_RES_STATUS 0x1a
2543+ #define PCI_VC_RES_STATUS_TABLE 0x00000001
2544+ #define PCI_VC_RES_STATUS_NEGO 0x00000002
2545+ #define PCI_CAP_VC_BASE_SIZEOF 0x10
2546+-#define PCI_CAP_VC_PER_VC_SIZEOF 0x0C
2547++#define PCI_CAP_VC_PER_VC_SIZEOF 0x0c
2548+
2549+ /* Power Budgeting */
2550+-#define PCI_PWR_DSR 4 /* Data Select Register */
2551+-#define PCI_PWR_DATA 8 /* Data Register */
2552++#define PCI_PWR_DSR 0x04 /* Data Select Register */
2553++#define PCI_PWR_DATA 0x08 /* Data Register */
2554+ #define PCI_PWR_DATA_BASE(x) ((x) & 0xff) /* Base Power */
2555+ #define PCI_PWR_DATA_SCALE(x) (((x) >> 8) & 3) /* Data Scale */
2556+ #define PCI_PWR_DATA_PM_SUB(x) (((x) >> 10) & 7) /* PM Sub State */
2557+ #define PCI_PWR_DATA_PM_STATE(x) (((x) >> 13) & 3) /* PM State */
2558+ #define PCI_PWR_DATA_TYPE(x) (((x) >> 15) & 7) /* Type */
2559+ #define PCI_PWR_DATA_RAIL(x) (((x) >> 18) & 7) /* Power Rail */
2560+-#define PCI_PWR_CAP 12 /* Capability */
2561++#define PCI_PWR_CAP 0x0c /* Capability */
2562+ #define PCI_PWR_CAP_BUDGET(x) ((x) & 1) /* Included in system budget */
2563+-#define PCI_EXT_CAP_PWR_SIZEOF 16
2564++#define PCI_EXT_CAP_PWR_SIZEOF 0x10
2565+
2566+ /* Root Complex Event Collector Endpoint Association */
2567+ #define PCI_RCEC_RCIEP_BITMAP 4 /* Associated Bitmap for RCiEPs */
2568+@@ -964,7 +964,7 @@
2569+ #define PCI_SRIOV_VFM_MI 0x1 /* Dormant.MigrateIn */
2570+ #define PCI_SRIOV_VFM_MO 0x2 /* Active.MigrateOut */
2571+ #define PCI_SRIOV_VFM_AV 0x3 /* Active.Available */
2572+-#define PCI_EXT_CAP_SRIOV_SIZEOF 64
2573++#define PCI_EXT_CAP_SRIOV_SIZEOF 0x40
2574+
2575+ #define PCI_LTR_MAX_SNOOP_LAT 0x4
2576+ #define PCI_LTR_MAX_NOSNOOP_LAT 0x6
2577+@@ -1017,12 +1017,12 @@
2578+ #define PCI_TPH_LOC_NONE 0x000 /* no location */
2579+ #define PCI_TPH_LOC_CAP 0x200 /* in capability */
2580+ #define PCI_TPH_LOC_MSIX 0x400 /* in MSI-X */
2581+-#define PCI_TPH_CAP_ST_MASK 0x07FF0000 /* st table mask */
2582+-#define PCI_TPH_CAP_ST_SHIFT 16 /* st table shift */
2583+-#define PCI_TPH_BASE_SIZEOF 12 /* size with no st table */
2584++#define PCI_TPH_CAP_ST_MASK 0x07FF0000 /* ST table mask */
2585++#define PCI_TPH_CAP_ST_SHIFT 16 /* ST table shift */
2586++#define PCI_TPH_BASE_SIZEOF 0xc /* size with no ST table */
2587+
2588+ /* Downstream Port Containment */
2589+-#define PCI_EXP_DPC_CAP 4 /* DPC Capability */
2590++#define PCI_EXP_DPC_CAP 0x04 /* DPC Capability */
2591+ #define PCI_EXP_DPC_IRQ 0x001F /* Interrupt Message Number */
2592+ #define PCI_EXP_DPC_CAP_RP_EXT 0x0020 /* Root Port Extensions */
2593+ #define PCI_EXP_DPC_CAP_POISONED_TLP 0x0040 /* Poisoned TLP Egress Blocking Supported */
2594+@@ -1030,19 +1030,19 @@
2595+ #define PCI_EXP_DPC_RP_PIO_LOG_SIZE 0x0F00 /* RP PIO Log Size */
2596+ #define PCI_EXP_DPC_CAP_DL_ACTIVE 0x1000 /* ERR_COR signal on DL_Active supported */
2597+
2598+-#define PCI_EXP_DPC_CTL 6 /* DPC control */
2599++#define PCI_EXP_DPC_CTL 0x06 /* DPC control */
2600+ #define PCI_EXP_DPC_CTL_EN_FATAL 0x0001 /* Enable trigger on ERR_FATAL message */
2601+ #define PCI_EXP_DPC_CTL_EN_NONFATAL 0x0002 /* Enable trigger on ERR_NONFATAL message */
2602+ #define PCI_EXP_DPC_CTL_INT_EN 0x0008 /* DPC Interrupt Enable */
2603+
2604+-#define PCI_EXP_DPC_STATUS 8 /* DPC Status */
2605++#define PCI_EXP_DPC_STATUS 0x08 /* DPC Status */
2606+ #define PCI_EXP_DPC_STATUS_TRIGGER 0x0001 /* Trigger Status */
2607+ #define PCI_EXP_DPC_STATUS_TRIGGER_RSN 0x0006 /* Trigger Reason */
2608+ #define PCI_EXP_DPC_STATUS_INTERRUPT 0x0008 /* Interrupt Status */
2609+ #define PCI_EXP_DPC_RP_BUSY 0x0010 /* Root Port Busy */
2610+ #define PCI_EXP_DPC_STATUS_TRIGGER_RSN_EXT 0x0060 /* Trig Reason Extension */
2611+
2612+-#define PCI_EXP_DPC_SOURCE_ID 10 /* DPC Source Identifier */
2613++#define PCI_EXP_DPC_SOURCE_ID 0x0A /* DPC Source Identifier */
2614+
2615+ #define PCI_EXP_DPC_RP_PIO_STATUS 0x0C /* RP PIO Status */
2616+ #define PCI_EXP_DPC_RP_PIO_MASK 0x10 /* RP PIO Mask */
2617+@@ -1086,7 +1086,11 @@
2618+
2619+ /* Designated Vendor-Specific (DVSEC, PCI_EXT_CAP_ID_DVSEC) */
2620+ #define PCI_DVSEC_HEADER1 0x4 /* Designated Vendor-Specific Header1 */
2621++#define PCI_DVSEC_HEADER1_VID(x) ((x) & 0xffff)
2622++#define PCI_DVSEC_HEADER1_REV(x) (((x) >> 16) & 0xf)
2623++#define PCI_DVSEC_HEADER1_LEN(x) (((x) >> 20) & 0xfff)
2624+ #define PCI_DVSEC_HEADER2 0x8 /* Designated Vendor-Specific Header2 */
2625++#define PCI_DVSEC_HEADER2_ID(x) ((x) & 0xffff)
2626+
2627+ /* Data Link Feature */
2628+ #define PCI_DLF_CAP 0x04 /* Capabilities Register */
2629+Index: qemu/include/standard-headers/linux/virtio_gpio.h
2630+===================================================================
2631+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2632++++ qemu/include/standard-headers/linux/virtio_gpio.h 2023-07-04 20:49:59.000000000 -0400
2633+@@ -0,0 +1,72 @@
2634++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2635++
2636++#ifndef _LINUX_VIRTIO_GPIO_H
2637++#define _LINUX_VIRTIO_GPIO_H
2638++
2639++#include "standard-headers/linux/types.h"
2640++
2641++/* Virtio GPIO Feature bits */
2642++#define VIRTIO_GPIO_F_IRQ 0
2643++
2644++/* Virtio GPIO request types */
2645++#define VIRTIO_GPIO_MSG_GET_NAMES 0x0001
2646++#define VIRTIO_GPIO_MSG_GET_DIRECTION 0x0002
2647++#define VIRTIO_GPIO_MSG_SET_DIRECTION 0x0003
2648++#define VIRTIO_GPIO_MSG_GET_VALUE 0x0004
2649++#define VIRTIO_GPIO_MSG_SET_VALUE 0x0005
2650++#define VIRTIO_GPIO_MSG_IRQ_TYPE 0x0006
2651++
2652++/* Possible values of the status field */
2653++#define VIRTIO_GPIO_STATUS_OK 0x0
2654++#define VIRTIO_GPIO_STATUS_ERR 0x1
2655++
2656++/* Direction types */
2657++#define VIRTIO_GPIO_DIRECTION_NONE 0x00
2658++#define VIRTIO_GPIO_DIRECTION_OUT 0x01
2659++#define VIRTIO_GPIO_DIRECTION_IN 0x02
2660++
2661++/* Virtio GPIO IRQ types */
2662++#define VIRTIO_GPIO_IRQ_TYPE_NONE 0x00
2663++#define VIRTIO_GPIO_IRQ_TYPE_EDGE_RISING 0x01
2664++#define VIRTIO_GPIO_IRQ_TYPE_EDGE_FALLING 0x02
2665++#define VIRTIO_GPIO_IRQ_TYPE_EDGE_BOTH 0x03
2666++#define VIRTIO_GPIO_IRQ_TYPE_LEVEL_HIGH 0x04
2667++#define VIRTIO_GPIO_IRQ_TYPE_LEVEL_LOW 0x08
2668++
2669++struct virtio_gpio_config {
2670++ uint16_t ngpio;
2671++ uint8_t padding[2];
2672++ uint32_t gpio_names_size;
2673++};
2674++
2675++/* Virtio GPIO Request / Response */
2676++struct virtio_gpio_request {
2677++ uint16_t type;
2678++ uint16_t gpio;
2679++ uint32_t value;
2680++};
2681++
2682++struct virtio_gpio_response {
2683++ uint8_t status;
2684++ uint8_t value;
2685++};
2686++
2687++struct virtio_gpio_response_get_names {
2688++ uint8_t status;
2689++ uint8_t value[];
2690++};
2691++
2692++/* Virtio GPIO IRQ Request / Response */
2693++struct virtio_gpio_irq_request {
2694++ uint16_t gpio;
2695++};
2696++
2697++struct virtio_gpio_irq_response {
2698++ uint8_t status;
2699++};
2700++
2701++/* Possible values of the interrupt status field */
2702++#define VIRTIO_GPIO_IRQ_STATUS_INVALID 0x0
2703++#define VIRTIO_GPIO_IRQ_STATUS_VALID 0x1
2704++
2705++#endif /* _LINUX_VIRTIO_GPIO_H */
2706+Index: qemu/include/standard-headers/linux/virtio_i2c.h
2707+===================================================================
2708+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2709++++ qemu/include/standard-headers/linux/virtio_i2c.h 2023-07-04 20:49:59.000000000 -0400
2710+@@ -0,0 +1,47 @@
2711++/* SPDX-License-Identifier: GPL-2.0-or-later WITH Linux-syscall-note */
2712++/*
2713++ * Definitions for virtio I2C Adpter
2714++ *
2715++ * Copyright (c) 2021 Intel Corporation. All rights reserved.
2716++ */
2717++
2718++#ifndef _LINUX_VIRTIO_I2C_H
2719++#define _LINUX_VIRTIO_I2C_H
2720++
2721++#include "standard-headers/linux/const.h"
2722++#include "standard-headers/linux/types.h"
2723++
2724++/* Virtio I2C Feature bits */
2725++#define VIRTIO_I2C_F_ZERO_LENGTH_REQUEST 0
2726++
2727++/* The bit 0 of the @virtio_i2c_out_hdr.@flags, used to group the requests */
2728++#define VIRTIO_I2C_FLAGS_FAIL_NEXT _BITUL(0)
2729++
2730++/* The bit 1 of the @virtio_i2c_out_hdr.@flags, used to mark a buffer as read */
2731++#define VIRTIO_I2C_FLAGS_M_RD _BITUL(1)
2732++
2733++/**
2734++ * struct virtio_i2c_out_hdr - the virtio I2C message OUT header
2735++ * @addr: the controlled device address
2736++ * @padding: used to pad to full dword
2737++ * @flags: used for feature extensibility
2738++ */
2739++struct virtio_i2c_out_hdr {
2740++ uint16_t addr;
2741++ uint16_t padding;
2742++ uint32_t flags;
2743++};
2744++
2745++/**
2746++ * struct virtio_i2c_in_hdr - the virtio I2C message IN header
2747++ * @status: the processing result from the backend
2748++ */
2749++struct virtio_i2c_in_hdr {
2750++ uint8_t status;
2751++};
2752++
2753++/* The final status written by the device */
2754++#define VIRTIO_I2C_MSG_OK 0
2755++#define VIRTIO_I2C_MSG_ERR 1
2756++
2757++#endif /* _LINUX_VIRTIO_I2C_H */
2758+Index: qemu/include/standard-headers/linux/virtio_iommu.h
2759+===================================================================
2760+--- qemu.orig/include/standard-headers/linux/virtio_iommu.h 2023-07-04 20:38:39.000000000 -0400
2761++++ qemu/include/standard-headers/linux/virtio_iommu.h 2023-07-04 20:49:59.000000000 -0400
2762+@@ -16,6 +16,7 @@
2763+ #define VIRTIO_IOMMU_F_BYPASS 3
2764+ #define VIRTIO_IOMMU_F_PROBE 4
2765+ #define VIRTIO_IOMMU_F_MMIO 5
2766++#define VIRTIO_IOMMU_F_BYPASS_CONFIG 6
2767+
2768+ struct virtio_iommu_range_64 {
2769+ uint64_t start;
2770+@@ -36,6 +37,8 @@
2771+ struct virtio_iommu_range_32 domain_range;
2772+ /* Probe buffer size */
2773+ uint32_t probe_size;
2774++ uint8_t bypass;
2775++ uint8_t reserved[3];
2776+ };
2777+
2778+ /* Request types */
2779+@@ -66,11 +69,14 @@
2780+ uint8_t reserved[3];
2781+ };
2782+
2783++#define VIRTIO_IOMMU_ATTACH_F_BYPASS (1 << 0)
2784++
2785+ struct virtio_iommu_req_attach {
2786+ struct virtio_iommu_req_head head;
2787+ uint32_t domain;
2788+ uint32_t endpoint;
2789+- uint8_t reserved[8];
2790++ uint32_t flags;
2791++ uint8_t reserved[4];
2792+ struct virtio_iommu_req_tail tail;
2793+ };
2794+
2795+Index: qemu/include/standard-headers/linux/virtio_pcidev.h
2796+===================================================================
2797+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2798++++ qemu/include/standard-headers/linux/virtio_pcidev.h 2023-07-04 20:49:59.000000000 -0400
2799+@@ -0,0 +1,65 @@
2800++/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2801++/*
2802++ * Copyright (C) 2021 Intel Corporation
2803++ * Author: Johannes Berg <johannes@sipsolutions.net>
2804++ */
2805++#ifndef _LINUX_VIRTIO_PCIDEV_H
2806++#define _LINUX_VIRTIO_PCIDEV_H
2807++#include "standard-headers/linux/types.h"
2808++
2809++/**
2810++ * enum virtio_pcidev_ops - virtual PCI device operations
2811++ * @VIRTIO_PCIDEV_OP_RESERVED: reserved to catch errors
2812++ * @VIRTIO_PCIDEV_OP_CFG_READ: read config space, size is 1, 2, 4 or 8;
2813++ * the @data field should be filled in by the device (in little endian).
2814++ * @VIRTIO_PCIDEV_OP_CFG_WRITE: write config space, size is 1, 2, 4 or 8;
2815++ * the @data field contains the data to write (in little endian).
2816++ * @VIRTIO_PCIDEV_OP_MMIO_READ: read BAR mem/pio, size can be variable;
2817++ * the @data field should be filled in by the device (in little endian).
2818++ * @VIRTIO_PCIDEV_OP_MMIO_WRITE: write BAR mem/pio, size can be variable;
2819++ * the @data field contains the data to write (in little endian).
2820++ * @VIRTIO_PCIDEV_OP_MMIO_MEMSET: memset MMIO, size is variable but
2821++ * the @data field only has one byte (unlike @VIRTIO_PCIDEV_OP_MMIO_WRITE)
2822++ * @VIRTIO_PCIDEV_OP_INT: legacy INTx# pin interrupt, the addr field is 1-4 for
2823++ * the number
2824++ * @VIRTIO_PCIDEV_OP_MSI: MSI(-X) interrupt, this message basically transports
2825++ * the 16- or 32-bit write that would otherwise be done into memory,
2826++ * analogous to the write messages (@VIRTIO_PCIDEV_OP_MMIO_WRITE) above
2827++ * @VIRTIO_PCIDEV_OP_PME: Dummy message whose content is ignored (and should be
2828++ * all zeroes) to signal the PME# pin.
2829++ */
2830++enum virtio_pcidev_ops {
2831++ VIRTIO_PCIDEV_OP_RESERVED = 0,
2832++ VIRTIO_PCIDEV_OP_CFG_READ,
2833++ VIRTIO_PCIDEV_OP_CFG_WRITE,
2834++ VIRTIO_PCIDEV_OP_MMIO_READ,
2835++ VIRTIO_PCIDEV_OP_MMIO_WRITE,
2836++ VIRTIO_PCIDEV_OP_MMIO_MEMSET,
2837++ VIRTIO_PCIDEV_OP_INT,
2838++ VIRTIO_PCIDEV_OP_MSI,
2839++ VIRTIO_PCIDEV_OP_PME,
2840++};
2841++
2842++/**
2843++ * struct virtio_pcidev_msg - virtio PCI device operation
2844++ * @op: the operation to do
2845++ * @bar: the bar (only with BAR read/write messages)
2846++ * @reserved: reserved
2847++ * @size: the size of the read/write (in bytes)
2848++ * @addr: the address to read/write
2849++ * @data: the data, normally @size long, but just one byte for
2850++ * %VIRTIO_PCIDEV_OP_MMIO_MEMSET
2851++ *
2852++ * Note: the fields are all in native (CPU) endian, however, the
2853++ * @data values will often be in little endian (see the ops above.)
2854++ */
2855++struct virtio_pcidev_msg {
2856++ uint8_t op;
2857++ uint8_t bar;
2858++ uint16_t reserved;
2859++ uint32_t size;
2860++ uint64_t addr;
2861++ uint8_t data[];
2862++};
2863++
2864++#endif /* _LINUX_VIRTIO_PCIDEV_H */
2865+Index: qemu/include/standard-headers/linux/virtio_scmi.h
2866+===================================================================
2867+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2868++++ qemu/include/standard-headers/linux/virtio_scmi.h 2023-07-04 20:49:59.000000000 -0400
2869+@@ -0,0 +1,24 @@
2870++/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
2871++/*
2872++ * Copyright (C) 2020-2021 OpenSynergy GmbH
2873++ * Copyright (C) 2021 ARM Ltd.
2874++ */
2875++
2876++#ifndef _LINUX_VIRTIO_SCMI_H
2877++#define _LINUX_VIRTIO_SCMI_H
2878++
2879++#include "standard-headers/linux/virtio_types.h"
2880++
2881++/* Device implements some SCMI notifications, or delayed responses. */
2882++#define VIRTIO_SCMI_F_P2A_CHANNELS 0
2883++
2884++/* Device implements any SCMI statistics shared memory region */
2885++#define VIRTIO_SCMI_F_SHARED_MEMORY 1
2886++
2887++/* Virtqueues */
2888++
2889++#define VIRTIO_SCMI_VQ_TX 0 /* cmdq */
2890++#define VIRTIO_SCMI_VQ_RX 1 /* eventq */
2891++#define VIRTIO_SCMI_VQ_MAX_CNT 2
2892++
2893++#endif /* _LINUX_VIRTIO_SCMI_H */
2894+Index: qemu/linux-headers/asm-generic/unistd.h
2895+===================================================================
2896+--- qemu.orig/linux-headers/asm-generic/unistd.h 2023-07-04 20:49:59.000000000 -0400
2897++++ qemu/linux-headers/asm-generic/unistd.h 2023-07-04 20:51:04.000000000 -0400
2898+@@ -883,8 +883,11 @@
2899+ #define __NR_futex_waitv 449
2900+ __SYSCALL(__NR_futex_waitv, sys_futex_waitv)
2901+
2902++#define __NR_set_mempolicy_home_node 450
2903++__SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
2904++
2905+ #undef __NR_syscalls
2906+-#define __NR_syscalls 450
2907++#define __NR_syscalls 451
2908+
2909+ /*
2910+ * 32 bit systems traditionally used different
2911+Index: qemu/linux-headers/asm-mips/unistd_n32.h
2912+===================================================================
2913+--- qemu.orig/linux-headers/asm-mips/unistd_n32.h 2023-07-04 20:49:59.000000000 -0400
2914++++ qemu/linux-headers/asm-mips/unistd_n32.h 2023-07-04 20:49:59.000000000 -0400
2915+@@ -377,5 +377,7 @@
2916+ #define __NR_landlock_add_rule (__NR_Linux + 445)
2917+ #define __NR_landlock_restrict_self (__NR_Linux + 446)
2918+ #define __NR_process_mrelease (__NR_Linux + 448)
2919++#define __NR_futex_waitv (__NR_Linux + 449)
2920++#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
2921+
2922+ #endif /* _ASM_UNISTD_N32_H */
2923+Index: qemu/linux-headers/asm-mips/unistd_n64.h
2924+===================================================================
2925+--- qemu.orig/linux-headers/asm-mips/unistd_n64.h 2023-07-04 20:49:59.000000000 -0400
2926++++ qemu/linux-headers/asm-mips/unistd_n64.h 2023-07-04 20:49:59.000000000 -0400
2927+@@ -353,5 +353,7 @@
2928+ #define __NR_landlock_add_rule (__NR_Linux + 445)
2929+ #define __NR_landlock_restrict_self (__NR_Linux + 446)
2930+ #define __NR_process_mrelease (__NR_Linux + 448)
2931++#define __NR_futex_waitv (__NR_Linux + 449)
2932++#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
2933+
2934+ #endif /* _ASM_UNISTD_N64_H */
2935+Index: qemu/linux-headers/asm-mips/unistd_o32.h
2936+===================================================================
2937+--- qemu.orig/linux-headers/asm-mips/unistd_o32.h 2023-07-04 20:49:59.000000000 -0400
2938++++ qemu/linux-headers/asm-mips/unistd_o32.h 2023-07-04 20:49:59.000000000 -0400
2939+@@ -423,5 +423,7 @@
2940+ #define __NR_landlock_add_rule (__NR_Linux + 445)
2941+ #define __NR_landlock_restrict_self (__NR_Linux + 446)
2942+ #define __NR_process_mrelease (__NR_Linux + 448)
2943++#define __NR_futex_waitv (__NR_Linux + 449)
2944++#define __NR_set_mempolicy_home_node (__NR_Linux + 450)
2945+
2946+ #endif /* _ASM_UNISTD_O32_H */
2947+Index: qemu/linux-headers/asm-powerpc/unistd_32.h
2948+===================================================================
2949+--- qemu.orig/linux-headers/asm-powerpc/unistd_32.h 2023-07-04 20:49:59.000000000 -0400
2950++++ qemu/linux-headers/asm-powerpc/unistd_32.h 2023-07-04 20:49:59.000000000 -0400
2951+@@ -430,6 +430,8 @@
2952+ #define __NR_landlock_add_rule 445
2953+ #define __NR_landlock_restrict_self 446
2954+ #define __NR_process_mrelease 448
2955++#define __NR_futex_waitv 449
2956++#define __NR_set_mempolicy_home_node 450
2957+
2958+
2959+ #endif /* _ASM_UNISTD_32_H */
2960+Index: qemu/linux-headers/asm-powerpc/unistd_64.h
2961+===================================================================
2962+--- qemu.orig/linux-headers/asm-powerpc/unistd_64.h 2023-07-04 20:49:59.000000000 -0400
2963++++ qemu/linux-headers/asm-powerpc/unistd_64.h 2023-07-04 20:49:59.000000000 -0400
2964+@@ -402,6 +402,8 @@
2965+ #define __NR_landlock_add_rule 445
2966+ #define __NR_landlock_restrict_self 446
2967+ #define __NR_process_mrelease 448
2968++#define __NR_futex_waitv 449
2969++#define __NR_set_mempolicy_home_node 450
2970+
2971+
2972+ #endif /* _ASM_UNISTD_64_H */
2973+Index: qemu/linux-headers/asm-riscv/bitsperlong.h
2974+===================================================================
2975+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2976++++ qemu/linux-headers/asm-riscv/bitsperlong.h 2023-07-04 20:49:59.000000000 -0400
2977+@@ -0,0 +1,14 @@
2978++/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2979++/*
2980++ * Copyright (C) 2012 ARM Ltd.
2981++ * Copyright (C) 2015 Regents of the University of California
2982++ */
2983++
2984++#ifndef _ASM_RISCV_BITSPERLONG_H
2985++#define _ASM_RISCV_BITSPERLONG_H
2986++
2987++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
2988++
2989++#include <asm-generic/bitsperlong.h>
2990++
2991++#endif /* _ASM_RISCV_BITSPERLONG_H */
2992+Index: qemu/linux-headers/asm-riscv/mman.h
2993+===================================================================
2994+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2995++++ qemu/linux-headers/asm-riscv/mman.h 2023-07-04 20:49:59.000000000 -0400
2996+@@ -0,0 +1 @@
2997++#include <asm-generic/mman.h>
2998+Index: qemu/linux-headers/asm-riscv/unistd.h
2999+===================================================================
3000+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
3001++++ qemu/linux-headers/asm-riscv/unistd.h 2023-07-04 20:51:04.000000000 -0400
3002+@@ -0,0 +1,44 @@
3003++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3004++/*
3005++ * Copyright (C) 2018 David Abdurachmanov <david.abdurachmanov@gmail.com>
3006++ *
3007++ * This program is free software; you can redistribute it and/or modify
3008++ * it under the terms of the GNU General Public License version 2 as
3009++ * published by the Free Software Foundation.
3010++ *
3011++ * This program is distributed in the hope that it will be useful,
3012++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3013++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3014++ * GNU General Public License for more details.
3015++ *
3016++ * You should have received a copy of the GNU General Public License
3017++ * along with this program. If not, see <https://www.gnu.org/licenses/>.
3018++ */
3019++
3020++#ifdef __LP64__
3021++#define __ARCH_WANT_NEW_STAT
3022++#define __ARCH_WANT_SET_GET_RLIMIT
3023++#endif /* __LP64__ */
3024++
3025++#define __ARCH_WANT_SYS_CLONE3
3026++
3027++#include <asm-generic/unistd.h>
3028++
3029++/*
3030++ * Allows the instruction cache to be flushed from userspace. Despite RISC-V
3031++ * having a direct 'fence.i' instruction available to userspace (which we
3032++ * can't trap!), that's not actually viable when running on Linux because the
3033++ * kernel might schedule a process on another hart. There is no way for
3034++ * userspace to handle this without invoking the kernel (as it doesn't know the
3035++ * thread->hart mappings), so we've defined a RISC-V specific system call to
3036++ * flush the instruction cache.
3037++ *
3038++ * __NR_riscv_flush_icache is defined to flush the instruction cache over an
3039++ * address range, with the flush applying to either all threads or just the
3040++ * caller. We don't currently do anything with the address range, that's just
3041++ * in there for forwards compatibility.
3042++ */
3043++#ifndef __NR_riscv_flush_icache
3044++#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
3045++#endif
3046++__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)
3047+Index: qemu/linux-headers/asm-s390/unistd_32.h
3048+===================================================================
3049+--- qemu.orig/linux-headers/asm-s390/unistd_32.h 2023-07-04 20:49:59.000000000 -0400
3050++++ qemu/linux-headers/asm-s390/unistd_32.h 2023-07-04 20:49:59.000000000 -0400
3051+@@ -420,5 +420,7 @@
3052+ #define __NR_landlock_add_rule 445
3053+ #define __NR_landlock_restrict_self 446
3054+ #define __NR_process_mrelease 448
3055++#define __NR_futex_waitv 449
3056++#define __NR_set_mempolicy_home_node 450
3057+
3058+ #endif /* _ASM_S390_UNISTD_32_H */
3059+Index: qemu/linux-headers/asm-s390/unistd_64.h
3060+===================================================================
3061+--- qemu.orig/linux-headers/asm-s390/unistd_64.h 2023-07-04 20:49:59.000000000 -0400
3062++++ qemu/linux-headers/asm-s390/unistd_64.h 2023-07-04 20:49:59.000000000 -0400
3063+@@ -368,5 +368,7 @@
3064+ #define __NR_landlock_add_rule 445
3065+ #define __NR_landlock_restrict_self 446
3066+ #define __NR_process_mrelease 448
3067++#define __NR_futex_waitv 449
3068++#define __NR_set_mempolicy_home_node 450
3069+
3070+ #endif /* _ASM_S390_UNISTD_64_H */
3071+Index: qemu/linux-headers/asm-x86/kvm.h
3072+===================================================================
3073+--- qemu.orig/linux-headers/asm-x86/kvm.h 2023-07-04 20:49:59.000000000 -0400
3074++++ qemu/linux-headers/asm-x86/kvm.h 2023-07-04 20:51:11.000000000 -0400
3075+@@ -373,9 +373,23 @@
3076+ __u64 reserved[9];
3077+ };
3078+
3079+-/* for KVM_CAP_XSAVE */
3080++/* for KVM_CAP_XSAVE and KVM_CAP_XSAVE2 */
3081+ struct kvm_xsave {
3082++ /*
3083++ * KVM_GET_XSAVE2 and KVM_SET_XSAVE write and read as many bytes
3084++ * as are returned by KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2)
3085++ * respectively, when invoked on the vm file descriptor.
3086++ *
3087++ * The size value returned by KVM_CHECK_EXTENSION(KVM_CAP_XSAVE2)
3088++ * will always be at least 4096. Currently, it is only greater
3089++ * than 4096 if a dynamic feature has been enabled with
3090++ * ``arch_prctl()``, but this may change in the future.
3091++ *
3092++ * The offsets of the state save areas in struct kvm_xsave follow
3093++ * the contents of CPUID leaf 0xD on the host.
3094++ */
3095+ __u32 region[1024];
3096++ __u32 extra[0];
3097+ };
3098+
3099+ #define KVM_MAX_XCRS 16
3100+Index: qemu/linux-headers/asm-x86/unistd_32.h
3101+===================================================================
3102+--- qemu.orig/linux-headers/asm-x86/unistd_32.h 2023-07-04 20:49:59.000000000 -0400
3103++++ qemu/linux-headers/asm-x86/unistd_32.h 2023-07-04 20:49:59.000000000 -0400
3104+@@ -440,6 +440,7 @@
3105+ #define __NR_memfd_secret 447
3106+ #define __NR_process_mrelease 448
3107+ #define __NR_futex_waitv 449
3108++#define __NR_set_mempolicy_home_node 450
3109+
3110+
3111+ #endif /* _ASM_UNISTD_32_H */
3112+Index: qemu/linux-headers/asm-x86/unistd_64.h
3113+===================================================================
3114+--- qemu.orig/linux-headers/asm-x86/unistd_64.h 2023-07-04 20:49:59.000000000 -0400
3115++++ qemu/linux-headers/asm-x86/unistd_64.h 2023-07-04 20:49:59.000000000 -0400
3116+@@ -362,6 +362,7 @@
3117+ #define __NR_memfd_secret 447
3118+ #define __NR_process_mrelease 448
3119+ #define __NR_futex_waitv 449
3120++#define __NR_set_mempolicy_home_node 450
3121+
3122+
3123+ #endif /* _ASM_UNISTD_64_H */
3124+Index: qemu/linux-headers/asm-x86/unistd_x32.h
3125+===================================================================
3126+--- qemu.orig/linux-headers/asm-x86/unistd_x32.h 2023-07-04 20:49:59.000000000 -0400
3127++++ qemu/linux-headers/asm-x86/unistd_x32.h 2023-07-04 20:49:59.000000000 -0400
3128+@@ -315,6 +315,7 @@
3129+ #define __NR_memfd_secret (__X32_SYSCALL_BIT + 447)
3130+ #define __NR_process_mrelease (__X32_SYSCALL_BIT + 448)
3131+ #define __NR_futex_waitv (__X32_SYSCALL_BIT + 449)
3132++#define __NR_set_mempolicy_home_node (__X32_SYSCALL_BIT + 450)
3133+ #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
3134+ #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
3135+ #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
3136+Index: qemu/linux-headers/linux/kvm.h
3137+===================================================================
3138+--- qemu.orig/linux-headers/linux/kvm.h 2023-07-04 20:49:59.000000000 -0400
3139++++ qemu/linux-headers/linux/kvm.h 2023-07-04 20:51:11.000000000 -0400
3140+@@ -1130,6 +1130,9 @@
3141+ #define KVM_CAP_BINARY_STATS_FD 203
3142+ #define KVM_CAP_EXIT_ON_EMULATION_FAILURE 204
3143+ #define KVM_CAP_ARM_MTE 205
3144++#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
3145++#define KVM_CAP_VM_GPA_BITS 207
3146++#define KVM_CAP_XSAVE2 208
3147+
3148+ #ifdef KVM_CAP_IRQ_ROUTING
3149+
3150+@@ -1161,11 +1164,20 @@
3151+ __u32 sint;
3152+ };
3153+
3154++struct kvm_irq_routing_xen_evtchn {
3155++ __u32 port;
3156++ __u32 vcpu;
3157++ __u32 priority;
3158++};
3159++
3160++#define KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL ((__u32)(-1))
3161++
3162+ /* gsi routing entry types */
3163+ #define KVM_IRQ_ROUTING_IRQCHIP 1
3164+ #define KVM_IRQ_ROUTING_MSI 2
3165+ #define KVM_IRQ_ROUTING_S390_ADAPTER 3
3166+ #define KVM_IRQ_ROUTING_HV_SINT 4
3167++#define KVM_IRQ_ROUTING_XEN_EVTCHN 5
3168+
3169+ struct kvm_irq_routing_entry {
3170+ __u32 gsi;
3171+@@ -1177,6 +1189,7 @@
3172+ struct kvm_irq_routing_msi msi;
3173+ struct kvm_irq_routing_s390_adapter adapter;
3174+ struct kvm_irq_routing_hv_sint hv_sint;
3175++ struct kvm_irq_routing_xen_evtchn xen_evtchn;
3176+ __u32 pad[8];
3177+ } u;
3178+ };
3179+@@ -1207,6 +1220,7 @@
3180+ #define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL (1 << 1)
3181+ #define KVM_XEN_HVM_CONFIG_SHARED_INFO (1 << 2)
3182+ #define KVM_XEN_HVM_CONFIG_RUNSTATE (1 << 3)
3183++#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
3184+
3185+ struct kvm_xen_hvm_config {
3186+ __u32 flags;
3187+@@ -1609,6 +1623,9 @@
3188+ #define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
3189+ #define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
3190+
3191++/* Available with KVM_CAP_XSAVE2 */
3192++#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
3193++
3194+ struct kvm_s390_pv_sec_parm {
3195+ __u64 origin;
3196+ __u64 length;
3197diff --git a/debian/patches/ubuntu/lp-1853307-linux-headers-Update-to-v5.18-rc6.patch b/debian/patches/ubuntu/lp-1853307-linux-headers-Update-to-v5.18-rc6.patch
3198new file mode 100644
3199index 0000000..b939ec2
3200--- /dev/null
3201+++ b/debian/patches/ubuntu/lp-1853307-linux-headers-Update-to-v5.18-rc6.patch
3202@@ -0,0 +1,1009 @@
3203+From e4082063e47e9731dbeb1c26174c17f6038f577f Mon Sep 17 00:00:00 2001
3204+From: Alex Williamson <alex.williamson@redhat.com>
3205+Date: Fri, 13 May 2022 08:20:08 -0600
3206+Subject: [PATCH] linux-headers: Update to v5.18-rc6
3207+
3208+Update to c5eb0a61238d ("Linux 5.18-rc6"). Mechanical search and
3209+replace of vfio defines with white space massaging.
3210+
3211+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
3212+
3213+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/e4082063e4
3214+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
3215+Last-Update: 2023-07-04
3216+
3217+---
3218+ hw/vfio/common.c | 6 +-
3219+ hw/vfio/migration.c | 27 +-
3220+ .../linux/input-event-codes.h | 25 +-
3221+ .../standard-headers/linux/virtio_config.h | 6 +
3222+ .../standard-headers/linux/virtio_crypto.h | 82 +++-
3223+ linux-headers/asm-arm64/kvm.h | 16 +
3224+ linux-headers/asm-generic/mman-common.h | 2 +
3225+ linux-headers/asm-mips/mman.h | 2 +
3226+ linux-headers/linux/kvm.h | 27 +-
3227+ linux-headers/linux/psci.h | 4 +
3228+ linux-headers/linux/userfaultfd.h | 8 +-
3229+ linux-headers/linux/vfio.h | 406 +++++++++---------
3230+ linux-headers/linux/vhost.h | 7 +
3231+ 13 files changed, 383 insertions(+), 235 deletions(-)
3232+
3233+Index: qemu/hw/vfio/common.c
3234+===================================================================
3235+--- qemu.orig/hw/vfio/common.c 2023-07-04 20:49:59.000000000 -0400
3236++++ qemu/hw/vfio/common.c 2023-07-04 20:49:59.000000000 -0400
3237+@@ -354,7 +354,7 @@
3238+ }
3239+
3240+ if ((vbasedev->pre_copy_dirty_page_tracking == ON_OFF_AUTO_OFF)
3241+- && (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) {
3242++ && (migration->device_state & VFIO_DEVICE_STATE_V1_RUNNING)) {
3243+ return false;
3244+ }
3245+ }
3246+@@ -380,8 +380,8 @@
3247+ return false;
3248+ }
3249+
3250+- if ((migration->device_state & VFIO_DEVICE_STATE_SAVING) &&
3251+- (migration->device_state & VFIO_DEVICE_STATE_RUNNING)) {
3252++ if ((migration->device_state & VFIO_DEVICE_STATE_V1_SAVING) &&
3253++ (migration->device_state & VFIO_DEVICE_STATE_V1_RUNNING)) {
3254+ continue;
3255+ } else {
3256+ return false;
3257+Index: qemu/hw/vfio/migration.c
3258+===================================================================
3259+--- qemu.orig/hw/vfio/migration.c 2023-07-04 20:38:39.000000000 -0400
3260++++ qemu/hw/vfio/migration.c 2023-07-04 20:49:59.000000000 -0400
3261+@@ -432,7 +432,7 @@
3262+ }
3263+
3264+ ret = vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_MASK,
3265+- VFIO_DEVICE_STATE_SAVING);
3266++ VFIO_DEVICE_STATE_V1_SAVING);
3267+ if (ret) {
3268+ error_report("%s: Failed to set state SAVING", vbasedev->name);
3269+ return ret;
3270+@@ -531,8 +531,8 @@
3271+ uint64_t data_size;
3272+ int ret;
3273+
3274+- ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_RUNNING,
3275+- VFIO_DEVICE_STATE_SAVING);
3276++ ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_RUNNING,
3277++ VFIO_DEVICE_STATE_V1_SAVING);
3278+ if (ret) {
3279+ error_report("%s: Failed to set state STOP and SAVING",
3280+ vbasedev->name);
3281+@@ -569,7 +569,7 @@
3282+ return ret;
3283+ }
3284+
3285+- ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_SAVING, 0);
3286++ ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_V1_SAVING, 0);
3287+ if (ret) {
3288+ error_report("%s: Failed to set state STOPPED", vbasedev->name);
3289+ return ret;
3290+@@ -609,7 +609,7 @@
3291+ }
3292+
3293+ ret = vfio_migration_set_state(vbasedev, ~VFIO_DEVICE_STATE_MASK,
3294+- VFIO_DEVICE_STATE_RESUMING);
3295++ VFIO_DEVICE_STATE_V1_RESUMING);
3296+ if (ret) {
3297+ error_report("%s: Failed to set state RESUMING", vbasedev->name);
3298+ if (migration->region.mmaps) {
3299+@@ -717,20 +717,20 @@
3300+ * In both the above cases, set _RUNNING bit.
3301+ */
3302+ mask = ~VFIO_DEVICE_STATE_MASK;
3303+- value = VFIO_DEVICE_STATE_RUNNING;
3304++ value = VFIO_DEVICE_STATE_V1_RUNNING;
3305+ } else {
3306+ /*
3307+ * Here device state could be either _RUNNING or _SAVING|_RUNNING. Reset
3308+ * _RUNNING bit
3309+ */
3310+- mask = ~VFIO_DEVICE_STATE_RUNNING;
3311++ mask = ~VFIO_DEVICE_STATE_V1_RUNNING;
3312+
3313+ /*
3314+ * When VM state transition to stop for savevm command, device should
3315+ * start saving data.
3316+ */
3317+ if (state == RUN_STATE_SAVE_VM) {
3318+- value = VFIO_DEVICE_STATE_SAVING;
3319++ value = VFIO_DEVICE_STATE_V1_SAVING;
3320+ } else {
3321+ value = 0;
3322+ }
3323+@@ -768,8 +768,9 @@
3324+ case MIGRATION_STATUS_FAILED:
3325+ bytes_transferred = 0;
3326+ ret = vfio_migration_set_state(vbasedev,
3327+- ~(VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING),
3328+- VFIO_DEVICE_STATE_RUNNING);
3329++ ~(VFIO_DEVICE_STATE_V1_SAVING |
3330++ VFIO_DEVICE_STATE_V1_RESUMING),
3331++ VFIO_DEVICE_STATE_V1_RUNNING);
3332+ if (ret) {
3333+ error_report("%s: Failed to set state RUNNING", vbasedev->name);
3334+ }
3335+@@ -864,8 +865,10 @@
3336+ goto add_blocker;
3337+ }
3338+
3339+- ret = vfio_get_dev_region_info(vbasedev, VFIO_REGION_TYPE_MIGRATION,
3340+- VFIO_REGION_SUBTYPE_MIGRATION, &info);
3341++ ret = vfio_get_dev_region_info(vbasedev,
3342++ VFIO_REGION_TYPE_MIGRATION_DEPRECATED,
3343++ VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED,
3344++ &info);
3345+ if (ret) {
3346+ goto add_blocker;
3347+ }
3348+Index: qemu/include/standard-headers/linux/input-event-codes.h
3349+===================================================================
3350+--- qemu.orig/include/standard-headers/linux/input-event-codes.h 2023-07-04 20:38:39.000000000 -0400
3351++++ qemu/include/standard-headers/linux/input-event-codes.h 2023-07-04 20:49:59.000000000 -0400
3352+@@ -278,7 +278,8 @@
3353+ #define KEY_PAUSECD 201
3354+ #define KEY_PROG3 202
3355+ #define KEY_PROG4 203
3356+-#define KEY_DASHBOARD 204 /* AL Dashboard */
3357++#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */
3358++#define KEY_DASHBOARD KEY_ALL_APPLICATIONS
3359+ #define KEY_SUSPEND 205
3360+ #define KEY_CLOSE 206 /* AC Close */
3361+ #define KEY_PLAY 207
3362+@@ -612,6 +613,7 @@
3363+ #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
3364+ #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
3365+ #define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
3366++#define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */
3367+
3368+ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
3369+ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
3370+@@ -660,6 +662,27 @@
3371+ /* Select an area of screen to be copied */
3372+ #define KEY_SELECTIVE_SCREENSHOT 0x27a
3373+
3374++/* Move the focus to the next or previous user controllable element within a UI container */
3375++#define KEY_NEXT_ELEMENT 0x27b
3376++#define KEY_PREVIOUS_ELEMENT 0x27c
3377++
3378++/* Toggle Autopilot engagement */
3379++#define KEY_AUTOPILOT_ENGAGE_TOGGLE 0x27d
3380++
3381++/* Shortcut Keys */
3382++#define KEY_MARK_WAYPOINT 0x27e
3383++#define KEY_SOS 0x27f
3384++#define KEY_NAV_CHART 0x280
3385++#define KEY_FISHING_CHART 0x281
3386++#define KEY_SINGLE_RANGE_RADAR 0x282
3387++#define KEY_DUAL_RANGE_RADAR 0x283
3388++#define KEY_RADAR_OVERLAY 0x284
3389++#define KEY_TRADITIONAL_SONAR 0x285
3390++#define KEY_CLEARVU_SONAR 0x286
3391++#define KEY_SIDEVU_SONAR 0x287
3392++#define KEY_NAV_INFO 0x288
3393++#define KEY_BRIGHTNESS_MENU 0x289
3394++
3395+ /*
3396+ * Some keyboards have keys which do not have a defined meaning, these keys
3397+ * are intended to be programmed / bound to macros by the user. For most
3398+Index: qemu/include/standard-headers/linux/virtio_config.h
3399+===================================================================
3400+--- qemu.orig/include/standard-headers/linux/virtio_config.h 2023-07-04 20:38:39.000000000 -0400
3401++++ qemu/include/standard-headers/linux/virtio_config.h 2023-07-04 20:51:04.000000000 -0400
3402+@@ -81,6 +81,12 @@
3403+ #define VIRTIO_F_RING_PACKED 34
3404+
3405+ /*
3406++ * Inorder feature indicates that all buffers are used by the device
3407++ * in the same order in which they have been made available.
3408++ */
3409++#define VIRTIO_F_IN_ORDER 35
3410++
3411++/*
3412+ * This feature indicates that memory accesses by the driver and the
3413+ * device are ordered in a way described by the platform.
3414+ */
3415+Index: qemu/include/standard-headers/linux/virtio_crypto.h
3416+===================================================================
3417+--- qemu.orig/include/standard-headers/linux/virtio_crypto.h 2023-07-04 20:38:39.000000000 -0400
3418++++ qemu/include/standard-headers/linux/virtio_crypto.h 2023-07-04 20:49:59.000000000 -0400
3419+@@ -37,6 +37,7 @@
3420+ #define VIRTIO_CRYPTO_SERVICE_HASH 1
3421+ #define VIRTIO_CRYPTO_SERVICE_MAC 2
3422+ #define VIRTIO_CRYPTO_SERVICE_AEAD 3
3423++#define VIRTIO_CRYPTO_SERVICE_AKCIPHER 4
3424+
3425+ #define VIRTIO_CRYPTO_OPCODE(service, op) (((service) << 8) | (op))
3426+
3427+@@ -57,6 +58,10 @@
3428+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x02)
3429+ #define VIRTIO_CRYPTO_AEAD_DESTROY_SESSION \
3430+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x03)
3431++#define VIRTIO_CRYPTO_AKCIPHER_CREATE_SESSION \
3432++ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x04)
3433++#define VIRTIO_CRYPTO_AKCIPHER_DESTROY_SESSION \
3434++ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x05)
3435+ uint32_t opcode;
3436+ uint32_t algo;
3437+ uint32_t flag;
3438+@@ -180,6 +185,58 @@
3439+ uint8_t padding[32];
3440+ };
3441+
3442++struct virtio_crypto_rsa_session_para {
3443++#define VIRTIO_CRYPTO_RSA_RAW_PADDING 0
3444++#define VIRTIO_CRYPTO_RSA_PKCS1_PADDING 1
3445++ uint32_t padding_algo;
3446++
3447++#define VIRTIO_CRYPTO_RSA_NO_HASH 0
3448++#define VIRTIO_CRYPTO_RSA_MD2 1
3449++#define VIRTIO_CRYPTO_RSA_MD3 2
3450++#define VIRTIO_CRYPTO_RSA_MD4 3
3451++#define VIRTIO_CRYPTO_RSA_MD5 4
3452++#define VIRTIO_CRYPTO_RSA_SHA1 5
3453++#define VIRTIO_CRYPTO_RSA_SHA256 6
3454++#define VIRTIO_CRYPTO_RSA_SHA384 7
3455++#define VIRTIO_CRYPTO_RSA_SHA512 8
3456++#define VIRTIO_CRYPTO_RSA_SHA224 9
3457++ uint32_t hash_algo;
3458++};
3459++
3460++struct virtio_crypto_ecdsa_session_para {
3461++#define VIRTIO_CRYPTO_CURVE_UNKNOWN 0
3462++#define VIRTIO_CRYPTO_CURVE_NIST_P192 1
3463++#define VIRTIO_CRYPTO_CURVE_NIST_P224 2
3464++#define VIRTIO_CRYPTO_CURVE_NIST_P256 3
3465++#define VIRTIO_CRYPTO_CURVE_NIST_P384 4
3466++#define VIRTIO_CRYPTO_CURVE_NIST_P521 5
3467++ uint32_t curve_id;
3468++ uint32_t padding;
3469++};
3470++
3471++struct virtio_crypto_akcipher_session_para {
3472++#define VIRTIO_CRYPTO_NO_AKCIPHER 0
3473++#define VIRTIO_CRYPTO_AKCIPHER_RSA 1
3474++#define VIRTIO_CRYPTO_AKCIPHER_DSA 2
3475++#define VIRTIO_CRYPTO_AKCIPHER_ECDSA 3
3476++ uint32_t algo;
3477++
3478++#define VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PUBLIC 1
3479++#define VIRTIO_CRYPTO_AKCIPHER_KEY_TYPE_PRIVATE 2
3480++ uint32_t keytype;
3481++ uint32_t keylen;
3482++
3483++ union {
3484++ struct virtio_crypto_rsa_session_para rsa;
3485++ struct virtio_crypto_ecdsa_session_para ecdsa;
3486++ } u;
3487++};
3488++
3489++struct virtio_crypto_akcipher_create_session_req {
3490++ struct virtio_crypto_akcipher_session_para para;
3491++ uint8_t padding[36];
3492++};
3493++
3494+ struct virtio_crypto_alg_chain_session_para {
3495+ #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_HASH_THEN_CIPHER 1
3496+ #define VIRTIO_CRYPTO_SYM_ALG_CHAIN_ORDER_CIPHER_THEN_HASH 2
3497+@@ -247,6 +304,8 @@
3498+ mac_create_session;
3499+ struct virtio_crypto_aead_create_session_req
3500+ aead_create_session;
3501++ struct virtio_crypto_akcipher_create_session_req
3502++ akcipher_create_session;
3503+ struct virtio_crypto_destroy_session_req
3504+ destroy_session;
3505+ uint8_t padding[56];
3506+@@ -266,6 +325,14 @@
3507+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x00)
3508+ #define VIRTIO_CRYPTO_AEAD_DECRYPT \
3509+ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AEAD, 0x01)
3510++#define VIRTIO_CRYPTO_AKCIPHER_ENCRYPT \
3511++ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x00)
3512++#define VIRTIO_CRYPTO_AKCIPHER_DECRYPT \
3513++ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x01)
3514++#define VIRTIO_CRYPTO_AKCIPHER_SIGN \
3515++ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x02)
3516++#define VIRTIO_CRYPTO_AKCIPHER_VERIFY \
3517++ VIRTIO_CRYPTO_OPCODE(VIRTIO_CRYPTO_SERVICE_AKCIPHER, 0x03)
3518+ uint32_t opcode;
3519+ /* algo should be service-specific algorithms */
3520+ uint32_t algo;
3521+@@ -390,6 +457,16 @@
3522+ uint8_t padding[32];
3523+ };
3524+
3525++struct virtio_crypto_akcipher_para {
3526++ uint32_t src_data_len;
3527++ uint32_t dst_data_len;
3528++};
3529++
3530++struct virtio_crypto_akcipher_data_req {
3531++ struct virtio_crypto_akcipher_para para;
3532++ uint8_t padding[40];
3533++};
3534++
3535+ /* The request of the data virtqueue's packet */
3536+ struct virtio_crypto_op_data_req {
3537+ struct virtio_crypto_op_header header;
3538+@@ -399,6 +476,7 @@
3539+ struct virtio_crypto_hash_data_req hash_req;
3540+ struct virtio_crypto_mac_data_req mac_req;
3541+ struct virtio_crypto_aead_data_req aead_req;
3542++ struct virtio_crypto_akcipher_data_req akcipher_req;
3543+ uint8_t padding[48];
3544+ } u;
3545+ };
3546+@@ -408,6 +486,8 @@
3547+ #define VIRTIO_CRYPTO_BADMSG 2
3548+ #define VIRTIO_CRYPTO_NOTSUPP 3
3549+ #define VIRTIO_CRYPTO_INVSESS 4 /* Invalid session id */
3550++#define VIRTIO_CRYPTO_NOSPC 5 /* no free session ID */
3551++#define VIRTIO_CRYPTO_KEY_REJECTED 6 /* Signature verification failed */
3552+
3553+ /* The accelerator hardware is ready */
3554+ #define VIRTIO_CRYPTO_S_HW_READY (1 << 0)
3555+@@ -438,7 +518,7 @@
3556+ uint32_t max_cipher_key_len;
3557+ /* Maximum length of authenticated key */
3558+ uint32_t max_auth_key_len;
3559+- uint32_t reserve;
3560++ uint32_t akcipher_algo;
3561+ /* Maximum size of each crypto request's content */
3562+ uint64_t max_size;
3563+ };
3564+Index: qemu/linux-headers/asm-arm64/kvm.h
3565+===================================================================
3566+--- qemu.orig/linux-headers/asm-arm64/kvm.h 2023-07-04 20:38:39.000000000 -0400
3567++++ qemu/linux-headers/asm-arm64/kvm.h 2023-07-04 20:51:04.000000000 -0400
3568+@@ -281,6 +281,11 @@
3569+ #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_NOT_REQUIRED 3
3570+ #define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_2_ENABLED (1U << 4)
3571+
3572++#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3 KVM_REG_ARM_FW_REG(3)
3573++#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_AVAIL 0
3574++#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_AVAIL 1
3575++#define KVM_REG_ARM_SMCCC_ARCH_WORKAROUND_3_NOT_REQUIRED 2
3576++
3577+ /* SVE registers */
3578+ #define KVM_REG_ARM64_SVE (0x15 << KVM_REG_ARM_COPROC_SHIFT)
3579+
3580+@@ -362,6 +367,7 @@
3581+ #define KVM_ARM_VCPU_PMU_V3_IRQ 0
3582+ #define KVM_ARM_VCPU_PMU_V3_INIT 1
3583+ #define KVM_ARM_VCPU_PMU_V3_FILTER 2
3584++#define KVM_ARM_VCPU_PMU_V3_SET_PMU 3
3585+ #define KVM_ARM_VCPU_TIMER_CTRL 1
3586+ #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
3587+ #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
3588+@@ -411,6 +417,16 @@
3589+ #define KVM_PSCI_RET_INVAL PSCI_RET_INVALID_PARAMS
3590+ #define KVM_PSCI_RET_DENIED PSCI_RET_DENIED
3591+
3592++/* arm64-specific kvm_run::system_event flags */
3593++/*
3594++ * Reset caused by a PSCI v1.1 SYSTEM_RESET2 call.
3595++ * Valid only when the system event has a type of KVM_SYSTEM_EVENT_RESET.
3596++ */
3597++#define KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 (1ULL << 0)
3598++
3599++/* run->fail_entry.hardware_entry_failure_reason codes. */
3600++#define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0)
3601++
3602+ #endif
3603+
3604+ #endif /* __ARM_KVM_H__ */
3605+Index: qemu/linux-headers/asm-generic/mman-common.h
3606+===================================================================
3607+--- qemu.orig/linux-headers/asm-generic/mman-common.h 2023-07-04 20:38:39.000000000 -0400
3608++++ qemu/linux-headers/asm-generic/mman-common.h 2023-07-04 20:49:59.000000000 -0400
3609+@@ -75,6 +75,8 @@
3610+ #define MADV_POPULATE_READ 22 /* populate (prefault) page tables readable */
3611+ #define MADV_POPULATE_WRITE 23 /* populate (prefault) page tables writable */
3612+
3613++#define MADV_DONTNEED_LOCKED 24 /* like DONTNEED, but drop locked pages too */
3614++
3615+ /* compatibility flags */
3616+ #define MAP_FILE 0
3617+
3618+Index: qemu/linux-headers/asm-mips/mman.h
3619+===================================================================
3620+--- qemu.orig/linux-headers/asm-mips/mman.h 2023-07-04 20:38:39.000000000 -0400
3621++++ qemu/linux-headers/asm-mips/mman.h 2023-07-04 20:49:59.000000000 -0400
3622+@@ -101,6 +101,8 @@
3623+ #define MADV_POPULATE_READ 22 /* populate (prefault) page tables readable */
3624+ #define MADV_POPULATE_WRITE 23 /* populate (prefault) page tables writable */
3625+
3626++#define MADV_DONTNEED_LOCKED 24 /* like DONTNEED, but drop locked pages too */
3627++
3628+ /* compatibility flags */
3629+ #define MAP_FILE 0
3630+
3631+Index: qemu/linux-headers/linux/kvm.h
3632+===================================================================
3633+--- qemu.orig/linux-headers/linux/kvm.h 2023-07-04 20:49:59.000000000 -0400
3634++++ qemu/linux-headers/linux/kvm.h 2023-07-04 20:51:08.000000000 -0400
3635+@@ -445,7 +445,11 @@
3636+ #define KVM_SYSTEM_EVENT_RESET 2
3637+ #define KVM_SYSTEM_EVENT_CRASH 3
3638+ __u32 type;
3639+- __u64 flags;
3640++ __u32 ndata;
3641++ union {
3642++ __u64 flags;
3643++ __u64 data[16];
3644++ };
3645+ } system_event;
3646+ /* KVM_EXIT_S390_STSI */
3647+ struct {
3648+@@ -562,9 +566,12 @@
3649+ __u32 op; /* type of operation */
3650+ __u64 buf; /* buffer in userspace */
3651+ union {
3652+- __u8 ar; /* the access register number */
3653++ struct {
3654++ __u8 ar; /* the access register number */
3655++ __u8 key; /* access key, ignored if flag unset */
3656++ };
3657+ __u32 sida_offset; /* offset into the sida */
3658+- __u8 reserved[32]; /* should be set to 0 */
3659++ __u8 reserved[32]; /* ignored */
3660+ };
3661+ };
3662+ /* types for kvm_s390_mem_op->op */
3663+@@ -572,9 +579,12 @@
3664+ #define KVM_S390_MEMOP_LOGICAL_WRITE 1
3665+ #define KVM_S390_MEMOP_SIDA_READ 2
3666+ #define KVM_S390_MEMOP_SIDA_WRITE 3
3667++#define KVM_S390_MEMOP_ABSOLUTE_READ 4
3668++#define KVM_S390_MEMOP_ABSOLUTE_WRITE 5
3669+ /* flags for kvm_s390_mem_op->flags */
3670+ #define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
3671+ #define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
3672++#define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2)
3673+
3674+ /* for KVM_INTERRUPT */
3675+ struct kvm_interrupt {
3676+@@ -1134,6 +1144,12 @@
3677+ #define KVM_CAP_VM_GPA_BITS 207
3678+ #define KVM_CAP_XSAVE2 208
3679+ #define KVM_CAP_SYS_ATTRIBUTES 209
3680++#define KVM_CAP_PPC_AIL_MODE_3 210
3681++#define KVM_CAP_S390_MEM_OP_EXTENSION 211
3682++#define KVM_CAP_PMU_CAPABILITY 212
3683++#define KVM_CAP_DISABLE_QUIRKS2 213
3684++/* #define KVM_CAP_VM_TSC_CONTROL 214 */
3685++#define KVM_CAP_SYSTEM_EVENT_DATA 215
3686+
3687+ #ifdef KVM_CAP_IRQ_ROUTING
3688+
3689+@@ -1624,9 +1640,6 @@
3690+ #define KVM_S390_NORMAL_RESET _IO(KVMIO, 0xc3)
3691+ #define KVM_S390_CLEAR_RESET _IO(KVMIO, 0xc4)
3692+
3693+-/* Available with KVM_CAP_XSAVE2 */
3694+-#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
3695+-
3696+ struct kvm_s390_pv_sec_parm {
3697+ __u64 origin;
3698+ __u64 length;
3699+@@ -1973,6 +1986,8 @@
3700+ #define KVM_BUS_LOCK_DETECTION_OFF (1 << 0)
3701+ #define KVM_BUS_LOCK_DETECTION_EXIT (1 << 1)
3702+
3703++#define KVM_PMU_CAP_DISABLE (1 << 0)
3704++
3705+ /**
3706+ * struct kvm_stats_header - Header of per vm/vcpu binary statistics data.
3707+ * @flags: Some extra information for header, always 0 for now.
3708+Index: qemu/linux-headers/linux/psci.h
3709+===================================================================
3710+--- qemu.orig/linux-headers/linux/psci.h 2023-07-04 20:38:39.000000000 -0400
3711++++ qemu/linux-headers/linux/psci.h 2023-07-04 20:49:59.000000000 -0400
3712+@@ -82,6 +82,10 @@
3713+ #define PSCI_0_2_TOS_UP_NO_MIGRATE 1
3714+ #define PSCI_0_2_TOS_MP 2
3715+
3716++/* PSCI v1.1 reset type encoding for SYSTEM_RESET2 */
3717++#define PSCI_1_1_RESET_TYPE_SYSTEM_WARM_RESET 0
3718++#define PSCI_1_1_RESET_TYPE_VENDOR_START 0x80000000U
3719++
3720+ /* PSCI version decoding (independent of PSCI version) */
3721+ #define PSCI_VERSION_MAJOR_SHIFT 16
3722+ #define PSCI_VERSION_MINOR_MASK \
3723+Index: qemu/linux-headers/linux/userfaultfd.h
3724+===================================================================
3725+--- qemu.orig/linux-headers/linux/userfaultfd.h 2023-07-04 20:38:39.000000000 -0400
3726++++ qemu/linux-headers/linux/userfaultfd.h 2023-07-04 20:51:04.000000000 -0400
3727+@@ -32,7 +32,8 @@
3728+ UFFD_FEATURE_SIGBUS | \
3729+ UFFD_FEATURE_THREAD_ID | \
3730+ UFFD_FEATURE_MINOR_HUGETLBFS | \
3731+- UFFD_FEATURE_MINOR_SHMEM)
3732++ UFFD_FEATURE_MINOR_SHMEM | \
3733++ UFFD_FEATURE_EXACT_ADDRESS)
3734+ #define UFFD_API_IOCTLS \
3735+ ((__u64)1 << _UFFDIO_REGISTER | \
3736+ (__u64)1 << _UFFDIO_UNREGISTER | \
3737+@@ -189,6 +190,10 @@
3738+ *
3739+ * UFFD_FEATURE_MINOR_SHMEM indicates the same support as
3740+ * UFFD_FEATURE_MINOR_HUGETLBFS, but for shmem-backed pages instead.
3741++ *
3742++ * UFFD_FEATURE_EXACT_ADDRESS indicates that the exact address of page
3743++ * faults would be provided and the offset within the page would not be
3744++ * masked.
3745+ */
3746+ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
3747+ #define UFFD_FEATURE_EVENT_FORK (1<<1)
3748+@@ -201,6 +206,7 @@
3749+ #define UFFD_FEATURE_THREAD_ID (1<<8)
3750+ #define UFFD_FEATURE_MINOR_HUGETLBFS (1<<9)
3751+ #define UFFD_FEATURE_MINOR_SHMEM (1<<10)
3752++#define UFFD_FEATURE_EXACT_ADDRESS (1<<11)
3753+ __u64 features;
3754+
3755+ __u64 ioctls;
3756+Index: qemu/linux-headers/linux/vfio.h
3757+===================================================================
3758+--- qemu.orig/linux-headers/linux/vfio.h 2023-07-04 20:38:39.000000000 -0400
3759++++ qemu/linux-headers/linux/vfio.h 2023-07-04 20:51:04.000000000 -0400
3760+@@ -323,7 +323,7 @@
3761+ #define VFIO_REGION_TYPE_PCI_VENDOR_MASK (0xffff)
3762+ #define VFIO_REGION_TYPE_GFX (1)
3763+ #define VFIO_REGION_TYPE_CCW (2)
3764+-#define VFIO_REGION_TYPE_MIGRATION (3)
3765++#define VFIO_REGION_TYPE_MIGRATION_DEPRECATED (3)
3766+
3767+ /* sub-types for VFIO_REGION_TYPE_PCI_* */
3768+
3769+@@ -405,225 +405,29 @@
3770+ #define VFIO_REGION_SUBTYPE_CCW_CRW (3)
3771+
3772+ /* sub-types for VFIO_REGION_TYPE_MIGRATION */
3773+-#define VFIO_REGION_SUBTYPE_MIGRATION (1)
3774+-
3775+-/*
3776+- * The structure vfio_device_migration_info is placed at the 0th offset of
3777+- * the VFIO_REGION_SUBTYPE_MIGRATION region to get and set VFIO device related
3778+- * migration information. Field accesses from this structure are only supported
3779+- * at their native width and alignment. Otherwise, the result is undefined and
3780+- * vendor drivers should return an error.
3781+- *
3782+- * device_state: (read/write)
3783+- * - The user application writes to this field to inform the vendor driver
3784+- * about the device state to be transitioned to.
3785+- * - The vendor driver should take the necessary actions to change the
3786+- * device state. After successful transition to a given state, the
3787+- * vendor driver should return success on write(device_state, state)
3788+- * system call. If the device state transition fails, the vendor driver
3789+- * should return an appropriate -errno for the fault condition.
3790+- * - On the user application side, if the device state transition fails,
3791+- * that is, if write(device_state, state) returns an error, read
3792+- * device_state again to determine the current state of the device from
3793+- * the vendor driver.
3794+- * - The vendor driver should return previous state of the device unless
3795+- * the vendor driver has encountered an internal error, in which case
3796+- * the vendor driver may report the device_state VFIO_DEVICE_STATE_ERROR.
3797+- * - The user application must use the device reset ioctl to recover the
3798+- * device from VFIO_DEVICE_STATE_ERROR state. If the device is
3799+- * indicated to be in a valid device state by reading device_state, the
3800+- * user application may attempt to transition the device to any valid
3801+- * state reachable from the current state or terminate itself.
3802+- *
3803+- * device_state consists of 3 bits:
3804+- * - If bit 0 is set, it indicates the _RUNNING state. If bit 0 is clear,
3805+- * it indicates the _STOP state. When the device state is changed to
3806+- * _STOP, driver should stop the device before write() returns.
3807+- * - If bit 1 is set, it indicates the _SAVING state, which means that the
3808+- * driver should start gathering device state information that will be
3809+- * provided to the VFIO user application to save the device's state.
3810+- * - If bit 2 is set, it indicates the _RESUMING state, which means that
3811+- * the driver should prepare to resume the device. Data provided through
3812+- * the migration region should be used to resume the device.
3813+- * Bits 3 - 31 are reserved for future use. To preserve them, the user
3814+- * application should perform a read-modify-write operation on this
3815+- * field when modifying the specified bits.
3816+- *
3817+- * +------- _RESUMING
3818+- * |+------ _SAVING
3819+- * ||+----- _RUNNING
3820+- * |||
3821+- * 000b => Device Stopped, not saving or resuming
3822+- * 001b => Device running, which is the default state
3823+- * 010b => Stop the device & save the device state, stop-and-copy state
3824+- * 011b => Device running and save the device state, pre-copy state
3825+- * 100b => Device stopped and the device state is resuming
3826+- * 101b => Invalid state
3827+- * 110b => Error state
3828+- * 111b => Invalid state
3829+- *
3830+- * State transitions:
3831+- *
3832+- * _RESUMING _RUNNING Pre-copy Stop-and-copy _STOP
3833+- * (100b) (001b) (011b) (010b) (000b)
3834+- * 0. Running or default state
3835+- * |
3836+- *
3837+- * 1. Normal Shutdown (optional)
3838+- * |------------------------------------->|
3839+- *
3840+- * 2. Save the state or suspend
3841+- * |------------------------->|---------->|
3842+- *
3843+- * 3. Save the state during live migration
3844+- * |----------->|------------>|---------->|
3845+- *
3846+- * 4. Resuming
3847+- * |<---------|
3848+- *
3849+- * 5. Resumed
3850+- * |--------->|
3851+- *
3852+- * 0. Default state of VFIO device is _RUNNING when the user application starts.
3853+- * 1. During normal shutdown of the user application, the user application may
3854+- * optionally change the VFIO device state from _RUNNING to _STOP. This
3855+- * transition is optional. The vendor driver must support this transition but
3856+- * must not require it.
3857+- * 2. When the user application saves state or suspends the application, the
3858+- * device state transitions from _RUNNING to stop-and-copy and then to _STOP.
3859+- * On state transition from _RUNNING to stop-and-copy, driver must stop the
3860+- * device, save the device state and send it to the application through the
3861+- * migration region. The sequence to be followed for such transition is given
3862+- * below.
3863+- * 3. In live migration of user application, the state transitions from _RUNNING
3864+- * to pre-copy, to stop-and-copy, and to _STOP.
3865+- * On state transition from _RUNNING to pre-copy, the driver should start
3866+- * gathering the device state while the application is still running and send
3867+- * the device state data to application through the migration region.
3868+- * On state transition from pre-copy to stop-and-copy, the driver must stop
3869+- * the device, save the device state and send it to the user application
3870+- * through the migration region.
3871+- * Vendor drivers must support the pre-copy state even for implementations
3872+- * where no data is provided to the user before the stop-and-copy state. The
3873+- * user must not be required to consume all migration data before the device
3874+- * transitions to a new state, including the stop-and-copy state.
3875+- * The sequence to be followed for above two transitions is given below.
3876+- * 4. To start the resuming phase, the device state should be transitioned from
3877+- * the _RUNNING to the _RESUMING state.
3878+- * In the _RESUMING state, the driver should use the device state data
3879+- * received through the migration region to resume the device.
3880+- * 5. After providing saved device data to the driver, the application should
3881+- * change the state from _RESUMING to _RUNNING.
3882+- *
3883+- * reserved:
3884+- * Reads on this field return zero and writes are ignored.
3885+- *
3886+- * pending_bytes: (read only)
3887+- * The number of pending bytes still to be migrated from the vendor driver.
3888+- *
3889+- * data_offset: (read only)
3890+- * The user application should read data_offset field from the migration
3891+- * region. The user application should read the device data from this
3892+- * offset within the migration region during the _SAVING state or write
3893+- * the device data during the _RESUMING state. See below for details of
3894+- * sequence to be followed.
3895+- *
3896+- * data_size: (read/write)
3897+- * The user application should read data_size to get the size in bytes of
3898+- * the data copied in the migration region during the _SAVING state and
3899+- * write the size in bytes of the data copied in the migration region
3900+- * during the _RESUMING state.
3901+- *
3902+- * The format of the migration region is as follows:
3903+- * ------------------------------------------------------------------
3904+- * |vfio_device_migration_info| data section |
3905+- * | | /////////////////////////////// |
3906+- * ------------------------------------------------------------------
3907+- * ^ ^
3908+- * offset 0-trapped part data_offset
3909+- *
3910+- * The structure vfio_device_migration_info is always followed by the data
3911+- * section in the region, so data_offset will always be nonzero. The offset
3912+- * from where the data is copied is decided by the kernel driver. The data
3913+- * section can be trapped, mmapped, or partitioned, depending on how the kernel
3914+- * driver defines the data section. The data section partition can be defined
3915+- * as mapped by the sparse mmap capability. If mmapped, data_offset must be
3916+- * page aligned, whereas initial section which contains the
3917+- * vfio_device_migration_info structure, might not end at the offset, which is
3918+- * page aligned. The user is not required to access through mmap regardless
3919+- * of the capabilities of the region mmap.
3920+- * The vendor driver should determine whether and how to partition the data
3921+- * section. The vendor driver should return data_offset accordingly.
3922+- *
3923+- * The sequence to be followed while in pre-copy state and stop-and-copy state
3924+- * is as follows:
3925+- * a. Read pending_bytes, indicating the start of a new iteration to get device
3926+- * data. Repeated read on pending_bytes at this stage should have no side
3927+- * effects.
3928+- * If pending_bytes == 0, the user application should not iterate to get data
3929+- * for that device.
3930+- * If pending_bytes > 0, perform the following steps.
3931+- * b. Read data_offset, indicating that the vendor driver should make data
3932+- * available through the data section. The vendor driver should return this
3933+- * read operation only after data is available from (region + data_offset)
3934+- * to (region + data_offset + data_size).
3935+- * c. Read data_size, which is the amount of data in bytes available through
3936+- * the migration region.
3937+- * Read on data_offset and data_size should return the offset and size of
3938+- * the current buffer if the user application reads data_offset and
3939+- * data_size more than once here.
3940+- * d. Read data_size bytes of data from (region + data_offset) from the
3941+- * migration region.
3942+- * e. Process the data.
3943+- * f. Read pending_bytes, which indicates that the data from the previous
3944+- * iteration has been read. If pending_bytes > 0, go to step b.
3945+- *
3946+- * The user application can transition from the _SAVING|_RUNNING
3947+- * (pre-copy state) to the _SAVING (stop-and-copy) state regardless of the
3948+- * number of pending bytes. The user application should iterate in _SAVING
3949+- * (stop-and-copy) until pending_bytes is 0.
3950+- *
3951+- * The sequence to be followed while _RESUMING device state is as follows:
3952+- * While data for this device is available, repeat the following steps:
3953+- * a. Read data_offset from where the user application should write data.
3954+- * b. Write migration data starting at the migration region + data_offset for
3955+- * the length determined by data_size from the migration source.
3956+- * c. Write data_size, which indicates to the vendor driver that data is
3957+- * written in the migration region. Vendor driver must return this write
3958+- * operations on consuming data. Vendor driver should apply the
3959+- * user-provided migration region data to the device resume state.
3960+- *
3961+- * If an error occurs during the above sequences, the vendor driver can return
3962+- * an error code for next read() or write() operation, which will terminate the
3963+- * loop. The user application should then take the next necessary action, for
3964+- * example, failing migration or terminating the user application.
3965+- *
3966+- * For the user application, data is opaque. The user application should write
3967+- * data in the same order as the data is received and the data should be of
3968+- * same transaction size at the source.
3969+- */
3970++#define VFIO_REGION_SUBTYPE_MIGRATION_DEPRECATED (1)
3971+
3972+ struct vfio_device_migration_info {
3973+ __u32 device_state; /* VFIO device state */
3974+-#define VFIO_DEVICE_STATE_STOP (0)
3975+-#define VFIO_DEVICE_STATE_RUNNING (1 << 0)
3976+-#define VFIO_DEVICE_STATE_SAVING (1 << 1)
3977+-#define VFIO_DEVICE_STATE_RESUMING (1 << 2)
3978+-#define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_RUNNING | \
3979+- VFIO_DEVICE_STATE_SAVING | \
3980+- VFIO_DEVICE_STATE_RESUMING)
3981++#define VFIO_DEVICE_STATE_V1_STOP (0)
3982++#define VFIO_DEVICE_STATE_V1_RUNNING (1 << 0)
3983++#define VFIO_DEVICE_STATE_V1_SAVING (1 << 1)
3984++#define VFIO_DEVICE_STATE_V1_RESUMING (1 << 2)
3985++#define VFIO_DEVICE_STATE_MASK (VFIO_DEVICE_STATE_V1_RUNNING | \
3986++ VFIO_DEVICE_STATE_V1_SAVING | \
3987++ VFIO_DEVICE_STATE_V1_RESUMING)
3988+
3989+ #define VFIO_DEVICE_STATE_VALID(state) \
3990+- (state & VFIO_DEVICE_STATE_RESUMING ? \
3991+- (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_RESUMING : 1)
3992++ (state & VFIO_DEVICE_STATE_V1_RESUMING ? \
3993++ (state & VFIO_DEVICE_STATE_MASK) == VFIO_DEVICE_STATE_V1_RESUMING : 1)
3994+
3995+ #define VFIO_DEVICE_STATE_IS_ERROR(state) \
3996+- ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_SAVING | \
3997+- VFIO_DEVICE_STATE_RESUMING))
3998++ ((state & VFIO_DEVICE_STATE_MASK) == (VFIO_DEVICE_STATE_V1_SAVING | \
3999++ VFIO_DEVICE_STATE_V1_RESUMING))
4000+
4001+ #define VFIO_DEVICE_STATE_SET_ERROR(state) \
4002+- ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_SATE_SAVING | \
4003+- VFIO_DEVICE_STATE_RESUMING)
4004++ ((state & ~VFIO_DEVICE_STATE_MASK) | VFIO_DEVICE_STATE_V1_SAVING | \
4005++ VFIO_DEVICE_STATE_V1_RESUMING)
4006+
4007+ __u32 reserved;
4008+ __u64 pending_bytes;
4009+@@ -1002,6 +806,186 @@
4010+ */
4011+ #define VFIO_DEVICE_FEATURE_PCI_VF_TOKEN (0)
4012+
4013++/*
4014++ * Indicates the device can support the migration API through
4015++ * VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE. If this GET succeeds, the RUNNING and
4016++ * ERROR states are always supported. Support for additional states is
4017++ * indicated via the flags field; at least VFIO_MIGRATION_STOP_COPY must be
4018++ * set.
4019++ *
4020++ * VFIO_MIGRATION_STOP_COPY means that STOP, STOP_COPY and
4021++ * RESUMING are supported.
4022++ *
4023++ * VFIO_MIGRATION_STOP_COPY | VFIO_MIGRATION_P2P means that RUNNING_P2P
4024++ * is supported in addition to the STOP_COPY states.
4025++ *
4026++ * Other combinations of flags have behavior to be defined in the future.
4027++ */
4028++struct vfio_device_feature_migration {
4029++ __aligned_u64 flags;
4030++#define VFIO_MIGRATION_STOP_COPY (1 << 0)
4031++#define VFIO_MIGRATION_P2P (1 << 1)
4032++};
4033++#define VFIO_DEVICE_FEATURE_MIGRATION 1
4034++
4035++/*
4036++ * Upon VFIO_DEVICE_FEATURE_SET, execute a migration state change on the VFIO
4037++ * device. The new state is supplied in device_state, see enum
4038++ * vfio_device_mig_state for details
4039++ *
4040++ * The kernel migration driver must fully transition the device to the new state
4041++ * value before the operation returns to the user.
4042++ *
4043++ * The kernel migration driver must not generate asynchronous device state
4044++ * transitions outside of manipulation by the user or the VFIO_DEVICE_RESET
4045++ * ioctl as described above.
4046++ *
4047++ * If this function fails then current device_state may be the original
4048++ * operating state or some other state along the combination transition path.
4049++ * The user can then decide if it should execute a VFIO_DEVICE_RESET, attempt
4050++ * to return to the original state, or attempt to return to some other state
4051++ * such as RUNNING or STOP.
4052++ *
4053++ * If the new_state starts a new data transfer session then the FD associated
4054++ * with that session is returned in data_fd. The user is responsible to close
4055++ * this FD when it is finished. The user must consider the migration data stream
4056++ * carried over the FD to be opaque and must preserve the byte order of the
4057++ * stream. The user is not required to preserve buffer segmentation when writing
4058++ * the data stream during the RESUMING operation.
4059++ *
4060++ * Upon VFIO_DEVICE_FEATURE_GET, get the current migration state of the VFIO
4061++ * device, data_fd will be -1.
4062++ */
4063++struct vfio_device_feature_mig_state {
4064++ __u32 device_state; /* From enum vfio_device_mig_state */
4065++ __s32 data_fd;
4066++};
4067++#define VFIO_DEVICE_FEATURE_MIG_DEVICE_STATE 2
4068++
4069++/*
4070++ * The device migration Finite State Machine is described by the enum
4071++ * vfio_device_mig_state. Some of the FSM arcs will create a migration data
4072++ * transfer session by returning a FD, in this case the migration data will
4073++ * flow over the FD using read() and write() as discussed below.
4074++ *
4075++ * There are 5 states to support VFIO_MIGRATION_STOP_COPY:
4076++ * RUNNING - The device is running normally
4077++ * STOP - The device does not change the internal or external state
4078++ * STOP_COPY - The device internal state can be read out
4079++ * RESUMING - The device is stopped and is loading a new internal state
4080++ * ERROR - The device has failed and must be reset
4081++ *
4082++ * And 1 optional state to support VFIO_MIGRATION_P2P:
4083++ * RUNNING_P2P - RUNNING, except the device cannot do peer to peer DMA
4084++ *
4085++ * The FSM takes actions on the arcs between FSM states. The driver implements
4086++ * the following behavior for the FSM arcs:
4087++ *
4088++ * RUNNING_P2P -> STOP
4089++ * STOP_COPY -> STOP
4090++ * While in STOP the device must stop the operation of the device. The device
4091++ * must not generate interrupts, DMA, or any other change to external state.
4092++ * It must not change its internal state. When stopped the device and kernel
4093++ * migration driver must accept and respond to interaction to support external
4094++ * subsystems in the STOP state, for example PCI MSI-X and PCI config space.
4095++ * Failure by the user to restrict device access while in STOP must not result
4096++ * in error conditions outside the user context (ex. host system faults).
4097++ *
4098++ * The STOP_COPY arc will terminate a data transfer session.
4099++ *
4100++ * RESUMING -> STOP
4101++ * Leaving RESUMING terminates a data transfer session and indicates the
4102++ * device should complete processing of the data delivered by write(). The
4103++ * kernel migration driver should complete the incorporation of data written
4104++ * to the data transfer FD into the device internal state and perform
4105++ * final validity and consistency checking of the new device state. If the
4106++ * user provided data is found to be incomplete, inconsistent, or otherwise
4107++ * invalid, the migration driver must fail the SET_STATE ioctl and
4108++ * optionally go to the ERROR state as described below.
4109++ *
4110++ * While in STOP the device has the same behavior as other STOP states
4111++ * described above.
4112++ *
4113++ * To abort a RESUMING session the device must be reset.
4114++ *
4115++ * RUNNING_P2P -> RUNNING
4116++ * While in RUNNING the device is fully operational, the device may generate
4117++ * interrupts, DMA, respond to MMIO, all vfio device regions are functional,
4118++ * and the device may advance its internal state.
4119++ *
4120++ * RUNNING -> RUNNING_P2P
4121++ * STOP -> RUNNING_P2P
4122++ * While in RUNNING_P2P the device is partially running in the P2P quiescent
4123++ * state defined below.
4124++ *
4125++ * STOP -> STOP_COPY
4126++ * This arc begin the process of saving the device state and will return a
4127++ * new data_fd.
4128++ *
4129++ * While in the STOP_COPY state the device has the same behavior as STOP
4130++ * with the addition that the data transfers session continues to stream the
4131++ * migration state. End of stream on the FD indicates the entire device
4132++ * state has been transferred.
4133++ *
4134++ * The user should take steps to restrict access to vfio device regions while
4135++ * the device is in STOP_COPY or risk corruption of the device migration data
4136++ * stream.
4137++ *
4138++ * STOP -> RESUMING
4139++ * Entering the RESUMING state starts a process of restoring the device state
4140++ * and will return a new data_fd. The data stream fed into the data_fd should
4141++ * be taken from the data transfer output of a single FD during saving from
4142++ * a compatible device. The migration driver may alter/reset the internal
4143++ * device state for this arc if required to prepare the device to receive the
4144++ * migration data.
4145++ *
4146++ * any -> ERROR
4147++ * ERROR cannot be specified as a device state, however any transition request
4148++ * can be failed with an errno return and may then move the device_state into
4149++ * ERROR. In this case the device was unable to execute the requested arc and
4150++ * was also unable to restore the device to any valid device_state.
4151++ * To recover from ERROR VFIO_DEVICE_RESET must be used to return the
4152++ * device_state back to RUNNING.
4153++ *
4154++ * The optional peer to peer (P2P) quiescent state is intended to be a quiescent
4155++ * state for the device for the purposes of managing multiple devices within a
4156++ * user context where peer-to-peer DMA between devices may be active. The
4157++ * RUNNING_P2P states must prevent the device from initiating
4158++ * any new P2P DMA transactions. If the device can identify P2P transactions
4159++ * then it can stop only P2P DMA, otherwise it must stop all DMA. The migration
4160++ * driver must complete any such outstanding operations prior to completing the
4161++ * FSM arc into a P2P state. For the purpose of specification the states
4162++ * behave as though the device was fully running if not supported. Like while in
4163++ * STOP or STOP_COPY the user must not touch the device, otherwise the state
4164++ * can be exited.
4165++ *
4166++ * The remaining possible transitions are interpreted as combinations of the
4167++ * above FSM arcs. As there are multiple paths through the FSM arcs the path
4168++ * should be selected based on the following rules:
4169++ * - Select the shortest path.
4170++ * Refer to vfio_mig_get_next_state() for the result of the algorithm.
4171++ *
4172++ * The automatic transit through the FSM arcs that make up the combination
4173++ * transition is invisible to the user. When working with combination arcs the
4174++ * user may see any step along the path in the device_state if SET_STATE
4175++ * fails. When handling these types of errors users should anticipate future
4176++ * revisions of this protocol using new states and those states becoming
4177++ * visible in this case.
4178++ *
4179++ * The optional states cannot be used with SET_STATE if the device does not
4180++ * support them. The user can discover if these states are supported by using
4181++ * VFIO_DEVICE_FEATURE_MIGRATION. By using combination transitions the user can
4182++ * avoid knowing about these optional states if the kernel driver supports them.
4183++ */
4184++enum vfio_device_mig_state {
4185++ VFIO_DEVICE_STATE_ERROR = 0,
4186++ VFIO_DEVICE_STATE_STOP = 1,
4187++ VFIO_DEVICE_STATE_RUNNING = 2,
4188++ VFIO_DEVICE_STATE_STOP_COPY = 3,
4189++ VFIO_DEVICE_STATE_RESUMING = 4,
4190++ VFIO_DEVICE_STATE_RUNNING_P2P = 5,
4191++};
4192++
4193+ /* -------- API for Type1 VFIO IOMMU -------- */
4194+
4195+ /**
4196+Index: qemu/linux-headers/linux/vhost.h
4197+===================================================================
4198+--- qemu.orig/linux-headers/linux/vhost.h 2023-07-04 20:38:39.000000000 -0400
4199++++ qemu/linux-headers/linux/vhost.h 2023-07-04 20:51:04.000000000 -0400
4200+@@ -150,4 +150,11 @@
4201+ /* Get the valid iova range */
4202+ #define VHOST_VDPA_GET_IOVA_RANGE _IOR(VHOST_VIRTIO, 0x78, \
4203+ struct vhost_vdpa_iova_range)
4204++
4205++/* Get the config size */
4206++#define VHOST_VDPA_GET_CONFIG_SIZE _IOR(VHOST_VIRTIO, 0x79, __u32)
4207++
4208++/* Get the count of all virtqueues */
4209++#define VHOST_VDPA_GET_VQS_COUNT _IOR(VHOST_VIRTIO, 0x80, __u32)
4210++
4211+ #endif
4212diff --git a/debian/patches/ubuntu/lp-1853307-linux-headers-include-missing-changes-from-5.17.patch b/debian/patches/ubuntu/lp-1853307-linux-headers-include-missing-changes-from-5.17.patch
4213new file mode 100644
4214index 0000000..83b84bd
4215--- /dev/null
4216+++ b/debian/patches/ubuntu/lp-1853307-linux-headers-include-missing-changes-from-5.17.patch
4217@@ -0,0 +1,50 @@
4218+From 1ea5208febcc068449b63282d72bb719ab67a466 Mon Sep 17 00:00:00 2001
4219+From: Paolo Bonzini <pbonzini@redhat.com>
4220+Date: Tue, 22 Feb 2022 17:58:11 +0100
4221+Subject: [PATCH] linux-headers: include missing changes from 5.17
4222+
4223+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4224+
4225+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/1ea5208feb
4226+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
4227+Last-Update: 2023-07-04
4228+
4229+---
4230+ linux-headers/asm-x86/kvm.h | 3 +++
4231+ linux-headers/linux/kvm.h | 4 ++++
4232+ 2 files changed, 7 insertions(+)
4233+
4234+Index: qemu/linux-headers/asm-x86/kvm.h
4235+===================================================================
4236+--- qemu.orig/linux-headers/asm-x86/kvm.h 2023-07-04 20:49:59.000000000 -0400
4237++++ qemu/linux-headers/asm-x86/kvm.h 2023-07-04 20:51:04.000000000 -0400
4238+@@ -452,6 +452,9 @@
4239+
4240+ #define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE 0x00000001
4241+
4242++/* attributes for system fd (group 0) */
4243++#define KVM_X86_XCOMP_GUEST_SUPP 0
4244++
4245+ struct kvm_vmx_nested_state_data {
4246+ __u8 vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
4247+ __u8 shadow_vmcs12[KVM_STATE_NESTED_VMX_VMCS_SIZE];
4248+Index: qemu/linux-headers/linux/kvm.h
4249+===================================================================
4250+--- qemu.orig/linux-headers/linux/kvm.h 2023-07-04 20:49:59.000000000 -0400
4251++++ qemu/linux-headers/linux/kvm.h 2023-07-04 20:51:10.000000000 -0400
4252+@@ -1133,6 +1133,7 @@
4253+ #define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM 206
4254+ #define KVM_CAP_VM_GPA_BITS 207
4255+ #define KVM_CAP_XSAVE2 208
4256++#define KVM_CAP_SYS_ATTRIBUTES 209
4257+
4258+ #ifdef KVM_CAP_IRQ_ROUTING
4259+
4260+@@ -2047,4 +2048,7 @@
4261+
4262+ #define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
4263+
4264++/* Available with KVM_CAP_XSAVE2 */
4265++#define KVM_GET_XSAVE2 _IOR(KVMIO, 0xcf, struct kvm_xsave)
4266++
4267+ #endif /* __LINUX_KVM_H */
4268diff --git a/debian/patches/ubuntu/lp-1853307-linux-headers-update-to-5.16-rc1.patch b/debian/patches/ubuntu/lp-1853307-linux-headers-update-to-5.16-rc1.patch
4269new file mode 100644
4270index 0000000..251b03a
4271--- /dev/null
4272+++ b/debian/patches/ubuntu/lp-1853307-linux-headers-update-to-5.16-rc1.patch
4273@@ -0,0 +1,717 @@
4274+From 43709a0ca3b09e952bde3f38112f1d7fbf7c65b1 Mon Sep 17 00:00:00 2001
4275+From: Paolo Bonzini <pbonzini@redhat.com>
4276+Date: Thu, 11 Nov 2021 12:06:01 +0100
4277+Subject: [PATCH] linux-headers: update to 5.16-rc1
4278+MIME-Version: 1.0
4279+Content-Type: text/plain; charset=UTF-8
4280+Content-Transfer-Encoding: 8bit
4281+
4282+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4283+Acked-by: Cornelia Huck <cohuck@redhat.com>
4284+Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
4285+Message-Id: <20211111110604.207376-3-pbonzini@redhat.com>
4286+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
4287+
4288+Origin: upstream, https://gitlab.com/qemu-project/qemu/commit/43709a0ca3
4289+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1853307
4290+Last-Update: 2023-07-04
4291+
4292+---
4293+ include/standard-headers/drm/drm_fourcc.h | 121 +++++++++++++++++-
4294+ include/standard-headers/linux/ethtool.h | 31 +++++
4295+ include/standard-headers/linux/fuse.h | 10 +-
4296+ include/standard-headers/linux/pci_regs.h | 6 +
4297+ include/standard-headers/linux/virtio_gpu.h | 18 ++-
4298+ include/standard-headers/linux/virtio_ids.h | 24 ++++
4299+ include/standard-headers/linux/virtio_vsock.h | 3 +-
4300+ linux-headers/asm-arm64/unistd.h | 1 +
4301+ linux-headers/asm-generic/unistd.h | 22 +++-
4302+ linux-headers/asm-mips/unistd_n32.h | 1 +
4303+ linux-headers/asm-mips/unistd_n64.h | 1 +
4304+ linux-headers/asm-mips/unistd_o32.h | 1 +
4305+ linux-headers/asm-powerpc/unistd_32.h | 1 +
4306+ linux-headers/asm-powerpc/unistd_64.h | 1 +
4307+ linux-headers/asm-s390/unistd_32.h | 1 +
4308+ linux-headers/asm-s390/unistd_64.h | 1 +
4309+ linux-headers/asm-x86/kvm.h | 5 +
4310+ linux-headers/asm-x86/unistd_32.h | 3 +
4311+ linux-headers/asm-x86/unistd_64.h | 3 +
4312+ linux-headers/asm-x86/unistd_x32.h | 3 +
4313+ linux-headers/linux/kvm.h | 40 +++++-
4314+ 21 files changed, 276 insertions(+), 21 deletions(-)
4315+
4316+Index: qemu/include/standard-headers/drm/drm_fourcc.h
4317+===================================================================
4318+--- qemu.orig/include/standard-headers/drm/drm_fourcc.h 2023-07-04 20:38:39.000000000 -0400
4319++++ qemu/include/standard-headers/drm/drm_fourcc.h 2023-07-04 20:51:12.000000000 -0400
4320+@@ -103,6 +103,12 @@
4321+ /* 8 bpp Red */
4322+ #define DRM_FORMAT_R8 fourcc_code('R', '8', ' ', ' ') /* [7:0] R */
4323+
4324++/* 10 bpp Red */
4325++#define DRM_FORMAT_R10 fourcc_code('R', '1', '0', ' ') /* [15:0] x:R 6:10 little endian */
4326++
4327++/* 12 bpp Red */
4328++#define DRM_FORMAT_R12 fourcc_code('R', '1', '2', ' ') /* [15:0] x:R 4:12 little endian */
4329++
4330+ /* 16 bpp Red */
4331+ #define DRM_FORMAT_R16 fourcc_code('R', '1', '6', ' ') /* [15:0] R little endian */
4332+
4333+@@ -372,6 +378,12 @@
4334+
4335+ #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1)
4336+
4337++#define fourcc_mod_get_vendor(modifier) \
4338++ (((modifier) >> 56) & 0xff)
4339++
4340++#define fourcc_mod_is_vendor(modifier, vendor) \
4341++ (fourcc_mod_get_vendor(modifier) == DRM_FORMAT_MOD_VENDOR_## vendor)
4342++
4343+ #define fourcc_mod_code(vendor, val) \
4344+ ((((uint64_t)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | ((val) & 0x00ffffffffffffffULL))
4345+
4346+@@ -899,9 +911,9 @@
4347+
4348+ /*
4349+ * The top 4 bits (out of the 56 bits alloted for specifying vendor specific
4350+- * modifiers) denote the category for modifiers. Currently we have only two
4351+- * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen
4352+- * different categories.
4353++ * modifiers) denote the category for modifiers. Currently we have three
4354++ * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of
4355++ * sixteen different categories.
4356+ */
4357+ #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \
4358+ fourcc_mod_code(ARM, ((uint64_t)(__type) << 52) | ((__val) & 0x000fffffffffffffULL))
4359+@@ -1017,6 +1029,109 @@
4360+ #define AFBC_FORMAT_MOD_USM (1ULL << 12)
4361+
4362+ /*
4363++ * Arm Fixed-Rate Compression (AFRC) modifiers
4364++ *
4365++ * AFRC is a proprietary fixed rate image compression protocol and format,
4366++ * designed to provide guaranteed bandwidth and memory footprint
4367++ * reductions in graphics and media use-cases.
4368++ *
4369++ * AFRC buffers consist of one or more planes, with the same components
4370++ * and meaning as an uncompressed buffer using the same pixel format.
4371++ *
4372++ * Within each plane, the pixel/luma/chroma values are grouped into
4373++ * "coding unit" blocks which are individually compressed to a
4374++ * fixed size (in bytes). All coding units within a given plane of a buffer
4375++ * store the same number of values, and have the same compressed size.
4376++ *
4377++ * The coding unit size is configurable, allowing different rates of compression.
4378++ *
4379++ * The start of each AFRC buffer plane must be aligned to an alignment granule which
4380++ * depends on the coding unit size.
4381++ *
4382++ * Coding Unit Size Plane Alignment
4383++ * ---------------- ---------------
4384++ * 16 bytes 1024 bytes
4385++ * 24 bytes 512 bytes
4386++ * 32 bytes 2048 bytes
4387++ *
4388++ * Coding units are grouped into paging tiles. AFRC buffer dimensions must be aligned
4389++ * to a multiple of the paging tile dimensions.
4390++ * The dimensions of each paging tile depend on whether the buffer is optimised for
4391++ * scanline (SCAN layout) or rotated (ROT layout) access.
4392++ *
4393++ * Layout Paging Tile Width Paging Tile Height
4394++ * ------ ----------------- ------------------
4395++ * SCAN 16 coding units 4 coding units
4396++ * ROT 8 coding units 8 coding units
4397++ *
4398++ * The dimensions of each coding unit depend on the number of components
4399++ * in the compressed plane and whether the buffer is optimised for
4400++ * scanline (SCAN layout) or rotated (ROT layout) access.
4401++ *
4402++ * Number of Components in Plane Layout Coding Unit Width Coding Unit Height
4403++ * ----------------------------- --------- ----------------- ------------------
4404++ * 1 SCAN 16 samples 4 samples
4405++ * Example: 16x4 luma samples in a 'Y' plane
4406++ * 16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer
4407++ * ----------------------------- --------- ----------------- ------------------
4408++ * 1 ROT 8 samples 8 samples
4409++ * Example: 8x8 luma samples in a 'Y' plane
4410++ * 8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer
4411++ * ----------------------------- --------- ----------------- ------------------
4412++ * 2 DONT CARE 8 samples 4 samples
4413++ * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer
4414++ * ----------------------------- --------- ----------------- ------------------
4415++ * 3 DONT CARE 4 samples 4 samples
4416++ * Example: 4x4 pixels in an RGB buffer without alpha
4417++ * ----------------------------- --------- ----------------- ------------------
4418++ * 4 DONT CARE 4 samples 4 samples
4419++ * Example: 4x4 pixels in an RGB buffer with alpha
4420++ */
4421++
4422++#define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02
4423++
4424++#define DRM_FORMAT_MOD_ARM_AFRC(__afrc_mode) \
4425++ DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFRC, __afrc_mode)
4426++
4427++/*
4428++ * AFRC coding unit size modifier.
4429++ *
4430++ * Indicates the number of bytes used to store each compressed coding unit for
4431++ * one or more planes in an AFRC encoded buffer. The coding unit size for chrominance
4432++ * is the same for both Cb and Cr, which may be stored in separate planes.
4433++ *
4434++ * AFRC_FORMAT_MOD_CU_SIZE_P0 indicates the number of bytes used to store
4435++ * each compressed coding unit in the first plane of the buffer. For RGBA buffers
4436++ * this is the only plane, while for semi-planar and fully-planar YUV buffers,
4437++ * this corresponds to the luma plane.
4438++ *
4439++ * AFRC_FORMAT_MOD_CU_SIZE_P12 indicates the number of bytes used to store
4440++ * each compressed coding unit in the second and third planes in the buffer.
4441++ * For semi-planar and fully-planar YUV buffers, this corresponds to the chroma plane(s).
4442++ *
4443++ * For single-plane buffers, AFRC_FORMAT_MOD_CU_SIZE_P0 must be specified
4444++ * and AFRC_FORMAT_MOD_CU_SIZE_P12 must be zero.
4445++ * For semi-planar and fully-planar buffers, both AFRC_FORMAT_MOD_CU_SIZE_P0 and
4446++ * AFRC_FORMAT_MOD_CU_SIZE_P12 must be specified.
4447++ */
4448++#define AFRC_FORMAT_MOD_CU_SIZE_MASK 0xf
4449++#define AFRC_FORMAT_MOD_CU_SIZE_16 (1ULL)
4450++#define AFRC_FORMAT_MOD_CU_SIZE_24 (2ULL)
4451++#define AFRC_FORMAT_MOD_CU_SIZE_32 (3ULL)
4452++
4453++#define AFRC_FORMAT_MOD_CU_SIZE_P0(__afrc_cu_size) (__afrc_cu_size)
4454++#define AFRC_FORMAT_MOD_CU_SIZE_P12(__afrc_cu_size) ((__afrc_cu_size) << 4)
4455++
4456++/*
4457++ * AFRC scanline memory layout.
4458++ *
4459++ * Indicates if the buffer uses the scanline-optimised layout
4460++ * for an AFRC encoded buffer, otherwise, it uses the rotation-optimised layout.
4461++ * The memory layout is the same for all planes.
4462++ */
4463++#define AFRC_FORMAT_MOD_LAYOUT_SCAN (1ULL << 8)
4464++
4465++/*
4466+ * Arm 16x16 Block U-Interleaved modifier
4467+ *
4468+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
4469+Index: qemu/include/standard-headers/linux/ethtool.h
4470+===================================================================
4471+--- qemu.orig/include/standard-headers/linux/ethtool.h 2023-07-04 20:38:39.000000000 -0400
4472++++ qemu/include/standard-headers/linux/ethtool.h 2023-07-04 20:51:12.000000000 -0400
4473+@@ -603,6 +603,7 @@
4474+ ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE,
4475+ ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED,
4476+ ETHTOOL_LINK_EXT_STATE_OVERHEAT,
4477++ ETHTOOL_LINK_EXT_STATE_MODULE,
4478+ };
4479+
4480+ /* More information in addition to ETHTOOL_LINK_EXT_STATE_AUTONEG. */
4481+@@ -639,6 +640,8 @@
4482+ enum ethtool_link_ext_substate_bad_signal_integrity {
4483+ ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1,
4484+ ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE,
4485++ ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_REFERENCE_CLOCK_LOST,
4486++ ETHTOOL_LINK_EXT_SUBSTATE_BSI_SERDES_ALOS,
4487+ };
4488+
4489+ /* More information in addition to ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE. */
4490+@@ -647,6 +650,11 @@
4491+ ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE,
4492+ };
4493+
4494++/* More information in addition to ETHTOOL_LINK_EXT_STATE_MODULE. */
4495++enum ethtool_link_ext_substate_module {
4496++ ETHTOOL_LINK_EXT_SUBSTATE_MODULE_CMIS_NOT_READY = 1,
4497++};
4498++
4499+ #define ETH_GSTRING_LEN 32
4500+
4501+ /**
4502+@@ -705,6 +713,29 @@
4503+ };
4504+
4505+ /**
4506++ * enum ethtool_module_power_mode_policy - plug-in module power mode policy
4507++ * @ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH: Module is always in high power mode.
4508++ * @ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO: Module is transitioned by the host
4509++ * to high power mode when the first port using it is put administratively
4510++ * up and to low power mode when the last port using it is put
4511++ * administratively down.
4512++ */
4513++enum ethtool_module_power_mode_policy {
4514++ ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH = 1,
4515++ ETHTOOL_MODULE_POWER_MODE_POLICY_AUTO,
4516++};
4517++
4518++/**
4519++ * enum ethtool_module_power_mode - plug-in module power mode
4520++ * @ETHTOOL_MODULE_POWER_MODE_LOW: Module is in low power mode.
4521++ * @ETHTOOL_MODULE_POWER_MODE_HIGH: Module is in high power mode.
4522++ */
4523++enum ethtool_module_power_mode {
4524++ ETHTOOL_MODULE_POWER_MODE_LOW = 1,
4525++ ETHTOOL_MODULE_POWER_MODE_HIGH,
4526++};
4527++
4528++/**
4529+ * struct ethtool_gstrings - string set for data tagging
4530+ * @cmd: Command number = %ETHTOOL_GSTRINGS
4531+ * @string_set: String set ID; one of &enum ethtool_stringset
4532+Index: qemu/include/standard-headers/linux/fuse.h
4533+===================================================================
4534+--- qemu.orig/include/standard-headers/linux/fuse.h 2023-07-04 20:38:39.000000000 -0400
4535++++ qemu/include/standard-headers/linux/fuse.h 2023-07-04 20:51:12.000000000 -0400
4536+@@ -181,6 +181,9 @@
4537+ * - add FUSE_OPEN_KILL_SUIDGID
4538+ * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT
4539+ * - add FUSE_SETXATTR_ACL_KILL_SGID
4540++ *
4541++ * 7.34
4542++ * - add FUSE_SYNCFS
4543+ */
4544+
4545+ #ifndef _LINUX_FUSE_H
4546+@@ -212,7 +215,7 @@
4547+ #define FUSE_KERNEL_VERSION 7
4548+
4549+ /** Minor version number of this interface */
4550+-#define FUSE_KERNEL_MINOR_VERSION 33
4551++#define FUSE_KERNEL_MINOR_VERSION 34
4552+
4553+ /** The node ID of the root inode */
4554+ #define FUSE_ROOT_ID 1
4555+@@ -505,6 +508,7 @@
4556+ FUSE_COPY_FILE_RANGE = 47,
4557+ FUSE_SETUPMAPPING = 48,
4558+ FUSE_REMOVEMAPPING = 49,
4559++ FUSE_SYNCFS = 50,
4560+
4561+ /* CUSE specific operations */
4562+ CUSE_INIT = 4096,
4563+@@ -967,4 +971,8 @@
4564+ #define FUSE_REMOVEMAPPING_MAX_ENTRY \
4565+ (PAGE_SIZE / sizeof(struct fuse_removemapping_one))
4566+
4567++struct fuse_syncfs_in {
4568++ uint64_t padding;
4569++};
4570++
4571+ #endif /* _LINUX_FUSE_H */
4572+Index: qemu/include/standard-headers/linux/pci_regs.h
4573+===================================================================
4574+--- qemu.orig/include/standard-headers/linux/pci_regs.h 2023-07-04 20:38:39.000000000 -0400
4575++++ qemu/include/standard-headers/linux/pci_regs.h 2023-07-04 20:51:12.000000000 -0400
4576+@@ -504,6 +504,12 @@
4577+ #define PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */
4578+ #define PCI_EXP_DEVCTL_RELAX_EN 0x0010 /* Enable relaxed ordering */
4579+ #define PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */
4580++#define PCI_EXP_DEVCTL_PAYLOAD_128B 0x0000 /* 128 Bytes */
4581++#define PCI_EXP_DEVCTL_PAYLOAD_256B 0x0020 /* 256 Bytes */
4582++#define PCI_EXP_DEVCTL_PAYLOAD_512B 0x0040 /* 512 Bytes */
4583++#define PCI_EXP_DEVCTL_PAYLOAD_1024B 0x0060 /* 1024 Bytes */
4584++#define PCI_EXP_DEVCTL_PAYLOAD_2048B 0x0080 /* 2048 Bytes */
4585++#define PCI_EXP_DEVCTL_PAYLOAD_4096B 0x00a0 /* 4096 Bytes */
4586+ #define PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */
4587+ #define PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */
4588+ #define PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
4589+Index: qemu/include/standard-headers/linux/virtio_gpu.h
4590+===================================================================
4591+--- qemu.orig/include/standard-headers/linux/virtio_gpu.h 2023-07-04 20:38:39.000000000 -0400
4592++++ qemu/include/standard-headers/linux/virtio_gpu.h 2023-07-04 20:49:59.000000000 -0400
4593+@@ -59,6 +59,11 @@
4594+ * VIRTIO_GPU_CMD_RESOURCE_CREATE_BLOB
4595+ */
4596+ #define VIRTIO_GPU_F_RESOURCE_BLOB 3
4597++/*
4598++ * VIRTIO_GPU_CMD_CREATE_CONTEXT with
4599++ * context_init and multiple timelines
4600++ */
4601++#define VIRTIO_GPU_F_CONTEXT_INIT 4
4602+
4603+ enum virtio_gpu_ctrl_type {
4604+ VIRTIO_GPU_UNDEFINED = 0,
4605+@@ -122,14 +127,20 @@
4606+ VIRTIO_GPU_SHM_ID_HOST_VISIBLE = 1
4607+ };
4608+
4609+-#define VIRTIO_GPU_FLAG_FENCE (1 << 0)
4610++#define VIRTIO_GPU_FLAG_FENCE (1 << 0)
4611++/*
4612++ * If the following flag is set, then ring_idx contains the index
4613++ * of the command ring that needs to used when creating the fence
4614++ */
4615++#define VIRTIO_GPU_FLAG_INFO_RING_IDX (1 << 1)
4616+
4617+ struct virtio_gpu_ctrl_hdr {
4618+ uint32_t type;
4619+ uint32_t flags;
4620+ uint64_t fence_id;
4621+ uint32_t ctx_id;
4622+- uint32_t padding;
4623++ uint8_t ring_idx;
4624++ uint8_t padding[3];
4625+ };
4626+
4627+ /* data passed in the cursor vq */
4628+@@ -269,10 +280,11 @@
4629+ };
4630+
4631+ /* VIRTIO_GPU_CMD_CTX_CREATE */
4632++#define VIRTIO_GPU_CONTEXT_INIT_CAPSET_ID_MASK 0x000000ff
4633+ struct virtio_gpu_ctx_create {
4634+ struct virtio_gpu_ctrl_hdr hdr;
4635+ uint32_t nlen;
4636+- uint32_t padding;
4637++ uint32_t context_init;
4638+ char debug_name[64];
4639+ };
4640+
4641+Index: qemu/include/standard-headers/linux/virtio_ids.h
4642+===================================================================
4643+--- qemu.orig/include/standard-headers/linux/virtio_ids.h 2023-07-04 20:38:39.000000000 -0400
4644++++ qemu/include/standard-headers/linux/virtio_ids.h 2023-07-04 20:51:04.000000000 -0400
4645+@@ -54,7 +54,31 @@
4646+ #define VIRTIO_ID_SOUND 25 /* virtio sound */
4647+ #define VIRTIO_ID_FS 26 /* virtio filesystem */
4648+ #define VIRTIO_ID_PMEM 27 /* virtio pmem */
4649++#define VIRTIO_ID_RPMB 28 /* virtio rpmb */
4650+ #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */
4651++#define VIRTIO_ID_VIDEO_ENCODER 30 /* virtio video encoder */
4652++#define VIRTIO_ID_VIDEO_DECODER 31 /* virtio video decoder */
4653++#define VIRTIO_ID_SCMI 32 /* virtio SCMI */
4654++#define VIRTIO_ID_NITRO_SEC_MOD 33 /* virtio nitro secure module*/
4655++#define VIRTIO_ID_I2C_ADAPTER 34 /* virtio i2c adapter */
4656++#define VIRTIO_ID_WATCHDOG 35 /* virtio watchdog */
4657++#define VIRTIO_ID_CAN 36 /* virtio can */
4658++#define VIRTIO_ID_DMABUF 37 /* virtio dmabuf */
4659++#define VIRTIO_ID_PARAM_SERV 38 /* virtio parameter server */
4660++#define VIRTIO_ID_AUDIO_POLICY 39 /* virtio audio policy */
4661+ #define VIRTIO_ID_BT 40 /* virtio bluetooth */
4662++#define VIRTIO_ID_GPIO 41 /* virtio gpio */
4663++
4664++/*
4665++ * Virtio Transitional IDs
4666++ */
4667++
4668++#define VIRTIO_TRANS_ID_NET 1000 /* transitional virtio net */
4669++#define VIRTIO_TRANS_ID_BLOCK 1001 /* transitional virtio block */
4670++#define VIRTIO_TRANS_ID_BALLOON 1002 /* transitional virtio balloon */
4671++#define VIRTIO_TRANS_ID_CONSOLE 1003 /* transitional virtio console */
4672++#define VIRTIO_TRANS_ID_SCSI 1004 /* transitional virtio SCSI */
4673++#define VIRTIO_TRANS_ID_RNG 1005 /* transitional virtio rng */
4674++#define VIRTIO_TRANS_ID_9P 1009 /* transitional virtio 9p console */
4675+
4676+ #endif /* _LINUX_VIRTIO_IDS_H */
4677+Index: qemu/include/standard-headers/linux/virtio_vsock.h
4678+===================================================================
4679+--- qemu.orig/include/standard-headers/linux/virtio_vsock.h 2023-07-04 20:38:39.000000000 -0400
4680++++ qemu/include/standard-headers/linux/virtio_vsock.h 2023-07-04 20:49:59.000000000 -0400
4681+@@ -97,7 +97,8 @@
4682+
4683+ /* VIRTIO_VSOCK_OP_RW flags values */
4684+ enum virtio_vsock_rw {
4685+- VIRTIO_VSOCK_SEQ_EOR = 1,
4686++ VIRTIO_VSOCK_SEQ_EOM = 1,
4687++ VIRTIO_VSOCK_SEQ_EOR = 2,
4688+ };
4689+
4690+ #endif /* _LINUX_VIRTIO_VSOCK_H */
4691+Index: qemu/linux-headers/asm-arm64/unistd.h
4692+===================================================================
4693+--- qemu.orig/linux-headers/asm-arm64/unistd.h 2023-07-04 20:38:39.000000000 -0400
4694++++ qemu/linux-headers/asm-arm64/unistd.h 2023-07-04 20:49:59.000000000 -0400
4695+@@ -20,5 +20,6 @@
4696+ #define __ARCH_WANT_SET_GET_RLIMIT
4697+ #define __ARCH_WANT_TIME32_SYSCALLS
4698+ #define __ARCH_WANT_SYS_CLONE3
4699++#define __ARCH_WANT_MEMFD_SECRET
4700+
4701+ #include <asm-generic/unistd.h>
4702+Index: qemu/linux-headers/asm-generic/unistd.h
4703+===================================================================
4704+--- qemu.orig/linux-headers/asm-generic/unistd.h 2023-07-04 20:38:39.000000000 -0400
4705++++ qemu/linux-headers/asm-generic/unistd.h 2023-07-04 20:51:12.000000000 -0400
4706+@@ -673,15 +673,15 @@
4707+ #define __NR_remap_file_pages 234
4708+ __SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
4709+ #define __NR_mbind 235
4710+-__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
4711++__SYSCALL(__NR_mbind, sys_mbind)
4712+ #define __NR_get_mempolicy 236
4713+-__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
4714++__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
4715+ #define __NR_set_mempolicy 237
4716+-__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
4717++__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
4718+ #define __NR_migrate_pages 238
4719+-__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
4720++__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
4721+ #define __NR_move_pages 239
4722+-__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
4723++__SYSCALL(__NR_move_pages, sys_move_pages)
4724+ #endif
4725+
4726+ #define __NR_rt_tgsigqueueinfo 240
4727+@@ -873,8 +873,18 @@
4728+ #define __NR_landlock_restrict_self 446
4729+ __SYSCALL(__NR_landlock_restrict_self, sys_landlock_restrict_self)
4730+
4731++#ifdef __ARCH_WANT_MEMFD_SECRET
4732++#define __NR_memfd_secret 447
4733++__SYSCALL(__NR_memfd_secret, sys_memfd_secret)
4734++#endif
4735++#define __NR_process_mrelease 448
4736++__SYSCALL(__NR_process_mrelease, sys_process_mrelease)
4737++
4738++#define __NR_futex_waitv 449
4739++__SYSCALL(__NR_futex_waitv, sys_futex_waitv)
4740++
4741+ #undef __NR_syscalls
4742+-#define __NR_syscalls 447
4743++#define __NR_syscalls 450
4744+
4745+ /*
4746+ * 32 bit systems traditionally used different
4747+Index: qemu/linux-headers/asm-mips/unistd_n32.h
4748+===================================================================
4749+--- qemu.orig/linux-headers/asm-mips/unistd_n32.h 2023-07-04 20:38:39.000000000 -0400
4750++++ qemu/linux-headers/asm-mips/unistd_n32.h 2023-07-04 20:51:12.000000000 -0400
4751+@@ -376,5 +376,6 @@
4752+ #define __NR_landlock_create_ruleset (__NR_Linux + 444)
4753+ #define __NR_landlock_add_rule (__NR_Linux + 445)
4754+ #define __NR_landlock_restrict_self (__NR_Linux + 446)
4755++#define __NR_process_mrelease (__NR_Linux + 448)
4756+
4757+ #endif /* _ASM_UNISTD_N32_H */
4758+Index: qemu/linux-headers/asm-mips/unistd_n64.h
4759+===================================================================
4760+--- qemu.orig/linux-headers/asm-mips/unistd_n64.h 2023-07-04 20:38:39.000000000 -0400
4761++++ qemu/linux-headers/asm-mips/unistd_n64.h 2023-07-04 20:51:12.000000000 -0400
4762+@@ -352,5 +352,6 @@
4763+ #define __NR_landlock_create_ruleset (__NR_Linux + 444)
4764+ #define __NR_landlock_add_rule (__NR_Linux + 445)
4765+ #define __NR_landlock_restrict_self (__NR_Linux + 446)
4766++#define __NR_process_mrelease (__NR_Linux + 448)
4767+
4768+ #endif /* _ASM_UNISTD_N64_H */
4769+Index: qemu/linux-headers/asm-mips/unistd_o32.h
4770+===================================================================
4771+--- qemu.orig/linux-headers/asm-mips/unistd_o32.h 2023-07-04 20:38:39.000000000 -0400
4772++++ qemu/linux-headers/asm-mips/unistd_o32.h 2023-07-04 20:51:12.000000000 -0400
4773+@@ -422,5 +422,6 @@
4774+ #define __NR_landlock_create_ruleset (__NR_Linux + 444)
4775+ #define __NR_landlock_add_rule (__NR_Linux + 445)
4776+ #define __NR_landlock_restrict_self (__NR_Linux + 446)
4777++#define __NR_process_mrelease (__NR_Linux + 448)
4778+
4779+ #endif /* _ASM_UNISTD_O32_H */
4780+Index: qemu/linux-headers/asm-powerpc/unistd_32.h
4781+===================================================================
4782+--- qemu.orig/linux-headers/asm-powerpc/unistd_32.h 2023-07-04 20:38:39.000000000 -0400
4783++++ qemu/linux-headers/asm-powerpc/unistd_32.h 2023-07-04 20:51:12.000000000 -0400
4784+@@ -429,6 +429,7 @@
4785+ #define __NR_landlock_create_ruleset 444
4786+ #define __NR_landlock_add_rule 445
4787+ #define __NR_landlock_restrict_self 446
4788++#define __NR_process_mrelease 448
4789+
4790+
4791+ #endif /* _ASM_UNISTD_32_H */
4792+Index: qemu/linux-headers/asm-powerpc/unistd_64.h
4793+===================================================================
4794+--- qemu.orig/linux-headers/asm-powerpc/unistd_64.h 2023-07-04 20:38:39.000000000 -0400
4795++++ qemu/linux-headers/asm-powerpc/unistd_64.h 2023-07-04 20:51:12.000000000 -0400
4796+@@ -401,6 +401,7 @@
4797+ #define __NR_landlock_create_ruleset 444
4798+ #define __NR_landlock_add_rule 445
4799+ #define __NR_landlock_restrict_self 446
4800++#define __NR_process_mrelease 448
4801+
4802+
4803+ #endif /* _ASM_UNISTD_64_H */
4804+Index: qemu/linux-headers/asm-s390/unistd_32.h
4805+===================================================================
4806+--- qemu.orig/linux-headers/asm-s390/unistd_32.h 2023-07-04 20:38:39.000000000 -0400
4807++++ qemu/linux-headers/asm-s390/unistd_32.h 2023-07-04 20:51:12.000000000 -0400
4808+@@ -419,5 +419,6 @@
4809+ #define __NR_landlock_create_ruleset 444
4810+ #define __NR_landlock_add_rule 445
4811+ #define __NR_landlock_restrict_self 446
4812++#define __NR_process_mrelease 448
4813+
4814+ #endif /* _ASM_S390_UNISTD_32_H */
4815+Index: qemu/linux-headers/asm-s390/unistd_64.h
4816+===================================================================
4817+--- qemu.orig/linux-headers/asm-s390/unistd_64.h 2023-07-04 20:38:39.000000000 -0400
4818++++ qemu/linux-headers/asm-s390/unistd_64.h 2023-07-04 20:51:12.000000000 -0400
4819+@@ -367,5 +367,6 @@
4820+ #define __NR_landlock_create_ruleset 444
4821+ #define __NR_landlock_add_rule 445
4822+ #define __NR_landlock_restrict_self 446
4823++#define __NR_process_mrelease 448
4824+
4825+ #endif /* _ASM_S390_UNISTD_64_H */
4826+Index: qemu/linux-headers/asm-x86/kvm.h
4827+===================================================================
4828+--- qemu.orig/linux-headers/asm-x86/kvm.h 2023-07-04 20:38:39.000000000 -0400
4829++++ qemu/linux-headers/asm-x86/kvm.h 2023-07-04 20:51:12.000000000 -0400
4830+@@ -295,6 +295,7 @@
4831+ #define KVM_GUESTDBG_USE_HW_BP 0x00020000
4832+ #define KVM_GUESTDBG_INJECT_DB 0x00040000
4833+ #define KVM_GUESTDBG_INJECT_BP 0x00080000
4834++#define KVM_GUESTDBG_BLOCKIRQ 0x00100000
4835+
4836+ /* for KVM_SET_GUEST_DEBUG */
4837+ struct kvm_guest_debug_arch {
4838+@@ -503,4 +504,8 @@
4839+ #define KVM_PMU_EVENT_ALLOW 0
4840+ #define KVM_PMU_EVENT_DENY 1
4841+
4842++/* for KVM_{GET,SET,HAS}_DEVICE_ATTR */
4843++#define KVM_VCPU_TSC_CTRL 0 /* control group for the timestamp counter (TSC) */
4844++#define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */
4845++
4846+ #endif /* _ASM_X86_KVM_H */
4847+Index: qemu/linux-headers/asm-x86/unistd_32.h
4848+===================================================================
4849+--- qemu.orig/linux-headers/asm-x86/unistd_32.h 2023-07-04 20:38:39.000000000 -0400
4850++++ qemu/linux-headers/asm-x86/unistd_32.h 2023-07-04 20:51:12.000000000 -0400
4851+@@ -437,6 +437,9 @@
4852+ #define __NR_landlock_create_ruleset 444
4853+ #define __NR_landlock_add_rule 445
4854+ #define __NR_landlock_restrict_self 446
4855++#define __NR_memfd_secret 447
4856++#define __NR_process_mrelease 448
4857++#define __NR_futex_waitv 449
4858+
4859+
4860+ #endif /* _ASM_UNISTD_32_H */
4861+Index: qemu/linux-headers/asm-x86/unistd_64.h
4862+===================================================================
4863+--- qemu.orig/linux-headers/asm-x86/unistd_64.h 2023-07-04 20:38:39.000000000 -0400
4864++++ qemu/linux-headers/asm-x86/unistd_64.h 2023-07-04 20:51:12.000000000 -0400
4865+@@ -359,6 +359,9 @@
4866+ #define __NR_landlock_create_ruleset 444
4867+ #define __NR_landlock_add_rule 445
4868+ #define __NR_landlock_restrict_self 446
4869++#define __NR_memfd_secret 447
4870++#define __NR_process_mrelease 448
4871++#define __NR_futex_waitv 449
4872+
4873+
4874+ #endif /* _ASM_UNISTD_64_H */
4875+Index: qemu/linux-headers/asm-x86/unistd_x32.h
4876+===================================================================
4877+--- qemu.orig/linux-headers/asm-x86/unistd_x32.h 2023-07-04 20:38:39.000000000 -0400
4878++++ qemu/linux-headers/asm-x86/unistd_x32.h 2023-07-04 20:51:12.000000000 -0400
4879+@@ -312,6 +312,9 @@
4880+ #define __NR_landlock_create_ruleset (__X32_SYSCALL_BIT + 444)
4881+ #define __NR_landlock_add_rule (__X32_SYSCALL_BIT + 445)
4882+ #define __NR_landlock_restrict_self (__X32_SYSCALL_BIT + 446)
4883++#define __NR_memfd_secret (__X32_SYSCALL_BIT + 447)
4884++#define __NR_process_mrelease (__X32_SYSCALL_BIT + 448)
4885++#define __NR_futex_waitv (__X32_SYSCALL_BIT + 449)
4886+ #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
4887+ #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
4888+ #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
4889+Index: qemu/linux-headers/linux/kvm.h
4890+===================================================================
4891+--- qemu.orig/linux-headers/linux/kvm.h 2023-07-04 20:38:39.000000000 -0400
4892++++ qemu/linux-headers/linux/kvm.h 2023-07-04 20:51:12.000000000 -0400
4893+@@ -269,6 +269,7 @@
4894+ #define KVM_EXIT_AP_RESET_HOLD 32
4895+ #define KVM_EXIT_X86_BUS_LOCK 33
4896+ #define KVM_EXIT_XEN 34
4897++#define KVM_EXIT_RISCV_SBI 35
4898+
4899+ /* For KVM_EXIT_INTERNAL_ERROR */
4900+ /* Emulate instruction failed. */
4901+@@ -397,13 +398,23 @@
4902+ * "ndata" is correct, that new fields are enumerated in "flags",
4903+ * and that each flag enumerates fields that are 64-bit aligned
4904+ * and sized (so that ndata+internal.data[] is valid/accurate).
4905++ *
4906++ * Space beyond the defined fields may be used to store arbitrary
4907++ * debug information relating to the emulation failure. It is
4908++ * accounted for in "ndata" but the format is unspecified and is
4909++ * not represented in "flags". Any such information is *not* ABI!
4910+ */
4911+ struct {
4912+ __u32 suberror;
4913+ __u32 ndata;
4914+ __u64 flags;
4915+- __u8 insn_size;
4916+- __u8 insn_bytes[15];
4917++ union {
4918++ struct {
4919++ __u8 insn_size;
4920++ __u8 insn_bytes[15];
4921++ };
4922++ };
4923++ /* Arbitrary debug data may follow. */
4924+ } emulation_failure;
4925+ /* KVM_EXIT_OSI */
4926+ struct {
4927+@@ -469,6 +480,13 @@
4928+ } msr;
4929+ /* KVM_EXIT_XEN */
4930+ struct kvm_xen_exit xen;
4931++ /* KVM_EXIT_RISCV_SBI */
4932++ struct {
4933++ unsigned long extension_id;
4934++ unsigned long function_id;
4935++ unsigned long args[6];
4936++ unsigned long ret[2];
4937++ } riscv_sbi;
4938+ /* Fix the size of the union. */
4939+ char padding[256];
4940+ };
4941+@@ -1223,11 +1241,16 @@
4942+
4943+ /* Do not use 1, KVM_CHECK_EXTENSION returned it before we had flags. */
4944+ #define KVM_CLOCK_TSC_STABLE 2
4945++#define KVM_CLOCK_REALTIME (1 << 2)
4946++#define KVM_CLOCK_HOST_TSC (1 << 3)
4947+
4948+ struct kvm_clock_data {
4949+ __u64 clock;
4950+ __u32 flags;
4951+- __u32 pad[9];
4952++ __u32 pad0;
4953++ __u64 realtime;
4954++ __u64 host_tsc;
4955++ __u32 pad[4];
4956+ };
4957+
4958+ /* For KVM_CAP_SW_TLB */
4959+@@ -1965,7 +1988,9 @@
4960+ #define KVM_STATS_TYPE_CUMULATIVE (0x0 << KVM_STATS_TYPE_SHIFT)
4961+ #define KVM_STATS_TYPE_INSTANT (0x1 << KVM_STATS_TYPE_SHIFT)
4962+ #define KVM_STATS_TYPE_PEAK (0x2 << KVM_STATS_TYPE_SHIFT)
4963+-#define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_PEAK
4964++#define KVM_STATS_TYPE_LINEAR_HIST (0x3 << KVM_STATS_TYPE_SHIFT)
4965++#define KVM_STATS_TYPE_LOG_HIST (0x4 << KVM_STATS_TYPE_SHIFT)
4966++#define KVM_STATS_TYPE_MAX KVM_STATS_TYPE_LOG_HIST
4967+
4968+ #define KVM_STATS_UNIT_SHIFT 4
4969+ #define KVM_STATS_UNIT_MASK (0xF << KVM_STATS_UNIT_SHIFT)
4970+@@ -1988,8 +2013,9 @@
4971+ * @size: The number of data items for this stats.
4972+ * Every data item is of type __u64.
4973+ * @offset: The offset of the stats to the start of stat structure in
4974+- * struture kvm or kvm_vcpu.
4975+- * @unused: Unused field for future usage. Always 0 for now.
4976++ * structure kvm or kvm_vcpu.
4977++ * @bucket_size: A parameter value used for histogram stats. It is only used
4978++ * for linear histogram stats, specifying the size of the bucket;
4979+ * @name: The name string for the stats. Its size is indicated by the
4980+ * &kvm_stats_header->name_size.
4981+ */
4982+@@ -1998,7 +2024,7 @@
4983+ __s16 exponent;
4984+ __u16 size;
4985+ __u32 offset;
4986+- __u32 unused;
4987++ __u32 bucket_size;
4988+ char name[];
4989+ };
4990+
4991diff --git a/debian/patches/ubuntu/lp-1853307-s390x-pci-RPCIT-second-pass-when-mappings-exhausted.patch b/debian/patches/ubuntu/lp-1853307-s390x-pci-RPCIT-second-pass-when-mappings-exhausted.patch
4992new file mode 100644
4993index 0000000..dd5d063
4994--- /dev/null
4995+++ b/debian/patches/ubuntu/lp-1853307-s390x-pci-RPCIT-second-pass-when-mappings-exhausted.patch
4996@@ -0,0 +1,103 @@
4997+From 4a8d21ba50fc8625c3bd51dab903872952f95718 Mon Sep 17 00:00:00 2001
4998+From: Matthew Rosato <mjrosato@linux.ibm.com>
4999+Date: Fri, 28 Oct 2022 15:47:56 -0400
5000+Subject: [PATCH] s390x/pci: RPCIT second pass when mappings exhausted
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches