Skip to content

Commit 4b60742

Browse files
committed
feat: Generate bindings to enable Intel AMX's TILEDATA for XSAVE
Bindings for ARCH_REQ_XCOMP_GUEST_PERM and ARCH_XCOMP_TILEDATA are required to enable Intel AMX's XTILEDATA for XSAVE. Note that the required bits were added in kernel v6.4+. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent a24bae5 commit 4b60742

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
// automatically generated by tools/bindgen.sh
5+
6+
#![allow(
7+
non_camel_case_types,
8+
non_upper_case_globals,
9+
dead_code,
10+
non_snake_case,
11+
clippy::ptr_as_ptr,
12+
clippy::undocumented_unsafe_blocks,
13+
missing_debug_implementations,
14+
clippy::tests_outside_test_module
15+
)]
16+
17+
pub const ARCH_SET_GS: u32 = 4097;
18+
pub const ARCH_SET_FS: u32 = 4098;
19+
pub const ARCH_GET_FS: u32 = 4099;
20+
pub const ARCH_GET_GS: u32 = 4100;
21+
pub const ARCH_GET_CPUID: u32 = 4113;
22+
pub const ARCH_SET_CPUID: u32 = 4114;
23+
pub const ARCH_GET_XCOMP_SUPP: u32 = 4129;
24+
pub const ARCH_GET_XCOMP_PERM: u32 = 4130;
25+
pub const ARCH_REQ_XCOMP_PERM: u32 = 4131;
26+
pub const ARCH_GET_XCOMP_GUEST_PERM: u32 = 4132;
27+
pub const ARCH_REQ_XCOMP_GUEST_PERM: u32 = 4133;
28+
pub const ARCH_XCOMP_TILECFG: u32 = 17;
29+
pub const ARCH_XCOMP_TILEDATA: u32 = 18;
30+
pub const ARCH_MAP_VDSO_X32: u32 = 8193;
31+
pub const ARCH_MAP_VDSO_32: u32 = 8194;
32+
pub const ARCH_MAP_VDSO_64: u32 = 8195;
33+
pub const ARCH_GET_UNTAG_MASK: u32 = 16385;
34+
pub const ARCH_ENABLE_TAGGED_ADDR: u32 = 16386;
35+
pub const ARCH_GET_MAX_TAG_BITS: u32 = 16387;
36+
pub const ARCH_FORCE_TAGGED_SVA: u32 = 16388;
37+
pub const ARCH_SHSTK_ENABLE: u32 = 20481;
38+
pub const ARCH_SHSTK_DISABLE: u32 = 20482;
39+
pub const ARCH_SHSTK_LOCK: u32 = 20483;
40+
pub const ARCH_SHSTK_UNLOCK: u32 = 20484;
41+
pub const ARCH_SHSTK_STATUS: u32 = 20485;
42+
pub const ARCH_SHSTK_SHSTK: u32 = 1;
43+
pub const ARCH_SHSTK_WRSS: u32 = 2;

src/vmm/src/arch/x86_64/gen/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
// Use of this source code is governed by a BSD-style license that can be
66
// found in the THIRD-PARTY file.
77

8+
pub mod arch_prctl;
89
pub mod hyperv;
910
pub mod hyperv_tlfs;
1011
pub mod mpspec;
11-
1212
pub mod msr_index;
1313
pub mod perf_event;

tools/bindgen.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ fc-bindgen \
154154
"amazonlinux-v5.10.y/include/uapi/linux/io_uring.h" \
155155
>src/vmm/src/io_uring/gen.rs
156156

157+
# Latest upstream kernel
158+
KERNEL_SRC_DIR="linux"
159+
[ -d ${KERNEL_SRC_DIR} ] || git clone --depth 1 https://github.com/amazonlinux/linux ${KERNEL_SRC_DIR}
160+
161+
info "BINDGEN asm/prctl.h"
162+
fc-bindgen \
163+
--allowlist-var "ARCH_.*" \
164+
"${KERNEL_SRC_DIR}/arch/x86/include/uapi/asm/prctl.h" >src/vmm/src/arch/x86_64/gen/arch_prctl.rs
165+
157166
# Apply any patches
158167
info "Apply patches"
159168
for PATCH in $(dirname $0)/bindgen-patches/*.patch; do

0 commit comments

Comments
 (0)