summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hw/core/machine.c6
-rw-r--r--include/hw/boards.h1
-rw-r--r--target-i386/kvm.c3
3 files changed, 8 insertions, 2 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c
index e04e5ab330..0ad5b12781 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -284,6 +284,7 @@ static void machine_initfn(Object *obj)
MachineState *ms = MACHINE(obj);
ms->kernel_irqchip_allowed = true;
+ ms->kvm_shadow_mem = -1;
object_property_add_str(obj, "accel",
machine_get_accel, machine_set_accel, NULL);
@@ -414,6 +415,11 @@ bool machine_kernel_irqchip_required(MachineState *machine)
return machine->kernel_irqchip_required;
}
+int machine_kvm_shadow_mem(MachineState *machine)
+{
+ return machine->kvm_shadow_mem;
+}
+
static const TypeInfo machine_info = {
.name = TYPE_MACHINE,
.parent = TYPE_OBJECT,
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 69ab606964..4be3cd1416 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -69,6 +69,7 @@ bool machine_usb(MachineState *machine);
bool machine_iommu(MachineState *machine);
bool machine_kernel_irqchip_allowed(MachineState *machine);
bool machine_kernel_irqchip_required(MachineState *machine);
+int machine_kvm_shadow_mem(MachineState *machine);
/**
* MachineClass:
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index ce554e4665..acb6831028 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -890,8 +890,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
}
qemu_register_reset(kvm_unpoison_all, NULL);
- shadow_mem = qemu_opt_get_size(qemu_get_machine_opts(),
- "kvm_shadow_mem", -1);
+ shadow_mem = machine_kvm_shadow_mem(ms);
if (shadow_mem != -1) {
shadow_mem /= 4096;
ret = kvm_vm_ioctl(s, KVM_SET_NR_MMU_PAGES, shadow_mem);