From: Zide Chen Date: Thu, 11 Dec 2025 07:09:40 +0000 (+0800) Subject: i386/cpu: Add APX migration support X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e105745d2086b5f67959510910a7d6f613385c52;p=thirdparty%2Fqemu.git i386/cpu: Add APX migration support Add a VMStateDescription to migrate APX EGPRs. Tested-by: Xudong Hao Signed-off-by: Zide Chen Co-developed-by: Zhao Liu Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20251211070942.3612547-8-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- diff --git a/target/i386/machine.c b/target/i386/machine.c index 0882dc3eb0..c913961281 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -1741,6 +1741,28 @@ static const VMStateDescription vmstate_cet = { }, }; +#ifdef TARGET_X86_64 +static bool apx_needed(void *opaque) +{ + X86CPU *cpu = opaque; + CPUX86State *env = &cpu->env; + + return !!(env->features[FEAT_7_1_EDX] & CPUID_7_1_EDX_APXF); +} + +static const VMStateDescription vmstate_apx = { + .name = "cpu/apx", + .version_id = 1, + .minimum_version_id = 1, + .needed = apx_needed, + .fields = (VMStateField[]) { + VMSTATE_UINTTL_SUB_ARRAY(env.regs, X86CPU, CPU_NB_REGS, + CPU_NB_EREGS - CPU_NB_REGS), + VMSTATE_END_OF_LIST() + } +}; +#endif + const VMStateDescription vmstate_x86_cpu = { .name = "cpu", .version_id = 12, @@ -1892,6 +1914,9 @@ const VMStateDescription vmstate_x86_cpu = { &vmstate_triple_fault, &vmstate_pl0_ssp, &vmstate_cet, +#ifdef TARGET_X86_64 + &vmstate_apx, +#endif NULL } };