From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Marcelo Tosatti" <mtosatti@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Xiaoyao Li" <xiaoyao.li@intel.com>,
"Chenyi Qiang" <chenyi.qiang@intel.com>,
qemu-devel@nongnu.org
Subject: [PATCH 2/2] i386/kvm: Drop KVM_CAP_X86_SMM check in kvm_arch_init()
Date: Tue, 29 Jul 2025 14:20:14 +0800 [thread overview]
Message-ID: <20250729062014.1669578-3-xiaoyao.li@intel.com> (raw)
In-Reply-To: <20250729062014.1669578-1-xiaoyao.li@intel.com>
x86_machine_is_smm_enabled() checks the KVM_CAP_X86_SMM for KVM
case. No need to check KVM_CAP_X86_SMM specifically.
One benefit of checking it specifically is that it can return early when
KVM_CAP_X86_SMM is not supported. But considering KVM_CAP_X86_SMM was
added in KVM 10 year ago, it's unlikely the case.
So just drop the check of KVM_CAP_X86_SMM to simplify the code.
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
target/i386/kvm/kvm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index d145ad49e4e5..92025b8fcae9 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -3311,8 +3311,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
return ret;
}
- if (kvm_check_extension(s, KVM_CAP_X86_SMM) &&
- x86_machine_is_smm_enabled(x86ms)) {
+ if (x86_machine_is_smm_enabled(x86ms)) {
smram_machine_done.notify = register_smram_listener;
qemu_add_machine_init_done_notifier(&smram_machine_done);
}
--
2.43.0
next prev parent reply other threads:[~2025-07-29 6:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 6:20 [PATCH 0/2] i386/kvm: Cleanups in kvm_arch_init() Xiaoyao Li
2025-07-29 6:20 ` [PATCH 1/2] i386/kvm: Get X86MachineState in kvm_arch_init() without the cast check Xiaoyao Li
2025-07-29 7:12 ` Philippe Mathieu-Daudé
2025-07-29 7:51 ` Chenyi Qiang
2025-07-29 6:20 ` Xiaoyao Li [this message]
2025-09-12 5:48 ` [PATCH 0/2] i386/kvm: Cleanups in kvm_arch_init() Xiaoyao Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250729062014.1669578-3-xiaoyao.li@intel.com \
--to=xiaoyao.li@intel.com \
--cc=chenyi.qiang@intel.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).