On 26.11.25 08:59, Jan Beulich wrote:
On 26.11.2025 00:00, Grygorii Strashko wrote:
From: Grygorii Strashko <[email protected]>
Introduce separate HVM_SAVE_RESTORE config for HVM save/restore feature,
which is enabled by default for HVM and depends on MGMT_HYPERCALLS config.
This allows to make MGMT_HYPERCALLS specific changes more granular and, if
required, make HVM save/restore optional, selectable feature.
Signed-off-by: Grygorii Strashko <[email protected]>
---
I'd like to propose this patch as a replacement of Patch 19 [1]
[1]
https://patchwork.kernel.org/project/xen-devel/patch/[email protected]/
xen/arch/x86/cpu/mcheck/vmce.c | 4 ++--
xen/arch/x86/emul-i8254.c | 4 +++-
xen/arch/x86/hvm/Kconfig | 6 ++++++
xen/arch/x86/hvm/Makefile | 2 +-
xen/arch/x86/hvm/hpet.c | 3 ++-
xen/arch/x86/hvm/hvm.c | 4 ++++
xen/arch/x86/hvm/irq.c | 2 ++
xen/arch/x86/hvm/mtrr.c | 2 ++
xen/arch/x86/hvm/pmtimer.c | 2 ++
xen/arch/x86/hvm/rtc.c | 2 ++
xen/arch/x86/hvm/vioapic.c | 2 ++
xen/arch/x86/hvm/viridian/viridian.c | 2 ++
xen/arch/x86/hvm/vlapic.c | 3 ++-
xen/arch/x86/hvm/vpic.c | 2 ++
xen/arch/x86/include/asm/hvm/save.h | 5 ++++-
15 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/xen/arch/x86/cpu/mcheck/vmce.c b/xen/arch/x86/cpu/mcheck/vmce.c
index 1a7e92506ac8..ba27f6f8bd91 100644
--- a/xen/arch/x86/cpu/mcheck/vmce.c
+++ b/xen/arch/x86/cpu/mcheck/vmce.c
@@ -349,7 +349,7 @@ int vmce_wrmsr(uint32_t msr, uint64_t val)
return ret;
}
-#if CONFIG_HVM
+#if defined(CONFIG_HVM_SAVE_RESTORE)
#if wasn't really correct to use here; #ifdef was and is wanted.
static int cf_check vmce_save_vcpu_ctxt(struct vcpu *v, hvm_domain_context_t
*h)
{
struct hvm_vmce_vcpu ctxt = {
@@ -380,10 +380,10 @@ static int cf_check vmce_load_vcpu_ctxt(struct domain *d,
hvm_domain_context_t *
return err ?: vmce_restore_vcpu(v, &ctxt);
}
+#endif /* CONFIG_HVM_SAVE_RESTORE */
HVM_REGISTER_SAVE_RESTORE(VMCE_VCPU, vmce_save_vcpu_ctxt, NULL,
vmce_load_vcpu_ctxt, 1, HVMSR_PER_VCPU);
-#endif
Why would this #endif move? (It gaining a comment is fine of course.)
Huh. Initially I've used __maybe_unused with save/restore callbacks and
HVM_REGISTER_SAVE_RESTORE() defines as NOP.
I'll correct and drop empty HVM_REGISTER_SAVE_RESTORE()
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -93,4 +93,10 @@ config MEM_SHARING
depends on INTEL_VMX
depends on MGMT_HYPERCALLS
+config HVM_SAVE_RESTORE
+ depends on MGMT_HYPERCALLS
+ def_bool y
+ help
+ Enables HVM save/load functionality.
+
endif
This wants to move up some imo; MEM_SHARING is clearing the more niche feature.
Could you clarify preferred place - before which Kconfig option in hvm/Kconfig?
--
Best regards,
-grygorii