Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756854AbcCRKLo (ORCPT ); Fri, 18 Mar 2016 06:11:44 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38138 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbcCRKLd (ORCPT ); Fri, 18 Mar 2016 06:11:33 -0400 Subject: Re: [PART1 RFC v3 03/12] KVM: x86: Introducing kvm_x86_ops VCPU blocking/unblocking hooks To: Suravee Suthikulpanit , rkrcmar@redhat.com, joro@8bytes.org, bp@alien8.de, gleb@kernel.org, alex.williamson@redhat.com References: <1458281388-14452-1-git-send-email-Suravee.Suthikulpanit@amd.com> <1458281388-14452-4-git-send-email-Suravee.Suthikulpanit@amd.com> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com From: Paolo Bonzini Message-ID: <56EBD44E.8070607@redhat.com> Date: Fri, 18 Mar 2016 11:11:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1458281388-14452-4-git-send-email-Suravee.Suthikulpanit@amd.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1681 Lines: 48 On 18/03/2016 07:09, Suravee Suthikulpanit wrote: > Adding new function pointer in struct kvm_x86_ops, and calling them > from the kvm_arch_vcpu[blocking/unblocking]. > > Signed-off-by: Suravee Suthikulpanit > --- > arch/x86/include/asm/kvm_host.h | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 4b0dd0f..87eac2a 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -972,6 +972,10 @@ struct kvm_x86_ops { > */ > int (*pre_block)(struct kvm_vcpu *vcpu); > void (*post_block)(struct kvm_vcpu *vcpu); > + > + void (*vcpu_blocking)(struct kvm_vcpu *vcpu); > + void (*vcpu_unblocking)(struct kvm_vcpu *vcpu); > + > int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq, > uint32_t guest_irq, bool set); > }; > @@ -1323,7 +1327,16 @@ bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq, > void kvm_set_msi_irq(struct kvm_kernel_irq_routing_entry *e, > struct kvm_lapic_irq *irq); > > -static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {} > -static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {} > +static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) > +{ > + if (kvm_x86_ops->vcpu_blocking) > + kvm_x86_ops->vcpu_blocking(vcpu); > +} > + > +static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) > +{ > + if (kvm_x86_ops->vcpu_unblocking) > + kvm_x86_ops->vcpu_unblocking(vcpu); > +} > > #endif /* _ASM_X86_KVM_HOST_H */ > Reviewed-by: Paolo Bonzini