Merge ~sergiodj/ubuntu/+source/qemu:ibm-enable-secure-execution-devel into ubuntu/+source/qemu:ubuntu/mantic-devel

Proposed by Sergio Durigan Junior
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 556e6c4e5101a59889b83a72e7d860814ac4860d
Proposed branch: ~sergiodj/ubuntu/+source/qemu:ibm-enable-secure-execution-devel
Merge into: ubuntu/+source/qemu:ubuntu/mantic-devel
Diff against target: 3601 lines (+3543/-0)
9 files modified
debian/changelog (+7/-0)
debian/patches/series (+7/-0)
debian/patches/ubuntu/lp2003673-s390x-ap-passthrough-for-pv-guests.patch (+178/-0)
debian/patches/ubuntu/lp2003673-s390x-fix-missing-subsystem-reset-registration.patch (+33/-0)
debian/patches/ubuntu/lp2003673-s390x-refactor-ap-functionalities.patch (+100/-0)
debian/patches/ubuntu/lp2003673-s390x-system-reset-before-unprotect-on-reboot.patch (+51/-0)
debian/patches/ubuntu/lp2003673-update-linux-headers-6.3rc5.patch (+820/-0)
debian/patches/ubuntu/lp2003673-update-linux-headers-6.5rc1.patch (+1565/-0)
debian/patches/ubuntu/lp2003673-update-linux-headers-6.6rc1.patch (+782/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Athos Ribeiro (community) Approve
Canonical Server Core Reviewers Pending
Canonical Server Reporter Pending
Review via email: mp+454830@code.launchpad.net

Description of the change

This is the backport required to address the request from bug #2003673.

There are 7 seven patches from upstream that needed to be backported. Five of them were provided directly by IBM in the bug mentioned above; the other two (updates to Linux headers 6.3rc5 and 6.5rc1) are dependencies for the update to Linux headers 6.6rc1.

I'm running qemu-migration-test on s390x, but as mentioned a few times during standup I'm having some trouble with the machine so it's taking longer than expected. I'll also run tests on amd64 and ppc64el and post the results here. Nevertheless, I'd like to request a review so that I can go ahead and upload the package ASAP.

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

Cross test passed. Rerunning migrate and misc.

prep (x86_64) : Pass 25 F/S/N 0/0/0 - RC 0 (26 min 52406 lin)
migrate (x86_64) : Pass 243 F/S/N 11/0/0 - RC 11 (315 min 298390 lin)
cross (x86_64) : Pass 40 F/S/N 0/0/2 - RC 0 (152 min 94109 lin)
misc (x86_64) : Pass 69 F/S/N 4/0/0 - RC 4 (31 min 31172 lin)

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

I found the problem with misc.

misc (x86_64) : Pass 103 F/S/N 0/0/0 - RC 0 (38 min 50057 lin)

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

I spent more time investigating the few failures that I'm seeing on qemu-migration-tests, and I'm convinced that they're unrelated to the patchset being backported. In fact, they seem unrelated to qemu.

I talked to Christian about this and he agreed, therefore I'm proceeding with this MP. I also opened an MP against Noble (https://code.launchpad.net/~sergiodj/ubuntu/+source/qemu/+git/qemu/+merge/455724), which needs to be reviewed and uploaded before this one.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

The same comments from https://code.launchpad.net/~sergiodj/ubuntu/+source/qemu/+git/qemu/+merge/455724 apply here (bogus LP bug reference in DEP3 headers).

Thanks for running and verifying all the checks for this one :)

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

Athos, I went ahead an uploaded this. Thank you very much for your review.

Revision history for this message
Athos Ribeiro (athos-ribeiro) :
review: Approve
Revision history for this message
Athos Ribeiro (athos-ribeiro) :
review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: sergiodj, athos-ribeiro
Uploaders: sergiodj, athos-ribeiro
MP auto-approved

