From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37151) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1bti-0006yS-92 for qemu-devel@nongnu.org; Wed, 25 Nov 2015 10:22:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1btg-00077A-Ku for qemu-devel@nongnu.org; Wed, 25 Nov 2015 10:22:18 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:2368 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1btg-00076s-5q for qemu-devel@nongnu.org; Wed, 25 Nov 2015 10:22:16 -0500 From: Andrey Smetanin Date: Wed, 25 Nov 2015 18:20:18 +0300 Message-Id: <1448464821-8199-5-git-send-email-asmetanin@virtuozzo.com> In-Reply-To: <1448464821-8199-1-git-send-email-asmetanin@virtuozzo.com> References: <1448464821-8199-1-git-send-email-asmetanin@virtuozzo.com> Subject: [Qemu-devel] [PATCH v1 4/7] kvm/x86: Added Hyper-V vcpu_to_hv_vcpu()/hv_vcpu_to_vcpu() helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm@vger.kernel.org Cc: Gleb Natapov , Haiyang Zhang , qemu-devel@nongnu.org, Roman Kagan , "Denis V. Lunev" , Paolo Bonzini , Vitaly Kuznetsov , "K. Y. Srinivasan" Signed-off-by: Andrey Smetanin Reviewed-by: Roman Kagan CC: Gleb Natapov CC: Paolo Bonzini CC: "K. Y. Srinivasan" CC: Haiyang Zhang CC: Vitaly Kuznetsov CC: Roman Kagan CC: Denis V. Lunev CC: qemu-devel@nongnu.org --- arch/x86/kvm/hyperv.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/hyperv.h b/arch/x86/kvm/hyperv.h index 9483d49..d5d8217 100644 --- a/arch/x86/kvm/hyperv.h +++ b/arch/x86/kvm/hyperv.h @@ -24,21 +24,29 @@ #ifndef __ARCH_X86_KVM_HYPERV_H__ #define __ARCH_X86_KVM_HYPERV_H__ -static inline struct kvm_vcpu_hv_synic *vcpu_to_synic(struct kvm_vcpu *vcpu) +static inline struct kvm_vcpu_hv *vcpu_to_hv_vcpu(struct kvm_vcpu *vcpu) { - return &vcpu->arch.hyperv.synic; + return &vcpu->arch.hyperv; } -static inline struct kvm_vcpu *synic_to_vcpu(struct kvm_vcpu_hv_synic *synic) +static inline struct kvm_vcpu *hv_vcpu_to_vcpu(struct kvm_vcpu_hv *hv_vcpu) { - struct kvm_vcpu_hv *hv; struct kvm_vcpu_arch *arch; - hv = container_of(synic, struct kvm_vcpu_hv, synic); - arch = container_of(hv, struct kvm_vcpu_arch, hyperv); + arch = container_of(hv_vcpu, struct kvm_vcpu_arch, hyperv); return container_of(arch, struct kvm_vcpu, arch); } +static inline struct kvm_vcpu_hv_synic *vcpu_to_synic(struct kvm_vcpu *vcpu) +{ + return &vcpu->arch.hyperv.synic; +} + +static inline struct kvm_vcpu *synic_to_vcpu(struct kvm_vcpu_hv_synic *synic) +{ + return hv_vcpu_to_vcpu(container_of(synic, struct kvm_vcpu_hv, synic)); +} + int kvm_hv_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data, bool host); int kvm_hv_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); -- 2.4.3