Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp6019805pxb; Mon, 14 Feb 2022 13:17:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJw46SkmmLpNm5fOowmdLy+Ner1NV6x2IHZWuP+KDBoQyW2qz8DpitvbNamQV1wP4tabidi1 X-Received: by 2002:a17:902:8ec5:: with SMTP id x5mr659905plo.131.1644873431181; Mon, 14 Feb 2022 13:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644873431; cv=none; d=google.com; s=arc-20160816; b=xE6fFgc2PU7ou/ugT6nFJbAcQBwW5YZ4TMgEpto1FdM6OP+TnAlIOyBfpW5Wk7JsRS xfFObdVgUzbErC+aW6wuRMZJKGWd3jhnWYkApUhiZDHIS1cXGY5lwM7lXoRt9SNfcjFl uoK4JMwDW8+oDSbtjfNJumpIFpUwszoLWabdGGnRQUNBCLEBL2JairGItLmjfPpbU7AN of2Rt/BnlmYhUI3/GDyI/fwJItT5Yroqq3oXmvbbuVLlI/MZLwAQYV87IKbRw5Nmgn1n syWcAh+o/nmghHLxssdAIw9c40LGSMVbevxCL/fLQyQjmZ6h8c7N6Ljnt7WgQAiEtzp4 Yvkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JDUf2tpr5kPnpKzZ6aaEOhkBh0LPd3SsWiBXQ6HQc3c=; b=ZJbYMftBuxnBfbLMAZyO5VDZlogUL1tp/KDdBQZMzaa2bJIExWQ5f/2PbwTY4VAg47 kvBCCNEf37BBXAdDE/snFdJCcNU7BJ26w4t7BQWHA4k3i9gQNc/3SOoZzhqoBZexrELg XFknSoWZMkRltBM7CSzL6C/TuHTpFB1YF4wI79MjD5IXHF2BbW+a8VkidkVuFL+GyAYJ vx+XCItjDGdd6nsHKtBDpq1dBlin23aDa8n+vUqslrnnfVvYjqXFArvRbiE+2pN9r0qu 9DZr5dgrm6DNAwQiJzHDpCeLfV9r/Q/Ty+ijWKbxqSjbef2wo37EZra8Gytzn9TDiVIX pBwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TiszzbAt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bj9si986349pgb.447.2022.02.14.13.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 13:17:11 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TiszzbAt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66F9A14CD92; Mon, 14 Feb 2022 12:35:09 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345396AbiBNKJb (ORCPT + 99 others); Mon, 14 Feb 2022 05:09:31 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345057AbiBNKFL (ORCPT ); Mon, 14 Feb 2022 05:05:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FDC674847; Mon, 14 Feb 2022 01:49:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E21CC61291; Mon, 14 Feb 2022 09:49:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5C55C340E9; Mon, 14 Feb 2022 09:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832158; bh=TyD2aMjxLMkZUzR4ycHZFT9SUVAGZ7tCb5EfJ04mpnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TiszzbAt7YtNHHKy2/k+zgy8sJ+wrMff0KD4b9DVHY5spCyVeFq8z5UN+p3RXVQZv AbBkg0e6TPzKItbfn+Vtn6lQ2fmN+nZ7VJtE1X7a/kKNjdAoHVgwce3phOCqNOHmJI b4CHJTtWrieTzhBGdSd+gC/n9dD6aXx0OMiw1I6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Lewis , Jim Mattson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 065/172] KVM: x86: Report deprecated x87 features in supported CPUID Date: Mon, 14 Feb 2022 10:25:23 +0100 Message-Id: <20220214092508.648091407@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092506.354292783@linuxfoundation.org> References: <20220214092506.354292783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jim Mattson [ Upstream commit e3bcfda012edd3564e12551b212afbd2521a1f68 ] CPUID.(EAX=7,ECX=0):EBX.FDP_EXCPTN_ONLY[bit 6] and CPUID.(EAX=7,ECX=0):EBX.ZERO_FCS_FDS[bit 13] are "defeature" bits. Unlike most of the other CPUID feature bits, these bits are clear if the features are present and set if the features are not present. These bits should be reported in KVM_GET_SUPPORTED_CPUID, because if these bits are set on hardware, they cannot be cleared in the guest CPUID. Doing so would claim guest support for a feature that the hardware doesn't support and that can't be efficiently emulated. Of course, any software (e.g WIN87EM.DLL) expecting these features to be present likely predates these CPUID feature bits and therefore doesn't know to check for them anyway. Aaron Lewis added the corresponding X86_FEATURE macros in commit cbb99c0f5887 ("x86/cpufeatures: Add FDP_EXCPTN_ONLY and ZERO_FCS_FDS"), with the intention of reporting these bits in KVM_GET_SUPPORTED_CPUID, but I was unable to find a proposed patch on the kvm list. Opportunistically reordered the CPUID_7_0_EBX capability bits from least to most significant. Cc: Aaron Lewis Signed-off-by: Jim Mattson Message-Id: <20220204001348.2844660-1-jmattson@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- arch/x86/kvm/cpuid.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index f666fd79d8ad6..5f1d4a5aa8716 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -421,12 +421,13 @@ void kvm_set_cpu_caps(void) ); kvm_cpu_cap_mask(CPUID_7_0_EBX, - F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | - F(BMI2) | F(ERMS) | F(INVPCID) | F(RTM) | 0 /*MPX*/ | F(RDSEED) | - F(ADX) | F(SMAP) | F(AVX512IFMA) | F(AVX512F) | F(AVX512PF) | - F(AVX512ER) | F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB) | F(AVX512DQ) | - F(SHA_NI) | F(AVX512BW) | F(AVX512VL) | 0 /*INTEL_PT*/ - ); + F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) | + F(FDP_EXCPTN_ONLY) | F(SMEP) | F(BMI2) | F(ERMS) | F(INVPCID) | + F(RTM) | F(ZERO_FCS_FDS) | 0 /*MPX*/ | F(AVX512F) | + F(AVX512DQ) | F(RDSEED) | F(ADX) | F(SMAP) | F(AVX512IFMA) | + F(CLFLUSHOPT) | F(CLWB) | 0 /*INTEL_PT*/ | F(AVX512PF) | + F(AVX512ER) | F(AVX512CD) | F(SHA_NI) | F(AVX512BW) | + F(AVX512VL)); kvm_cpu_cap_mask(CPUID_7_ECX, F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) | -- 2.34.1