[RFC PATCH v1 08/42] Add plane config param to specify kernel image format

Sriram Nambakam <[email protected]> Wed, 5 Aug 2026 04:02:50 -0700
Newsgroups org.kernel.vger.kvm,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
---
 include/linux/vm_planes.h |  9 +++++++++
 init/vm_planes.c          | 20 ++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/include/linux/vm_planes.h b/include/linux/vm_planes.h
index 506de566cbd5..6d0066f70349 100644
--- a/include/linux/vm_planes.h
+++ b/include/linux/vm_planes.h
@@ -9,14 +9,23 @@
 
 #define VM_PLANE_KERNEL_NAME_MAX	128
 
+enum vm_plane_kernel_format {
+	VM_PLANE_KFMT_RAW = 0,
+	VM_PLANE_KFMT_BZIMAGE,
+	VM_PLANE_KFMT_ELF,
+};
+
 struct vm_plane_config {
 	phys_addr_t load_offset;
 	phys_addr_t memory_size;
 	unsigned int vcpu_count;
+	unsigned int kernel_format;
 	char kernel[VM_PLANE_KERNEL_NAME_MAX];
 };
 
 void __init arch_init_vm_planes(void);
+void __init load_vm_plane_kernels(unsigned int plane_count,
+				  struct vm_plane_config *plane_cfg);
 
 #endif /* CONFIG_VM_PLANES */
 
diff --git a/init/vm_planes.c b/init/vm_planes.c
index ecfe8de409a8..da9c17de4a44 100644
--- a/init/vm_planes.c
+++ b/init/vm_planes.c
@@ -8,8 +8,10 @@
 #include <linux/string.h>
 #include <linux/kvm_para.h>
 #include <linux/vm_planes.h>
+#include <linux/elf.h>
 #include <asm/cpu.h>
 #include <asm/kvm_para.h>
+#include <asm/io.h>
 
 #ifdef CONFIG_VM_PLANES
 static bool __initdata enable_vm_planes_requested;
@@ -21,6 +23,7 @@ struct vm_plane_parse_state {
 	phys_addr_t load_offset;
 	phys_addr_t memory_size;
 	unsigned int vcpu_count;
+	unsigned int kernel_format;
 	char kernel[VM_PLANE_KERNEL_NAME_MAX];
 };
 
@@ -209,6 +212,23 @@ static int __init parse_plane_cfg_line(const char *line, size_t len,
 		return 0;
 	}
 
+	if (!strcmp(key, "KERNEL_FORMAT")) {
+		unsigned int fmt;
+
+		if (!strcasecmp(val, "raw"))
+			fmt = VM_PLANE_KFMT_RAW;
+		else if (!strcasecmp(val, "bzimage"))
+			fmt = VM_PLANE_KFMT_BZIMAGE;
+		else if (!strcasecmp(val, "elf"))
+			fmt = VM_PLANE_KFMT_ELF;
+		else
+			return -EINVAL;
+
+		plane_cfg[plane_id].kernel_format = fmt;
+		state[plane_id].kernel_format = fmt;
+		return 0;
+	}
+
 	if (kstrtou64(val, 0, &parsed_u64))
 		return -EINVAL;
 
-- 
2.55.0