hypervisor: AMX state snapshot and restore support

The TILE data state of AMX may require 8KB+ space, calling the legacy
KVM_GET_XSAVE will encounter an error since KVM_GET_XSAVE only can get
4KB space. This patch adds KVM_GET_XSAVE2 support to allow snapping more
data.

Fixes: #7533

Signed-off-by: Songqian Li <sionli@tencent.com>
This commit is contained in:
Songqian Li
2025-12-03 17:35:10 +08:00
committed by Rob Bradford
parent 5c5f33050c
commit 4b4954ff86
3 changed files with 152 additions and 16 deletions

View File

@@ -315,12 +315,19 @@ pub struct MsrEntry {
pub struct XsaveState {
#[serde_as(as = "[_; 1024usize]")]
pub region: [u32; 1024usize],
// extra data to support xsave2
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub extra: Vec<u32>,
}
impl Default for XsaveState {
fn default() -> Self {
// SAFETY: this is plain old data structure
unsafe { ::std::mem::zeroed() }
Self {
// SAFETY: this is plain old data structure
region: unsafe { std::mem::zeroed() },
extra: Vec::new(),
}
}
}