]> git.proxmox.com Git - mirror_qemu.git/commitdiff
machine: query mem-merge machine property
authorMarcel Apfelbaum <marcel@redhat.com>
Wed, 4 Feb 2015 15:43:55 +0000 (17:43 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 11 Mar 2015 17:19:22 +0000 (18:19 +0100)
Running
    qemu-bin ... -machine pc,mem-merge=on
leads to crash:
    x86_64-softmmu/qemu-system-x86_64 -machine pc,dump-guest-core=on
    qemu-system-x86_64: qemu/util/qemu-option.c:387: qemu_opt_get_bool_helper:
    Assertion `opt->desc && opt->desc->type == QEMU_OPT_BOOL' failed.  Aborted
    (core dumped)

This happens because the commit e79d5a6 ("machine: remove qemu_machine_opts
global list") removed the global option descriptions and moved them to
MachineState's QOM properties.

Fix this by querying machine properties through designated wrappers.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
exec.c
hw/core/machine.c
include/hw/boards.h

diff --git a/exec.c b/exec.c
index f55270bdeb857c9867346bb214931f2b1854beb7..fe64009f0ce89e0b9f2e6565ffb5164e3a176ebe 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1326,7 +1326,7 @@ void qemu_ram_unset_idstr(ram_addr_t addr)
 
 static int memory_try_enable_merging(void *addr, size_t len)
 {
-    if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) {
+    if (!machine_mem_merge(current_machine)) {
         /* disabled by the user */
         return 0;
     }
index 80336839d506b0e6d80b2fa68d8680e2f069b920..e3a3e2ab73701ff045bb3e24fef0b8ce8ca8d6c1 100644 (file)
@@ -286,6 +286,7 @@ static void machine_initfn(Object *obj)
     ms->kernel_irqchip_allowed = true;
     ms->kvm_shadow_mem = -1;
     ms->dump_guest_core = true;
+    ms->mem_merge = true;
 
     object_property_add_str(obj, "accel",
                             machine_get_accel, machine_set_accel, NULL);
@@ -431,6 +432,11 @@ bool machine_dump_guest_core(MachineState *machine)
     return machine->dump_guest_core;
 }
 
+bool machine_mem_merge(MachineState *machine)
+{
+    return machine->mem_merge;
+}
+
 static const TypeInfo machine_info = {
     .name = TYPE_MACHINE,
     .parent = TYPE_OBJECT,
index bbac39d5e26aa377e28efcad503a543a04c8daed..cd6deb0547fdf4a241835e46e9d3cde56e19c86f 100644 (file)
@@ -74,6 +74,7 @@ bool machine_kernel_irqchip_required(MachineState *machine);
 int machine_kvm_shadow_mem(MachineState *machine);
 int machine_phandle_start(MachineState *machine);
 bool machine_dump_guest_core(MachineState *machine);
+bool machine_mem_merge(MachineState *machine);
 
 /**
  * MachineClass: