From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A827DC4332F for ; Thu, 10 Feb 2022 16:40:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244532AbiBJQko (ORCPT ); Thu, 10 Feb 2022 11:40:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244513AbiBJQkj (ORCPT ); Thu, 10 Feb 2022 11:40:39 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA6AEC26 for ; Thu, 10 Feb 2022 08:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644511239; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gc6lDZSpHVIw8OQnB9eZkWezLNZIBK4RgA5Yuh75LNE=; b=KVpdPmPU+qfI1NZDZWPfrKaS0/yrTeg+LZl380V+PVNly+2JTuEuE7TWpqMhGSl8Bm6A0x NP1n9FT+KGvZ1Y3656Oe4y6DSOrczK3Xn2VEQDh6JvvRm2+hh40RjnYG227LW8EWIpAzOE MEiSqCFZ4j14S3mNfxTgLf2hj89/mHU= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-554-LEPyXhJmNlOEvYsyzOpHmA-1; Thu, 10 Feb 2022 11:40:38 -0500 X-MC-Unique: LEPyXhJmNlOEvYsyzOpHmA-1 Received: by mail-ed1-f72.google.com with SMTP id 30-20020a508e5e000000b0040f6642e814so3610918edx.19 for ; Thu, 10 Feb 2022 08:40:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=gc6lDZSpHVIw8OQnB9eZkWezLNZIBK4RgA5Yuh75LNE=; b=cUXR6zZTGe39UFfFyJzTsBKwaZvIXkEVF0Pgl3Az0/FQwe+zQ/DqwAPPvcQprqpzMt obQW/IqeOZrZuLUXicvveBvODg8L2wKpo/vj8DJGukMLQhdQr7Tq6gCp6ozD6R3KR2Y9 jFFUDxN2ytDr/vNXbYkbVIgK0JsXcm8rDTMFA7p7+8OQ+glaCTxnDm9EY2vqDDnHKKfF qWzDkNG1Nh3NlRou84bnv5TeWGF2tenm4KKhUr8tkXpTLuY1emXoouqYsmzFEKc9c7UQ vRLJFBuqKkNhrB+Hws56W5Z+WV6lgvToGpvVKAlzn4IWy6ih/XCYmwXs9Y1Hob7Qh43Y 3Mtg== X-Gm-Message-State: AOAM532ZqACaeupa24Vy1vLTa5/mYj2HkSKWaADOhrnH/fY3Vkd04dEw l5KTO4Jj2PuscTyft/nM/K5wkqEEKHbSjHzq7mJamSb8mpmbw0r4i9MDDwiTeTwfquiuryVw+Lh oJovYGES7iy6yWMCLbLri5zEw X-Received: by 2002:a17:906:490:: with SMTP id f16mr7341993eja.438.1644511237368; Thu, 10 Feb 2022 08:40:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJCu0suja1TEmC8U2UFl9bLC7ANkyhhyfRNlUqIFPjixn9yffcCpPhtoPlNE1tZEAHYlhFJg== X-Received: by 2002:a17:906:490:: with SMTP id f16mr7341966eja.438.1644511237111; Thu, 10 Feb 2022 08:40:37 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id ot38sm4718946ejb.131.2022.02.10.08.40.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Feb 2022 08:40:36 -0800 (PST) Message-ID: <65f23531-4c39-2b1e-9e80-02dcef9c0645@redhat.com> Date: Thu, 10 Feb 2022 17:40:28 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH MANUALSEL 5.15 8/8] KVM: x86: Report deprecated x87 features in supported CPUID Content-Language: en-US To: Sasha Levin , linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jim Mattson , Aaron Lewis , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, kvm@vger.kernel.org References: <20220209185653.48833-1-sashal@kernel.org> <20220209185653.48833-8-sashal@kernel.org> From: Paolo Bonzini In-Reply-To: <20220209185653.48833-8-sashal@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/9/22 19:56, Sasha Levin wrote: > From: Jim Mattson > > [ Upstream commit e3bcfda012edd3564e12551b212afbd2521a1f68 ] Acked-by: Paolo Bonzini Paolo > 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) |