[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 33/33] kvm: don't register smram_listener when smm is
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 33/33] kvm: don't register smram_listener when smm is off |
Date: |
Thu, 1 Jun 2017 14:41:51 +0200 |
From: Gonglei <address@hidden>
If the user set disable smm by '-machine smm=off', we
should not register smram_listener so that we can
avoid waster memory in kvm since the added sencond
address space.
Meanwhile we should assign value of the global kvm_state
before invoking the kvm_arch_init(), because
pc_machine_is_smm_enabled() may use it by kvm_has_mm().
Signed-off-by: Gonglei <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
kvm-all.c | 4 ++--
target/i386/kvm.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 2598b1f..fb87bdc 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1748,6 +1748,8 @@ static int kvm_init(MachineState *ms)
kvm_ioeventfd_any_length_allowed =
(kvm_check_extension(s, KVM_CAP_IOEVENTFD_ANY_LENGTH) > 0);
+ kvm_state = s;
+
ret = kvm_arch_init(ms, s);
if (ret < 0) {
goto err;
@@ -1757,8 +1759,6 @@ static int kvm_init(MachineState *ms)
kvm_irqchip_create(ms, s);
}
- kvm_state = s;
-
if (kvm_eventfds_allowed) {
s->memory_listener.listener.eventfd_add = kvm_mem_ioeventfd_add;
s->memory_listener.listener.eventfd_del = kvm_mem_ioeventfd_del;
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 6e7c197..8e3bbc5 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -1255,7 +1255,9 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
}
}
- if (kvm_check_extension(s, KVM_CAP_X86_SMM)) {
+ if (kvm_check_extension(s, KVM_CAP_X86_SMM) &&
+ object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE) &&
+ pc_machine_is_smm_enabled(PC_MACHINE(ms))) {
smram_machine_done.notify = register_smram_listener;
qemu_add_machine_init_done_notifier(&smram_machine_done);
}
--
1.8.3.1
- [Qemu-devel] [PULL 22/33] sockets: improve error reporting if UNIX socket path is too long, (continued)
- [Qemu-devel] [PULL 22/33] sockets: improve error reporting if UNIX socket path is too long, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 26/33] kvmclock: update system_time_msr address forcibly, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 25/33] qtest: add rtc periodic timer test, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 27/33] linuxboot_dma: compile for i486, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 28/33] edu: fix memory leak on msi_broken platforms, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 30/33] target/i386: Add GDB XML description for SSE registers, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 31/33] hw/core: nmi.c can be compiled as common-obj nowadays, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 29/33] i386/kvm: do not zero out segment flags if segment is unusable or not present, Paolo Bonzini, 2017/06/01
- [Qemu-devel] [PULL 33/33] kvm: don't register smram_listener when smm is off,
Paolo Bonzini <=
- [Qemu-devel] [PULL 32/33] nbd: make it thread-safe, fix qcow2 over nbd, Paolo Bonzini, 2017/06/01
- Re: [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, no-reply, 2017/06/01
- Re: [Qemu-devel] [PULL 00/33] Misc patches for 2017-06-01, no-reply, 2017/06/01