Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3615161imm; Fri, 25 May 2018 08:38:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqhIvWAuH4nXQzVVx8eqpktyYTL1HerA7k+s1YGybhHh2sMiFf2jruVLgd+K0Rs0AX9HmdW X-Received: by 2002:a62:c00e:: with SMTP id x14-v6mr2969888pff.67.1527262685750; Fri, 25 May 2018 08:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527262685; cv=none; d=google.com; s=arc-20160816; b=UjizM32rfp7u+5ETiqodT6nF8mxCYm38zcTG6G14iJc5eX3yxLVtyU9phj2s48uNy9 bxXPRK6oFwj3lANrrNTXCcIVZOtJCNq9f8JG9sS4G3zxBWZYXBtYbzAb1yBPY4BYhjM1 ZEc6JC8d3sHbL3Vt9zyk5sm5CqPkz/Zw5VQvhwv70yC1D9IDDvMa1XCgiJzF4DYe7Sst tZWMpZU70nTN+51lBlUsS8CUbJnhK/TX/PK1yt8/pQgaGJ8RDv/fVxMsMDmQc2lbhb1U kcukdlB1b605DV4diXRddLT3YqVWi8Hnk+um80KEijrBXoKN01cbG0uyt8RC8zj+MN6k 57kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=t8kLUrt3I8gyuPwPvF+TDX7vc2eYay4aHgb7NfC46zg=; b=c+9qmZAe1w35zkVY2O8DkTeT63B8PveuEVKVKECkbzhV3SHFDu7f4oe8R3R6X+1B0m 0G84BX1lJsXLVQLKR8pE4Ru6j5xrZ06S/f1yMUHl8D75Caf71iUuAH3h/g+dyIxn3cUk HJQ/eMEDX/NlQPtMzGpSEjxKJyo0+6EhCJCLrKGR0i/HZOjpk5kuYTJvmftQM+ivndoO m6jpK+q0ODhL0G3ypns+5cPUMUGIMnaiMoVboCtExUayGxPWspHjZaiNIHg1B6E4zgSE bFgNE0FBaqJ2zXjgt0JgCUL6Rtkl7mhH1Z85XrovOkCaiOkos/yzlcHzbiqXVe3rHB3V r7EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24-v6si24679833pfj.6.2018.05.25.08.37.50; Fri, 25 May 2018 08:38:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966807AbeEYPhn (ORCPT + 99 others); Fri, 25 May 2018 11:37:43 -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-ar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owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.9.0