mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
x86: add support for KVM_CAP_XSAVE2 and AMX state migration
When dynamic xfeatures (e.g. AMX) are used by the guest, the xsave area would be larger than 4KB. KVM_GET_XSAVE2 and KVM_SET_XSAVE under KVM_CAP_XSAVE2 works with a xsave buffer larger than 4KB. Always use the new ioctls under KVM_CAP_XSAVE2 when KVM supports it. Signed-off-by: Jing Liu <jing2.liu@intel.com> Signed-off-by: Zeng Guang <guang.zeng@intel.com> Signed-off-by: Wei Wang <wei.w.wang@intel.com> Signed-off-by: Yang Zhong <yang.zhong@intel.com> Message-Id: <20220217060434.52460-7-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f21a48171c
commit
e56dd3c70a
3 changed files with 59 additions and 15 deletions
|
@ -126,6 +126,20 @@ void x86_cpu_xsave_all_areas(X86CPU *cpu, void *buf, uint32_t buflen)
|
|||
|
||||
memcpy(pkru, &env->pkru, sizeof(env->pkru));
|
||||
}
|
||||
|
||||
e = &x86_ext_save_areas[XSTATE_XTILE_CFG_BIT];
|
||||
if (e->size && e->offset) {
|
||||
XSaveXTILECFG *tilecfg = buf + e->offset;
|
||||
|
||||
memcpy(tilecfg, &env->xtilecfg, sizeof(env->xtilecfg));
|
||||
}
|
||||
|
||||
e = &x86_ext_save_areas[XSTATE_XTILE_DATA_BIT];
|
||||
if (e->size && e->offset && buflen >= e->size + e->offset) {
|
||||
XSaveXTILEDATA *tiledata = buf + e->offset;
|
||||
|
||||
memcpy(tiledata, &env->xtiledata, sizeof(env->xtiledata));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -247,5 +261,19 @@ void x86_cpu_xrstor_all_areas(X86CPU *cpu, const void *buf, uint32_t buflen)
|
|||
pkru = buf + e->offset;
|
||||
memcpy(&env->pkru, pkru, sizeof(env->pkru));
|
||||
}
|
||||
|
||||
e = &x86_ext_save_areas[XSTATE_XTILE_CFG_BIT];
|
||||
if (e->size && e->offset) {
|
||||
const XSaveXTILECFG *tilecfg = buf + e->offset;
|
||||
|
||||
memcpy(&env->xtilecfg, tilecfg, sizeof(env->xtilecfg));
|
||||
}
|
||||
|
||||
e = &x86_ext_save_areas[XSTATE_XTILE_DATA_BIT];
|
||||
if (e->size && e->offset && buflen >= e->size + e->offset) {
|
||||
const XSaveXTILEDATA *tiledata = buf + e->offset;
|
||||
|
||||
memcpy(&env->xtiledata, tiledata, sizeof(env->xtiledata));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue