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 9722CC433FE for ; Fri, 7 Oct 2022 22:41:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbiJGWlc (ORCPT ); Fri, 7 Oct 2022 18:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbiJGWl2 (ORCPT ); Fri, 7 Oct 2022 18:41:28 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6673E7B1D7 for ; Fri, 7 Oct 2022 15:41:26 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id p14so1759941pfq.5 for ; Fri, 07 Oct 2022 15:41:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XZo46KulR3GJqtVuZHIWbUUZizarbLhyKl4TV2qKphU=; b=dBBdyRYuo32YUPpc1kGUEYYAzpkYTTnrRhBl72Uadl3ko8LhHSWsmYs9i/H+A5IIRy HwzMZ71od0PXvo5KcAGPDGqTfiupn7S3CO/Gor9rE83zMRkPMTlbzLmnsKUjHgIZg8LN 2juqE0SCgI095Dw2wskPWPXZmF+GYPIiO73ixWc6ilrstT0Jb5+zbXR8opgyw5Ng2y+U 9i2SqN7uxjBBGUXGP9k3SRcIU3VBwMGHEUv7kYTLMKmxW8h8tTuwOOeZy0g6eaGrDLn0 RQg4QKwsTQpr/NJfGxU+dHtPK1Tt5vY4flFa/Y0WFMowYAI42st5gno21ZVaJ7uqSmrF rQCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XZo46KulR3GJqtVuZHIWbUUZizarbLhyKl4TV2qKphU=; b=PquZ3cn1WsKzILiWFTBSUcoTobX4Mg/EUJDjELDgz1tUYDt2fozZA17RFV7gokzdr4 Et7rbNeaX5a9coILk0qRDgZXw+hJHs0a22GGzuWvfJa8rC7/fcROtDiuT9WF74JDUI5F sw9AlmRZULP6d7TnviwQGC9lknyDexDCQsp8tKUuUgQvvkvJSdJgwdYYGlPUzp4p9yNp y7B9XmoVpNLqwQkbSwcZMSVQCqSkXDPQtdCSc59zzjiE04numk7AXs9153u5Fu24UTQS ipnvyrdYlgAmrbOKTteKOvICmIdm+W1+KyScfKjLfEUzT22osqBz+944fjlI4PCl/3C2 xcsg== X-Gm-Message-State: ACrzQf2AjBFrggAyOUF715jKhyfdddGf9so6pdhZn9lMpWuNtneW8OZZ g1f1HlklHZrkzDUun9M/Zljupg== X-Google-Smtp-Source: AMsMyM6v3bn6n2QXmRyp6k9/WFXcHeQTrFHSgtt18uX5jmUuho3VNautnRtV5ssoL+ke73ayUJkiiQ== X-Received: by 2002:a63:2f45:0:b0:457:dc63:68b4 with SMTP id v66-20020a632f45000000b00457dc6368b4mr6416380pgv.228.1665182485640; Fri, 07 Oct 2022 15:41:25 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id e17-20020a17090301d100b00172e19c2fa9sm2069723plh.9.2022.10.07.15.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 15:41:25 -0700 (PDT) Date: Fri, 7 Oct 2022 22:41:21 +0000 From: Sean Christopherson To: Jim Mattson Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v2 3/3] KVM: SVM: Unconditionally enumerate EferLmsleUnsupported Message-ID: References: <20220920205922.1564814-1-jmattson@google.com> <20220920205922.1564814-4-jmattson@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220920205922.1564814-4-jmattson@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 20, 2022, Jim Mattson wrote: > CPUID.80000008H:EDX.EferLmsleUnsupported[bit 20] indicates that > IA32_EFER.LMSLE[bit 13] is unsupported and must be zero. > > KVM doesn't support "Long Mode Segment Limit Enable," even if the > underlying physical processor does, so set that bit in the guest CPUID > table returned by KVM_GET_SUPPORTED_CPUID. > > Signed-off-by: Jim Mattson > --- > arch/x86/kvm/svm/svm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c > index 3af360fe21e6..0bf6ac51f097 100644 > --- a/arch/x86/kvm/svm/svm.c > +++ b/arch/x86/kvm/svm/svm.c > @@ -4945,6 +4945,7 @@ static __init void svm_set_cpu_caps(void) > if (boot_cpu_has(X86_FEATURE_LS_CFG_SSBD) || > boot_cpu_has(X86_FEATURE_AMD_SSBD)) > kvm_cpu_cap_set(X86_FEATURE_VIRT_SSBD); > + kvm_cpu_cap_set(X86_FEATURE_NO_LMSLE); This can go in common x86 code, e.g. if someone wants to run an AMD VM on Intel hardware. Side topic, in the context of this series, the below diff highlights how silly it is for PSFD to be banished from cpufeatures.h. While we have Boris's attention (and ACK!), can you tack on a patch to move drop KVM_X86_FEATURE_PSFD and move the bit to cpufeatures.h where it belongs? --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -696,6 +696,7 @@ void kvm_set_cpu_caps(void) F(AMD_SSB_NO) | F(AMD_STIBP) | F(AMD_STIBP_ALWAYS_ON) | __feature_bit(KVM_X86_FEATURE_PSFD) ); + kvm_cpu_cap_set(X86_FEATURE_NO_LMSLE); /* * AMD has separate bits for each SPEC_CTRL bit.