Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp184460ybf; Thu, 27 Feb 2020 18:52:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxI5ZaLC/LWORswAum4lM1RBjgXUP1KNTV2iLFlCj8rvn2Gzz0N/sCyd21Gc7jHEJXYfyhT X-Received: by 2002:a9d:6d1a:: with SMTP id o26mr1527075otp.141.1582858334247; Thu, 27 Feb 2020 18:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582858334; cv=none; d=google.com; s=arc-20160816; b=rB7ClF+H28fRqCDbOA2Am3XC9rR11A4yF2EUSv7HepoDG1w7PtgPEd1zAqgm2qJrW8 RWHEFEfxmA0xAxJlSp+/wSwYLuAeBsW7V5YDPzAs4CAol7z38Z6ymBw2sK222P2oMH5p ieh0xypuPr5P4T6l5iLzvBB3TUoYzx7vTA2X8WBmEaYLiDh1I91kMCGxtEIzxsKvmVxJ eh+WLstF6D/ToBXpp7G/A4FkdIY7YNc4NkreUTbnkKzWR+kWpHqqhQ4CndM0qR55uKui HpaA8iCLyqdF0iAJml4LW+XB4UJbU5W2XhuqrQsMp1KxUaawZhXWCh13pBJVL88PL971 ZKfg== 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:content-transfer-encoding :content-id:mime-version:subject:cc:to:from; bh=onKFgCd++9b1/BEyIABkH4r2MhzH9Nv20zqwXRdpGxU=; b=wIGZ3LsRzxDRumpZ7LA6vmdmYi6oC3a7WqXT4B+3VDysmfhLmHlZBjW/qamVw1c4h0 2nOfYY5qT3kz3GDXpRSWs20ROa5KkMvXo7UWHnSydYI8Uzk1Q30TBY1PtPhmQqqw7Kp6 jocSuK+pRzy4BWu1dhM8HcI99+vL63NNGE2lPQbCxXg7ceQgoi8TSoIzP6m/AegbK+/o 8QWb3wvSWDya6erZRvKPbLzDkmTEgzFhqaCTEQeh4OOd99EtvUoEevMG6r8S9RQ9yhcA bTWX3nLbnGASgcPpjPwxN2iaSegRlIElM1nCoSlYfJ5w/DseoI3+6J3IKnk6zXFZq+/h NtrQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vt.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si747425otk.164.2020.02.27.18.51.59; Thu, 27 Feb 2020 18:52:14 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vt.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730540AbgB1CuB convert rfc822-to-8bit (ORCPT + 99 others); Thu, 27 Feb 2020 21:50:01 -0500 Received: from outbound.smtp.vt.edu ([198.82.183.121]:39058 "EHLO omr1.cc.vt.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726943AbgB1CuB (ORCPT ); Thu, 27 Feb 2020 21:50:01 -0500 Received: from mr2.cc.vt.edu (mr2.cc.ipv6.vt.edu [IPv6:2607:b400:92:8400:0:90:e077:bf22]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id 01S2o0hU004054 for ; Thu, 27 Feb 2020 21:50:00 -0500 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by mr2.cc.vt.edu (8.14.7/8.14.7) with ESMTP id 01S2ntdx004420 for ; Thu, 27 Feb 2020 21:50:00 -0500 Received: by mail-qv1-f71.google.com with SMTP id m6so377988qvo.11 for ; Thu, 27 Feb 2020 18:50:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:mime-version :content-id:content-transfer-encoding:date:message-id; bh=TMxAIoujXzqS3798HgNWfd0wXc3IAjXqWU595ApRFSw=; b=NbgkmNErYbrfiWJGF6pPbvKyIgOTStBu9ue/Huvsz5mYRmGE3+hkJMHNgNDFoQmmQz ijMF/YoyGLeyGfbo5waf2dCqiCYUx3ppv3631YfoSvQMBwy9mrvu0LL38WGu51CraKn9 4iRLxgg67bP/xrrXXQ4km3j+rOjLtCpJzLeC0zpZSUtQ1NuL0/wwVcPZNstLamFVK2A4 oZUbvGuC5ehoLr17ZHpuDjdyWuWZv9wW/NMLC5lxw+VG82c1ip/nrXhmM1daNcwYnlxa Yv+p/6g8CX3RvVx8n2auX2geMOBb6ds2pRKEX857wUumVW7dHD7r8FCjrUicMR0CERcp QIIA== X-Gm-Message-State: APjAAAWzw5Keq5DUJfekJPbKlKlFw9RslsgnZGET+AYppPSxzxiJW1Ub J55TWScrUonGTkYjphtB85J0XCmHEHaSiU0/hsp8EwAXxeu8qK8W+vwHVGHqbWCWAsuHNMiODvV gCU4HhhVQQ8OVuoDInw9pd+w2ld0Ni4znlAg= X-Received: by 2002:a37:6111:: with SMTP id v17mr2544753qkb.210.1582858195018; Thu, 27 Feb 2020 18:49:55 -0800 (PST) X-Received: by 2002:a37:6111:: with SMTP id v17mr2544735qkb.210.1582858194753; Thu, 27 Feb 2020 18:49:54 -0800 (PST) Received: from turing-police ([2601:5c0:c001:c9e1::359]) by smtp.gmail.com with ESMTPSA id t4sm4300738qkm.82.2020.02.27.18.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 18:49:53 -0800 (PST) From: "Valdis =?utf-8?Q?Kl=c4=93tnieks?=" X-Google-Original-From: "Valdis =?utf-8?Q?Kl=c4=93tnieks?=" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Paolo Bonzini , Thomas Gleixner , Ingo Molnar cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: nVMX: allow compiling with W=1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <263440.1582858192.1@turing-police> Content-Transfer-Encoding: 8BIT Date: Thu, 27 Feb 2020 21:49:52 -0500 Message-ID: <263441.1582858192@turing-police> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Compile error with CONFIG_KVM_INTEL=y and W=1: CC arch/x86/kvm/vmx/vmx.o arch/x86/kvm/vmx/vmx.c:68:32: error: 'vmx_cpu_id' defined but not used [-Werror=unused-const-variable=] 68 | static const struct x86_cpu_id vmx_cpu_id[] = { | ^~~~~~~~~~ cc1: all warnings being treated as errors When building with =y, the MODULE_DEVICE_TABLE macro doesn't generate a reference to the structure (or any code at all). This makes W=1 compiles unhappy. Wrap both in a #ifdef to avoid the issue. Signed-off-by: Valdis Kletnieks diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 40a1467d1655..5c2fc2177b0d 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -65,11 +65,13 @@ MODULE_AUTHOR("Qumranet"); MODULE_LICENSE("GPL"); +#ifdef MODULE static const struct x86_cpu_id vmx_cpu_id[] = { X86_FEATURE_MATCH(X86_FEATURE_VMX), {} }; MODULE_DEVICE_TABLE(x86cpu, vmx_cpu_id); +#endif bool __read_mostly enable_vpid = 1; module_param_named(vpid, enable_vpid, bool, 0444);