smm.h (f1554150d3c694e30e92c681c20ce9714cac3d42) smm.h (4b8e1b32013da2495244dbdee70f2456e6bc7aca)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef ASM_KVM_SMM_H
3#define ASM_KVM_SMM_H
4
5#define GET_SMSTATE(type, buf, offset) \
6 (*(type *)((buf) + (offset) - 0x7e00))
7
8#define PUT_SMSTATE(type, buf, offset, val) \
9 *(type *)((buf) + (offset) - 0x7e00) = val
10
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef ASM_KVM_SMM_H
3#define ASM_KVM_SMM_H
4
5#define GET_SMSTATE(type, buf, offset) \
6 (*(type *)((buf) + (offset) - 0x7e00))
7
8#define PUT_SMSTATE(type, buf, offset, val) \
9 *(type *)((buf) + (offset) - 0x7e00) = val
10
11#ifdef CONFIG_KVM_SMM
11static inline int kvm_inject_smi(struct kvm_vcpu *vcpu)
12{
13 kvm_make_request(KVM_REQ_SMI, vcpu);
14 return 0;
15}
16
17static inline bool is_smm(struct kvm_vcpu *vcpu)
18{
19 return vcpu->arch.hflags & HF_SMM_MASK;
20}
21
22void kvm_smm_changed(struct kvm_vcpu *vcpu, bool in_smm);
23void enter_smm(struct kvm_vcpu *vcpu);
24int emulator_leave_smm(struct x86_emulate_ctxt *ctxt);
25void process_smi(struct kvm_vcpu *vcpu);
12static inline int kvm_inject_smi(struct kvm_vcpu *vcpu)
13{
14 kvm_make_request(KVM_REQ_SMI, vcpu);
15 return 0;
16}
17
18static inline bool is_smm(struct kvm_vcpu *vcpu)
19{
20 return vcpu->arch.hflags & HF_SMM_MASK;
21}
22
23void kvm_smm_changed(struct kvm_vcpu *vcpu, bool in_smm);
24void enter_smm(struct kvm_vcpu *vcpu);
25int emulator_leave_smm(struct x86_emulate_ctxt *ctxt);
26void process_smi(struct kvm_vcpu *vcpu);
27#else
28static inline int kvm_inject_smi(struct kvm_vcpu *vcpu) { return -ENOTTY; }
29static inline bool is_smm(struct kvm_vcpu *vcpu) { return false; }
30static inline void enter_smm(struct kvm_vcpu *vcpu) { WARN_ON_ONCE(1); }
31static inline void process_smi(struct kvm_vcpu *vcpu) { WARN_ON_ONCE(1); }
26
32
33/*
34 * emulator_leave_smm is used as a function pointer, so the
35 * stub is defined in x86.c.
36 */
27#endif
37#endif
38
39#endif