review: Approve

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 a668570..bc3cce5 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+qemu (1:8.0.4+dfsg-1ubuntu3.23.10.1) mantic; urgency=medium
7+
8+ * d/p/u/lp2003673-*.patch: Enable passthrough of IBM Z crypto
9+ hardware to Secure Execution guests. (LP: #2003673)
10+
11+ -- Sergio Durigan Junior <sergio.durigan@canonical.com> Mon, 30 Oct 2023 16:16:32 -0400
12+
13 qemu (1:8.0.4+dfsg-1ubuntu3) mantic; urgency=medium
14
15 * d/rules: Get rid of binary-helper target; explicitly invoke its
16diff --git a/debian/patches/series b/debian/patches/series
17index 7a7fa09..15733f3 100644
18--- a/debian/patches/series
19+++ b/debian/patches/series
20@@ -24,3 +24,10 @@ ubuntu/enable-svm-by-default.patch
21 ubuntu/define-ubuntu-machine-types.patch
22 ubuntu/pre-bionic-256k-ipxe-efi-roms.patch
23 ubuntu/qboot-Disable-LTO-for-ELF-binary-build-step.patch
24+ubuntu/lp2003673-update-linux-headers-6.3rc5.patch
25+ubuntu/lp2003673-update-linux-headers-6.5rc1.patch
26+ubuntu/lp2003673-s390x-fix-missing-subsystem-reset-registration.patch
27+ubuntu/lp2003673-s390x-system-reset-before-unprotect-on-reboot.patch
28+ubuntu/lp2003673-update-linux-headers-6.6rc1.patch
29+ubuntu/lp2003673-s390x-refactor-ap-functionalities.patch
30+ubuntu/lp2003673-s390x-ap-passthrough-for-pv-guests.patch
31diff --git a/debian/patches/ubuntu/lp2003673-s390x-ap-passthrough-for-pv-guests.patch b/debian/patches/ubuntu/lp2003673-s390x-ap-passthrough-for-pv-guests.patch
32new file mode 100644
33index 0000000..fbb4729
34--- /dev/null
35+++ b/debian/patches/ubuntu/lp2003673-s390x-ap-passthrough-for-pv-guests.patch
36@@ -0,0 +1,178 @@
37+From: Steffen Eiden <seiden@linux.ibm.com>
38+Date: Wed, 23 Aug 2023 16:22:19 +0200
39+Subject: target/s390x: AP-passthrough for PV guests
40+
41+Enabling AP-passthrough(AP-pt) for PV-guest by using the new CPU
42+features for PV-AP-pt of KVM.
43+
44+As usual QEMU first checks which CPU features are available and then
45+sets them if available and selected by user. An additional check is done
46+to verify that PV-AP can only be enabled if "regular" AP-pt is enabled
47+as well. Note that KVM itself does not enforce this restriction.
48+
49+Reviewed-by: Michael Mueller <mimu@linux.ibm.com>
50+Reviewed-by: Thomas Huth <thuth@redhat.com>
51+Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
52+Message-ID: <20230823142219.1046522-6-seiden@linux.ibm.com>
53+Signed-off-by: Thomas Huth <thuth@redhat.com>
54+
55+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/5ac951519c
56+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
57+---
58+ target/s390x/cpu_features.h | 1 +
59+ target/s390x/cpu_features_def.h.inc | 4 +++
60+ target/s390x/cpu_models.c | 2 ++
61+ target/s390x/gen-features.c | 2 ++
62+ target/s390x/kvm/kvm.c | 70 +++++++++++++++++++++++++++++++++++++
63+ 5 files changed, 79 insertions(+)
64+
65+diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
66+index 87463f0..a9bd68a 100644
67+--- a/target/s390x/cpu_features.h
68++++ b/target/s390x/cpu_features.h
69+@@ -43,6 +43,7 @@ typedef enum {
70+ S390_FEAT_TYPE_KDSA,
71+ S390_FEAT_TYPE_SORTL,
72+ S390_FEAT_TYPE_DFLTCC,
73++ S390_FEAT_TYPE_UV_FEAT_GUEST,
74+ } S390FeatType;
75+
76+ /* Definition of a CPU feature */
77+diff --git a/target/s390x/cpu_features_def.h.inc b/target/s390x/cpu_features_def.h.inc
78+index e3cfe63..e68da9b 100644
79+--- a/target/s390x/cpu_features_def.h.inc
80++++ b/target/s390x/cpu_features_def.h.inc
81+@@ -379,3 +379,7 @@ DEF_FEAT(DEFLATE_GHDT, "dfltcc-gdht", DFLTCC, 1, "DFLTCC GDHT")
82+ DEF_FEAT(DEFLATE_CMPR, "dfltcc-cmpr", DFLTCC, 2, "DFLTCC CMPR")
83+ DEF_FEAT(DEFLATE_XPND, "dfltcc-xpnd", DFLTCC, 4, "DFLTCC XPND")
84+ DEF_FEAT(DEFLATE_F0, "dfltcc-f0", DFLTCC, 192, "DFLTCC format 0 parameter-block")
85++
86++/* Features exposed via the UV-CALL instruction */
87++DEF_FEAT(UV_FEAT_AP, "appv", UV_FEAT_GUEST, 4, "AP instructions installed for secure guests")
88++DEF_FEAT(UV_FEAT_AP_INTR, "appvi", UV_FEAT_GUEST, 5, "AP instructions interruption support for secure guests")
89+diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
90+index ae8880e..b5ae455 100644
91+--- a/target/s390x/cpu_models.c
92++++ b/target/s390x/cpu_models.c
93+@@ -483,6 +483,8 @@ static void check_consistency(const S390CPUModel *model)
94+ { S390_FEAT_DIAG_318, S390_FEAT_EXTENDED_LENGTH_SCCB },
95+ { S390_FEAT_NNPA, S390_FEAT_VECTOR },
96+ { S390_FEAT_RDP, S390_FEAT_LOCAL_TLB_CLEARING },
97++ { S390_FEAT_UV_FEAT_AP, S390_FEAT_AP },
98++ { S390_FEAT_UV_FEAT_AP_INTR, S390_FEAT_UV_FEAT_AP },
99+ };
100+ int i;
101+
102+diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
103+index 1e3b7c0..2b2bfc3 100644
104+--- a/target/s390x/gen-features.c
105++++ b/target/s390x/gen-features.c
106+@@ -576,6 +576,8 @@ static uint16_t full_GEN16_GA1[] = {
107+ S390_FEAT_RDP,
108+ S390_FEAT_PAI,
109+ S390_FEAT_PAIE,
110++ S390_FEAT_UV_FEAT_AP,
111++ S390_FEAT_UV_FEAT_AP_INTR,
112+ };
113+
114+
115+diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
116+index d973768..309f870 100644
117+--- a/target/s390x/kvm/kvm.c
118++++ b/target/s390x/kvm/kvm.c
119+@@ -2307,6 +2307,42 @@ static bool ap_enabled(const S390FeatBitmap features)
120+ return test_bit(S390_FEAT_AP, features);
121+ }
122+
123++static bool uv_feat_supported(void)
124++{
125++ return kvm_vm_check_attr(kvm_state, KVM_S390_VM_CPU_MODEL,
126++ KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST);
127++}
128++
129++static int query_uv_feat_guest(S390FeatBitmap features)
130++{
131++ struct kvm_s390_vm_cpu_uv_feat prop = {};
132++ struct kvm_device_attr attr = {
133++ .group = KVM_S390_VM_CPU_MODEL,
134++ .attr = KVM_S390_VM_CPU_MACHINE_UV_FEAT_GUEST,
135++ .addr = (uint64_t) &prop,
136++ };
137++ int rc;
138++
139++ /* AP support check is currently the only user of the UV feature test */
140++ if (!(uv_feat_supported() && ap_available())) {
141++ return 0;
142++ }
143++
144++ rc = kvm_vm_ioctl(kvm_state, KVM_GET_DEVICE_ATTR, &attr);
145++ if (rc) {
146++ return rc;
147++ }
148++
149++ if (prop.ap) {
150++ set_bit(S390_FEAT_UV_FEAT_AP, features);
151++ }
152++ if (prop.ap_intr) {
153++ set_bit(S390_FEAT_UV_FEAT_AP_INTR, features);
154++ }
155++
156++ return 0;
157++}
158++
159+ static int kvm_to_feat[][2] = {
160+ { KVM_S390_VM_CPU_FEAT_ESOP, S390_FEAT_ESOP },
161+ { KVM_S390_VM_CPU_FEAT_SIEF2, S390_FEAT_SIE_F2 },
162+@@ -2501,11 +2537,38 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
163+ set_bit(S390_FEAT_DIAG_318, model->features);
164+ }
165+
166++ /* Test for Ultravisor features that influence secure guest behavior */
167++ query_uv_feat_guest(model->features);
168++
169+ /* strip of features that are not part of the maximum model */
170+ bitmap_and(model->features, model->features, model->def->full_feat,
171+ S390_FEAT_MAX);
172+ }
173+
174++static int configure_uv_feat_guest(const S390FeatBitmap features)
175++{
176++ struct kvm_s390_vm_cpu_uv_feat uv_feat = {};
177++ struct kvm_device_attr attribute = {
178++ .group = KVM_S390_VM_CPU_MODEL,
179++ .attr = KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST,
180++ .addr = (__u64) &uv_feat,
181++ };
182++
183++ /* AP support check is currently the only user of the UV feature test */
184++ if (!(uv_feat_supported() && ap_enabled(features))) {
185++ return 0;
186++ }
187++
188++ if (test_bit(S390_FEAT_UV_FEAT_AP, features)) {
189++ uv_feat.ap = 1;
190++ }
191++ if (test_bit(S390_FEAT_UV_FEAT_AP_INTR, features)) {
192++ uv_feat.ap_intr = 1;
193++ }
194++
195++ return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attribute);
196++}
197++
198+ static void kvm_s390_configure_apie(bool interpret)
199+ {
200+ uint64_t attr = interpret ? KVM_S390_VM_CRYPTO_ENABLE_APIE :
201+@@ -2569,6 +2632,13 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
202+ if (ap_enabled(model->features)) {
203+ kvm_s390_configure_apie(true);
204+ }
205++
206++ /* configure UV-features for the guest indicated via query / test_bit */
207++ rc = configure_uv_feat_guest(model->features);
208++ if (rc) {
209++ error_setg(errp, "KVM: Error configuring CPU UV features %d", rc);
210++ return;
211++ }
212+ }
213+
214+ void kvm_s390_restart_interrupt(S390CPU *cpu)
215diff --git a/debian/patches/ubuntu/lp2003673-s390x-fix-missing-subsystem-reset-registration.patch b/debian/patches/ubuntu/lp2003673-s390x-fix-missing-subsystem-reset-registration.patch
216new file mode 100644
217index 0000000..a026f1e
218--- /dev/null
219+++ b/debian/patches/ubuntu/lp2003673-s390x-fix-missing-subsystem-reset-registration.patch
220@@ -0,0 +1,33 @@
221+From: Janosch Frank <frankja@linux.ibm.com>
222+Date: Wed, 23 Aug 2023 16:22:15 +0200
223+Subject: s390x/ap: fix missing subsystem reset registration
224+
225+A subsystem reset contains a reset of AP resources which has been
226+missing. Adding the AP bridge to the list of device types that need
227+reset fixes this issue.
228+
229+Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
230+Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
231+Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
232+Fixes: a51b3153 ("s390x/ap: base Adjunct Processor (AP) object model")
233+Message-ID: <20230823142219.1046522-2-seiden@linux.ibm.com>
234+Signed-off-by: Thomas Huth <thuth@redhat.com>
235+
236+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/297ec01f0b
237+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
238+---
239+ hw/s390x/s390-virtio-ccw.c | 1 +
240+ 1 file changed, 1 insertion(+)
241+
242+diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
243+index 2e1f0f0..59d83e1 100644
244+--- a/hw/s390x/s390-virtio-ccw.c
245++++ b/hw/s390x/s390-virtio-ccw.c
246+@@ -109,6 +109,7 @@ static const char *const reset_dev_types[] = {
247+ "s390-flic",
248+ "diag288",
249+ TYPE_S390_PCI_HOST_BRIDGE,
250++ TYPE_AP_BRIDGE,
251+ };
252+
253+ static void subsystem_reset(void)
254diff --git a/debian/patches/ubuntu/lp2003673-s390x-refactor-ap-functionalities.patch b/debian/patches/ubuntu/lp2003673-s390x-refactor-ap-functionalities.patch
255new file mode 100644
256index 0000000..c972f46
257--- /dev/null
258+++ b/debian/patches/ubuntu/lp2003673-s390x-refactor-ap-functionalities.patch
259@@ -0,0 +1,100 @@
260+From: Steffen Eiden <seiden@linux.ibm.com>
261+Date: Wed, 23 Aug 2023 16:22:18 +0200
262+Subject: target/s390x/kvm: Refactor AP functionalities
263+
264+kvm_s390_set_attr() is a misleading name as it only sets attributes for
265+the KVM_S390_VM_CRYPTO group. Therefore, rename it to
266+kvm_s390_set_crypto_attr().
267+
268+Add new functions ap_available() and ap_enabled() to avoid code
269+duplication later.
270+
271+Reviewed-by: Thomas Huth <thuth@redhat.com>
272+Reviewed-by: Michael Mueller <mimu@linux.ibm.com>
273+Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
274+Message-ID: <20230823142219.1046522-5-seiden@linux.ibm.com>
275+Signed-off-by: Thomas Huth <thuth@redhat.com>
276+
277+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/354383c122
278+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
279+---
280+ target/s390x/kvm/kvm.c | 24 +++++++++++++++++-------
281+ 1 file changed, 17 insertions(+), 7 deletions(-)
282+
283+diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
284+index 3ac7ec9..d973768 100644
285+--- a/target/s390x/kvm/kvm.c
286++++ b/target/s390x/kvm/kvm.c
287+@@ -250,7 +250,7 @@ static void kvm_s390_enable_cmma(void)
288+ trace_kvm_enable_cmma(rc);
289+ }
290+
291+-static void kvm_s390_set_attr(uint64_t attr)
292++static void kvm_s390_set_crypto_attr(uint64_t attr)
293+ {
294+ struct kvm_device_attr attribute = {
295+ .group = KVM_S390_VM_CRYPTO,
296+@@ -275,7 +275,7 @@ static void kvm_s390_init_aes_kw(void)
297+ }
298+
299+ if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
300+- kvm_s390_set_attr(attr);
301++ kvm_s390_set_crypto_attr(attr);
302+ }
303+ }
304+
305+@@ -289,7 +289,7 @@ static void kvm_s390_init_dea_kw(void)
306+ }
307+
308+ if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
309+- kvm_s390_set_attr(attr);
310++ kvm_s390_set_crypto_attr(attr);
311+ }
312+ }
313+
314+@@ -2296,6 +2296,17 @@ static int configure_cpu_subfunc(const S390FeatBitmap features)
315+ return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr);
316+ }
317+
318++static bool ap_available(void)
319++{
320++ return kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO,
321++ KVM_S390_VM_CRYPTO_ENABLE_APIE);
322++}
323++
324++static bool ap_enabled(const S390FeatBitmap features)
325++{
326++ return test_bit(S390_FEAT_AP, features);
327++}
328++
329+ static int kvm_to_feat[][2] = {
330+ { KVM_S390_VM_CPU_FEAT_ESOP, S390_FEAT_ESOP },
331+ { KVM_S390_VM_CPU_FEAT_SIEF2, S390_FEAT_SIE_F2 },
332+@@ -2475,8 +2486,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model, Error **errp)
333+ return;
334+ }
335+ /* for now, we can only provide the AP feature with HW support */
336+- if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO,
337+- KVM_S390_VM_CRYPTO_ENABLE_APIE)) {
338++ if (ap_available()) {
339+ set_bit(S390_FEAT_AP, model->features);
340+ }
341+
342+@@ -2502,7 +2512,7 @@ static void kvm_s390_configure_apie(bool interpret)
343+ KVM_S390_VM_CRYPTO_DISABLE_APIE;
344+
345+ if (kvm_vm_check_attr(kvm_state, KVM_S390_VM_CRYPTO, attr)) {
346+- kvm_s390_set_attr(attr);
347++ kvm_s390_set_crypto_attr(attr);
348+ }
349+ }
350+
351+@@ -2556,7 +2566,7 @@ void kvm_s390_apply_cpu_model(const S390CPUModel *model, Error **errp)
352+ kvm_s390_enable_cmma();
353+ }
354+
355+- if (test_bit(S390_FEAT_AP, model->features)) {
356++ if (ap_enabled(model->features)) {
357+ kvm_s390_configure_apie(true);
358+ }
359+ }
360diff --git a/debian/patches/ubuntu/lp2003673-s390x-system-reset-before-unprotect-on-reboot.patch b/debian/patches/ubuntu/lp2003673-s390x-system-reset-before-unprotect-on-reboot.patch
361new file mode 100644
362index 0000000..dfd0c88
363--- /dev/null
364+++ b/debian/patches/ubuntu/lp2003673-s390x-system-reset-before-unprotect-on-reboot.patch
365@@ -0,0 +1,51 @@
366+From: Janosch Frank <frankja@linux.ibm.com>
367+Date: Fri, 1 Sep 2023 11:48:51 +0000
368+Subject: s390x: do a subsystem reset before the unprotect on reboot
369+
370+Bound APQNs have to be reset before tearing down the secure config via
371+s390_machine_unprotect(). Otherwise the Ultravisor will return a error
372+code.
373+
374+So let's do a subsystem_reset() which includes a AP reset before the
375+unprotect call. We'll do a full device_reset() afterwards which will
376+reset some devices twice. That's ok since we can't move the
377+device_reset() before the unprotect as it includes a CPU clear reset
378+which the Ultravisor does not expect at that point in time.
379+
380+Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
381+Message-ID: <20230901114851.154357-1-frankja@linux.ibm.com>
382+Tested-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
383+Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
384+Signed-off-by: Thomas Huth <thuth@redhat.com>
385+
386+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/ef1535901a
387+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
388+---
389+ hw/s390x/s390-virtio-ccw.c | 10 ++++++++++
390+ 1 file changed, 10 insertions(+)
391+
392+diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
393+index 59d83e1..cbf1780 100644
394+--- a/hw/s390x/s390-virtio-ccw.c
395++++ b/hw/s390x/s390-virtio-ccw.c
396+@@ -441,10 +441,20 @@ static void s390_machine_reset(MachineState *machine, ShutdownCause reason)
397+ switch (reset_type) {
398+ case S390_RESET_EXTERNAL:
399+ case S390_RESET_REIPL:
400++ /*
401++ * Reset the subsystem which includes a AP reset. If a PV
402++ * guest had APQNs attached the AP reset is a prerequisite to
403++ * unprotecting since the UV checks if all APQNs are reset.
404++ */
405++ subsystem_reset();
406+ if (s390_is_pv()) {
407+ s390_machine_unprotect(ms);
408+ }
409+
410++ /*
411++ * Device reset includes CPU clear resets so this has to be
412++ * done AFTER the unprotect call above.
413++ */
414+ qemu_devices_reset(reason);
415+ s390_crypto_reset();
416+
417diff --git a/debian/patches/ubuntu/lp2003673-update-linux-headers-6.3rc5.patch b/debian/patches/ubuntu/lp2003673-update-linux-headers-6.3rc5.patch
418new file mode 100644
419index 0000000..39c812c
420--- /dev/null
421+++ b/debian/patches/ubuntu/lp2003673-update-linux-headers-6.3rc5.patch
422@@ -0,0 +1,820 @@
423+From: David 'Digit' Turner <digit@google.com>
424+Date: Wed, 5 Apr 2023 19:21:09 +0200
425+Subject: Update linux headers to v6.3rc5
426+
427+commit 7e364e56293bb98cae1b55fd835f5991c4e96e7d
428+
429+Signed-off-by: David 'Digit' Turner <digit@google.com>
430+Message-Id: <20230405172109.3081788-4-digit@google.com>
431+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
432+
433+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/c5c0fdbe39a
434+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
435+Applied-Upstream: v8.1.2
436+---
437+ include/standard-headers/drm/drm_fourcc.h | 12 +++
438+ include/standard-headers/linux/ethtool.h | 48 ++++++++++-
439+ include/standard-headers/linux/fuse.h | 45 ++++++++++-
440+ include/standard-headers/linux/pci_regs.h | 1 +
441+ include/standard-headers/linux/vhost_types.h | 2 +
442+ include/standard-headers/linux/virtio_blk.h | 105 ++++++++++++++++++++++++
443+ linux-headers/asm-arm64/kvm.h | 1 +
444+ linux-headers/asm-x86/kvm.h | 34 +++++++-
445+ linux-headers/linux/const.h | 36 +++++++++
446+ linux-headers/linux/kvm.h | 9 +++
447+ linux-headers/linux/memfd.h | 39 +++++++++
448+ linux-headers/linux/nvme_ioctl.h | 114 +++++++++++++++++++++++++++
449+ linux-headers/linux/stddef.h | 47 +++++++++++
450+ linux-headers/linux/vfio.h | 15 ++--
451+ linux-headers/linux/vhost.h | 8 ++
452+ 15 files changed, 506 insertions(+), 10 deletions(-)
453+ create mode 100644 linux-headers/linux/const.h
454+ create mode 100644 linux-headers/linux/memfd.h
455+ create mode 100644 linux-headers/linux/nvme_ioctl.h
456+ create mode 100644 linux-headers/linux/stddef.h
457+
458+diff --git a/include/standard-headers/drm/drm_fourcc.h b/include/standard-headers/drm/drm_fourcc.h
459+index 69cab17..dc3e611 100644
460+--- a/include/standard-headers/drm/drm_fourcc.h
461++++ b/include/standard-headers/drm/drm_fourcc.h
462+@@ -87,6 +87,18 @@ extern "C" {
463+ *
464+ * The authoritative list of format modifier codes is found in
465+ * `include/uapi/drm/drm_fourcc.h`
466++ *
467++ * Open Source User Waiver
468++ * -----------------------
469++ *
470++ * Because this is the authoritative source for pixel formats and modifiers
471++ * referenced by GL, Vulkan extensions and other standards and hence used both
472++ * by open source and closed source driver stacks, the usual requirement for an
473++ * upstream in-kernel or open source userspace user does not apply.
474++ *
475++ * To ensure, as much as feasible, compatibility across stacks and avoid
476++ * confusion with incompatible enumerations stakeholders for all relevant driver
477++ * stacks should approve additions.
478+ */
479+
480+ #define fourcc_code(a, b, c, d) ((uint32_t)(a) | ((uint32_t)(b) << 8) | \
481+diff --git a/include/standard-headers/linux/ethtool.h b/include/standard-headers/linux/ethtool.h
482+index 87176ab..99fcddf 100644
483+--- a/include/standard-headers/linux/ethtool.h
484++++ b/include/standard-headers/linux/ethtool.h
485+@@ -711,6 +711,24 @@ enum ethtool_stringset {
486+ ETH_SS_COUNT
487+ };
488+
489++/**
490++ * enum ethtool_mac_stats_src - source of ethtool MAC statistics
491++ * @ETHTOOL_MAC_STATS_SRC_AGGREGATE:
492++ * if device supports a MAC merge layer, this retrieves the aggregate
493++ * statistics of the eMAC and pMAC. Otherwise, it retrieves just the
494++ * statistics of the single (express) MAC.
495++ * @ETHTOOL_MAC_STATS_SRC_EMAC:
496++ * if device supports a MM layer, this retrieves the eMAC statistics.
497++ * Otherwise, it retrieves the statistics of the single (express) MAC.
498++ * @ETHTOOL_MAC_STATS_SRC_PMAC:
499++ * if device supports a MM layer, this retrieves the pMAC statistics.
500++ */
501++enum ethtool_mac_stats_src {
502++ ETHTOOL_MAC_STATS_SRC_AGGREGATE,
503++ ETHTOOL_MAC_STATS_SRC_EMAC,
504++ ETHTOOL_MAC_STATS_SRC_PMAC,
505++};
506++
507+ /**
508+ * enum ethtool_module_power_mode_policy - plug-in module power mode policy
509+ * @ETHTOOL_MODULE_POWER_MODE_POLICY_HIGH: Module is always in high power mode.
510+@@ -779,6 +797,31 @@ enum ethtool_podl_pse_pw_d_status {
511+ ETHTOOL_PODL_PSE_PW_D_STATUS_ERROR,
512+ };
513+
514++/**
515++ * enum ethtool_mm_verify_status - status of MAC Merge Verify function
516++ * @ETHTOOL_MM_VERIFY_STATUS_UNKNOWN:
517++ * verification status is unknown
518++ * @ETHTOOL_MM_VERIFY_STATUS_INITIAL:
519++ * the 802.3 Verify State diagram is in the state INIT_VERIFICATION
520++ * @ETHTOOL_MM_VERIFY_STATUS_VERIFYING:
521++ * the Verify State diagram is in the state VERIFICATION_IDLE,
522++ * SEND_VERIFY or WAIT_FOR_RESPONSE
523++ * @ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED:
524++ * indicates that the Verify State diagram is in the state VERIFIED
525++ * @ETHTOOL_MM_VERIFY_STATUS_FAILED:
526++ * the Verify State diagram is in the state VERIFY_FAIL
527++ * @ETHTOOL_MM_VERIFY_STATUS_DISABLED:
528++ * verification of preemption operation is disabled
529++ */
530++enum ethtool_mm_verify_status {
531++ ETHTOOL_MM_VERIFY_STATUS_UNKNOWN,
532++ ETHTOOL_MM_VERIFY_STATUS_INITIAL,
533++ ETHTOOL_MM_VERIFY_STATUS_VERIFYING,
534++ ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED,
535++ ETHTOOL_MM_VERIFY_STATUS_FAILED,
536++ ETHTOOL_MM_VERIFY_STATUS_DISABLED,
537++};
538++
539+ /**
540+ * struct ethtool_gstrings - string set for data tagging
541+ * @cmd: Command number = %ETHTOOL_GSTRINGS
542+@@ -1183,7 +1226,7 @@ struct ethtool_rxnfc {
543+ uint32_t rule_cnt;
544+ uint32_t rss_context;
545+ };
546+- uint32_t rule_locs[0];
547++ uint32_t rule_locs[];
548+ };
549+
550+
551+@@ -1741,6 +1784,9 @@ enum ethtool_link_mode_bit_indices {
552+ ETHTOOL_LINK_MODE_800000baseDR8_2_Full_BIT = 96,
553+ ETHTOOL_LINK_MODE_800000baseSR8_Full_BIT = 97,
554+ ETHTOOL_LINK_MODE_800000baseVR8_Full_BIT = 98,
555++ ETHTOOL_LINK_MODE_10baseT1S_Full_BIT = 99,
556++ ETHTOOL_LINK_MODE_10baseT1S_Half_BIT = 100,
557++ ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT = 101,
558+
559+ /* must be last entry */
560+ __ETHTOOL_LINK_MODE_MASK_NBITS
561+diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h
562+index a1af78d..35c131a 100644
563+--- a/include/standard-headers/linux/fuse.h
564++++ b/include/standard-headers/linux/fuse.h
565+@@ -201,6 +201,11 @@
566+ * 7.38
567+ * - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry
568+ * - add FOPEN_PARALLEL_DIRECT_WRITES
569++ * - add total_extlen to fuse_in_header
570++ * - add FUSE_MAX_NR_SECCTX
571++ * - add extension header
572++ * - add FUSE_EXT_GROUPS
573++ * - add FUSE_CREATE_SUPP_GROUP
574+ */
575+
576+ #ifndef _LINUX_FUSE_H
577+@@ -358,6 +363,8 @@ struct fuse_file_lock {
578+ * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and
579+ * mknod
580+ * FUSE_HAS_INODE_DAX: use per inode DAX
581++ * FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir,
582++ * symlink and mknod (single group that matches parent)
583+ */
584+ #define FUSE_ASYNC_READ (1 << 0)
585+ #define FUSE_POSIX_LOCKS (1 << 1)
586+@@ -394,6 +401,7 @@ struct fuse_file_lock {
587+ /* bits 32..63 get shifted down 32 bits into the flags2 field */
588+ #define FUSE_SECURITY_CTX (1ULL << 32)
589+ #define FUSE_HAS_INODE_DAX (1ULL << 33)
590++#define FUSE_CREATE_SUPP_GROUP (1ULL << 34)
591+
592+ /**
593+ * CUSE INIT request/reply flags
594+@@ -499,6 +507,17 @@ struct fuse_file_lock {
595+ */
596+ #define FUSE_EXPIRE_ONLY (1 << 0)
597+
598++/**
599++ * extension type
600++ * FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx
601++ * FUSE_EXT_GROUPS: &fuse_supp_groups extension
602++ */
603++enum fuse_ext_type {
604++ /* Types 0..31 are reserved for fuse_secctx_header */
605++ FUSE_MAX_NR_SECCTX = 31,
606++ FUSE_EXT_GROUPS = 32,
607++};
608++
609+ enum fuse_opcode {
610+ FUSE_LOOKUP = 1,
611+ FUSE_FORGET = 2, /* no reply */
612+@@ -882,7 +901,8 @@ struct fuse_in_header {
613+ uint32_t uid;
614+ uint32_t gid;
615+ uint32_t pid;
616+- uint32_t padding;
617++ uint16_t total_extlen; /* length of extensions in 8byte units */
618++ uint16_t padding;
619+ };
620+
621+ struct fuse_out_header {
622+@@ -1043,4 +1063,27 @@ struct fuse_secctx_header {
623+ uint32_t nr_secctx;
624+ };
625+
626++/**
627++ * struct fuse_ext_header - extension header
628++ * @size: total size of this extension including this header
629++ * @type: type of extension
630++ *
631++ * This is made compatible with fuse_secctx_header by using type values >
632++ * FUSE_MAX_NR_SECCTX
633++ */
634++struct fuse_ext_header {
635++ uint32_t size;
636++ uint32_t type;
637++};
638++
639++/**
640++ * struct fuse_supp_groups - Supplementary group extension
641++ * @nr_groups: number of supplementary groups
642++ * @groups: flexible array of group IDs
643++ */
644++struct fuse_supp_groups {
645++ uint32_t nr_groups;
646++ uint32_t groups[];
647++};
648++
649+ #endif /* _LINUX_FUSE_H */
650+diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h
651+index 85ab127..dc2000e 100644
652+--- a/include/standard-headers/linux/pci_regs.h
653++++ b/include/standard-headers/linux/pci_regs.h
654+@@ -693,6 +693,7 @@
655+ #define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */
656+ #define PCI_EXP_LNKCTL2_HASD 0x0020 /* HW Autonomous Speed Disable */
657+ #define PCI_EXP_LNKSTA2 0x32 /* Link Status 2 */
658++#define PCI_EXP_LNKSTA2_FLIT 0x0400 /* Flit Mode Status */
659+ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 0x32 /* end of v2 EPs w/ link */
660+ #define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities 2 */
661+ #define PCI_EXP_SLTCAP2_IBPD 0x00000001 /* In-band PD Disable Supported */
662+diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-headers/linux/vhost_types.h
663+index c41a73fe..88600e2 100644
664+--- a/include/standard-headers/linux/vhost_types.h
665++++ b/include/standard-headers/linux/vhost_types.h
666+@@ -163,5 +163,7 @@ struct vhost_vdpa_iova_range {
667+ #define VHOST_BACKEND_F_IOTLB_ASID 0x3
668+ /* Device can be suspended */
669+ #define VHOST_BACKEND_F_SUSPEND 0x4
670++/* Device can be resumed */
671++#define VHOST_BACKEND_F_RESUME 0x5
672+
673+ #endif
674+diff --git a/include/standard-headers/linux/virtio_blk.h b/include/standard-headers/linux/virtio_blk.h
675+index e81715c..7155b1a 100644
676+--- a/include/standard-headers/linux/virtio_blk.h
677++++ b/include/standard-headers/linux/virtio_blk.h
678+@@ -41,6 +41,7 @@
679+ #define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */
680+ #define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */
681+ #define VIRTIO_BLK_F_SECURE_ERASE 16 /* Secure Erase is supported */
682++#define VIRTIO_BLK_F_ZONED 17 /* Zoned block device */
683+
684+ /* Legacy feature bits */
685+ #ifndef VIRTIO_BLK_NO_LEGACY
686+@@ -135,6 +136,16 @@ struct virtio_blk_config {
687+ /* Secure erase commands must be aligned to this number of sectors. */
688+ __virtio32 secure_erase_sector_alignment;
689+
690++ /* Zoned block device characteristics (if VIRTIO_BLK_F_ZONED) */
691++ struct virtio_blk_zoned_characteristics {
692++ uint32_t zone_sectors;
693++ uint32_t max_open_zones;
694++ uint32_t max_active_zones;
695++ uint32_t max_append_sectors;
696++ uint32_t write_granularity;
697++ uint8_t model;
698++ uint8_t unused2[3];
699++ } zoned;
700+ } QEMU_PACKED;
701+
702+ /*
703+@@ -172,6 +183,27 @@ struct virtio_blk_config {
704+ /* Secure erase command */
705+ #define VIRTIO_BLK_T_SECURE_ERASE 14
706+
707++/* Zone append command */
708++#define VIRTIO_BLK_T_ZONE_APPEND 15
709++
710++/* Report zones command */
711++#define VIRTIO_BLK_T_ZONE_REPORT 16
712++
713++/* Open zone command */
714++#define VIRTIO_BLK_T_ZONE_OPEN 18
715++
716++/* Close zone command */
717++#define VIRTIO_BLK_T_ZONE_CLOSE 20
718++
719++/* Finish zone command */
720++#define VIRTIO_BLK_T_ZONE_FINISH 22
721++
722++/* Reset zone command */
723++#define VIRTIO_BLK_T_ZONE_RESET 24
724++
725++/* Reset All zones command */
726++#define VIRTIO_BLK_T_ZONE_RESET_ALL 26
727++
728+ #ifndef VIRTIO_BLK_NO_LEGACY
729+ /* Barrier before this op. */
730+ #define VIRTIO_BLK_T_BARRIER 0x80000000
731+@@ -191,6 +223,72 @@ struct virtio_blk_outhdr {
732+ __virtio64 sector;
733+ };
734+
735++/*
736++ * Supported zoned device models.
737++ */
738++
739++/* Regular block device */
740++#define VIRTIO_BLK_Z_NONE 0
741++/* Host-managed zoned device */
742++#define VIRTIO_BLK_Z_HM 1
743++/* Host-aware zoned device */
744++#define VIRTIO_BLK_Z_HA 2
745++
746++/*
747++ * Zone descriptor. A part of VIRTIO_BLK_T_ZONE_REPORT command reply.
748++ */
749++struct virtio_blk_zone_descriptor {
750++ /* Zone capacity */
751++ uint64_t z_cap;
752++ /* The starting sector of the zone */
753++ uint64_t z_start;
754++ /* Zone write pointer position in sectors */
755++ uint64_t z_wp;
756++ /* Zone type */
757++ uint8_t z_type;
758++ /* Zone state */
759++ uint8_t z_state;
760++ uint8_t reserved[38];
761++};
762++
763++struct virtio_blk_zone_report {
764++ uint64_t nr_zones;
765++ uint8_t reserved[56];
766++ struct virtio_blk_zone_descriptor zones[];
767++};
768++
769++/*
770++ * Supported zone types.
771++ */
772++
773++/* Conventional zone */
774++#define VIRTIO_BLK_ZT_CONV 1
775++/* Sequential Write Required zone */
776++#define VIRTIO_BLK_ZT_SWR 2
777++/* Sequential Write Preferred zone */
778++#define VIRTIO_BLK_ZT_SWP 3
779++
780++/*
781++ * Zone states that are available for zones of all types.
782++ */
783++
784++/* Not a write pointer (conventional zones only) */
785++#define VIRTIO_BLK_ZS_NOT_WP 0
786++/* Empty */
787++#define VIRTIO_BLK_ZS_EMPTY 1
788++/* Implicitly Open */
789++#define VIRTIO_BLK_ZS_IOPEN 2
790++/* Explicitly Open */
791++#define VIRTIO_BLK_ZS_EOPEN 3
792++/* Closed */
793++#define VIRTIO_BLK_ZS_CLOSED 4
794++/* Read-Only */
795++#define VIRTIO_BLK_ZS_RDONLY 13
796++/* Full */
797++#define VIRTIO_BLK_ZS_FULL 14
798++/* Offline */
799++#define VIRTIO_BLK_ZS_OFFLINE 15
800++
801+ /* Unmap this range (only valid for write zeroes command) */
802+ #define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP 0x00000001
803+
804+@@ -217,4 +315,11 @@ struct virtio_scsi_inhdr {
805+ #define VIRTIO_BLK_S_OK 0
806+ #define VIRTIO_BLK_S_IOERR 1
807+ #define VIRTIO_BLK_S_UNSUPP 2
808++
809++/* Error codes that are specific to zoned block devices */
810++#define VIRTIO_BLK_S_ZONE_INVALID_CMD 3
811++#define VIRTIO_BLK_S_ZONE_UNALIGNED_WP 4
812++#define VIRTIO_BLK_S_ZONE_OPEN_RESOURCE 5
813++#define VIRTIO_BLK_S_ZONE_ACTIVE_RESOURCE 6
814++
815+ #endif /* _LINUX_VIRTIO_BLK_H */
816+diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
817+index a7cfefb..d7e7bb8 100644
818+--- a/linux-headers/asm-arm64/kvm.h
819++++ b/linux-headers/asm-arm64/kvm.h
820+@@ -109,6 +109,7 @@ struct kvm_regs {
821+ #define KVM_ARM_VCPU_SVE 4 /* enable SVE for this CPU */
822+ #define KVM_ARM_VCPU_PTRAUTH_ADDRESS 5 /* VCPU uses address authentication */
823+ #define KVM_ARM_VCPU_PTRAUTH_GENERIC 6 /* VCPU uses generic authentication */
824++#define KVM_ARM_VCPU_HAS_EL2 7 /* Support nested virtualization */
825+
826+ struct kvm_vcpu_init {
827+ __u32 target;
828+diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
829+index 2747d2c..2937e7b 100644
830+--- a/linux-headers/asm-x86/kvm.h
831++++ b/linux-headers/asm-x86/kvm.h
832+@@ -9,6 +9,7 @@
833+
834+ #include <linux/types.h>
835+ #include <linux/ioctl.h>
836++#include <linux/stddef.h>
837+
838+ #define KVM_PIO_PAGE_OFFSET 1
839+ #define KVM_COALESCED_MMIO_PAGE_OFFSET 2
840+@@ -505,8 +506,8 @@ struct kvm_nested_state {
841+ * KVM_{GET,PUT}_NESTED_STATE ioctl values.
842+ */
843+ union {
844+- struct kvm_vmx_nested_state_data vmx[0];
845+- struct kvm_svm_nested_state_data svm[0];
846++ __DECLARE_FLEX_ARRAY(struct kvm_vmx_nested_state_data, vmx);
847++ __DECLARE_FLEX_ARRAY(struct kvm_svm_nested_state_data, svm);
848+ } data;
849+ };
850+
851+@@ -523,6 +524,35 @@ struct kvm_pmu_event_filter {
852+ #define KVM_PMU_EVENT_ALLOW 0
853+ #define KVM_PMU_EVENT_DENY 1
854+
855++#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS BIT(0)
856++#define KVM_PMU_EVENT_FLAGS_VALID_MASK (KVM_PMU_EVENT_FLAG_MASKED_EVENTS)
857++
858++/*
859++ * Masked event layout.
860++ * Bits Description
861++ * ---- -----------
862++ * 7:0 event select (low bits)
863++ * 15:8 umask match
864++ * 31:16 unused
865++ * 35:32 event select (high bits)
866++ * 36:54 unused
867++ * 55 exclude bit
868++ * 63:56 umask mask
869++ */
870++
871++#define KVM_PMU_ENCODE_MASKED_ENTRY(event_select, mask, match, exclude) \
872++ (((event_select) & 0xFFULL) | (((event_select) & 0XF00ULL) << 24) | \
873++ (((mask) & 0xFFULL) << 56) | \
874++ (((match) & 0xFFULL) << 8) | \
875++ ((__u64)(!!(exclude)) << 55))
876++
877++#define KVM_PMU_MASKED_ENTRY_EVENT_SELECT \
878++ (GENMASK_ULL(7, 0) | GENMASK_ULL(35, 32))
879++#define KVM_PMU_MASKED_ENTRY_UMASK_MASK (GENMASK_ULL(63, 56))
880++#define KVM_PMU_MASKED_ENTRY_UMASK_MATCH (GENMASK_ULL(15, 8))
881++#define KVM_PMU_MASKED_ENTRY_EXCLUDE (BIT_ULL(55))
882++#define KVM_PMU_MASKED_ENTRY_UMASK_MASK_SHIFT (56)
883++
884+ /* for KVM_{GET,SET,HAS}_DEVICE_ATTR */
885+ #define KVM_VCPU_TSC_CTRL 0 /* control group for the timestamp counter (TSC) */
886+ #define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */
887+diff --git a/linux-headers/linux/const.h b/linux-headers/linux/const.h
888+new file mode 100644
889+index 0000000..5e48987
890+--- /dev/null
891++++ b/linux-headers/linux/const.h
892+@@ -0,0 +1,36 @@
893++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
894++/* const.h: Macros for dealing with constants. */
895++
896++#ifndef _LINUX_CONST_H
897++#define _LINUX_CONST_H
898++
899++/* Some constant macros are used in both assembler and
900++ * C code. Therefore we cannot annotate them always with
901++ * 'UL' and other type specifiers unilaterally. We
902++ * use the following macros to deal with this.
903++ *
904++ * Similarly, _AT() will cast an expression with a type in C, but
905++ * leave it unchanged in asm.
906++ */
907++
908++#ifdef __ASSEMBLY__
909++#define _AC(X,Y) X
910++#define _AT(T,X) X
911++#else
912++#define __AC(X,Y) (X##Y)
913++#define _AC(X,Y) __AC(X,Y)
914++#define _AT(T,X) ((T)(X))
915++#endif
916++
917++#define _UL(x) (_AC(x, UL))
918++#define _ULL(x) (_AC(x, ULL))
919++
920++#define _BITUL(x) (_UL(1) << (x))
921++#define _BITULL(x) (_ULL(1) << (x))
922++
923++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
924++#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
925++
926++#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
927++
928++#endif /* _LINUX_CONST_H */
929+diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
930+index 1e2c16c..599de3c 100644
931+--- a/linux-headers/linux/kvm.h
932++++ b/linux-headers/linux/kvm.h
933+@@ -581,6 +581,8 @@ struct kvm_s390_mem_op {
934+ struct {
935+ __u8 ar; /* the access register number */
936+ __u8 key; /* access key, ignored if flag unset */
937++ __u8 pad1[6]; /* ignored */
938++ __u64 old_addr; /* ignored if cmpxchg flag unset */
939+ };
940+ __u32 sida_offset; /* offset into the sida */
941+ __u8 reserved[32]; /* ignored */
942+@@ -593,11 +595,17 @@ struct kvm_s390_mem_op {
943+ #define KVM_S390_MEMOP_SIDA_WRITE 3
944+ #define KVM_S390_MEMOP_ABSOLUTE_READ 4
945+ #define KVM_S390_MEMOP_ABSOLUTE_WRITE 5
946++#define KVM_S390_MEMOP_ABSOLUTE_CMPXCHG 6
947++
948+ /* flags for kvm_s390_mem_op->flags */
949+ #define KVM_S390_MEMOP_F_CHECK_ONLY (1ULL << 0)
950+ #define KVM_S390_MEMOP_F_INJECT_EXCEPTION (1ULL << 1)
951+ #define KVM_S390_MEMOP_F_SKEY_PROTECTION (1ULL << 2)
952+
953++/* flags specifying extension support via KVM_CAP_S390_MEM_OP_EXTENSION */
954++#define KVM_S390_MEMOP_EXTENSION_CAP_BASE (1 << 0)
955++#define KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG (1 << 1)
956++
957+ /* for KVM_INTERRUPT */
958+ struct kvm_interrupt {
959+ /* in */
960+@@ -1173,6 +1181,7 @@ struct kvm_ppc_resize_hpt {
961+ #define KVM_CAP_DIRTY_LOG_RING_ACQ_REL 223
962+ #define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
963+ #define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
964++#define KVM_CAP_PMU_EVENT_MASKED_EVENTS 226
965+
966+ #ifdef KVM_CAP_IRQ_ROUTING
967+
968+diff --git a/linux-headers/linux/memfd.h b/linux-headers/linux/memfd.h
969+new file mode 100644
970+index 0000000..01c0324
971+--- /dev/null
972++++ b/linux-headers/linux/memfd.h
973+@@ -0,0 +1,39 @@
974++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
975++#ifndef _LINUX_MEMFD_H
976++#define _LINUX_MEMFD_H
977++
978++#include <asm-generic/hugetlb_encode.h>
979++
980++/* flags for memfd_create(2) (unsigned int) */
981++#define MFD_CLOEXEC 0x0001U
982++#define MFD_ALLOW_SEALING 0x0002U
983++#define MFD_HUGETLB 0x0004U
984++/* not executable and sealed to prevent changing to executable. */
985++#define MFD_NOEXEC_SEAL 0x0008U
986++/* executable */
987++#define MFD_EXEC 0x0010U
988++
989++/*
990++ * Huge page size encoding when MFD_HUGETLB is specified, and a huge page
991++ * size other than the default is desired. See hugetlb_encode.h.
992++ * All known huge page size encodings are provided here. It is the
993++ * responsibility of the application to know which sizes are supported on
994++ * the running system. See mmap(2) man page for details.
995++ */
996++#define MFD_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
997++#define MFD_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
998++
999++#define MFD_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
1000++#define MFD_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
1001++#define MFD_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
1002++#define MFD_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
1003++#define MFD_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
1004++#define MFD_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
1005++#define MFD_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB
1006++#define MFD_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
1007++#define MFD_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB
1008++#define MFD_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
1009++#define MFD_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
1010++#define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
1011++
1012++#endif /* _LINUX_MEMFD_H */
1013+diff --git a/linux-headers/linux/nvme_ioctl.h b/linux-headers/linux/nvme_ioctl.h
1014+new file mode 100644
1015+index 0000000..f8df31d
1016+--- /dev/null
1017++++ b/linux-headers/linux/nvme_ioctl.h
1018+@@ -0,0 +1,114 @@
1019++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1020++/*
1021++ * Definitions for the NVM Express ioctl interface
1022++ * Copyright (c) 2011-2014, Intel Corporation.
1023++ */
1024++
1025++#ifndef _LINUX_NVME_IOCTL_H
1026++#define _LINUX_NVME_IOCTL_H
1027++
1028++#include <linux/types.h>
1029++
1030++struct nvme_user_io {
1031++ __u8 opcode;
1032++ __u8 flags;
1033++ __u16 control;
1034++ __u16 nblocks;
1035++ __u16 rsvd;
1036++ __u64 metadata;
1037++ __u64 addr;
1038++ __u64 slba;
1039++ __u32 dsmgmt;
1040++ __u32 reftag;
1041++ __u16 apptag;
1042++ __u16 appmask;
1043++};
1044++
1045++struct nvme_passthru_cmd {
1046++ __u8 opcode;
1047++ __u8 flags;
1048++ __u16 rsvd1;
1049++ __u32 nsid;
1050++ __u32 cdw2;
1051++ __u32 cdw3;
1052++ __u64 metadata;
1053++ __u64 addr;
1054++ __u32 metadata_len;
1055++ __u32 data_len;
1056++ __u32 cdw10;
1057++ __u32 cdw11;
1058++ __u32 cdw12;
1059++ __u32 cdw13;
1060++ __u32 cdw14;
1061++ __u32 cdw15;
1062++ __u32 timeout_ms;
1063++ __u32 result;
1064++};
1065++
1066++struct nvme_passthru_cmd64 {
1067++ __u8 opcode;
1068++ __u8 flags;
1069++ __u16 rsvd1;
1070++ __u32 nsid;
1071++ __u32 cdw2;
1072++ __u32 cdw3;
1073++ __u64 metadata;
1074++ __u64 addr;
1075++ __u32 metadata_len;
1076++ union {
1077++ __u32 data_len; /* for non-vectored io */
1078++ __u32 vec_cnt; /* for vectored io */
1079++ };
1080++ __u32 cdw10;
1081++ __u32 cdw11;
1082++ __u32 cdw12;
1083++ __u32 cdw13;
1084++ __u32 cdw14;
1085++ __u32 cdw15;
1086++ __u32 timeout_ms;
1087++ __u32 rsvd2;
1088++ __u64 result;
1089++};
1090++
1091++/* same as struct nvme_passthru_cmd64, minus the 8b result field */
1092++struct nvme_uring_cmd {
1093++ __u8 opcode;
1094++ __u8 flags;
1095++ __u16 rsvd1;
1096++ __u32 nsid;
1097++ __u32 cdw2;
1098++ __u32 cdw3;
1099++ __u64 metadata;
1100++ __u64 addr;
1101++ __u32 metadata_len;
1102++ __u32 data_len;
1103++ __u32 cdw10;
1104++ __u32 cdw11;
1105++ __u32 cdw12;
1106++ __u32 cdw13;
1107++ __u32 cdw14;
1108++ __u32 cdw15;
1109++ __u32 timeout_ms;
1110++ __u32 rsvd2;
1111++};
1112++
1113++#define nvme_admin_cmd nvme_passthru_cmd
1114++
1115++#define NVME_IOCTL_ID _IO('N', 0x40)
1116++#define NVME_IOCTL_ADMIN_CMD _IOWR('N', 0x41, struct nvme_admin_cmd)
1117++#define NVME_IOCTL_SUBMIT_IO _IOW('N', 0x42, struct nvme_user_io)
1118++#define NVME_IOCTL_IO_CMD _IOWR('N', 0x43, struct nvme_passthru_cmd)
1119++#define NVME_IOCTL_RESET _IO('N', 0x44)
1120++#define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45)
1121++#define NVME_IOCTL_RESCAN _IO('N', 0x46)
1122++#define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64)
1123++#define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64)
1124++#define NVME_IOCTL_IO64_CMD_VEC _IOWR('N', 0x49, struct nvme_passthru_cmd64)
1125++
1126++/* io_uring async commands: */
1127++#define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd)
1128++#define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd)
1129++#define NVME_URING_CMD_ADMIN _IOWR('N', 0x82, struct nvme_uring_cmd)
1130++#define NVME_URING_CMD_ADMIN_VEC _IOWR('N', 0x83, struct nvme_uring_cmd)
1131++
1132++#endif /* _LINUX_NVME_IOCTL_H */
1133+diff --git a/linux-headers/linux/stddef.h b/linux-headers/linux/stddef.h
1134+new file mode 100644
1135+index 0000000..bb6ea51
1136+--- /dev/null
1137++++ b/linux-headers/linux/stddef.h
1138+@@ -0,0 +1,47 @@
1139++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1140++#ifndef _LINUX_STDDEF_H
1141++#define _LINUX_STDDEF_H
1142++
1143++
1144++
1145++#ifndef __always_inline
1146++#define __always_inline __inline__
1147++#endif
1148++
1149++/**
1150++ * __struct_group() - Create a mirrored named and anonyomous struct
1151++ *
1152++ * @TAG: The tag name for the named sub-struct (usually empty)
1153++ * @NAME: The identifier name of the mirrored sub-struct
1154++ * @ATTRS: Any struct attributes (usually empty)
1155++ * @MEMBERS: The member declarations for the mirrored structs
1156++ *
1157++ * Used to create an anonymous union of two structs with identical layout
1158++ * and size: one anonymous and one named. The former's members can be used
1159++ * normally without sub-struct naming, and the latter can be used to
1160++ * reason about the start, end, and size of the group of struct members.
1161++ * The named struct can also be explicitly tagged for layer reuse, as well
1162++ * as both having struct attributes appended.
1163++ */
1164++#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
1165++ union { \
1166++ struct { MEMBERS } ATTRS; \
1167++ struct TAG { MEMBERS } ATTRS NAME; \
1168++ }
1169++
1170++/**
1171++ * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
1172++ *
1173++ * @TYPE: The type of each flexible array element
1174++ * @NAME: The name of the flexible array member
1175++ *
1176++ * In order to have a flexible array member in a union or alone in a
1177++ * struct, it needs to be wrapped in an anonymous struct with at least 1
1178++ * named member, but that member can be empty.
1179++ */
1180++#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \
1181++ struct { \
1182++ struct { } __empty_ ## NAME; \
1183++ TYPE NAME[]; \
1184++ }
1185++#endif
1186+diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
1187+index c59692c..4a534ed 100644
1188+--- a/linux-headers/linux/vfio.h
1189++++ b/linux-headers/linux/vfio.h
1190+@@ -49,7 +49,11 @@
1191+ /* Supports VFIO_DMA_UNMAP_FLAG_ALL */
1192+ #define VFIO_UNMAP_ALL 9
1193+
1194+-/* Supports the vaddr flag for DMA map and unmap */
1195++/*
1196++ * Supports the vaddr flag for DMA map and unmap. Not supported for mediated
1197++ * devices, so this capability is subject to change as groups are added or
1198++ * removed.
1199++ */
1200+ #define VFIO_UPDATE_VADDR 10
1201+
1202+ /*
1203+@@ -1343,8 +1347,7 @@ struct vfio_iommu_type1_info_dma_avail {
1204+ * Map process virtual addresses to IO virtual addresses using the
1205+ * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required.
1206+ *
1207+- * If flags & VFIO_DMA_MAP_FLAG_VADDR, update the base vaddr for iova, and
1208+- * unblock translation of host virtual addresses in the iova range. The vaddr
1209++ * If flags & VFIO_DMA_MAP_FLAG_VADDR, update the base vaddr for iova. The vaddr
1210+ * must have previously been invalidated with VFIO_DMA_UNMAP_FLAG_VADDR. To
1211+ * maintain memory consistency within the user application, the updated vaddr
1212+ * must address the same memory object as originally mapped. Failure to do so
1213+@@ -1395,9 +1398,9 @@ struct vfio_bitmap {
1214+ * must be 0. This cannot be combined with the get-dirty-bitmap flag.
1215+ *
1216+ * If flags & VFIO_DMA_UNMAP_FLAG_VADDR, do not unmap, but invalidate host
1217+- * virtual addresses in the iova range. Tasks that attempt to translate an
1218+- * iova's vaddr will block. DMA to already-mapped pages continues. This
1219+- * cannot be combined with the get-dirty-bitmap flag.
1220++ * virtual addresses in the iova range. DMA to already-mapped pages continues.
1221++ * Groups may not be added to the container while any addresses are invalid.
1222++ * This cannot be combined with the get-dirty-bitmap flag.
1223+ */
1224+ struct vfio_iommu_type1_dma_unmap {
1225+ __u32 argsz;
1226+diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
1227+index f9f115a..92e1b70 100644
1228+--- a/linux-headers/linux/vhost.h
1229++++ b/linux-headers/linux/vhost.h
1230+@@ -180,4 +180,12 @@
1231+ */
1232+ #define VHOST_VDPA_SUSPEND _IO(VHOST_VIRTIO, 0x7D)
1233+
1234++/* Resume a device so it can resume processing virtqueue requests
1235++ *
1236++ * After the return of this ioctl the device will have restored all the
1237++ * necessary states and it is fully operational to continue processing the
1238++ * virtqueue descriptors.
1239++ */
1240++#define VHOST_VDPA_RESUME _IO(VHOST_VIRTIO, 0x7E)
1241++
1242+ #endif
1243diff --git a/debian/patches/ubuntu/lp2003673-update-linux-headers-6.5rc1.patch b/debian/patches/ubuntu/lp2003673-update-linux-headers-6.5rc1.patch
1244new file mode 100644
1245index 0000000..9cf278f
1246--- /dev/null
1247+++ b/debian/patches/ubuntu/lp2003673-update-linux-headers-6.5rc1.patch
1248@@ -0,0 +1,1565 @@
1249+From: =?utf-8?q?C=C3=A9dric_Le_Goater?= <clg@redhat.com>
1250+Date: Sun, 9 Jul 2023 23:23:08 +0200
1251+Subject: linux-headers: update to v6.5-rc1
1252+MIME-Version: 1.0
1253+Content-Type: text/plain; charset="utf-8"
1254+Content-Transfer-Encoding: 8bit
1255+
1256+Reviewed-by: Thomas Huth <thuth@redhat.com>
1257+Signed-off-by: Cédric Le Goater <clg@redhat.com>
1258+
1259+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/d0bf492f387
1260+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
1261+Applied-Upstream: v8.1.2
1262+---
1263+ include/standard-headers/drm/drm_fourcc.h | 43 ++++++++
1264+ include/standard-headers/linux/const.h | 2 +-
1265+ include/standard-headers/linux/pci_regs.h | 1 +
1266+ include/standard-headers/linux/vhost_types.h | 16 +++
1267+ include/standard-headers/linux/virtio_blk.h | 18 ++--
1268+ include/standard-headers/linux/virtio_config.h | 6 ++
1269+ include/standard-headers/linux/virtio_net.h | 1 +
1270+ linux-headers/asm-arm64/bitsperlong.h | 23 -----
1271+ linux-headers/asm-arm64/kvm.h | 33 ++++++
1272+ linux-headers/asm-generic/bitsperlong.h | 13 ++-
1273+ linux-headers/asm-generic/unistd.h | 134 +++++++------------------
1274+ linux-headers/asm-mips/unistd_n32.h | 1 +
1275+ linux-headers/asm-mips/unistd_n64.h | 1 +
1276+ linux-headers/asm-mips/unistd_o32.h | 1 +
1277+ linux-headers/asm-powerpc/unistd_32.h | 1 +
1278+ linux-headers/asm-powerpc/unistd_64.h | 1 +
1279+ linux-headers/asm-riscv/bitsperlong.h | 13 ---
1280+ linux-headers/asm-riscv/kvm.h | 134 ++++++++++++++++++++++++-
1281+ linux-headers/asm-riscv/unistd.h | 9 ++
1282+ linux-headers/asm-s390/unistd_32.h | 2 +
1283+ linux-headers/asm-s390/unistd_64.h | 2 +
1284+ linux-headers/asm-x86/kvm.h | 3 +
1285+ linux-headers/asm-x86/unistd_32.h | 1 +
1286+ linux-headers/asm-x86/unistd_64.h | 1 +
1287+ linux-headers/asm-x86/unistd_x32.h | 1 +
1288+ linux-headers/linux/const.h | 2 +-
1289+ linux-headers/linux/kvm.h | 18 +++-
1290+ linux-headers/linux/mman.h | 14 +++
1291+ linux-headers/linux/psp-sev.h | 7 ++
1292+ linux-headers/linux/userfaultfd.h | 17 +++-
1293+ linux-headers/linux/vfio.h | 27 +++++
1294+ linux-headers/linux/vhost.h | 31 ++++++
1295+ 32 files changed, 423 insertions(+), 154 deletions(-)
1296+
1297+diff --git a/include/standard-headers/drm/drm_fourcc.h b/include/standard-headers/drm/drm_fourcc.h
1298+index dc3e611..72279f4 100644
1299+--- a/include/standard-headers/drm/drm_fourcc.h
1300++++ b/include/standard-headers/drm/drm_fourcc.h
1301+@@ -656,6 +656,49 @@ extern "C" {
1302+ */
1303+ #define I915_FORMAT_MOD_4_TILED_DG2_RC_CCS_CC fourcc_mod_code(INTEL, 12)
1304+
1305++/*
1306++ * Intel Color Control Surfaces (CCS) for display ver. 14 render compression.
1307++ *
1308++ * The main surface is tile4 and at plane index 0, the CCS is linear and
1309++ * at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in
1310++ * main surface. In other words, 4 bits in CCS map to a main surface cache
1311++ * line pair. The main surface pitch is required to be a multiple of four
1312++ * tile4 widths.
1313++ */
1314++#define I915_FORMAT_MOD_4_TILED_MTL_RC_CCS fourcc_mod_code(INTEL, 13)
1315++
1316++/*
1317++ * Intel Color Control Surfaces (CCS) for display ver. 14 media compression
1318++ *
1319++ * The main surface is tile4 and at plane index 0, the CCS is linear and
1320++ * at index 1. A 64B CCS cache line corresponds to an area of 4x1 tiles in
1321++ * main surface. In other words, 4 bits in CCS map to a main surface cache
1322++ * line pair. The main surface pitch is required to be a multiple of four
1323++ * tile4 widths. For semi-planar formats like NV12, CCS planes follow the
1324++ * Y and UV planes i.e., planes 0 and 1 are used for Y and UV surfaces,
1325++ * planes 2 and 3 for the respective CCS.
1326++ */
1327++#define I915_FORMAT_MOD_4_TILED_MTL_MC_CCS fourcc_mod_code(INTEL, 14)
1328++
1329++/*
1330++ * Intel Color Control Surface with Clear Color (CCS) for display ver. 14 render
1331++ * compression.
1332++ *
1333++ * The main surface is tile4 and is at plane index 0 whereas CCS is linear
1334++ * and at index 1. The clear color is stored at index 2, and the pitch should
1335++ * be ignored. The clear color structure is 256 bits. The first 128 bits
1336++ * represents Raw Clear Color Red, Green, Blue and Alpha color each represented
1337++ * by 32 bits. The raw clear color is consumed by the 3d engine and generates
1338++ * the converted clear color of size 64 bits. The first 32 bits store the Lower
1339++ * Converted Clear Color value and the next 32 bits store the Higher Converted
1340++ * Clear Color value when applicable. The Converted Clear Color values are
1341++ * consumed by the DE. The last 64 bits are used to store Color Discard Enable
1342++ * and Depth Clear Value Valid which are ignored by the DE. A CCS cache line
1343++ * corresponds to an area of 4x1 tiles in the main surface. The main surface
1344++ * pitch is required to be a multiple of 4 tile widths.
1345++ */
1346++#define I915_FORMAT_MOD_4_TILED_MTL_RC_CCS_CC fourcc_mod_code(INTEL, 15)
1347++
1348+ /*
1349+ * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
1350+ *
1351+diff --git a/include/standard-headers/linux/const.h b/include/standard-headers/linux/const.h
1352+index 5e48987..1eb84b5 100644
1353+--- a/include/standard-headers/linux/const.h
1354++++ b/include/standard-headers/linux/const.h
1355+@@ -28,7 +28,7 @@
1356+ #define _BITUL(x) (_UL(1) << (x))
1357+ #define _BITULL(x) (_ULL(1) << (x))
1358+
1359+-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
1360++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
1361+ #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
1362+
1363+ #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
1364+diff --git a/include/standard-headers/linux/pci_regs.h b/include/standard-headers/linux/pci_regs.h
1365+index dc2000e..e5f558d 100644
1366+--- a/include/standard-headers/linux/pci_regs.h
1367++++ b/include/standard-headers/linux/pci_regs.h
1368+@@ -738,6 +738,7 @@
1369+ #define PCI_EXT_CAP_ID_DVSEC 0x23 /* Designated Vendor-Specific */
1370+ #define PCI_EXT_CAP_ID_DLF 0x25 /* Data Link Feature */
1371+ #define PCI_EXT_CAP_ID_PL_16GT 0x26 /* Physical Layer 16.0 GT/s */
1372++#define PCI_EXT_CAP_ID_PL_32GT 0x2A /* Physical Layer 32.0 GT/s */
1373+ #define PCI_EXT_CAP_ID_DOE 0x2E /* Data Object Exchange */
1374+ #define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_DOE
1375+
1376+diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-headers/linux/vhost_types.h
1377+index 88600e2..6691a3c 100644
1378+--- a/include/standard-headers/linux/vhost_types.h
1379++++ b/include/standard-headers/linux/vhost_types.h
1380+@@ -47,6 +47,22 @@ struct vhost_vring_addr {
1381+ uint64_t log_guest_addr;
1382+ };
1383+
1384++struct vhost_worker_state {
1385++ /*
1386++ * For VHOST_NEW_WORKER the kernel will return the new vhost_worker id.
1387++ * For VHOST_FREE_WORKER this must be set to the id of the vhost_worker
1388++ * to free.
1389++ */
1390++ unsigned int worker_id;
1391++};
1392++
1393++struct vhost_vring_worker {
1394++ /* vring index */
1395++ unsigned int index;
1396++ /* The id of the vhost_worker returned from VHOST_NEW_WORKER */
1397++ unsigned int worker_id;
1398++};
1399++
1400+ /* no alignment requirement */
1401+ struct vhost_iotlb_msg {
1402+ uint64_t iova;
1403+diff --git a/include/standard-headers/linux/virtio_blk.h b/include/standard-headers/linux/virtio_blk.h
1404+index 7155b1a..d7be3cf 100644
1405+--- a/include/standard-headers/linux/virtio_blk.h
1406++++ b/include/standard-headers/linux/virtio_blk.h
1407+@@ -138,11 +138,11 @@ struct virtio_blk_config {
1408+
1409+ /* Zoned block device characteristics (if VIRTIO_BLK_F_ZONED) */
1410+ struct virtio_blk_zoned_characteristics {
1411+- uint32_t zone_sectors;
1412+- uint32_t max_open_zones;
1413+- uint32_t max_active_zones;
1414+- uint32_t max_append_sectors;
1415+- uint32_t write_granularity;
1416++ __virtio32 zone_sectors;
1417++ __virtio32 max_open_zones;
1418++ __virtio32 max_active_zones;
1419++ __virtio32 max_append_sectors;
1420++ __virtio32 write_granularity;
1421+ uint8_t model;
1422+ uint8_t unused2[3];
1423+ } zoned;
1424+@@ -239,11 +239,11 @@ struct virtio_blk_outhdr {
1425+ */
1426+ struct virtio_blk_zone_descriptor {
1427+ /* Zone capacity */
1428+- uint64_t z_cap;
1429++ __virtio64 z_cap;
1430+ /* The starting sector of the zone */
1431+- uint64_t z_start;
1432++ __virtio64 z_start;
1433+ /* Zone write pointer position in sectors */
1434+- uint64_t z_wp;
1435++ __virtio64 z_wp;
1436+ /* Zone type */
1437+ uint8_t z_type;
1438+ /* Zone state */
1439+@@ -252,7 +252,7 @@ struct virtio_blk_zone_descriptor {
1440+ };
1441+
1442+ struct virtio_blk_zone_report {
1443+- uint64_t nr_zones;
1444++ __virtio64 nr_zones;
1445+ uint8_t reserved[56];
1446+ struct virtio_blk_zone_descriptor zones[];
1447+ };
1448+diff --git a/include/standard-headers/linux/virtio_config.h b/include/standard-headers/linux/virtio_config.h
1449+index 965ee6a..8a7d0dc 100644
1450+--- a/include/standard-headers/linux/virtio_config.h
1451++++ b/include/standard-headers/linux/virtio_config.h
1452+@@ -97,6 +97,12 @@
1453+ */
1454+ #define VIRTIO_F_SR_IOV 37
1455+
1456++/*
1457++ * This feature indicates that the driver passes extra data (besides
1458++ * identifying the virtqueue) in its device notifications.
1459++ */
1460++#define VIRTIO_F_NOTIFICATION_DATA 38
1461++
1462+ /*
1463+ * This feature indicates that the driver can reset a queue individually.
1464+ */
1465+diff --git a/include/standard-headers/linux/virtio_net.h b/include/standard-headers/linux/virtio_net.h
1466+index c0e7970..2325485 100644
1467+--- a/include/standard-headers/linux/virtio_net.h
1468++++ b/include/standard-headers/linux/virtio_net.h
1469+@@ -61,6 +61,7 @@
1470+ #define VIRTIO_NET_F_GUEST_USO6 55 /* Guest can handle USOv6 in. */
1471+ #define VIRTIO_NET_F_HOST_USO 56 /* Host can handle USO in. */
1472+ #define VIRTIO_NET_F_HASH_REPORT 57 /* Supports hash report */
1473++#define VIRTIO_NET_F_GUEST_HDRLEN 59 /* Guest provides the exact hdr_len value. */
1474+ #define VIRTIO_NET_F_RSS 60 /* Supports RSS RX steering */
1475+ #define VIRTIO_NET_F_RSC_EXT 61 /* extended coalescing info */
1476+ #define VIRTIO_NET_F_STANDBY 62 /* Act as standby for another device
1477+diff --git a/linux-headers/asm-arm64/bitsperlong.h b/linux-headers/asm-arm64/bitsperlong.h
1478+index 485d60b..6dc0bb0 100644
1479+--- a/linux-headers/asm-arm64/bitsperlong.h
1480++++ b/linux-headers/asm-arm64/bitsperlong.h
1481+@@ -1,24 +1 @@
1482+-/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
1483+-/*
1484+- * Copyright (C) 2012 ARM Ltd.
1485+- *
1486+- * This program is free software; you can redistribute it and/or modify
1487+- * it under the terms of the GNU General Public License version 2 as
1488+- * published by the Free Software Foundation.
1489+- *
1490+- * This program is distributed in the hope that it will be useful,
1491+- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1492+- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1493+- * GNU General Public License for more details.
1494+- *
1495+- * You should have received a copy of the GNU General Public License
1496+- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1497+- */
1498+-#ifndef __ASM_BITSPERLONG_H
1499+-#define __ASM_BITSPERLONG_H
1500+-
1501+-#define __BITS_PER_LONG 64
1502+-
1503+ #include <asm-generic/bitsperlong.h>
1504+-
1505+-#endif /* __ASM_BITSPERLONG_H */
1506+diff --git a/linux-headers/asm-arm64/kvm.h b/linux-headers/asm-arm64/kvm.h
1507+index d7e7bb8..38e5957 100644
1508+--- a/linux-headers/asm-arm64/kvm.h
1509++++ b/linux-headers/asm-arm64/kvm.h
1510+@@ -198,6 +198,15 @@ struct kvm_arm_copy_mte_tags {
1511+ __u64 reserved[2];
1512+ };
1513+
1514++/*
1515++ * Counter/Timer offset structure. Describe the virtual/physical offset.
1516++ * To be used with KVM_ARM_SET_COUNTER_OFFSET.
1517++ */
1518++struct kvm_arm_counter_offset {
1519++ __u64 counter_offset;
1520++ __u64 reserved;
1521++};
1522++
1523+ #define KVM_ARM_TAGS_TO_GUEST 0
1524+ #define KVM_ARM_TAGS_FROM_GUEST 1
1525+
1526+@@ -363,6 +372,10 @@ enum {
1527+ KVM_REG_ARM_VENDOR_HYP_BIT_PTP = 1,
1528+ };
1529+
1530++/* Device Control API on vm fd */
1531++#define KVM_ARM_VM_SMCCC_CTRL 0
1532++#define KVM_ARM_VM_SMCCC_FILTER 0
1533++
1534+ /* Device Control API: ARM VGIC */
1535+ #define KVM_DEV_ARM_VGIC_GRP_ADDR 0
1536+ #define KVM_DEV_ARM_VGIC_GRP_DIST_REGS 1
1537+@@ -402,6 +415,8 @@ enum {
1538+ #define KVM_ARM_VCPU_TIMER_CTRL 1
1539+ #define KVM_ARM_VCPU_TIMER_IRQ_VTIMER 0
1540+ #define KVM_ARM_VCPU_TIMER_IRQ_PTIMER 1
1541++#define KVM_ARM_VCPU_TIMER_IRQ_HVTIMER 2
1542++#define KVM_ARM_VCPU_TIMER_IRQ_HPTIMER 3
1543+ #define KVM_ARM_VCPU_PVTIME_CTRL 2
1544+ #define KVM_ARM_VCPU_PVTIME_IPA 0
1545+
1546+@@ -458,6 +473,24 @@ enum {
1547+ /* run->fail_entry.hardware_entry_failure_reason codes. */
1548+ #define KVM_EXIT_FAIL_ENTRY_CPU_UNSUPPORTED (1ULL << 0)
1549+
1550++enum kvm_smccc_filter_action {
1551++ KVM_SMCCC_FILTER_HANDLE = 0,
1552++ KVM_SMCCC_FILTER_DENY,
1553++ KVM_SMCCC_FILTER_FWD_TO_USER,
1554++
1555++};
1556++
1557++struct kvm_smccc_filter {
1558++ __u32 base;
1559++ __u32 nr_functions;
1560++ __u8 action;
1561++ __u8 pad[15];
1562++};
1563++
1564++/* arm64-specific KVM_EXIT_HYPERCALL flags */
1565++#define KVM_HYPERCALL_EXIT_SMC (1U << 0)
1566++#define KVM_HYPERCALL_EXIT_16BIT (1U << 1)
1567++
1568+ #endif
1569+
1570+ #endif /* __ARM_KVM_H__ */
1571+diff --git a/linux-headers/asm-generic/bitsperlong.h b/linux-headers/asm-generic/bitsperlong.h
1572+index 0aac245..75f320f 100644
1573+--- a/linux-headers/asm-generic/bitsperlong.h
1574++++ b/linux-headers/asm-generic/bitsperlong.h
1575+@@ -2,6 +2,17 @@
1576+ #ifndef __ASM_GENERIC_BITS_PER_LONG
1577+ #define __ASM_GENERIC_BITS_PER_LONG
1578+
1579++#ifndef __BITS_PER_LONG
1580++/*
1581++ * In order to keep safe and avoid regression, only unify uapi
1582++ * bitsperlong.h for some archs which are using newer toolchains
1583++ * that have the definitions of __CHAR_BIT__ and __SIZEOF_LONG__.
1584++ * See the following link for more info:
1585++ * https://lore.kernel.org/linux-arch/b9624545-2c80-49a1-ac3c-39264a591f7b@app.fastmail.com/
1586++ */
1587++#if defined(__CHAR_BIT__) && defined(__SIZEOF_LONG__)
1588++#define __BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
1589++#else
1590+ /*
1591+ * There seems to be no way of detecting this automatically from user
1592+ * space, so 64 bit architectures should override this in their
1593+@@ -9,8 +20,8 @@
1594+ * both 32 and 64 bit user space must not rely on CONFIG_64BIT
1595+ * to decide it, but rather check a compiler provided macro.
1596+ */
1597+-#ifndef __BITS_PER_LONG
1598+ #define __BITS_PER_LONG 32
1599+ #endif
1600++#endif
1601+
1602+ #endif /* __ASM_GENERIC_BITS_PER_LONG */
1603+diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic/unistd.h
1604+index 45fa180..fd6c1cb 100644
1605+--- a/linux-headers/asm-generic/unistd.h
1606++++ b/linux-headers/asm-generic/unistd.h
1607+@@ -38,12 +38,12 @@ __SYSCALL(__NR_io_destroy, sys_io_destroy)
1608+ __SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
1609+ #define __NR_io_cancel 3
1610+ __SYSCALL(__NR_io_cancel, sys_io_cancel)
1611++
1612+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1613+ #define __NR_io_getevents 4
1614+ __SC_3264(__NR_io_getevents, sys_io_getevents_time32, sys_io_getevents)
1615+ #endif
1616+
1617+-/* fs/xattr.c */
1618+ #define __NR_setxattr 5
1619+ __SYSCALL(__NR_setxattr, sys_setxattr)
1620+ #define __NR_lsetxattr 6
1621+@@ -68,58 +68,38 @@ __SYSCALL(__NR_removexattr, sys_removexattr)
1622+ __SYSCALL(__NR_lremovexattr, sys_lremovexattr)
1623+ #define __NR_fremovexattr 16
1624+ __SYSCALL(__NR_fremovexattr, sys_fremovexattr)
1625+-
1626+-/* fs/dcache.c */
1627+ #define __NR_getcwd 17
1628+ __SYSCALL(__NR_getcwd, sys_getcwd)
1629+-
1630+-/* fs/cookies.c */
1631+ #define __NR_lookup_dcookie 18
1632+ __SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
1633+-
1634+-/* fs/eventfd.c */
1635+ #define __NR_eventfd2 19
1636+ __SYSCALL(__NR_eventfd2, sys_eventfd2)
1637+-
1638+-/* fs/eventpoll.c */
1639+ #define __NR_epoll_create1 20
1640+ __SYSCALL(__NR_epoll_create1, sys_epoll_create1)
1641+ #define __NR_epoll_ctl 21
1642+ __SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
1643+ #define __NR_epoll_pwait 22
1644+ __SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
1645+-
1646+-/* fs/fcntl.c */
1647+ #define __NR_dup 23
1648+ __SYSCALL(__NR_dup, sys_dup)
1649+ #define __NR_dup3 24
1650+ __SYSCALL(__NR_dup3, sys_dup3)
1651+ #define __NR3264_fcntl 25
1652+ __SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
1653+-
1654+-/* fs/inotify_user.c */
1655+ #define __NR_inotify_init1 26
1656+ __SYSCALL(__NR_inotify_init1, sys_inotify_init1)
1657+ #define __NR_inotify_add_watch 27
1658+ __SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
1659+ #define __NR_inotify_rm_watch 28
1660+ __SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
1661+-
1662+-/* fs/ioctl.c */
1663+ #define __NR_ioctl 29
1664+ __SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
1665+-
1666+-/* fs/ioprio.c */
1667+ #define __NR_ioprio_set 30
1668+ __SYSCALL(__NR_ioprio_set, sys_ioprio_set)
1669+ #define __NR_ioprio_get 31
1670+ __SYSCALL(__NR_ioprio_get, sys_ioprio_get)
1671+-
1672+-/* fs/locks.c */
1673+ #define __NR_flock 32
1674+ __SYSCALL(__NR_flock, sys_flock)
1675+-
1676+-/* fs/namei.c */
1677+ #define __NR_mknodat 33
1678+ __SYSCALL(__NR_mknodat, sys_mknodat)
1679+ #define __NR_mkdirat 34
1680+@@ -130,25 +110,21 @@ __SYSCALL(__NR_unlinkat, sys_unlinkat)
1681+ __SYSCALL(__NR_symlinkat, sys_symlinkat)
1682+ #define __NR_linkat 37
1683+ __SYSCALL(__NR_linkat, sys_linkat)
1684++
1685+ #ifdef __ARCH_WANT_RENAMEAT
1686+ /* renameat is superseded with flags by renameat2 */
1687+ #define __NR_renameat 38
1688+ __SYSCALL(__NR_renameat, sys_renameat)
1689+ #endif /* __ARCH_WANT_RENAMEAT */
1690+
1691+-/* fs/namespace.c */
1692+ #define __NR_umount2 39
1693+ __SYSCALL(__NR_umount2, sys_umount)
1694+ #define __NR_mount 40
1695+ __SYSCALL(__NR_mount, sys_mount)
1696+ #define __NR_pivot_root 41
1697+ __SYSCALL(__NR_pivot_root, sys_pivot_root)
1698+-
1699+-/* fs/nfsctl.c */
1700+ #define __NR_nfsservctl 42
1701+ __SYSCALL(__NR_nfsservctl, sys_ni_syscall)
1702+-
1703+-/* fs/open.c */
1704+ #define __NR3264_statfs 43
1705+ __SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
1706+ compat_sys_statfs64)
1707+@@ -161,7 +137,6 @@ __SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
1708+ #define __NR3264_ftruncate 46
1709+ __SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
1710+ compat_sys_ftruncate64)
1711+-
1712+ #define __NR_fallocate 47
1713+ __SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
1714+ #define __NR_faccessat 48
1715+@@ -186,20 +161,12 @@ __SYSCALL(__NR_openat, sys_openat)
1716+ __SYSCALL(__NR_close, sys_close)
1717+ #define __NR_vhangup 58
1718+ __SYSCALL(__NR_vhangup, sys_vhangup)
1719+-
1720+-/* fs/pipe.c */
1721+ #define __NR_pipe2 59
1722+ __SYSCALL(__NR_pipe2, sys_pipe2)
1723+-
1724+-/* fs/quota.c */
1725+ #define __NR_quotactl 60
1726+ __SYSCALL(__NR_quotactl, sys_quotactl)
1727+-
1728+-/* fs/readdir.c */
1729+ #define __NR_getdents64 61
1730+ __SYSCALL(__NR_getdents64, sys_getdents64)
1731+-
1732+-/* fs/read_write.c */
1733+ #define __NR3264_lseek 62
1734+ __SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
1735+ #define __NR_read 63
1736+@@ -218,12 +185,9 @@ __SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
1737+ __SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
1738+ #define __NR_pwritev 70
1739+ __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
1740+-
1741+-/* fs/sendfile.c */
1742+ #define __NR3264_sendfile 71
1743+ __SYSCALL(__NR3264_sendfile, sys_sendfile64)
1744+
1745+-/* fs/select.c */
1746+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1747+ #define __NR_pselect6 72
1748+ __SC_COMP_3264(__NR_pselect6, sys_pselect6_time32, sys_pselect6, compat_sys_pselect6_time32)
1749+@@ -231,21 +195,17 @@ __SC_COMP_3264(__NR_pselect6, sys_pselect6_time32, sys_pselect6, compat_sys_psel
1750+ __SC_COMP_3264(__NR_ppoll, sys_ppoll_time32, sys_ppoll, compat_sys_ppoll_time32)
1751+ #endif
1752+
1753+-/* fs/signalfd.c */
1754+ #define __NR_signalfd4 74
1755+ __SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
1756+-
1757+-/* fs/splice.c */
1758+ #define __NR_vmsplice 75
1759+ __SYSCALL(__NR_vmsplice, sys_vmsplice)
1760+ #define __NR_splice 76
1761+ __SYSCALL(__NR_splice, sys_splice)
1762+ #define __NR_tee 77
1763+ __SYSCALL(__NR_tee, sys_tee)
1764+-
1765+-/* fs/stat.c */
1766+ #define __NR_readlinkat 78
1767+ __SYSCALL(__NR_readlinkat, sys_readlinkat)
1768++
1769+ #if defined(__ARCH_WANT_NEW_STAT) || defined(__ARCH_WANT_STAT64)
1770+ #define __NR3264_fstatat 79
1771+ __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
1772+@@ -253,13 +213,13 @@ __SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
1773+ __SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
1774+ #endif
1775+
1776+-/* fs/sync.c */
1777+ #define __NR_sync 81
1778+ __SYSCALL(__NR_sync, sys_sync)
1779+ #define __NR_fsync 82
1780+ __SYSCALL(__NR_fsync, sys_fsync)
1781+ #define __NR_fdatasync 83
1782+ __SYSCALL(__NR_fdatasync, sys_fdatasync)
1783++
1784+ #ifdef __ARCH_WANT_SYNC_FILE_RANGE2
1785+ #define __NR_sync_file_range2 84
1786+ __SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
1787+@@ -270,9 +230,9 @@ __SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
1788+ compat_sys_sync_file_range)
1789+ #endif
1790+
1791+-/* fs/timerfd.c */
1792+ #define __NR_timerfd_create 85
1793+ __SYSCALL(__NR_timerfd_create, sys_timerfd_create)
1794++
1795+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1796+ #define __NR_timerfd_settime 86
1797+ __SC_3264(__NR_timerfd_settime, sys_timerfd_settime32, \
1798+@@ -282,45 +242,35 @@ __SC_3264(__NR_timerfd_gettime, sys_timerfd_gettime32, \
1799+ sys_timerfd_gettime)
1800+ #endif
1801+
1802+-/* fs/utimes.c */
1803+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1804+ #define __NR_utimensat 88
1805+ __SC_3264(__NR_utimensat, sys_utimensat_time32, sys_utimensat)
1806+ #endif
1807+
1808+-/* kernel/acct.c */
1809+ #define __NR_acct 89
1810+ __SYSCALL(__NR_acct, sys_acct)
1811+-
1812+-/* kernel/capability.c */
1813+ #define __NR_capget 90
1814+ __SYSCALL(__NR_capget, sys_capget)
1815+ #define __NR_capset 91
1816+ __SYSCALL(__NR_capset, sys_capset)
1817+-
1818+-/* kernel/exec_domain.c */
1819+ #define __NR_personality 92
1820+ __SYSCALL(__NR_personality, sys_personality)
1821+-
1822+-/* kernel/exit.c */
1823+ #define __NR_exit 93
1824+ __SYSCALL(__NR_exit, sys_exit)
1825+ #define __NR_exit_group 94
1826+ __SYSCALL(__NR_exit_group, sys_exit_group)
1827+ #define __NR_waitid 95
1828+ __SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
1829+-
1830+-/* kernel/fork.c */
1831+ #define __NR_set_tid_address 96
1832+ __SYSCALL(__NR_set_tid_address, sys_set_tid_address)
1833+ #define __NR_unshare 97
1834+ __SYSCALL(__NR_unshare, sys_unshare)
1835+
1836+-/* kernel/futex.c */
1837+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1838+ #define __NR_futex 98
1839+ __SC_3264(__NR_futex, sys_futex_time32, sys_futex)
1840+ #endif
1841++
1842+ #define __NR_set_robust_list 99
1843+ __SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
1844+ compat_sys_set_robust_list)
1845+@@ -328,43 +278,40 @@ __SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
1846+ __SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
1847+ compat_sys_get_robust_list)
1848+
1849+-/* kernel/hrtimer.c */
1850+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1851+ #define __NR_nanosleep 101
1852+ __SC_3264(__NR_nanosleep, sys_nanosleep_time32, sys_nanosleep)
1853+ #endif
1854+
1855+-/* kernel/itimer.c */
1856+ #define __NR_getitimer 102
1857+ __SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
1858+ #define __NR_setitimer 103
1859+ __SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
1860+-
1861+-/* kernel/kexec.c */
1862+ #define __NR_kexec_load 104
1863+ __SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
1864+-
1865+-/* kernel/module.c */
1866+ #define __NR_init_module 105
1867+ __SYSCALL(__NR_init_module, sys_init_module)
1868+ #define __NR_delete_module 106
1869+ __SYSCALL(__NR_delete_module, sys_delete_module)
1870+-
1871+-/* kernel/posix-timers.c */
1872+ #define __NR_timer_create 107
1873+ __SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
1874++
1875+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1876+ #define __NR_timer_gettime 108
1877+ __SC_3264(__NR_timer_gettime, sys_timer_gettime32, sys_timer_gettime)
1878+ #endif
1879++
1880+ #define __NR_timer_getoverrun 109
1881+ __SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
1882++
1883+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1884+ #define __NR_timer_settime 110
1885+ __SC_3264(__NR_timer_settime, sys_timer_settime32, sys_timer_settime)
1886+ #endif
1887++
1888+ #define __NR_timer_delete 111
1889+ __SYSCALL(__NR_timer_delete, sys_timer_delete)
1890++
1891+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1892+ #define __NR_clock_settime 112
1893+ __SC_3264(__NR_clock_settime, sys_clock_settime32, sys_clock_settime)
1894+@@ -377,15 +324,10 @@ __SC_3264(__NR_clock_nanosleep, sys_clock_nanosleep_time32, \
1895+ sys_clock_nanosleep)
1896+ #endif
1897+
1898+-/* kernel/printk.c */
1899+ #define __NR_syslog 116
1900+ __SYSCALL(__NR_syslog, sys_syslog)
1901+-
1902+-/* kernel/ptrace.c */
1903+ #define __NR_ptrace 117
1904+ __SC_COMP(__NR_ptrace, sys_ptrace, compat_sys_ptrace)
1905+-
1906+-/* kernel/sched/core.c */
1907+ #define __NR_sched_setparam 118
1908+ __SYSCALL(__NR_sched_setparam, sys_sched_setparam)
1909+ #define __NR_sched_setscheduler 119
1910+@@ -406,13 +348,13 @@ __SYSCALL(__NR_sched_yield, sys_sched_yield)
1911+ __SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
1912+ #define __NR_sched_get_priority_min 126
1913+ __SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
1914++
1915+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1916+ #define __NR_sched_rr_get_interval 127
1917+ __SC_3264(__NR_sched_rr_get_interval, sys_sched_rr_get_interval_time32, \
1918+ sys_sched_rr_get_interval)
1919+ #endif
1920+
1921+-/* kernel/signal.c */
1922+ #define __NR_restart_syscall 128
1923+ __SYSCALL(__NR_restart_syscall, sys_restart_syscall)
1924+ #define __NR_kill 129
1925+@@ -431,18 +373,18 @@ __SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
1926+ __SC_COMP(__NR_rt_sigprocmask, sys_rt_sigprocmask, compat_sys_rt_sigprocmask)
1927+ #define __NR_rt_sigpending 136
1928+ __SC_COMP(__NR_rt_sigpending, sys_rt_sigpending, compat_sys_rt_sigpending)
1929++
1930+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1931+ #define __NR_rt_sigtimedwait 137
1932+ __SC_COMP_3264(__NR_rt_sigtimedwait, sys_rt_sigtimedwait_time32, \
1933+ sys_rt_sigtimedwait, compat_sys_rt_sigtimedwait_time32)
1934+ #endif
1935++
1936+ #define __NR_rt_sigqueueinfo 138
1937+ __SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
1938+ compat_sys_rt_sigqueueinfo)
1939+ #define __NR_rt_sigreturn 139
1940+ __SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
1941+-
1942+-/* kernel/sys.c */
1943+ #define __NR_setpriority 140
1944+ __SYSCALL(__NR_setpriority, sys_setpriority)
1945+ #define __NR_getpriority 141
1946+@@ -507,7 +449,6 @@ __SYSCALL(__NR_prctl, sys_prctl)
1947+ #define __NR_getcpu 168
1948+ __SYSCALL(__NR_getcpu, sys_getcpu)
1949+
1950+-/* kernel/time.c */
1951+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1952+ #define __NR_gettimeofday 169
1953+ __SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
1954+@@ -517,7 +458,6 @@ __SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
1955+ __SC_3264(__NR_adjtimex, sys_adjtimex_time32, sys_adjtimex)
1956+ #endif
1957+
1958+-/* kernel/sys.c */
1959+ #define __NR_getpid 172
1960+ __SYSCALL(__NR_getpid, sys_getpid)
1961+ #define __NR_getppid 173
1962+@@ -534,12 +474,11 @@ __SYSCALL(__NR_getegid, sys_getegid)
1963+ __SYSCALL(__NR_gettid, sys_gettid)
1964+ #define __NR_sysinfo 179
1965+ __SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
1966+-
1967+-/* ipc/mqueue.c */
1968+ #define __NR_mq_open 180
1969+ __SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
1970+ #define __NR_mq_unlink 181
1971+ __SYSCALL(__NR_mq_unlink, sys_mq_unlink)
1972++
1973+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
1974+ #define __NR_mq_timedsend 182
1975+ __SC_3264(__NR_mq_timedsend, sys_mq_timedsend_time32, sys_mq_timedsend)
1976+@@ -547,12 +486,11 @@ __SC_3264(__NR_mq_timedsend, sys_mq_timedsend_time32, sys_mq_timedsend)
1977+ __SC_3264(__NR_mq_timedreceive, sys_mq_timedreceive_time32, \
1978+ sys_mq_timedreceive)
1979+ #endif
1980++
1981+ #define __NR_mq_notify 184
1982+ __SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
1983+ #define __NR_mq_getsetattr 185
1984+ __SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
1985+-
1986+-/* ipc/msg.c */
1987+ #define __NR_msgget 186
1988+ __SYSCALL(__NR_msgget, sys_msgget)
1989+ #define __NR_msgctl 187
1990+@@ -561,20 +499,18 @@ __SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
1991+ __SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
1992+ #define __NR_msgsnd 189
1993+ __SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
1994+-
1995+-/* ipc/sem.c */
1996+ #define __NR_semget 190
1997+ __SYSCALL(__NR_semget, sys_semget)
1998+ #define __NR_semctl 191
1999+ __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
2000++
2001+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
2002+ #define __NR_semtimedop 192
2003+ __SC_3264(__NR_semtimedop, sys_semtimedop_time32, sys_semtimedop)
2004+ #endif
2005++
2006+ #define __NR_semop 193
2007+ __SYSCALL(__NR_semop, sys_semop)
2008+-
2009+-/* ipc/shm.c */
2010+ #define __NR_shmget 194
2011+ __SYSCALL(__NR_shmget, sys_shmget)
2012+ #define __NR_shmctl 195
2013+@@ -583,8 +519,6 @@ __SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
2014+ __SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
2015+ #define __NR_shmdt 197
2016+ __SYSCALL(__NR_shmdt, sys_shmdt)
2017+-
2018+-/* net/socket.c */
2019+ #define __NR_socket 198
2020+ __SYSCALL(__NR_socket, sys_socket)
2021+ #define __NR_socketpair 199
2022+@@ -615,40 +549,30 @@ __SYSCALL(__NR_shutdown, sys_shutdown)
2023+ __SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
2024+ #define __NR_recvmsg 212
2025+ __SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
2026+-
2027+-/* mm/filemap.c */
2028+ #define __NR_readahead 213
2029+ __SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
2030+-
2031+-/* mm/nommu.c, also with MMU */
2032+ #define __NR_brk 214
2033+ __SYSCALL(__NR_brk, sys_brk)
2034+ #define __NR_munmap 215
2035+ __SYSCALL(__NR_munmap, sys_munmap)
2036+ #define __NR_mremap 216
2037+ __SYSCALL(__NR_mremap, sys_mremap)
2038+-
2039+-/* security/keys/keyctl.c */
2040+ #define __NR_add_key 217
2041+ __SYSCALL(__NR_add_key, sys_add_key)
2042+ #define __NR_request_key 218
2043+ __SYSCALL(__NR_request_key, sys_request_key)
2044+ #define __NR_keyctl 219
2045+ __SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
2046+-
2047+-/* arch/example/kernel/sys_example.c */
2048+ #define __NR_clone 220
2049+ __SYSCALL(__NR_clone, sys_clone)
2050+ #define __NR_execve 221
2051+ __SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
2052+-
2053+ #define __NR3264_mmap 222
2054+ __SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
2055+-/* mm/fadvise.c */
2056+ #define __NR3264_fadvise64 223
2057+ __SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
2058+
2059+-/* mm/, CONFIG_MMU only */
2060++/* CONFIG_MMU only */
2061+ #ifndef __ARCH_NOMMU
2062+ #define __NR_swapon 224
2063+ __SYSCALL(__NR_swapon, sys_swapon)
2064+@@ -691,6 +615,7 @@ __SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
2065+ __SYSCALL(__NR_perf_event_open, sys_perf_event_open)
2066+ #define __NR_accept4 242
2067+ __SYSCALL(__NR_accept4, sys_accept4)
2068++
2069+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
2070+ #define __NR_recvmmsg 243
2071+ __SC_COMP_3264(__NR_recvmmsg, sys_recvmmsg_time32, sys_recvmmsg, compat_sys_recvmmsg_time32)
2072+@@ -706,6 +631,7 @@ __SC_COMP_3264(__NR_recvmmsg, sys_recvmmsg_time32, sys_recvmmsg, compat_sys_recv
2073+ #define __NR_wait4 260
2074+ __SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
2075+ #endif
2076++
2077+ #define __NR_prlimit64 261
2078+ __SYSCALL(__NR_prlimit64, sys_prlimit64)
2079+ #define __NR_fanotify_init 262
2080+@@ -716,10 +642,12 @@ __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
2081+ __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
2082+ #define __NR_open_by_handle_at 265
2083+ __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at)
2084++
2085+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
2086+ #define __NR_clock_adjtime 266
2087+ __SC_3264(__NR_clock_adjtime, sys_clock_adjtime32, sys_clock_adjtime)
2088+ #endif
2089++
2090+ #define __NR_syncfs 267
2091+ __SYSCALL(__NR_syncfs, sys_syncfs)
2092+ #define __NR_setns 268
2093+@@ -770,15 +698,19 @@ __SYSCALL(__NR_pkey_alloc, sys_pkey_alloc)
2094+ __SYSCALL(__NR_pkey_free, sys_pkey_free)
2095+ #define __NR_statx 291
2096+ __SYSCALL(__NR_statx, sys_statx)
2097++
2098+ #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
2099+ #define __NR_io_pgetevents 292
2100+ __SC_COMP_3264(__NR_io_pgetevents, sys_io_pgetevents_time32, sys_io_pgetevents, compat_sys_io_pgetevents)
2101+ #endif
2102++
2103+ #define __NR_rseq 293
2104+ __SYSCALL(__NR_rseq, sys_rseq)
2105+ #define __NR_kexec_file_load 294
2106+ __SYSCALL(__NR_kexec_file_load, sys_kexec_file_load)
2107++
2108+ /* 295 through 402 are unassigned to sync up with generic numbers, don't use */
2109++
2110+ #if defined(__SYSCALL_COMPAT) || __BITS_PER_LONG == 32
2111+ #define __NR_clock_gettime64 403
2112+ __SYSCALL(__NR_clock_gettime64, sys_clock_gettime)
2113+@@ -844,13 +776,14 @@ __SYSCALL(__NR_fsmount, sys_fsmount)
2114+ __SYSCALL(__NR_fspick, sys_fspick)
2115+ #define __NR_pidfd_open 434
2116+ __SYSCALL(__NR_pidfd_open, sys_pidfd_open)
2117++
2118+ #ifdef __ARCH_WANT_SYS_CLONE3
2119+ #define __NR_clone3 435
2120+ __SYSCALL(__NR_clone3, sys_clone3)
2121+ #endif
2122++
2123+ #define __NR_close_range 436
2124+ __SYSCALL(__NR_close_range, sys_close_range)
2125+-
2126+ #define __NR_openat2 437
2127+ __SYSCALL(__NR_openat2, sys_openat2)
2128+ #define __NR_pidfd_getfd 438
2129+@@ -865,7 +798,6 @@ __SC_COMP(__NR_epoll_pwait2, sys_epoll_pwait2, compat_sys_epoll_pwait2)
2130+ __SYSCALL(__NR_mount_setattr, sys_mount_setattr)
2131+ #define __NR_quotactl_fd 443
2132+ __SYSCALL(__NR_quotactl_fd, sys_quotactl_fd)
2133+-
2134+ #define __NR_landlock_create_ruleset 444
2135+ __SYSCALL(__NR_landlock_create_ruleset, sys_landlock_create_ruleset)
2136+ #define __NR_landlock_add_rule 445
2137+@@ -877,17 +809,19 @@ __SYSCALL(__NR_landlock_restrict_self, sys_landlock_restrict_self)
2138+ #define __NR_memfd_secret 447
2139+ __SYSCALL(__NR_memfd_secret, sys_memfd_secret)
2140+ #endif
2141++
2142+ #define __NR_process_mrelease 448
2143+ __SYSCALL(__NR_process_mrelease, sys_process_mrelease)
2144+-
2145+ #define __NR_futex_waitv 449
2146+ __SYSCALL(__NR_futex_waitv, sys_futex_waitv)
2147+-
2148+ #define __NR_set_mempolicy_home_node 450
2149+ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
2150+
2151++#define __NR_cachestat 451
2152++__SYSCALL(__NR_cachestat, sys_cachestat)
2153++
2154+ #undef __NR_syscalls
2155+-#define __NR_syscalls 451
2156++#define __NR_syscalls 452
2157+
2158+ /*
2159+ * 32 bit systems traditionally used different
2160+diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_n32.h
2161+index 1f14a6f..8233f06 100644
2162+--- a/linux-headers/asm-mips/unistd_n32.h
2163++++ b/linux-headers/asm-mips/unistd_n32.h
2164+@@ -379,5 +379,6 @@
2165+ #define __NR_process_mrelease (__NR_Linux + 448)
2166+ #define __NR_futex_waitv (__NR_Linux + 449)
2167+ #define __NR_set_mempolicy_home_node (__NR_Linux + 450)
2168++#define __NR_cachestat (__NR_Linux + 451)
2169+
2170+ #endif /* _ASM_UNISTD_N32_H */
2171+diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/unistd_n64.h
2172+index e5a8ebe..a174edc 100644
2173+--- a/linux-headers/asm-mips/unistd_n64.h
2174++++ b/linux-headers/asm-mips/unistd_n64.h
2175+@@ -355,5 +355,6 @@
2176+ #define __NR_process_mrelease (__NR_Linux + 448)
2177+ #define __NR_futex_waitv (__NR_Linux + 449)
2178+ #define __NR_set_mempolicy_home_node (__NR_Linux + 450)
2179++#define __NR_cachestat (__NR_Linux + 451)
2180+
2181+ #endif /* _ASM_UNISTD_N64_H */
2182+diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/unistd_o32.h
2183+index 871d571..c1a5351 100644
2184+--- a/linux-headers/asm-mips/unistd_o32.h
2185++++ b/linux-headers/asm-mips/unistd_o32.h
2186+@@ -425,5 +425,6 @@
2187+ #define __NR_process_mrelease (__NR_Linux + 448)
2188+ #define __NR_futex_waitv (__NR_Linux + 449)
2189+ #define __NR_set_mempolicy_home_node (__NR_Linux + 450)
2190++#define __NR_cachestat (__NR_Linux + 451)
2191+
2192+ #endif /* _ASM_UNISTD_O32_H */
2193+diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powerpc/unistd_32.h
2194+index 585c7fe..8206758 100644
2195+--- a/linux-headers/asm-powerpc/unistd_32.h
2196++++ b/linux-headers/asm-powerpc/unistd_32.h
2197+@@ -432,6 +432,7 @@
2198+ #define __NR_process_mrelease 448
2199+ #define __NR_futex_waitv 449
2200+ #define __NR_set_mempolicy_home_node 450
2201++#define __NR_cachestat 451
2202+
2203+
2204+ #endif /* _ASM_UNISTD_32_H */
2205+diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powerpc/unistd_64.h
2206+index 350f7ec..7be98c1 100644
2207+--- a/linux-headers/asm-powerpc/unistd_64.h
2208++++ b/linux-headers/asm-powerpc/unistd_64.h
2209+@@ -404,6 +404,7 @@
2210+ #define __NR_process_mrelease 448
2211+ #define __NR_futex_waitv 449
2212+ #define __NR_set_mempolicy_home_node 450
2213++#define __NR_cachestat 451
2214+
2215+
2216+ #endif /* _ASM_UNISTD_64_H */
2217+diff --git a/linux-headers/asm-riscv/bitsperlong.h b/linux-headers/asm-riscv/bitsperlong.h
2218+index cc5c45a..6dc0bb0 100644
2219+--- a/linux-headers/asm-riscv/bitsperlong.h
2220++++ b/linux-headers/asm-riscv/bitsperlong.h
2221+@@ -1,14 +1 @@
2222+-/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
2223+-/*
2224+- * Copyright (C) 2012 ARM Ltd.
2225+- * Copyright (C) 2015 Regents of the University of California
2226+- */
2227+-
2228+-#ifndef _ASM_RISCV_BITSPERLONG_H
2229+-#define _ASM_RISCV_BITSPERLONG_H
2230+-
2231+-#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
2232+-
2233+ #include <asm-generic/bitsperlong.h>
2234+-
2235+-#endif /* _ASM_RISCV_BITSPERLONG_H */
2236+diff --git a/linux-headers/asm-riscv/kvm.h b/linux-headers/asm-riscv/kvm.h
2237+index 92af6f3..930fdc4 100644
2238+--- a/linux-headers/asm-riscv/kvm.h
2239++++ b/linux-headers/asm-riscv/kvm.h
2240+@@ -12,8 +12,10 @@
2241+ #ifndef __ASSEMBLY__
2242+
2243+ #include <linux/types.h>
2244++#include <asm/bitsperlong.h>
2245+ #include <asm/ptrace.h>
2246+
2247++#define __KVM_HAVE_IRQ_LINE
2248+ #define __KVM_HAVE_READONLY_MEM
2249+
2250+ #define KVM_COALESCED_MMIO_PAGE_OFFSET 1
2251+@@ -52,6 +54,7 @@ struct kvm_riscv_config {
2252+ unsigned long mvendorid;
2253+ unsigned long marchid;
2254+ unsigned long mimpid;
2255++ unsigned long zicboz_block_size;
2256+ };
2257+
2258+ /* CORE registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
2259+@@ -64,7 +67,7 @@ struct kvm_riscv_core {
2260+ #define KVM_RISCV_MODE_S 1
2261+ #define KVM_RISCV_MODE_U 0
2262+
2263+-/* CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
2264++/* General CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
2265+ struct kvm_riscv_csr {
2266+ unsigned long sstatus;
2267+ unsigned long sie;
2268+@@ -78,6 +81,17 @@ struct kvm_riscv_csr {
2269+ unsigned long scounteren;
2270+ };
2271+
2272++/* AIA CSR registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
2273++struct kvm_riscv_aia_csr {
2274++ unsigned long siselect;
2275++ unsigned long iprio1;
2276++ unsigned long iprio2;
2277++ unsigned long sieh;
2278++ unsigned long siph;
2279++ unsigned long iprio1h;
2280++ unsigned long iprio2h;
2281++};
2282++
2283+ /* TIMER registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
2284+ struct kvm_riscv_timer {
2285+ __u64 frequency;
2286+@@ -105,9 +119,31 @@ enum KVM_RISCV_ISA_EXT_ID {
2287+ KVM_RISCV_ISA_EXT_SVINVAL,
2288+ KVM_RISCV_ISA_EXT_ZIHINTPAUSE,
2289+ KVM_RISCV_ISA_EXT_ZICBOM,
2290++ KVM_RISCV_ISA_EXT_ZICBOZ,
2291++ KVM_RISCV_ISA_EXT_ZBB,
2292++ KVM_RISCV_ISA_EXT_SSAIA,
2293++ KVM_RISCV_ISA_EXT_V,
2294++ KVM_RISCV_ISA_EXT_SVNAPOT,
2295+ KVM_RISCV_ISA_EXT_MAX,
2296+ };
2297+
2298++/*
2299++ * SBI extension IDs specific to KVM. This is not the same as the SBI
2300++ * extension IDs defined by the RISC-V SBI specification.
2301++ */
2302++enum KVM_RISCV_SBI_EXT_ID {
2303++ KVM_RISCV_SBI_EXT_V01 = 0,
2304++ KVM_RISCV_SBI_EXT_TIME,
2305++ KVM_RISCV_SBI_EXT_IPI,
2306++ KVM_RISCV_SBI_EXT_RFENCE,
2307++ KVM_RISCV_SBI_EXT_SRST,
2308++ KVM_RISCV_SBI_EXT_HSM,
2309++ KVM_RISCV_SBI_EXT_PMU,
2310++ KVM_RISCV_SBI_EXT_EXPERIMENTAL,
2311++ KVM_RISCV_SBI_EXT_VENDOR,
2312++ KVM_RISCV_SBI_EXT_MAX,
2313++};
2314++
2315+ /* Possible states for kvm_riscv_timer */
2316+ #define KVM_RISCV_TIMER_STATE_OFF 0
2317+ #define KVM_RISCV_TIMER_STATE_ON 1
2318+@@ -118,6 +154,8 @@ enum KVM_RISCV_ISA_EXT_ID {
2319+ /* If you need to interpret the index values, here is the key: */
2320+ #define KVM_REG_RISCV_TYPE_MASK 0x00000000FF000000
2321+ #define KVM_REG_RISCV_TYPE_SHIFT 24
2322++#define KVM_REG_RISCV_SUBTYPE_MASK 0x0000000000FF0000
2323++#define KVM_REG_RISCV_SUBTYPE_SHIFT 16
2324+
2325+ /* Config registers are mapped as type 1 */
2326+ #define KVM_REG_RISCV_CONFIG (0x01 << KVM_REG_RISCV_TYPE_SHIFT)
2327+@@ -131,8 +169,12 @@ enum KVM_RISCV_ISA_EXT_ID {
2328+
2329+ /* Control and status registers are mapped as type 3 */
2330+ #define KVM_REG_RISCV_CSR (0x03 << KVM_REG_RISCV_TYPE_SHIFT)
2331++#define KVM_REG_RISCV_CSR_GENERAL (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT)
2332++#define KVM_REG_RISCV_CSR_AIA (0x1 << KVM_REG_RISCV_SUBTYPE_SHIFT)
2333+ #define KVM_REG_RISCV_CSR_REG(name) \
2334+ (offsetof(struct kvm_riscv_csr, name) / sizeof(unsigned long))
2335++#define KVM_REG_RISCV_CSR_AIA_REG(name) \
2336++ (offsetof(struct kvm_riscv_aia_csr, name) / sizeof(unsigned long))
2337+
2338+ /* Timer registers are mapped as type 4 */
2339+ #define KVM_REG_RISCV_TIMER (0x04 << KVM_REG_RISCV_TYPE_SHIFT)
2340+@@ -152,6 +194,96 @@ enum KVM_RISCV_ISA_EXT_ID {
2341+ /* ISA Extension registers are mapped as type 7 */
2342+ #define KVM_REG_RISCV_ISA_EXT (0x07 << KVM_REG_RISCV_TYPE_SHIFT)
2343+
2344++/* SBI extension registers are mapped as type 8 */
2345++#define KVM_REG_RISCV_SBI_EXT (0x08 << KVM_REG_RISCV_TYPE_SHIFT)
2346++#define KVM_REG_RISCV_SBI_SINGLE (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT)
2347++#define KVM_REG_RISCV_SBI_MULTI_EN (0x1 << KVM_REG_RISCV_SUBTYPE_SHIFT)
2348++#define KVM_REG_RISCV_SBI_MULTI_DIS (0x2 << KVM_REG_RISCV_SUBTYPE_SHIFT)
2349++#define KVM_REG_RISCV_SBI_MULTI_REG(__ext_id) \
2350++ ((__ext_id) / __BITS_PER_LONG)
2351++#define KVM_REG_RISCV_SBI_MULTI_MASK(__ext_id) \
2352++ (1UL << ((__ext_id) % __BITS_PER_LONG))
2353++#define KVM_REG_RISCV_SBI_MULTI_REG_LAST \
2354++ KVM_REG_RISCV_SBI_MULTI_REG(KVM_RISCV_SBI_EXT_MAX - 1)
2355++
2356++/* V extension registers are mapped as type 9 */
2357++#define KVM_REG_RISCV_VECTOR (0x09 << KVM_REG_RISCV_TYPE_SHIFT)
2358++#define KVM_REG_RISCV_VECTOR_CSR_REG(name) \
2359++ (offsetof(struct __riscv_v_ext_state, name) / sizeof(unsigned long))
2360++#define KVM_REG_RISCV_VECTOR_REG(n) \
2361++ ((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
2362++
2363++/* Device Control API: RISC-V AIA */
2364++#define KVM_DEV_RISCV_APLIC_ALIGN 0x1000
2365++#define KVM_DEV_RISCV_APLIC_SIZE 0x4000
2366++#define KVM_DEV_RISCV_APLIC_MAX_HARTS 0x4000
2367++#define KVM_DEV_RISCV_IMSIC_ALIGN 0x1000
2368++#define KVM_DEV_RISCV_IMSIC_SIZE 0x1000
2369++
2370++#define KVM_DEV_RISCV_AIA_GRP_CONFIG 0
2371++#define KVM_DEV_RISCV_AIA_CONFIG_MODE 0
2372++#define KVM_DEV_RISCV_AIA_CONFIG_IDS 1
2373++#define KVM_DEV_RISCV_AIA_CONFIG_SRCS 2
2374++#define KVM_DEV_RISCV_AIA_CONFIG_GROUP_BITS 3
2375++#define KVM_DEV_RISCV_AIA_CONFIG_GROUP_SHIFT 4
2376++#define KVM_DEV_RISCV_AIA_CONFIG_HART_BITS 5
2377++#define KVM_DEV_RISCV_AIA_CONFIG_GUEST_BITS 6
2378++
2379++/*
2380++ * Modes of RISC-V AIA device:
2381++ * 1) EMUL (aka Emulation): Trap-n-emulate IMSIC
2382++ * 2) HWACCEL (aka HW Acceleration): Virtualize IMSIC using IMSIC guest files
2383++ * 3) AUTO (aka Automatic): Virtualize IMSIC using IMSIC guest files whenever
2384++ * available otherwise fallback to trap-n-emulation
2385++ */
2386++#define KVM_DEV_RISCV_AIA_MODE_EMUL 0
2387++#define KVM_DEV_RISCV_AIA_MODE_HWACCEL 1
2388++#define KVM_DEV_RISCV_AIA_MODE_AUTO 2
2389++
2390++#define KVM_DEV_RISCV_AIA_IDS_MIN 63
2391++#define KVM_DEV_RISCV_AIA_IDS_MAX 2048
2392++#define KVM_DEV_RISCV_AIA_SRCS_MAX 1024
2393++#define KVM_DEV_RISCV_AIA_GROUP_BITS_MAX 8
2394++#define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MIN 24
2395++#define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MAX 56
2396++#define KVM_DEV_RISCV_AIA_HART_BITS_MAX 16
2397++#define KVM_DEV_RISCV_AIA_GUEST_BITS_MAX 8
2398++
2399++#define KVM_DEV_RISCV_AIA_GRP_ADDR 1
2400++#define KVM_DEV_RISCV_AIA_ADDR_APLIC 0
2401++#define KVM_DEV_RISCV_AIA_ADDR_IMSIC(__vcpu) (1 + (__vcpu))
2402++#define KVM_DEV_RISCV_AIA_ADDR_MAX \
2403++ (1 + KVM_DEV_RISCV_APLIC_MAX_HARTS)
2404++
2405++#define KVM_DEV_RISCV_AIA_GRP_CTRL 2
2406++#define KVM_DEV_RISCV_AIA_CTRL_INIT 0
2407++
2408++/*
2409++ * The device attribute type contains the memory mapped offset of the
2410++ * APLIC register (range 0x0000-0x3FFF) and it must be 4-byte aligned.
2411++ */
2412++#define KVM_DEV_RISCV_AIA_GRP_APLIC 3
2413++
2414++/*
2415++ * The lower 12-bits of the device attribute type contains the iselect
2416++ * value of the IMSIC register (range 0x70-0xFF) whereas the higher order
2417++ * bits contains the VCPU id.
2418++ */
2419++#define KVM_DEV_RISCV_AIA_GRP_IMSIC 4
2420++#define KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS 12
2421++#define KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK \
2422++ ((1U << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) - 1)
2423++#define KVM_DEV_RISCV_AIA_IMSIC_MKATTR(__vcpu, __isel) \
2424++ (((__vcpu) << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) | \
2425++ ((__isel) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK))
2426++#define KVM_DEV_RISCV_AIA_IMSIC_GET_ISEL(__attr) \
2427++ ((__attr) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK)
2428++#define KVM_DEV_RISCV_AIA_IMSIC_GET_VCPU(__attr) \
2429++ ((__attr) >> KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS)
2430++
2431++/* One single KVM irqchip, ie. the AIA */
2432++#define KVM_NR_IRQCHIPS 1
2433++
2434+ #endif
2435+
2436+ #endif /* __LINUX_KVM_RISCV_H */
2437+diff --git a/linux-headers/asm-riscv/unistd.h b/linux-headers/asm-riscv/unistd.h
2438+index 73d7cdd..950ab3f 100644
2439+--- a/linux-headers/asm-riscv/unistd.h
2440++++ b/linux-headers/asm-riscv/unistd.h
2441+@@ -43,3 +43,12 @@
2442+ #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
2443+ #endif
2444+ __SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)
2445++
2446++/*
2447++ * Allows userspace to query the kernel for CPU architecture and
2448++ * microarchitecture details across a given set of CPUs.
2449++ */
2450++#ifndef __NR_riscv_hwprobe
2451++#define __NR_riscv_hwprobe (__NR_arch_specific_syscall + 14)
2452++#endif
2453++__SYSCALL(__NR_riscv_hwprobe, sys_riscv_hwprobe)
2454+diff --git a/linux-headers/asm-s390/unistd_32.h b/linux-headers/asm-s390/unistd_32.h
2455+index 8e644d6..ef772cc 100644
2456+--- a/linux-headers/asm-s390/unistd_32.h
2457++++ b/linux-headers/asm-s390/unistd_32.h
2458+@@ -419,8 +419,10 @@
2459+ #define __NR_landlock_create_ruleset 444
2460+ #define __NR_landlock_add_rule 445
2461+ #define __NR_landlock_restrict_self 446
2462++#define __NR_memfd_secret 447
2463+ #define __NR_process_mrelease 448
2464+ #define __NR_futex_waitv 449
2465+ #define __NR_set_mempolicy_home_node 450
2466++#define __NR_cachestat 451
2467+
2468+ #endif /* _ASM_S390_UNISTD_32_H */
2469+diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/unistd_64.h
2470+index 51da542..32354a0 100644
2471+--- a/linux-headers/asm-s390/unistd_64.h
2472++++ b/linux-headers/asm-s390/unistd_64.h
2473+@@ -367,8 +367,10 @@
2474+ #define __NR_landlock_create_ruleset 444
2475+ #define __NR_landlock_add_rule 445
2476+ #define __NR_landlock_restrict_self 446
2477++#define __NR_memfd_secret 447
2478+ #define __NR_process_mrelease 448
2479+ #define __NR_futex_waitv 449
2480+ #define __NR_set_mempolicy_home_node 450
2481++#define __NR_cachestat 451
2482+
2483+ #endif /* _ASM_S390_UNISTD_64_H */
2484+diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
2485+index 2937e7b..2b3a8f7 100644
2486+--- a/linux-headers/asm-x86/kvm.h
2487++++ b/linux-headers/asm-x86/kvm.h
2488+@@ -557,4 +557,7 @@ struct kvm_pmu_event_filter {
2489+ #define KVM_VCPU_TSC_CTRL 0 /* control group for the timestamp counter (TSC) */
2490+ #define KVM_VCPU_TSC_OFFSET 0 /* attribute for the TSC offset */
2491+
2492++/* x86-specific KVM_EXIT_HYPERCALL flags. */
2493++#define KVM_EXIT_HYPERCALL_LONG_MODE BIT(0)
2494++
2495+ #endif /* _ASM_X86_KVM_H */
2496+diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unistd_32.h
2497+index 87e1e97..37b32d8 100644
2498+--- a/linux-headers/asm-x86/unistd_32.h
2499++++ b/linux-headers/asm-x86/unistd_32.h
2500+@@ -441,6 +441,7 @@
2501+ #define __NR_process_mrelease 448
2502+ #define __NR_futex_waitv 449
2503+ #define __NR_set_mempolicy_home_node 450
2504++#define __NR_cachestat 451
2505+
2506+
2507+ #endif /* _ASM_UNISTD_32_H */
2508+diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h
2509+index 147a78d..5b55d67 100644
2510+--- a/linux-headers/asm-x86/unistd_64.h
2511++++ b/linux-headers/asm-x86/unistd_64.h
2512+@@ -363,6 +363,7 @@
2513+ #define __NR_process_mrelease 448
2514+ #define __NR_futex_waitv 449
2515+ #define __NR_set_mempolicy_home_node 450
2516++#define __NR_cachestat 451
2517+
2518+
2519+ #endif /* _ASM_UNISTD_64_H */
2520+diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h
2521+index 27098db..e8a0075 100644
2522+--- a/linux-headers/asm-x86/unistd_x32.h
2523++++ b/linux-headers/asm-x86/unistd_x32.h
2524+@@ -316,6 +316,7 @@
2525+ #define __NR_process_mrelease (__X32_SYSCALL_BIT + 448)
2526+ #define __NR_futex_waitv (__X32_SYSCALL_BIT + 449)
2527+ #define __NR_set_mempolicy_home_node (__X32_SYSCALL_BIT + 450)
2528++#define __NR_cachestat (__X32_SYSCALL_BIT + 451)
2529+ #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
2530+ #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
2531+ #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
2532+diff --git a/linux-headers/linux/const.h b/linux-headers/linux/const.h
2533+index 5e48987..1eb84b5 100644
2534+--- a/linux-headers/linux/const.h
2535++++ b/linux-headers/linux/const.h
2536+@@ -28,7 +28,7 @@
2537+ #define _BITUL(x) (_UL(1) << (x))
2538+ #define _BITULL(x) (_ULL(1) << (x))
2539+
2540+-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
2541++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
2542+ #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
2543+
2544+ #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
2545+diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
2546+index 599de3c..1f3f333 100644
2547+--- a/linux-headers/linux/kvm.h
2548++++ b/linux-headers/linux/kvm.h
2549+@@ -341,8 +341,11 @@ struct kvm_run {
2550+ __u64 nr;
2551+ __u64 args[6];
2552+ __u64 ret;
2553+- __u32 longmode;
2554+- __u32 pad;
2555++
2556++ union {
2557++ __u32 longmode;
2558++ __u64 flags;
2559++ };
2560+ } hypercall;
2561+ /* KVM_EXIT_TPR_ACCESS */
2562+ struct {
2563+@@ -1182,6 +1185,9 @@ struct kvm_ppc_resize_hpt {
2564+ #define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE 224
2565+ #define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP 225
2566+ #define KVM_CAP_PMU_EVENT_MASKED_EVENTS 226
2567++#define KVM_CAP_COUNTER_OFFSET 227
2568++#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE 228
2569++#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES 229
2570+
2571+ #ifdef KVM_CAP_IRQ_ROUTING
2572+
2573+@@ -1434,6 +1440,8 @@ enum kvm_device_type {
2574+ #define KVM_DEV_TYPE_XIVE KVM_DEV_TYPE_XIVE
2575+ KVM_DEV_TYPE_ARM_PV_TIME,
2576+ #define KVM_DEV_TYPE_ARM_PV_TIME KVM_DEV_TYPE_ARM_PV_TIME
2577++ KVM_DEV_TYPE_RISCV_AIA,
2578++#define KVM_DEV_TYPE_RISCV_AIA KVM_DEV_TYPE_RISCV_AIA
2579+ KVM_DEV_TYPE_MAX,
2580+ };
2581+
2582+@@ -1449,7 +1457,7 @@ struct kvm_vfio_spapr_tce {
2583+ #define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
2584+ #define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
2585+ #define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
2586+-#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
2587++#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45) /* deprecated */
2588+ #define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46, \
2589+ struct kvm_userspace_memory_region)
2590+ #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
2591+@@ -1541,6 +1549,8 @@ struct kvm_s390_ucas_mapping {
2592+ #define KVM_SET_PMU_EVENT_FILTER _IOW(KVMIO, 0xb2, struct kvm_pmu_event_filter)
2593+ #define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3)
2594+ #define KVM_ARM_MTE_COPY_TAGS _IOR(KVMIO, 0xb4, struct kvm_arm_copy_mte_tags)
2595++/* Available with KVM_CAP_COUNTER_OFFSET */
2596++#define KVM_ARM_SET_COUNTER_OFFSET _IOW(KVMIO, 0xb5, struct kvm_arm_counter_offset)
2597+
2598+ /* ioctl for vm fd */
2599+ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device)
2600+@@ -1603,7 +1613,7 @@ struct kvm_s390_ucas_mapping {
2601+ #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs)
2602+ #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs)
2603+ /*
2604+- * vcpu version available with KVM_ENABLE_CAP
2605++ * vcpu version available with KVM_CAP_ENABLE_CAP
2606+ * vm version available with KVM_CAP_ENABLE_CAP_VM
2607+ */
2608+ #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap)
2609+diff --git a/linux-headers/linux/mman.h b/linux-headers/linux/mman.h
2610+index 434986f..4e8cb60 100644
2611+--- a/linux-headers/linux/mman.h
2612++++ b/linux-headers/linux/mman.h
2613+@@ -4,6 +4,7 @@
2614+
2615+ #include <asm/mman.h>
2616+ #include <asm-generic/hugetlb_encode.h>
2617++#include <linux/types.h>
2618+
2619+ #define MREMAP_MAYMOVE 1
2620+ #define MREMAP_FIXED 2
2621+@@ -41,4 +42,17 @@
2622+ #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
2623+ #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
2624+
2625++struct cachestat_range {
2626++ __u64 off;
2627++ __u64 len;
2628++};
2629++
2630++struct cachestat {
2631++ __u64 nr_cache;
2632++ __u64 nr_dirty;
2633++ __u64 nr_writeback;
2634++ __u64 nr_evicted;
2635++ __u64 nr_recently_evicted;
2636++};
2637++
2638+ #endif /* _LINUX_MMAN_H */
2639+diff --git a/linux-headers/linux/psp-sev.h b/linux-headers/linux/psp-sev.h
2640+index 51d8b39..12ccb70 100644
2641+--- a/linux-headers/linux/psp-sev.h
2642++++ b/linux-headers/linux/psp-sev.h
2643+@@ -36,6 +36,13 @@ enum {
2644+ * SEV Firmware status code
2645+ */
2646+ typedef enum {
2647++ /*
2648++ * This error code is not in the SEV spec. Its purpose is to convey that
2649++ * there was an error that prevented the SEV firmware from being called.
2650++ * The SEV API error codes are 16 bits, so the -1 value will not overlap
2651++ * with possible values from the specification.
2652++ */
2653++ SEV_RET_NO_FW_CALL = -1,
2654+ SEV_RET_SUCCESS = 0,
2655+ SEV_RET_INVALID_PLATFORM_STATE,
2656+ SEV_RET_INVALID_GUEST_STATE,
2657+diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfaultfd.h
2658+index ba5d0df..14e4022 100644
2659+--- a/linux-headers/linux/userfaultfd.h
2660++++ b/linux-headers/linux/userfaultfd.h
2661+@@ -38,7 +38,8 @@
2662+ UFFD_FEATURE_MINOR_HUGETLBFS | \
2663+ UFFD_FEATURE_MINOR_SHMEM | \
2664+ UFFD_FEATURE_EXACT_ADDRESS | \
2665+- UFFD_FEATURE_WP_HUGETLBFS_SHMEM)
2666++ UFFD_FEATURE_WP_HUGETLBFS_SHMEM | \
2667++ UFFD_FEATURE_WP_UNPOPULATED)
2668+ #define UFFD_API_IOCTLS \
2669+ ((__u64)1 << _UFFDIO_REGISTER | \
2670+ (__u64)1 << _UFFDIO_UNREGISTER | \
2671+@@ -203,6 +204,12 @@ struct uffdio_api {
2672+ *
2673+ * UFFD_FEATURE_WP_HUGETLBFS_SHMEM indicates that userfaultfd
2674+ * write-protection mode is supported on both shmem and hugetlbfs.
2675++ *
2676++ * UFFD_FEATURE_WP_UNPOPULATED indicates that userfaultfd
2677++ * write-protection mode will always apply to unpopulated pages
2678++ * (i.e. empty ptes). This will be the default behavior for shmem
2679++ * & hugetlbfs, so this flag only affects anonymous memory behavior
2680++ * when userfault write-protection mode is registered.
2681+ */
2682+ #define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
2683+ #define UFFD_FEATURE_EVENT_FORK (1<<1)
2684+@@ -217,6 +224,7 @@ struct uffdio_api {
2685+ #define UFFD_FEATURE_MINOR_SHMEM (1<<10)
2686+ #define UFFD_FEATURE_EXACT_ADDRESS (1<<11)
2687+ #define UFFD_FEATURE_WP_HUGETLBFS_SHMEM (1<<12)
2688++#define UFFD_FEATURE_WP_UNPOPULATED (1<<13)
2689+ __u64 features;
2690+
2691+ __u64 ioctls;
2692+@@ -297,6 +305,13 @@ struct uffdio_writeprotect {
2693+ struct uffdio_continue {
2694+ struct uffdio_range range;
2695+ #define UFFDIO_CONTINUE_MODE_DONTWAKE ((__u64)1<<0)
2696++ /*
2697++ * UFFDIO_CONTINUE_MODE_WP will map the page write protected on
2698++ * the fly. UFFDIO_CONTINUE_MODE_WP is available only if the
2699++ * write protected ioctl is implemented for the range
2700++ * according to the uffdio_register.ioctls.
2701++ */
2702++#define UFFDIO_CONTINUE_MODE_WP ((__u64)1<<1)
2703+ __u64 mode;
2704+
2705+ /*
2706+diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
2707+index 4a534ed..16db890 100644
2708+--- a/linux-headers/linux/vfio.h
2709++++ b/linux-headers/linux/vfio.h
2710+@@ -213,6 +213,7 @@ struct vfio_device_info {
2711+ #define VFIO_DEVICE_FLAGS_AP (1 << 5) /* vfio-ap device */
2712+ #define VFIO_DEVICE_FLAGS_FSL_MC (1 << 6) /* vfio-fsl-mc device */
2713+ #define VFIO_DEVICE_FLAGS_CAPS (1 << 7) /* Info supports caps */
2714++#define VFIO_DEVICE_FLAGS_CDX (1 << 8) /* vfio-cdx device */
2715+ __u32 num_regions; /* Max region index + 1 */
2716+ __u32 num_irqs; /* Max IRQ index + 1 */
2717+ __u32 cap_offset; /* Offset within info struct of first cap */
2718+@@ -240,6 +241,20 @@ struct vfio_device_info {
2719+ #define VFIO_DEVICE_INFO_CAP_ZPCI_UTIL 3
2720+ #define VFIO_DEVICE_INFO_CAP_ZPCI_PFIP 4
2721+
2722++/*
2723++ * The following VFIO_DEVICE_INFO capability reports support for PCIe AtomicOp
2724++ * completion to the root bus with supported widths provided via flags.
2725++ */
2726++#define VFIO_DEVICE_INFO_CAP_PCI_ATOMIC_COMP 5
2727++struct vfio_device_info_cap_pci_atomic_comp {
2728++ struct vfio_info_cap_header header;
2729++ __u32 flags;
2730++#define VFIO_PCI_ATOMIC_COMP32 (1 << 0)
2731++#define VFIO_PCI_ATOMIC_COMP64 (1 << 1)
2732++#define VFIO_PCI_ATOMIC_COMP128 (1 << 2)
2733++ __u32 reserved;
2734++};
2735++
2736+ /**
2737+ * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
2738+ * struct vfio_region_info)
2739+@@ -511,6 +526,9 @@ struct vfio_region_info_cap_nvlink2_lnkspd {
2740+ * then add and unmask vectors, it's up to userspace to make the decision
2741+ * whether to allocate the maximum supported number of vectors or tear
2742+ * down setup and incrementally increase the vectors as each is enabled.
2743++ * Absence of the NORESIZE flag indicates that vectors can be enabled
2744++ * and disabled dynamically without impacting other vectors within the
2745++ * index.
2746+ */
2747+ struct vfio_irq_info {
2748+ __u32 argsz;
2749+@@ -646,6 +664,15 @@ enum {
2750+ VFIO_CCW_NUM_IRQS
2751+ };
2752+
2753++/*
2754++ * The vfio-ap bus driver makes use of the following IRQ index mapping.
2755++ * Unimplemented IRQ types return a count of zero.
2756++ */
2757++enum {
2758++ VFIO_AP_REQ_IRQ_INDEX,
2759++ VFIO_AP_NUM_IRQS
2760++};
2761++
2762+ /**
2763+ * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12,
2764+ * struct vfio_pci_hot_reset_info)
2765+diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
2766+index 92e1b70..f5c48b6 100644
2767+--- a/linux-headers/linux/vhost.h
2768++++ b/linux-headers/linux/vhost.h
2769+@@ -45,6 +45,25 @@
2770+ #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
2771+ /* Specify an eventfd file descriptor to signal on log write. */
2772+ #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
2773++/* By default, a device gets one vhost_worker that its virtqueues share. This
2774++ * command allows the owner of the device to create an additional vhost_worker
2775++ * for the device. It can later be bound to 1 or more of its virtqueues using
2776++ * the VHOST_ATTACH_VRING_WORKER command.
2777++ *
2778++ * This must be called after VHOST_SET_OWNER and the caller must be the owner
2779++ * of the device. The new thread will inherit caller's cgroups and namespaces,
2780++ * and will share the caller's memory space. The new thread will also be
2781++ * counted against the caller's RLIMIT_NPROC value.
2782++ *
2783++ * The worker's ID used in other commands will be returned in
2784++ * vhost_worker_state.
2785++ */
2786++#define VHOST_NEW_WORKER _IOR(VHOST_VIRTIO, 0x8, struct vhost_worker_state)
2787++/* Free a worker created with VHOST_NEW_WORKER if it's not attached to any
2788++ * virtqueue. If userspace is not able to call this for workers its created,
2789++ * the kernel will free all the device's workers when the device is closed.
2790++ */
2791++#define VHOST_FREE_WORKER _IOW(VHOST_VIRTIO, 0x9, struct vhost_worker_state)
2792+
2793+ /* Ring setup. */
2794+ /* Set number of descriptors in ring. This parameter can not
2795+@@ -70,6 +89,18 @@
2796+ #define VHOST_VRING_BIG_ENDIAN 1
2797+ #define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state)
2798+ #define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state)
2799++/* Attach a vhost_worker created with VHOST_NEW_WORKER to one of the device's
2800++ * virtqueues.
2801++ *
2802++ * This will replace the virtqueue's existing worker. If the replaced worker
2803++ * is no longer attached to any virtqueues, it can be freed with
2804++ * VHOST_FREE_WORKER.
2805++ */
2806++#define VHOST_ATTACH_VRING_WORKER _IOW(VHOST_VIRTIO, 0x15, \
2807++ struct vhost_vring_worker)
2808++/* Return the vring worker's ID */
2809++#define VHOST_GET_VRING_WORKER _IOWR(VHOST_VIRTIO, 0x16, \
2810++ struct vhost_vring_worker)
2811+
2812+ /* The following ioctls use eventfd file descriptors to signal and poll
2813+ * for events. */
2814diff --git a/debian/patches/ubuntu/lp2003673-update-linux-headers-6.6rc1.patch b/debian/patches/ubuntu/lp2003673-update-linux-headers-6.6rc1.patch
2815new file mode 100644
2816index 0000000..9b19716
2817--- /dev/null
2818+++ b/debian/patches/ubuntu/lp2003673-update-linux-headers-6.6rc1.patch
2819@@ -0,0 +1,782 @@
2820+From: Thomas Huth <thuth@redhat.com>
2821+Date: Tue, 12 Sep 2023 11:24:40 +0200
2822+Subject: linux-headers: Update to Linux v6.6-rc1
2823+
2824+This update contains the required header changes for the
2825+"target/s390x: AP-passthrough for PV guests" patch from
2826+Steffen Eiden.
2827+
2828+Message-ID: <20230912093432.180041-1-thuth@redhat.com>
2829+Signed-off-by: Thomas Huth <thuth@redhat.com>
2830+
2831+Origin: upstream, https://gitlab.com/qemu-project/qemu/-/commit/da3c22c74a
2832+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/2003673
2833+---
2834+ include/standard-headers/linux/fuse.h | 63 ++++++++++-
2835+ include/standard-headers/linux/vhost_types.h | 4 +
2836+ include/standard-headers/linux/virtio_net.h | 14 +++
2837+ linux-headers/asm-arm64/bitsperlong.h | 23 ++++
2838+ linux-headers/asm-generic/unistd.h | 5 +-
2839+ linux-headers/asm-mips/unistd_n32.h | 1 +
2840+ linux-headers/asm-mips/unistd_n64.h | 1 +
2841+ linux-headers/asm-mips/unistd_o32.h | 1 +
2842+ linux-headers/asm-powerpc/unistd_32.h | 1 +
2843+ linux-headers/asm-powerpc/unistd_64.h | 1 +
2844+ linux-headers/asm-riscv/bitsperlong.h | 13 +++
2845+ linux-headers/asm-riscv/kvm.h | 16 +++
2846+ linux-headers/asm-s390/kvm.h | 16 +++
2847+ linux-headers/asm-s390/unistd_32.h | 1 +
2848+ linux-headers/asm-s390/unistd_64.h | 1 +
2849+ linux-headers/asm-x86/mman.h | 10 +-
2850+ linux-headers/asm-x86/unistd_32.h | 1 +
2851+ linux-headers/asm-x86/unistd_64.h | 2 +
2852+ linux-headers/asm-x86/unistd_x32.h | 1 +
2853+ linux-headers/linux/kvm.h | 13 ++-
2854+ linux-headers/linux/stddef.h | 4 +
2855+ linux-headers/linux/userfaultfd.h | 25 ++++-
2856+ linux-headers/linux/vfio.h | 150 ++++++++++++++++++++++++++-
2857+ 23 files changed, 351 insertions(+), 16 deletions(-)
2858+
2859+diff --git a/include/standard-headers/linux/fuse.h b/include/standard-headers/linux/fuse.h
2860+index 35c131a..6b97938 100644
2861+--- a/include/standard-headers/linux/fuse.h
2862++++ b/include/standard-headers/linux/fuse.h
2863+@@ -206,6 +206,11 @@
2864+ * - add extension header
2865+ * - add FUSE_EXT_GROUPS
2866+ * - add FUSE_CREATE_SUPP_GROUP
2867++ * - add FUSE_HAS_EXPIRE_ONLY
2868++ *
2869++ * 7.39
2870++ * - add FUSE_DIRECT_IO_RELAX
2871++ * - add FUSE_STATX and related structures
2872+ */
2873+
2874+ #ifndef _LINUX_FUSE_H
2875+@@ -237,7 +242,7 @@
2876+ #define FUSE_KERNEL_VERSION 7
2877+
2878+ /** Minor version number of this interface */
2879+-#define FUSE_KERNEL_MINOR_VERSION 38
2880++#define FUSE_KERNEL_MINOR_VERSION 39
2881+
2882+ /** The node ID of the root inode */
2883+ #define FUSE_ROOT_ID 1
2884+@@ -264,6 +269,40 @@ struct fuse_attr {
2885+ uint32_t flags;
2886+ };
2887+
2888++/*
2889++ * The following structures are bit-for-bit compatible with the statx(2) ABI in
2890++ * Linux.
2891++ */
2892++struct fuse_sx_time {
2893++ int64_t tv_sec;
2894++ uint32_t tv_nsec;
2895++ int32_t __reserved;
2896++};
2897++
2898++struct fuse_statx {
2899++ uint32_t mask;
2900++ uint32_t blksize;
2901++ uint64_t attributes;
2902++ uint32_t nlink;
2903++ uint32_t uid;
2904++ uint32_t gid;
2905++ uint16_t mode;
2906++ uint16_t __spare0[1];
2907++ uint64_t ino;
2908++ uint64_t size;
2909++ uint64_t blocks;
2910++ uint64_t attributes_mask;
2911++ struct fuse_sx_time atime;
2912++ struct fuse_sx_time btime;
2913++ struct fuse_sx_time ctime;
2914++ struct fuse_sx_time mtime;
2915++ uint32_t rdev_major;
2916++ uint32_t rdev_minor;
2917++ uint32_t dev_major;
2918++ uint32_t dev_minor;
2919++ uint64_t __spare2[14];
2920++};
2921++
2922+ struct fuse_kstatfs {
2923+ uint64_t blocks;
2924+ uint64_t bfree;
2925+@@ -365,6 +404,9 @@ struct fuse_file_lock {
2926+ * FUSE_HAS_INODE_DAX: use per inode DAX
2927+ * FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir,
2928+ * symlink and mknod (single group that matches parent)
2929++ * FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation
2930++ * FUSE_DIRECT_IO_RELAX: relax restrictions in FOPEN_DIRECT_IO mode, for now
2931++ * allow shared mmap
2932+ */
2933+ #define FUSE_ASYNC_READ (1 << 0)
2934+ #define FUSE_POSIX_LOCKS (1 << 1)
2935+@@ -402,6 +444,8 @@ struct fuse_file_lock {
2936+ #define FUSE_SECURITY_CTX (1ULL << 32)
2937+ #define FUSE_HAS_INODE_DAX (1ULL << 33)
2938+ #define FUSE_CREATE_SUPP_GROUP (1ULL << 34)
2939++#define FUSE_HAS_EXPIRE_ONLY (1ULL << 35)
2940++#define FUSE_DIRECT_IO_RELAX (1ULL << 36)
2941+
2942+ /**
2943+ * CUSE INIT request/reply flags
2944+@@ -568,6 +612,7 @@ enum fuse_opcode {
2945+ FUSE_REMOVEMAPPING = 49,
2946+ FUSE_SYNCFS = 50,
2947+ FUSE_TMPFILE = 51,
2948++ FUSE_STATX = 52,
2949+
2950+ /* CUSE specific operations */
2951+ CUSE_INIT = 4096,
2952+@@ -632,6 +677,22 @@ struct fuse_attr_out {
2953+ struct fuse_attr attr;
2954+ };
2955+
2956++struct fuse_statx_in {
2957++ uint32_t getattr_flags;
2958++ uint32_t reserved;
2959++ uint64_t fh;
2960++ uint32_t sx_flags;
2961++ uint32_t sx_mask;
2962++};
2963++
2964++struct fuse_statx_out {
2965++ uint64_t attr_valid; /* Cache timeout for the attributes */
2966++ uint32_t attr_valid_nsec;
2967++ uint32_t flags;
2968++ uint64_t spare[2];
2969++ struct fuse_statx stat;
2970++};
2971++
2972+ #define FUSE_COMPAT_MKNOD_IN_SIZE 8
2973+
2974+ struct fuse_mknod_in {
2975+diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-headers/linux/vhost_types.h
2976+index 6691a3c..5ad07e1 100644
2977+--- a/include/standard-headers/linux/vhost_types.h
2978++++ b/include/standard-headers/linux/vhost_types.h
2979+@@ -181,5 +181,9 @@ struct vhost_vdpa_iova_range {
2980+ #define VHOST_BACKEND_F_SUSPEND 0x4
2981+ /* Device can be resumed */
2982+ #define VHOST_BACKEND_F_RESUME 0x5
2983++/* Device supports the driver enabling virtqueues both before and after
2984++ * DRIVER_OK
2985++ */
2986++#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK 0x6
2987+
2988+ #endif
2989+diff --git a/include/standard-headers/linux/virtio_net.h b/include/standard-headers/linux/virtio_net.h
2990+index 2325485..0f88417 100644
2991+--- a/include/standard-headers/linux/virtio_net.h
2992++++ b/include/standard-headers/linux/virtio_net.h
2993+@@ -56,6 +56,7 @@
2994+ #define VIRTIO_NET_F_MQ 22 /* Device supports Receive Flow
2995+ * Steering */
2996+ #define VIRTIO_NET_F_CTRL_MAC_ADDR 23 /* Set MAC address */
2997++#define VIRTIO_NET_F_VQ_NOTF_COAL 52 /* Device supports virtqueue notification coalescing */
2998+ #define VIRTIO_NET_F_NOTF_COAL 53 /* Device supports notifications coalescing */
2999+ #define VIRTIO_NET_F_GUEST_USO4 54 /* Guest can handle USOv4 in. */
3000+ #define VIRTIO_NET_F_GUEST_USO6 55 /* Guest can handle USOv6 in. */
3001+@@ -391,5 +392,18 @@ struct virtio_net_ctrl_coal_rx {
3002+ };
3003+
3004+ #define VIRTIO_NET_CTRL_NOTF_COAL_RX_SET 1
3005++#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_SET 2
3006++#define VIRTIO_NET_CTRL_NOTF_COAL_VQ_GET 3
3007++
3008++struct virtio_net_ctrl_coal {
3009++ uint32_t max_packets;
3010++ uint32_t max_usecs;
3011++};
3012++
3013++struct virtio_net_ctrl_coal_vq {
3014++ uint16_t vqn;
3015++ uint16_t reserved;
3016++ struct virtio_net_ctrl_coal coal;
3017++};
3018+
3019+ #endif /* _LINUX_VIRTIO_NET_H */
3020+diff --git a/linux-headers/asm-arm64/bitsperlong.h b/linux-headers/asm-arm64/bitsperlong.h
3021+index 6dc0bb0..485d60b 100644
3022+--- a/linux-headers/asm-arm64/bitsperlong.h
3023++++ b/linux-headers/asm-arm64/bitsperlong.h
3024+@@ -1 +1,24 @@
3025++/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
3026++/*
3027++ * Copyright (C) 2012 ARM Ltd.
3028++ *
3029++ * This program is free software; you can redistribute it and/or modify
3030++ * it under the terms of the GNU General Public License version 2 as
3031++ * published by the Free Software Foundation.
3032++ *
3033++ * This program is distributed in the hope that it will be useful,
3034++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3035++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3036++ * GNU General Public License for more details.
3037++ *
3038++ * You should have received a copy of the GNU General Public License
3039++ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3040++ */
3041++#ifndef __ASM_BITSPERLONG_H
3042++#define __ASM_BITSPERLONG_H
3043++
3044++#define __BITS_PER_LONG 64
3045++
3046+ #include <asm-generic/bitsperlong.h>
3047++
3048++#endif /* __ASM_BITSPERLONG_H */
3049+diff --git a/linux-headers/asm-generic/unistd.h b/linux-headers/asm-generic/unistd.h
3050+index fd6c1cb..abe087c 100644
3051+--- a/linux-headers/asm-generic/unistd.h
3052++++ b/linux-headers/asm-generic/unistd.h
3053+@@ -820,8 +820,11 @@ __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
3054+ #define __NR_cachestat 451
3055+ __SYSCALL(__NR_cachestat, sys_cachestat)
3056+
3057++#define __NR_fchmodat2 452
3058++__SYSCALL(__NR_fchmodat2, sys_fchmodat2)
3059++
3060+ #undef __NR_syscalls
3061+-#define __NR_syscalls 452
3062++#define __NR_syscalls 453
3063+
3064+ /*
3065+ * 32 bit systems traditionally used different
3066+diff --git a/linux-headers/asm-mips/unistd_n32.h b/linux-headers/asm-mips/unistd_n32.h
3067+index 8233f06..46d8500 100644
3068+--- a/linux-headers/asm-mips/unistd_n32.h
3069++++ b/linux-headers/asm-mips/unistd_n32.h
3070+@@ -380,5 +380,6 @@
3071+ #define __NR_futex_waitv (__NR_Linux + 449)
3072+ #define __NR_set_mempolicy_home_node (__NR_Linux + 450)
3073+ #define __NR_cachestat (__NR_Linux + 451)
3074++#define __NR_fchmodat2 (__NR_Linux + 452)
3075+
3076+ #endif /* _ASM_UNISTD_N32_H */
3077+diff --git a/linux-headers/asm-mips/unistd_n64.h b/linux-headers/asm-mips/unistd_n64.h
3078+index a174edc..c2f7ac6 100644
3079+--- a/linux-headers/asm-mips/unistd_n64.h
3080++++ b/linux-headers/asm-mips/unistd_n64.h
3081+@@ -356,5 +356,6 @@
3082+ #define __NR_futex_waitv (__NR_Linux + 449)
3083+ #define __NR_set_mempolicy_home_node (__NR_Linux + 450)
3084+ #define __NR_cachestat (__NR_Linux + 451)
3085++#define __NR_fchmodat2 (__NR_Linux + 452)
3086+
3087+ #endif /* _ASM_UNISTD_N64_H */
3088+diff --git a/linux-headers/asm-mips/unistd_o32.h b/linux-headers/asm-mips/unistd_o32.h
3089+index c1a5351..757c68f 100644
3090+--- a/linux-headers/asm-mips/unistd_o32.h
3091++++ b/linux-headers/asm-mips/unistd_o32.h
3092+@@ -426,5 +426,6 @@
3093+ #define __NR_futex_waitv (__NR_Linux + 449)
3094+ #define __NR_set_mempolicy_home_node (__NR_Linux + 450)
3095+ #define __NR_cachestat (__NR_Linux + 451)
3096++#define __NR_fchmodat2 (__NR_Linux + 452)
3097+
3098+ #endif /* _ASM_UNISTD_O32_H */
3099+diff --git a/linux-headers/asm-powerpc/unistd_32.h b/linux-headers/asm-powerpc/unistd_32.h
3100+index 8206758..8ef94bb 100644
3101+--- a/linux-headers/asm-powerpc/unistd_32.h
3102++++ b/linux-headers/asm-powerpc/unistd_32.h
3103+@@ -433,6 +433,7 @@
3104+ #define __NR_futex_waitv 449
3105+ #define __NR_set_mempolicy_home_node 450
3106+ #define __NR_cachestat 451
3107++#define __NR_fchmodat2 452
3108+
3109+
3110+ #endif /* _ASM_UNISTD_32_H */
3111+diff --git a/linux-headers/asm-powerpc/unistd_64.h b/linux-headers/asm-powerpc/unistd_64.h
3112+index 7be98c1..0e7ee43 100644
3113+--- a/linux-headers/asm-powerpc/unistd_64.h
3114++++ b/linux-headers/asm-powerpc/unistd_64.h
3115+@@ -405,6 +405,7 @@
3116+ #define __NR_futex_waitv 449
3117+ #define __NR_set_mempolicy_home_node 450
3118+ #define __NR_cachestat 451
3119++#define __NR_fchmodat2 452
3120+
3121+
3122+ #endif /* _ASM_UNISTD_64_H */
3123+diff --git a/linux-headers/asm-riscv/bitsperlong.h b/linux-headers/asm-riscv/bitsperlong.h
3124+index 6dc0bb0..cc5c45a 100644
3125+--- a/linux-headers/asm-riscv/bitsperlong.h
3126++++ b/linux-headers/asm-riscv/bitsperlong.h
3127+@@ -1 +1,14 @@
3128++/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
3129++/*
3130++ * Copyright (C) 2012 ARM Ltd.
3131++ * Copyright (C) 2015 Regents of the University of California
3132++ */
3133++
3134++#ifndef _ASM_RISCV_BITSPERLONG_H
3135++#define _ASM_RISCV_BITSPERLONG_H
3136++
3137++#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
3138++
3139+ #include <asm-generic/bitsperlong.h>
3140++
3141++#endif /* _ASM_RISCV_BITSPERLONG_H */
3142+diff --git a/linux-headers/asm-riscv/kvm.h b/linux-headers/asm-riscv/kvm.h
3143+index 930fdc4..992c5e4 100644
3144+--- a/linux-headers/asm-riscv/kvm.h
3145++++ b/linux-headers/asm-riscv/kvm.h
3146+@@ -55,6 +55,7 @@ struct kvm_riscv_config {
3147+ unsigned long marchid;
3148+ unsigned long mimpid;
3149+ unsigned long zicboz_block_size;
3150++ unsigned long satp_mode;
3151+ };
3152+
3153+ /* CORE registers for KVM_GET_ONE_REG and KVM_SET_ONE_REG */
3154+@@ -124,6 +125,12 @@ enum KVM_RISCV_ISA_EXT_ID {
3155+ KVM_RISCV_ISA_EXT_SSAIA,
3156+ KVM_RISCV_ISA_EXT_V,
3157+ KVM_RISCV_ISA_EXT_SVNAPOT,
3158++ KVM_RISCV_ISA_EXT_ZBA,
3159++ KVM_RISCV_ISA_EXT_ZBS,
3160++ KVM_RISCV_ISA_EXT_ZICNTR,
3161++ KVM_RISCV_ISA_EXT_ZICSR,
3162++ KVM_RISCV_ISA_EXT_ZIFENCEI,
3163++ KVM_RISCV_ISA_EXT_ZIHPM,
3164+ KVM_RISCV_ISA_EXT_MAX,
3165+ };
3166+
3167+@@ -193,6 +200,15 @@ enum KVM_RISCV_SBI_EXT_ID {
3168+
3169+ /* ISA Extension registers are mapped as type 7 */
3170+ #define KVM_REG_RISCV_ISA_EXT (0x07 << KVM_REG_RISCV_TYPE_SHIFT)
3171++#define KVM_REG_RISCV_ISA_SINGLE (0x0 << KVM_REG_RISCV_SUBTYPE_SHIFT)
3172++#define KVM_REG_RISCV_ISA_MULTI_EN (0x1 << KVM_REG_RISCV_SUBTYPE_SHIFT)
3173++#define KVM_REG_RISCV_ISA_MULTI_DIS (0x2 << KVM_REG_RISCV_SUBTYPE_SHIFT)
3174++#define KVM_REG_RISCV_ISA_MULTI_REG(__ext_id) \
3175++ ((__ext_id) / __BITS_PER_LONG)
3176++#define KVM_REG_RISCV_ISA_MULTI_MASK(__ext_id) \
3177++ (1UL << ((__ext_id) % __BITS_PER_LONG))
3178++#define KVM_REG_RISCV_ISA_MULTI_REG_LAST \
3179++ KVM_REG_RISCV_ISA_MULTI_REG(KVM_RISCV_ISA_EXT_MAX - 1)
3180+
3181+ /* SBI extension registers are mapped as type 8 */
3182+ #define KVM_REG_RISCV_SBI_EXT (0x08 << KVM_REG_RISCV_TYPE_SHIFT)
3183+diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h
3184+index e2afd95..023a276 100644
3185+--- a/linux-headers/asm-s390/kvm.h
3186++++ b/linux-headers/asm-s390/kvm.h
3187+@@ -159,6 +159,22 @@ struct kvm_s390_vm_cpu_subfunc {
3188+ __u8 reserved[1728];
3189+ };
3190+
3191++#define KVM_S390_VM_CPU_PROCESSOR_UV_FEAT_GUEST 6
3192++#define KVM_S390_VM_CPU_MACHINE_UV_FEAT_GUEST 7
3193++
3194++#define KVM_S390_VM_CPU_UV_FEAT_NR_BITS 64
3195++struct kvm_s390_vm_cpu_uv_feat {
3196++ union {
3197++ struct {
3198++ __u64 : 4;
3199++ __u64 ap : 1; /* bit 4 */
3200++ __u64 ap_intr : 1; /* bit 5 */
3201++ __u64 : 58;
3202++ };
3203++ __u64 feat;
3204++ };
3205++};
3206++
3207+ /* kvm attributes for crypto */
3208+ #define KVM_S390_VM_CRYPTO_ENABLE_AES_KW 0
3209+ #define KVM_S390_VM_CRYPTO_ENABLE_DEA_KW 1
3210+diff --git a/linux-headers/asm-s390/unistd_32.h b/linux-headers/asm-s390/unistd_32.h
3211+index ef772cc..716fa36 100644
3212+--- a/linux-headers/asm-s390/unistd_32.h
3213++++ b/linux-headers/asm-s390/unistd_32.h
3214+@@ -424,5 +424,6 @@
3215+ #define __NR_futex_waitv 449
3216+ #define __NR_set_mempolicy_home_node 450
3217+ #define __NR_cachestat 451
3218++#define __NR_fchmodat2 452
3219+
3220+ #endif /* _ASM_S390_UNISTD_32_H */
3221+diff --git a/linux-headers/asm-s390/unistd_64.h b/linux-headers/asm-s390/unistd_64.h
3222+index 32354a0..b2a11b1 100644
3223+--- a/linux-headers/asm-s390/unistd_64.h
3224++++ b/linux-headers/asm-s390/unistd_64.h
3225+@@ -372,5 +372,6 @@
3226+ #define __NR_futex_waitv 449
3227+ #define __NR_set_mempolicy_home_node 450
3228+ #define __NR_cachestat 451
3229++#define __NR_fchmodat2 452
3230+
3231+ #endif /* _ASM_S390_UNISTD_64_H */
3232+diff --git a/linux-headers/asm-x86/mman.h b/linux-headers/asm-x86/mman.h
3233+index 775dbd3..46cdc94 100644
3234+--- a/linux-headers/asm-x86/mman.h
3235++++ b/linux-headers/asm-x86/mman.h
3236+@@ -3,14 +3,10 @@
3237+ #define _ASM_X86_MMAN_H
3238+
3239+ #define MAP_32BIT 0x40 /* only give out 32bit addresses */
3240++#define MAP_ABOVE4G 0x80 /* only map above 4GB */
3241+
3242+-#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
3243+-#define arch_calc_vm_prot_bits(prot, key) ( \
3244+- ((key) & 0x1 ? VM_PKEY_BIT0 : 0) | \
3245+- ((key) & 0x2 ? VM_PKEY_BIT1 : 0) | \
3246+- ((key) & 0x4 ? VM_PKEY_BIT2 : 0) | \
3247+- ((key) & 0x8 ? VM_PKEY_BIT3 : 0))
3248+-#endif
3249++/* Flags for map_shadow_stack(2) */
3250++#define SHADOW_STACK_SET_TOKEN (1ULL << 0) /* Set up a restore token in the shadow stack */
3251+
3252+ #include <asm-generic/mman.h>
3253+
3254+diff --git a/linux-headers/asm-x86/unistd_32.h b/linux-headers/asm-x86/unistd_32.h
3255+index 37b32d8..d749ad1 100644
3256+--- a/linux-headers/asm-x86/unistd_32.h
3257++++ b/linux-headers/asm-x86/unistd_32.h
3258+@@ -442,6 +442,7 @@
3259+ #define __NR_futex_waitv 449
3260+ #define __NR_set_mempolicy_home_node 450
3261+ #define __NR_cachestat 451
3262++#define __NR_fchmodat2 452
3263+
3264+
3265+ #endif /* _ASM_UNISTD_32_H */
3266+diff --git a/linux-headers/asm-x86/unistd_64.h b/linux-headers/asm-x86/unistd_64.h
3267+index 5b55d67..cea6728 100644
3268+--- a/linux-headers/asm-x86/unistd_64.h
3269++++ b/linux-headers/asm-x86/unistd_64.h
3270+@@ -364,6 +364,8 @@
3271+ #define __NR_futex_waitv 449
3272+ #define __NR_set_mempolicy_home_node 450
3273+ #define __NR_cachestat 451
3274++#define __NR_fchmodat2 452
3275++#define __NR_map_shadow_stack 453
3276+
3277+
3278+ #endif /* _ASM_UNISTD_64_H */
3279+diff --git a/linux-headers/asm-x86/unistd_x32.h b/linux-headers/asm-x86/unistd_x32.h
3280+index e8a0075..5b2e79b 100644
3281+--- a/linux-headers/asm-x86/unistd_x32.h
3282++++ b/linux-headers/asm-x86/unistd_x32.h
3283+@@ -317,6 +317,7 @@
3284+ #define __NR_futex_waitv (__X32_SYSCALL_BIT + 449)
3285+ #define __NR_set_mempolicy_home_node (__X32_SYSCALL_BIT + 450)
3286+ #define __NR_cachestat (__X32_SYSCALL_BIT + 451)
3287++#define __NR_fchmodat2 (__X32_SYSCALL_BIT + 452)
3288+ #define __NR_rt_sigaction (__X32_SYSCALL_BIT + 512)
3289+ #define __NR_rt_sigreturn (__X32_SYSCALL_BIT + 513)
3290+ #define __NR_ioctl (__X32_SYSCALL_BIT + 514)
3291+diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
3292+index 1f3f333..0d74ee9 100644
3293+--- a/linux-headers/linux/kvm.h
3294++++ b/linux-headers/linux/kvm.h
3295+@@ -1414,9 +1414,16 @@ struct kvm_device_attr {
3296+ __u64 addr; /* userspace address of attr data */
3297+ };
3298+
3299+-#define KVM_DEV_VFIO_GROUP 1
3300+-#define KVM_DEV_VFIO_GROUP_ADD 1
3301+-#define KVM_DEV_VFIO_GROUP_DEL 2
3302++#define KVM_DEV_VFIO_FILE 1
3303++
3304++#define KVM_DEV_VFIO_FILE_ADD 1
3305++#define KVM_DEV_VFIO_FILE_DEL 2
3306++
3307++/* KVM_DEV_VFIO_GROUP aliases are for compile time uapi compatibility */
3308++#define KVM_DEV_VFIO_GROUP KVM_DEV_VFIO_FILE
3309++
3310++#define KVM_DEV_VFIO_GROUP_ADD KVM_DEV_VFIO_FILE_ADD
3311++#define KVM_DEV_VFIO_GROUP_DEL KVM_DEV_VFIO_FILE_DEL
3312+ #define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE 3
3313+
3314+ enum kvm_device_type {
3315+diff --git a/linux-headers/linux/stddef.h b/linux-headers/linux/stddef.h
3316+index bb6ea51..9bb0708 100644
3317+--- a/linux-headers/linux/stddef.h
3318++++ b/linux-headers/linux/stddef.h
3319+@@ -45,3 +45,7 @@
3320+ TYPE NAME[]; \
3321+ }
3322+ #endif
3323++
3324++#ifndef __counted_by
3325++#define __counted_by(m)
3326++#endif
3327+diff --git a/linux-headers/linux/userfaultfd.h b/linux-headers/linux/userfaultfd.h
3328+index 14e4022..59978fb 100644
3329+--- a/linux-headers/linux/userfaultfd.h
3330++++ b/linux-headers/linux/userfaultfd.h
3331+@@ -39,7 +39,8 @@
3332+ UFFD_FEATURE_MINOR_SHMEM | \
3333+ UFFD_FEATURE_EXACT_ADDRESS | \
3334+ UFFD_FEATURE_WP_HUGETLBFS_SHMEM | \
3335+- UFFD_FEATURE_WP_UNPOPULATED)
3336++ UFFD_FEATURE_WP_UNPOPULATED | \
3337++ UFFD_FEATURE_POISON)
3338+ #define UFFD_API_IOCTLS \
3339+ ((__u64)1 << _UFFDIO_REGISTER | \
3340+ (__u64)1 << _UFFDIO_UNREGISTER | \
3341+@@ -49,12 +50,14 @@
3342+ (__u64)1 << _UFFDIO_COPY | \
3343+ (__u64)1 << _UFFDIO_ZEROPAGE | \
3344+ (__u64)1 << _UFFDIO_WRITEPROTECT | \
3345+- (__u64)1 << _UFFDIO_CONTINUE)
3346++ (__u64)1 << _UFFDIO_CONTINUE | \
3347++ (__u64)1 << _UFFDIO_POISON)
3348+ #define UFFD_API_RANGE_IOCTLS_BASIC \
3349+ ((__u64)1 << _UFFDIO_WAKE | \
3350+ (__u64)1 << _UFFDIO_COPY | \
3351++ (__u64)1 << _UFFDIO_WRITEPROTECT | \
3352+ (__u64)1 << _UFFDIO_CONTINUE | \
3353+- (__u64)1 << _UFFDIO_WRITEPROTECT)
3354++ (__u64)1 << _UFFDIO_POISON)
3355+
3356+ /*
3357+ * Valid ioctl command number range with this API is from 0x00 to
3358+@@ -71,6 +74,7 @@
3359+ #define _UFFDIO_ZEROPAGE (0x04)
3360+ #define _UFFDIO_WRITEPROTECT (0x06)
3361+ #define _UFFDIO_CONTINUE (0x07)
3362++#define _UFFDIO_POISON (0x08)
3363+ #define _UFFDIO_API (0x3F)
3364+
3365+ /* userfaultfd ioctl ids */
3366+@@ -91,6 +95,8 @@
3367+ struct uffdio_writeprotect)
3368+ #define UFFDIO_CONTINUE _IOWR(UFFDIO, _UFFDIO_CONTINUE, \
3369+ struct uffdio_continue)
3370++#define UFFDIO_POISON _IOWR(UFFDIO, _UFFDIO_POISON, \
3371++ struct uffdio_poison)
3372+
3373+ /* read() structure */
3374+ struct uffd_msg {
3375+@@ -225,6 +231,7 @@ struct uffdio_api {
3376+ #define UFFD_FEATURE_EXACT_ADDRESS (1<<11)
3377+ #define UFFD_FEATURE_WP_HUGETLBFS_SHMEM (1<<12)
3378+ #define UFFD_FEATURE_WP_UNPOPULATED (1<<13)
3379++#define UFFD_FEATURE_POISON (1<<14)
3380+ __u64 features;
3381+
3382+ __u64 ioctls;
3383+@@ -321,6 +328,18 @@ struct uffdio_continue {
3384+ __s64 mapped;
3385+ };
3386+
3387++struct uffdio_poison {
3388++ struct uffdio_range range;
3389++#define UFFDIO_POISON_MODE_DONTWAKE ((__u64)1<<0)
3390++ __u64 mode;
3391++
3392++ /*
3393++ * Fields below here are written by the ioctl and must be at the end:
3394++ * the copy_from_user will not read past here.
3395++ */
3396++ __s64 updated;
3397++};
3398++
3399+ /*
3400+ * Flags for the userfaultfd(2) system call itself.
3401+ */
3402+diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h
3403+index 16db890..acf72b4 100644
3404+--- a/linux-headers/linux/vfio.h
3405++++ b/linux-headers/linux/vfio.h
3406+@@ -217,6 +217,7 @@ struct vfio_device_info {
3407+ __u32 num_regions; /* Max region index + 1 */
3408+ __u32 num_irqs; /* Max IRQ index + 1 */
3409+ __u32 cap_offset; /* Offset within info struct of first cap */
3410++ __u32 pad;
3411+ };
3412+ #define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
3413+
3414+@@ -677,11 +678,60 @@ enum {
3415+ * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 12,
3416+ * struct vfio_pci_hot_reset_info)
3417+ *
3418++ * This command is used to query the affected devices in the hot reset for
3419++ * a given device.
3420++ *
3421++ * This command always reports the segment, bus, and devfn information for
3422++ * each affected device, and selectively reports the group_id or devid per
3423++ * the way how the calling device is opened.
3424++ *
3425++ * - If the calling device is opened via the traditional group/container
3426++ * API, group_id is reported. User should check if it has owned all
3427++ * the affected devices and provides a set of group fds to prove the
3428++ * ownership in VFIO_DEVICE_PCI_HOT_RESET ioctl.
3429++ *
3430++ * - If the calling device is opened as a cdev, devid is reported.
3431++ * Flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID is set to indicate this
3432++ * data type. All the affected devices should be represented in
3433++ * the dev_set, ex. bound to a vfio driver, and also be owned by
3434++ * this interface which is determined by the following conditions:
3435++ * 1) Has a valid devid within the iommufd_ctx of the calling device.
3436++ * Ownership cannot be determined across separate iommufd_ctx and
3437++ * the cdev calling conventions do not support a proof-of-ownership
3438++ * model as provided in the legacy group interface. In this case
3439++ * valid devid with value greater than zero is provided in the return
3440++ * structure.
3441++ * 2) Does not have a valid devid within the iommufd_ctx of the calling
3442++ * device, but belongs to the same IOMMU group as the calling device
3443++ * or another opened device that has a valid devid within the
3444++ * iommufd_ctx of the calling device. This provides implicit ownership
3445++ * for devices within the same DMA isolation context. In this case
3446++ * the devid value of VFIO_PCI_DEVID_OWNED is provided in the return
3447++ * structure.
3448++ *
3449++ * A devid value of VFIO_PCI_DEVID_NOT_OWNED is provided in the return
3450++ * structure for affected devices where device is NOT represented in the
3451++ * dev_set or ownership is not available. Such devices prevent the use
3452++ * of VFIO_DEVICE_PCI_HOT_RESET ioctl outside of the proof-of-ownership
3453++ * calling conventions (ie. via legacy group accessed devices). Flag
3454++ * VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED would be set when all the
3455++ * affected devices are represented in the dev_set and also owned by
3456++ * the user. This flag is available only when
3457++ * flag VFIO_PCI_HOT_RESET_FLAG_DEV_ID is set, otherwise reserved.
3458++ * When set, user could invoke VFIO_DEVICE_PCI_HOT_RESET with a zero
3459++ * length fd array on the calling device as the ownership is validated
3460++ * by iommufd_ctx.
3461++ *
3462+ * Return: 0 on success, -errno on failure:
3463+ * -enospc = insufficient buffer, -enodev = unsupported for device.
3464+ */
3465+ struct vfio_pci_dependent_device {
3466+- __u32 group_id;
3467++ union {
3468++ __u32 group_id;
3469++ __u32 devid;
3470++#define VFIO_PCI_DEVID_OWNED 0
3471++#define VFIO_PCI_DEVID_NOT_OWNED -1
3472++ };
3473+ __u16 segment;
3474+ __u8 bus;
3475+ __u8 devfn; /* Use PCI_SLOT/PCI_FUNC */
3476+@@ -690,6 +740,8 @@ struct vfio_pci_dependent_device {
3477+ struct vfio_pci_hot_reset_info {
3478+ __u32 argsz;
3479+ __u32 flags;
3480++#define VFIO_PCI_HOT_RESET_FLAG_DEV_ID (1 << 0)
3481++#define VFIO_PCI_HOT_RESET_FLAG_DEV_ID_OWNED (1 << 1)
3482+ __u32 count;
3483+ struct vfio_pci_dependent_device devices[];
3484+ };
3485+@@ -700,6 +752,24 @@ struct vfio_pci_hot_reset_info {
3486+ * VFIO_DEVICE_PCI_HOT_RESET - _IOW(VFIO_TYPE, VFIO_BASE + 13,
3487+ * struct vfio_pci_hot_reset)
3488+ *
3489++ * A PCI hot reset results in either a bus or slot reset which may affect
3490++ * other devices sharing the bus/slot. The calling user must have
3491++ * ownership of the full set of affected devices as determined by the
3492++ * VFIO_DEVICE_GET_PCI_HOT_RESET_INFO ioctl.
3493++ *
3494++ * When called on a device file descriptor acquired through the vfio
3495++ * group interface, the user is required to provide proof of ownership
3496++ * of those affected devices via the group_fds array in struct
3497++ * vfio_pci_hot_reset.
3498++ *
3499++ * When called on a direct cdev opened vfio device, the flags field of
3500++ * struct vfio_pci_hot_reset_info reports the ownership status of the
3501++ * affected devices and this ioctl must be called with an empty group_fds
3502++ * array. See above INFO ioctl definition for ownership requirements.
3503++ *
3504++ * Mixed usage of legacy groups and cdevs across the set of affected
3505++ * devices is not supported.
3506++ *
3507+ * Return: 0 on success, -errno on failure.
3508+ */
3509+ struct vfio_pci_hot_reset {
3510+@@ -828,6 +898,83 @@ struct vfio_device_feature {
3511+
3512+ #define VFIO_DEVICE_FEATURE _IO(VFIO_TYPE, VFIO_BASE + 17)
3513+
3514++/*
3515++ * VFIO_DEVICE_BIND_IOMMUFD - _IOR(VFIO_TYPE, VFIO_BASE + 18,
3516++ * struct vfio_device_bind_iommufd)
3517++ * @argsz: User filled size of this data.
3518++ * @flags: Must be 0.
3519++ * @iommufd: iommufd to bind.
3520++ * @out_devid: The device id generated by this bind. devid is a handle for
3521++ * this device/iommufd bond and can be used in IOMMUFD commands.
3522++ *
3523++ * Bind a vfio_device to the specified iommufd.
3524++ *
3525++ * User is restricted from accessing the device before the binding operation
3526++ * is completed. Only allowed on cdev fds.
3527++ *
3528++ * Unbind is automatically conducted when device fd is closed.
3529++ *
3530++ * Return: 0 on success, -errno on failure.
3531++ */
3532++struct vfio_device_bind_iommufd {
3533++ __u32 argsz;
3534++ __u32 flags;
3535++ __s32 iommufd;
3536++ __u32 out_devid;
3537++};
3538++
3539++#define VFIO_DEVICE_BIND_IOMMUFD _IO(VFIO_TYPE, VFIO_BASE + 18)
3540++
3541++/*
3542++ * VFIO_DEVICE_ATTACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 19,
3543++ * struct vfio_device_attach_iommufd_pt)
3544++ * @argsz: User filled size of this data.
3545++ * @flags: Must be 0.
3546++ * @pt_id: Input the target id which can represent an ioas or a hwpt
3547++ * allocated via iommufd subsystem.
3548++ * Output the input ioas id or the attached hwpt id which could
3549++ * be the specified hwpt itself or a hwpt automatically created
3550++ * for the specified ioas by kernel during the attachment.
3551++ *
3552++ * Associate the device with an address space within the bound iommufd.
3553++ * Undo by VFIO_DEVICE_DETACH_IOMMUFD_PT or device fd close. This is only
3554++ * allowed on cdev fds.
3555++ *
3556++ * If a vfio device is currently attached to a valid hw_pagetable, without doing
3557++ * a VFIO_DEVICE_DETACH_IOMMUFD_PT, a second VFIO_DEVICE_ATTACH_IOMMUFD_PT ioctl
3558++ * passing in another hw_pagetable (hwpt) id is allowed. This action, also known
3559++ * as a hw_pagetable replacement, will replace the device's currently attached
3560++ * hw_pagetable with a new hw_pagetable corresponding to the given pt_id.
3561++ *
3562++ * Return: 0 on success, -errno on failure.
3563++ */
3564++struct vfio_device_attach_iommufd_pt {
3565++ __u32 argsz;
3566++ __u32 flags;
3567++ __u32 pt_id;
3568++};
3569++
3570++#define VFIO_DEVICE_ATTACH_IOMMUFD_PT _IO(VFIO_TYPE, VFIO_BASE + 19)
3571++
3572++/*
3573++ * VFIO_DEVICE_DETACH_IOMMUFD_PT - _IOW(VFIO_TYPE, VFIO_BASE + 20,
3574++ * struct vfio_device_detach_iommufd_pt)
3575++ * @argsz: User filled size of this data.
3576++ * @flags: Must be 0.
3577++ *
3578++ * Remove the association of the device and its current associated address
3579++ * space. After it, the device should be in a blocking DMA state. This is only
3580++ * allowed on cdev fds.
3581++ *
3582++ * Return: 0 on success, -errno on failure.
3583++ */
3584++struct vfio_device_detach_iommufd_pt {
3585++ __u32 argsz;
3586++ __u32 flags;
3587++};
3588++
3589++#define VFIO_DEVICE_DETACH_IOMMUFD_PT _IO(VFIO_TYPE, VFIO_BASE + 20)
3590++
3591+ /*
3592+ * Provide support for setting a PCI VF Token, which is used as a shared
3593+ * secret between PF and VF drivers. This feature may only be set on a
3594+@@ -1304,6 +1451,7 @@ struct vfio_iommu_type1_info {
3595+ #define VFIO_IOMMU_INFO_CAPS (1 << 1) /* Info supports caps */
3596+ __u64 iova_pgsizes; /* Bitmap of supported page sizes */
3597+ __u32 cap_offset; /* Offset within info struct of first cap */
3598++ __u32 pad;
3599+ };
3600+
3601+ /*

Subscribers

People subscribed via source and target branches