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: 136950 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3743799lji; Fri, 25 May 2018 08:37:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqpOYSMQpi2SjesyOQnZ2p22edwTQrgw7grN+Gvf/22Jm5TF1SoXhVELQqK8FrNEY9mg4eo X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr2417303pgo.447.1527262665198; Fri, 25 May 2018 08:37:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527262665; cv=none; d=google.com; s=arc-20160816; b=SLIObe7ck9SXHS5wyB0noQ8ZbYxCihYGQKfeNOgkf5f0RrIpkckUUV8y56ya9l3MU+ B4eUktcsc0hR5QDzyunNMQmHsVXrupVH0yNaRpFq1Xd8Ki6lja8dSG2nycrQnv9ocBIT ozjL8hS2sdH/vECu9R8SW8VWPjFnZHlEYCY3T61ojfnsmq+aAbtZ3Q5n1nFURXMMfppb UVFomEnfOIdr+4PADJzGvKv2Jh01f1cKsyJYgAWYmm5f3/9aIl9j4JeJSkhpiQT+QBrY Jalgxp0Nxzt3m/3Dih5/kPZuape4b9MeNjEoKkxTPRIiYCC7TSxpDkyIWWVBXQOcXyRC gFOA== 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 c17-v6si7260097pgp.408.2018.05.25.08.37.44; Fri, 25 May 2018 08:37:45 -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 S966827AbeEYPhn (ORCPT + 30 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?b?UmFkaW0gS3LEjW3DocWZ?= 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: linux-kernel-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(-) -- 2.9.0 Reviewed-by: Vitaly Kuznetsov 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;