Skip to contentSkip to conversation

introduce -machine switch

PATCH New Glauber Costa 1 participant 1 message Jun 4, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 introduce -machine switch

This patch adds initial support for the -machine option, that allows command line specification of machine attributes.
Besides its value per-se, it is the saner way we found to allow for enabling/disabling of kvm's in-kernel irqchip.

machine-related options like kernel, initrd, etc, are now accepted under this switch.

Note: This is against anthony's staging.

---
 hw/boards.h     |    4 +++
 hw/pc_piix.c    |    3 ++
 qemu-options.hx |   14 ++++++++++
 vl.c            |   72 +++++++++++++++++++++++++++++++++++--------------------
 4 files changed, 67 insertions(+), 26 deletions(-)
hw/boards.h +4 -0
index 18b6b8f..bac8583 100644
@@ -35,6 +35,10 @@ extern QEMUMachine *current_machine;
 
 #define COMMON_MACHINE_OPTS() 		\
     {                                   \
+        .name = "machine",              \
+        .type = QEMU_OPT_STRING,        \
+    },                                  \
+    {                                   \
         .name = "ram_size",             \
         .type = QEMU_OPT_NUMBER,        \
     },                                  \
hw/pc_piix.c +3 -0
index f01194c..3ddb695 100644
@@ -67,6 +67,9 @@ static void pc_init1(QemuOpts *opts, int pci_enabled)
 
     vmport_init();
 
+    if (!kernel_cmdline)
+        kernel_cmdline = "";
+
     /* allocate ram and load rom/bios */
     pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
                    &below_4g_mem_size, &above_4g_mem_size);
qemu-options.hx +14 -0
index a6928b7..76ca866 100644
@@ -35,6 +35,20 @@ STEXI
 Select the emulated @var{machine} (@code{-M ?} for list)
 ETEXI
 
+DEF("machine", HAS_ARG, QEMU_OPTION_machine,
+    "-machine [machine=m][,ram_size=ram][,boot_device=dev]\n"
+    "         [,kernel=vmlinux][,cmdline=kernel_cmdline][,initrd=initrd]\n"
+    "         [,cpu=cpu_type]\n"
+    "                pc-specific options: [,acpi=on|off]\n"
+    "                kvm-x86 specific options: [,apic_in_kernel=on|off]\n"
+    "                select emulated machine (-machine ? for list)\n",
+    QEMU_ARCH_ALL)
+STEXI
+@item -machine @var{machine}[,@var{option}]
+@findex -machine
+Select the emulated @var{machine} (@code{-machine ?} for list)
+ETEXI
+
 DEF("cpu", HAS_ARG, QEMU_OPTION_cpu,
     "-cpu cpu        select CPU (-cpu ? for list)\n", QEMU_ARCH_ALL)
 STEXI
vl.c +46 -26

127 lines not on this page · raw message

Signature · 1 line
1.7.0.1