On Thu, Mar 28, 2019 at 10:55:56AM -0700, Sean Christopherson wrote: > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > --- > arch/x86/include/asm/kvm_host.h | 5 +- > arch/x86/kvm/svm.c | 20 ++--- > arch/x86/kvm/vmx/vmx.c | 2 +- > arch/x86/kvm/x86.c | 142 +++++++++++++++----------------- > 4 files changed, 81 insertions(+), 88 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 790876082a77..773f403d7017 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1182,7 +1182,7 @@ struct kvm_x86_ops { > > int (*smi_allowed)(struct kvm_vcpu *vcpu); > int (*pre_enter_smm)(struct kvm_vcpu *vcpu, char *smstate); > - int (*pre_leave_smm)(struct kvm_vcpu *vcpu, u64 smbase); > + int (*pre_leave_smm)(struct kvm_vcpu *vcpu, const char *smstate); > int (*enable_smi_window)(struct kvm_vcpu *vcpu); > > int (*mem_enc_op)(struct kvm *kvm, void __user *argp); > @@ -1592,4 +1592,7 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) > #define put_smstate(type, buf, offset, val) \ > *(type *)((buf) + (offset) - 0x7e00) = val > > +#define GET_SMSTATE(type, buf, offset) \ > + (*(type *)((buf) + (offset) - 0x7e00)) > + > #endif /* _ASM_X86_KVM_HOST_H */ > diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c > index 426039285fd1..33975e2aa486 100644 > --- a/arch/x86/kvm/svm.c > +++ b/arch/x86/kvm/svm.c > @@ -6215,27 +6215,23 @@ static int svm_pre_enter_smm(struct kvm_vcpu *vcpu, char *smstate) > return 0; > } > > -static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, u64 smbase) > +static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) > { > struct vcpu_svm *svm = to_svm(vcpu); > struct vmcb *nested_vmcb; > struct page *page; > - struct { > - u64 guest; > - u64 vmcb; > - } svm_state_save; > + u64 guest; > + u64 vmcb; > int ret; > > - ret = kvm_vcpu_read_guest(vcpu, smbase + 0xfed8, &svm_state_save, > - sizeof(svm_state_save)); > - if (ret) > - return ret; > + guest = GET_SMSTATE(u64, smsate, 0x7ed8); > + vmcb = GET_SMSTATE(u64, smsate, 0x7ee0); ^^^^^^ Doh, this doesn't compile due to a typo, didn't have CONFIG_KVM_AMD selected...