@@ -9,5 +9,6 @@
#define FW_START 1
#define LINUX_START_FWCFG 2
#define LINUX_START_BOOT 3
+#define LINUX_START_PVHBOOT 4
-#endif
+#endif /* BENCHMARK_H */
@@ -240,10 +240,17 @@ void boot_pvh_from_fw_cfg(void)
if (!sz)
panic();
+
fw_cfg_select(FW_CFG_KERNEL_ENTRY);
kernel_entry = (void *) fw_cfg_readl_le();
asm volatile("movl %0, %%ebx" : : "r"(&start_info));
+#ifdef BENCHMARK_HACK
+ /* Exit just before jumping to vmlinux, so that it is easy
+ * to time/profile the firmware.
+ */
+ outb(LINUX_EXIT_PORT, LINUX_START_PVHBOOT);
+#endif
asm volatile("jmp *%2" : : "a" (0x2badb002),
"b"(&start_info), "c"(kernel_entry));
panic();
This commit adds a PVH specific VM exit point for use in benchmarking boot times using a QEMU specific device that terminates the QEMU process and thus the VM itself when handling those VM exits. Since the VM terminates right at those exit points, generic tools like time can be used to measure the time spent between the QEMU startup and termination moments. The QEMU device used for those measurement is called isa-debug-exit for the PC and Q35 machine types. These devices take 2 arguments: iobase and iosize. iobase specifies which IO port we need to write into to have these devices eventually handle the corresponding VM exit. If for example, QEMU is started with the following argument: -device isa-debug-exit,iobase=0xf4 then any IO write to 0xf4 will terminate the QEMU process and the corresponding VM. Signed-off-by: Liam Merwick <liam.merwick@oracle.com> --- benchmark.h | 3 ++- fw_cfg.c | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-)