From: "Denis V. Lunev" <den@openvz.org>
To: andrey.zhadchenko@virtuozzo.com
Cc: khorenko@virtuozzo.com, svt-core@virtuozzo.com, den@openvz.org
Subject: [PATCH v2 hci-8.0/hci-8.1 5/6] i386: keep v-vmsave-vmload for nested AMD guests on vz types up to vz9.2.0 #VSTOR-152264
Date: Thu, 29 Oct 2026 12:34:35 +0100 [thread overview]
Message-ID: <20261029113436.93521-6-den@openvz.org> (raw)
In-Reply-To: <20261029113436.93521-1-den@openvz.org>
From: Denis V. Lunev <den@openvz.org>
On Zen 4 client parts (family 19h models 0x18-0x1f and 0x60-0x7f) the
6.12 kernel clears virtualized VMSAVE/VMLOAD in init_amd_zen4(), which
some BIOSes trigger on reboot, and KVM stops offering v-vmsave-vmload.
A nested guest (svm=on) started before has it in its CPUID, and QEMU
filters it on such a host, so migration, restore and snapshot revert
fail.
Add x-v-vmsave-vmload-compat and turn it on in pc_vz_9_2_compat: an
AMD guest keeps a requested v-vmsave-vmload. This does not turn host
VLS back on: KVM keeps intercepting VMLOAD and VMSAVE of the nested
guest and emulates them (nested_vmcb_needs_vls_intercept()), which is
only slower.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
hw/i386/pc.c | 1 +
target/i386/cpu.c | 7 +++++++
target/i386/cpu.h | 1 +
3 files changed, 9 insertions(+)
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 91198e8996c..5b2b2de4064 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -552,6 +552,7 @@ GlobalProperty pc_vz_9_2_compat[] = {
{ TYPE_X86_CPU, "x-tsx-compat", "on" },
{ TYPE_X86_CPU, "x-spec-ctrl-compat", "on" },
{ TYPE_X86_CPU, "x-bus-lock-detect-compat", "on" },
+ { TYPE_X86_CPU, "x-v-vmsave-vmload-compat", "on" },
};
const size_t pc_vz_9_2_compat_len = G_N_ELEMENTS(pc_vz_9_2_compat);
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 84abaf1ae31..52d7ffcb9ac 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -9134,6 +9134,11 @@ static uint64_t x86_cpu_compat_kept_features(X86CPU *cpu, FeatureWord w)
}
}
break;
+ case FEAT_SVM:
+ if (cpu->v_vmsave_vmload_compat && IS_AMD_CPU(env)) {
+ kept = CPUID_SVM_V_VMSAVE_VMLOAD;
+ }
+ break;
default:
break;
}
@@ -10102,6 +10107,8 @@ static const Property x86_cpu_properties[] = {
DEFINE_PROP_BOOL("x-spec-ctrl-compat", X86CPU, spec_ctrl_compat, false),
DEFINE_PROP_BOOL("x-bus-lock-detect-compat", X86CPU,
bus_lock_detect_compat, false),
+ DEFINE_PROP_BOOL("x-v-vmsave-vmload-compat", X86CPU,
+ v_vmsave_vmload_compat, false),
};
#ifndef CONFIG_USER_ONLY
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index b5e2d88d5d5..4f8bcbe600a 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2339,6 +2339,7 @@ struct ArchCPU {
bool tsx_compat;
bool spec_ctrl_compat;
bool bus_lock_detect_compat;
+ bool v_vmsave_vmload_compat;
/* Number of physical address bits supported */
uint32_t phys_bits;
--
2.53.0
next prev parent reply other threads:[~2026-10-29 11:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-29 11:34 [PATCH v2 hci-8.0/hci-8.1 0/6] i386: keep CPU features of guests from older nodes on vz machine types #VSTOR-152264 Denis V. Lunev
2026-10-29 11:34 ` [PATCH v2 hci-8.0/hci-8.1 1/6] i386/pc: raise the limit of compat arrays per Virtuozzo machine type to four #VSTOR-152264 Denis V. Lunev
2026-10-29 11:36 ` no-reply
2026-10-29 11:53 ` Andrey Drobyshev
2026-10-29 11:34 ` [PATCH v2 hci-8.0/hci-8.1 2/6] i386: keep hle and rtm on Virtuozzo machine types up to vz9.2.0 #PSBM-149402 Denis V. Lunev
2026-10-29 11:39 ` no-reply
2026-10-29 11:53 ` Andrey Drobyshev
2026-10-29 11:34 ` [PATCH v2 hci-8.0/hci-8.1 3/6] i386: keep spec-ctrl for AMD guests on vz machine types up to vz9.2.0 #VSTOR-151770 Denis V. Lunev
2026-10-29 11:39 ` no-reply
2026-10-29 11:53 ` Andrey Drobyshev
2026-10-29 11:34 ` [PATCH v2 hci-8.0/hci-8.1 4/6] i386: keep bus-lock-detect for AMD guests on vz machine types up to vz9.2.0 #VSTOR-152291 Denis V. Lunev
2026-10-29 11:39 ` no-reply
2026-10-29 11:53 ` Andrey Drobyshev
2026-10-29 11:34 ` Denis V. Lunev [this message]
2026-10-29 11:39 ` [PATCH v2 hci-8.0/hci-8.1 5/6] i386: keep v-vmsave-vmload for nested AMD guests on vz types up to vz9.2.0 #VSTOR-152264 no-reply
2026-10-29 11:53 ` Andrey Drobyshev
2026-10-29 11:34 ` [PATCH v2 hci-8.0/hci-8.1 6/6] i386: keep SVM leaf features without svm on vz types up to vz9.2.0 #PSBM-144630 Denis V. Lunev
2026-10-29 11:41 ` no-reply
2026-10-29 11:53 ` Andrey Drobyshev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261029113436.93521-6-den@openvz.org \
--to=den@openvz.org \
--cc=andrey.zhadchenko@virtuozzo.com \
--cc=khorenko@virtuozzo.com \
--cc=svt-core@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox