From patchwork Fri May 25 15:36:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10427827 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B14BC602D8 for ; Fri, 25 May 2018 15:37:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A816B29750 for ; Fri, 25 May 2018 15:37:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A04429758; Fri, 25 May 2018 15:37:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2929329750 for ; Fri, 25 May 2018 15:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966725AbeEYPhm (ORCPT ); Fri, 25 May 2018 11:37:42 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:44431 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966694AbeEYPhj (ORCPT ); Fri, 25 May 2018 11:37:39 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0LuYSK-1gM0NA3ZUe-00zrSt; Fri, 25 May 2018 17:36:45 +0200 From: Arnd Bergmann To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Cc: Lan Tianyu , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Jim Mattson , Wanpeng Li , David Hildenbrand , Vitaly Kuznetsov , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: x86: VMX: fix building without CONFIG_HYPERV Date: Fri, 25 May 2018 17:36:17 +0200 Message-Id: <20180525153640.3228067-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:zholDbXs/a/BZQD+yjoFV+Yq0HZjfvu2+yYd+GeN88IjZ454G0e g4FvFAcR3ZGMc4PPnmiDykEgNzpsC69/cu9d+PqRx4/hF2QAUR6sB4PYwzC1gMWJRXrkLbI RaHV9Gpl6clngOPanNpP+O+n1LjtHu/nKpZd5CnfRt+qUnRDNGJ6G4rBkpZEga79iRELycI pgLtr1MOCsuJD1xfBlgcg== X-UI-Out-Filterresults: notjunk:1; V01:K0:b2RsvZqalDY=:uwNuPhxW5KYzUVZ85VgpJt srMsl/5mLEjhVPx9ibAEPROivwhTYHnoCYWXa2+qj6GWE0AcxlVC7M/otFk9VKWjTrLdhsQcO rpoWkxRqbH/ClxVRYbF+Co8QNdCe4zRB3rGUZAE8ds5+YVVTVsEXKVfZPPDReU2ve7hW2QgeK /OeRG0mjX6LgeI2+STr9l3S0mulJI8LxFnVG6WhiA4d+dMZeaRHzNuj8eh2qLi7IJPX/+q6QZ QEzBZh5oXOl+9PWB+vak+MKJMTnvRvIx+NqrhmmpDYBglbLV5j1KFyMqrO6iQ9QNgesWqWmzF dPES87wbkO8Qb7K8aoSgj/0zU0mOI3XPPsXPLII830iWl9AmRILO3zISbyuAo8ApdIEj2jnLC 7CoEh62fqehZdER02QZ77a8PXISHyRjQfOsiP9hWABoEHMxOc5abrwTKZsuk8ap1zNGxuqWeR +XfnT5TjSpj3ztdzenmC3hJBEhu7wIzkwTFHTlH5Rvd5vP4mQ0J9wpFSxFf7PJVuzCGWEVlSS gkC5wxgbcC+s32kWqldWOpgisjkAYWLL+dOd0tEH6aq1sLPXeWJsrQZ3/Xhbfx04kt+azr5Lq vcaIR+WFzQgQIkpQbhTgnqEZejgKhb5zeF9i3d1UTaOKoMQEkL8N8T2XZKrsCOQxNno1w+hMJ UY7h85YPSfBi8Fdxo9J3Tjf+Ed5Vizf67rSD83j5/VkPm0EpHq/wzcXZTNrXBHZad2rc= Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The global ms_hyperv variable is part of the hyperv support, so we get a link error from accessing it in kernels that have this turned off: arch/x86/kvm/vmx.o: In function `alloc_loaded_vmcs': vmx.c:(.text+0x1654a): undefined reference to `ms_hyperv' vmx.c:(.text+0x1657a): undefined reference to `ms_hyperv' This changes the condition to first check the compile-time configuration symbol to avoid the link error. Fixes: ceef7d10dfb6 ("KVM: x86: VMX: hyper-v: Enlightened MSR-Bitmap support") Signed-off-by: Arnd Bergmann Reviewed-by: Vitaly Kuznetsov --- arch/x86/kvm/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index ea098131dcce..e6d6ccab43c3 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -4232,7 +4232,8 @@ static int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs) goto out_vmcs; memset(loaded_vmcs->msr_bitmap, 0xff, PAGE_SIZE); - if (static_branch_unlikely(&enable_evmcs) && + if (IS_ENABLED(CONFIG_HYPERV) && + static_branch_unlikely(&enable_evmcs) && (ms_hyperv.nested_features & HV_X64_NESTED_MSR_BITMAP)) { struct hv_enlightened_vmcs *evmcs = (struct hv_enlightened_vmcs *)loaded_vmcs->vmcs;