[RFC PATCH 01/46] KVM: luo: Delegate VM creation type to kvm_arch_vm_luo_preserve

From: Pasha Tatashin

Date: Sun Sep 20 2026 - 15:38:13 EST


Remove the architecture-specific #ifdef ladder setting ser->type in
kvm_luo_preserve(). Leaving ser->type zero by default allows
kvm_arch_vm_luo_preserve() to populate the architecture-defined VM
creation flags without referencing unexported architecture symbols in
generic KVM code.

Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
---
virt/kvm/kvm_luo.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/virt/kvm/kvm_luo.c b/virt/kvm/kvm_luo.c
index 025b53151b6a..b3bd9bebe17a 100644
--- a/virt/kvm/kvm_luo.c
+++ b/virt/kvm/kvm_luo.c
@@ -73,16 +73,13 @@ static int kvm_luo_preserve(struct liveupdate_file_op_args *args)
if (IS_ERR(ser))
return PTR_ERR(ser);

-#if defined(CONFIG_X86)
- ser->type = kvm->arch.vm_type;
-#elif defined(CONFIG_ARM64)
- ser->type = kvm_phys_shift(&kvm->arch.mmu);
- if (kvm_vm_is_protected(kvm))
- ser->type |= KVM_VM_TYPE_ARM_PROTECTED;
-
-#else
+ /*
+ * @type is the argument the new kernel will pass to KVM_CREATE_VM, and
+ * only the architecture knows how to spell it. kvm_arch_vm_luo_preserve()
+ * fills it in; leaving it zero here is the right answer for an
+ * architecture that does not implement the hook.
+ */
ser->type = 0;
-#endif

args->serialized_data = virt_to_phys(ser);
return 0;
@@ -115,7 +112,6 @@ static int kvm_luo_retrieve(struct liveupdate_file_op_args *args)
kvm = file->private_data;

args->file = file;
- kho_restore_free(ser);

kvm_uevent_notify_vm_create(kvm);
return 0;
@@ -147,11 +143,7 @@ static void kvm_luo_finish(struct liveupdate_file_op_args *args)
{
struct kvm_luo_ser *ser;

- /*
- * If retrieve_status is true or set to error, nothing to do here.
- * Already cleaned up in kvm_luo_retrieve().
- */
- if (args->retrieve_status)
+ if (args->retrieve_status < 0)
return;

if (!args->serialized_data)
--
2.55.0.1082.g2b9226bbc0-goog