From patchwork Thu Feb 7 10:42:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 10800793 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E55914E1 for ; Thu, 7 Feb 2019 10:42:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C85E2C901 for ; Thu, 7 Feb 2019 10:42:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00CBA2C9D8; Thu, 7 Feb 2019 10:42:22 +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=ham 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 99FF52C901 for ; Thu, 7 Feb 2019 10:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727057AbfBGKmV (ORCPT ); Thu, 7 Feb 2019 05:42:21 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41183 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726975AbfBGKmR (ORCPT ); Thu, 7 Feb 2019 05:42:17 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so10937787wrs.8 for ; Thu, 07 Feb 2019 02:42:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RuwMvLMxk1RvCG1TBZMwO3bX37Q/49v90QTd9ykJKOY=; b=h78DFP25UTkO+qVg3A8zk1ZemUO4MeDAJqFLrjQu5IUbHBqjZtFsoUYfx6SqRbRV1g ES/yW3Ds89qciib2CE56liwb8d+3yKcDsFa58un++9S7tuAzIQistNhG2XoqhjyzdAxg /2ZmWl6Dk6vC1TRCkKn2VQGuV82WtKauFvNr2uqB3IG8rtsmHa1jI5WkNqnrIASEvyPd P7HMwxJLJ3iwdANcVgbi55lCRGLgFT7gIoVaU0qGQA9m/mWopnGWZPV/Jb6dMcqVbm1+ nZY0+IVRGVGFjYfEGvQZ3R4iXPNvRz2SCOYy271PA4Ew0i2PGC4NB79pXSlVvEKwvhhn Wv0Q== X-Gm-Message-State: AHQUAuZiY0bUhj88Mdr0VqvfKtYosMv578z7fzUNFkLMWKZEWR5XIh8y rsli8AVQ0SZU6kp3sRcKYkaKGxcrSRw= X-Google-Smtp-Source: AHgI3IYNpDf5gAa45waRhD6kN1TGvtmRFSRNi2x9i18Uz6nZ/AcRTzR+m6e8VUzbd+dNwSsoETtzXg== X-Received: by 2002:adf:91a7:: with SMTP id 36mr5076108wri.77.1549536134944; Thu, 07 Feb 2019 02:42:14 -0800 (PST) Received: from vitty.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id v6sm17752419wro.57.2019.02.07.02.42.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Feb 2019 02:42:14 -0800 (PST) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , linux-kernel@vger.kernel.org Subject: [PATCH] x86/kvm/nVMX: read from MSR_IA32_VMX_PROCBASED_CTLS2 only when it is available Date: Thu, 7 Feb 2019 11:42:14 +0100 Message-Id: <20190207104214.8142-1-vkuznets@redhat.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP SDM says MSR_IA32_VMX_PROCBASED_CTLS2 is only available "If (CPUID.01H:ECX.[5] && IA32_VMX_PROCBASED_CTLS[63])". It was found that some old cpus (namely "Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz (family: 0x6, model: 0xf, stepping: 0x6") don't have it. Add the missing check. Reported-by: Zdenek Kaspar Tested-by: Zdenek Kaspar Signed-off-by: Vitaly Kuznetsov Reviewed-by: Jim Mattson --- arch/x86/kvm/vmx/nested.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 653830d0f3da..4bd0902bfd8c 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -5557,9 +5557,11 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, * secondary cpu-based controls. Do not include those that * depend on CPUID bits, they are added later by vmx_cpuid_update. */ - rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, - msrs->secondary_ctls_low, - msrs->secondary_ctls_high); + if (msrs->procbased_ctls_high & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) + rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, + msrs->secondary_ctls_low, + msrs->secondary_ctls_high); + msrs->secondary_ctls_low = 0; msrs->secondary_ctls_high &= SECONDARY_EXEC_DESC |