mirror of
https://github.com/torvalds/linux.git
synced 2024-12-04 10:01:41 +00:00
31e83e21cf
Vendor-specific code that deals with SMI injection and saving/restoring SMM state is not needed if CONFIG_KVM_SMM is disabled, so remove the four callbacks smi_allowed, enter_smm, leave_smm and enable_smi_window. The users in svm/nested.c and x86.c also have to be compiled out; the amount of #ifdef'ed code is small and it's not worth moving it to smm.c. enter_smm is now used only within #ifdef CONFIG_KVM_SMM, and the stub can therefore be removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20220929172016.319443-7-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef ASM_KVM_SMM_H
|
|
#define ASM_KVM_SMM_H
|
|
|
|
#define GET_SMSTATE(type, buf, offset) \
|
|
(*(type *)((buf) + (offset) - 0x7e00))
|
|
|
|
#define PUT_SMSTATE(type, buf, offset, val) \
|
|
*(type *)((buf) + (offset) - 0x7e00) = val
|
|
|
|
#ifdef CONFIG_KVM_SMM
|
|
static inline int kvm_inject_smi(struct kvm_vcpu *vcpu)
|
|
{
|
|
kvm_make_request(KVM_REQ_SMI, vcpu);
|
|
return 0;
|
|
}
|
|
|
|
static inline bool is_smm(struct kvm_vcpu *vcpu)
|
|
{
|
|
return vcpu->arch.hflags & HF_SMM_MASK;
|
|
}
|
|
|
|
void kvm_smm_changed(struct kvm_vcpu *vcpu, bool in_smm);
|
|
void enter_smm(struct kvm_vcpu *vcpu);
|
|
int emulator_leave_smm(struct x86_emulate_ctxt *ctxt);
|
|
void process_smi(struct kvm_vcpu *vcpu);
|
|
#else
|
|
static inline int kvm_inject_smi(struct kvm_vcpu *vcpu) { return -ENOTTY; }
|
|
static inline bool is_smm(struct kvm_vcpu *vcpu) { return false; }
|
|
static inline void process_smi(struct kvm_vcpu *vcpu) { WARN_ON_ONCE(1); }
|
|
|
|
/*
|
|
* emulator_leave_smm is used as a function pointer, so the
|
|
* stub is defined in x86.c.
|
|
*/
|
|
#endif
|
|
|
|
#endif
|