From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH v2 04/13] KVM: x86: API changes for SMM support Date: Fri, 29 May 2015 20:50:03 +0200 Message-ID: <20150529185002.GA7856@potion.brq.redhat.com> References: <1432746314-50196-1-git-send-email-pbonzini@redhat.com> <1432746314-50196-5-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, guangrong.xiao@linux.intel.com, bdas@redhat.com To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <1432746314-50196-5-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2015-05-27 19:05+0200, Paolo Bonzini: > This patch includes changes to the external API for SMM support. > All the changes are predicated by the availability of a new > capability, KVM_CAP_X86_SMM, which is added at the end of the > patch series. > > Signed-off-by: Paolo Bonzini > --- > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > @@ -309,7 +312,13 @@ struct kvm_vcpu_events { > - __u32 reserved[10]; > + struct { > + __u8 smm; > + __u8 pending; > + __u8 smm_inside_nmi; (The 'u8 flags' discussion made me see that we just lost 21 bits here, but it seems worth the sacrifice.) > + __u8 pad; > + } smi; > + __u32 reserved[9]; > @@ -3237,6 +3250,18 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, > + if (events->flags & KVM_VCPUEVENT_VALID_SMM) { > + if (events->smi.smm) > + vcpu->arch.hflags |= HF_SMM_MASK; > + else > + vcpu->arch.hflags &= ~HF_SMM_MASK; > + vcpu->arch.smi_pending = events->smi.pending; > + if (events->smi.smm_inside_nmi) > + vcpu->arch.hflags |= ~HF_SMM_INSIDE_NMI_MASK; ~~~ ~~ ~ HF_SMM_INSIDE_NMI_MASK. > + else > + vcpu->arch.hflags &= ~HF_SMM_INSIDE_NMI_MASK; (Looks like a use case for a new helper, __assign_bit(HF_SMM_INSIDE_NMI_MASK, &vcpu->arch.hflags, events->smi.smm_inside_nmi);)