Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2027961rwi; Thu, 3 Nov 2022 11:46:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7o9e4zKviK7WldwqAVkm3HE8206DS9YBiB/LH6TFdPo+aEKlFPfr5g+IOCjy1NIvgG/UzJ X-Received: by 2002:a62:e504:0:b0:56d:2798:f024 with SMTP id n4-20020a62e504000000b0056d2798f024mr27628938pff.12.1667501181425; Thu, 03 Nov 2022 11:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667501181; cv=none; d=google.com; s=arc-20160816; b=qrJYfm495OyfqcBCUfSabObu47LIFbzL4mAUEaTvplvtHozV2qcVfrYd9E14dIuW7F VymeuSgkeFDKq46L1K9ElQ26Y/Pw8s8BmqX9Izfnu6SFLmNWf3YLS/NujEhaqtG2NiWn /TrBhcDMBH+e4MHCagTEh/RP6wXXJbclN8ttSxj3SNmb83VtwWfBnm+dpW+69oQjS5On EWfr0+S3RyMI7F+gf2d1rfzGCM7wjPi5cxqxhVIfIcS8vHzzVzoUjFp3YqrrW2cd8CQf l9K1IGheif2jdNeo4p0E2G/X6rP1huWIc1IqQ9PX48GrUxMoZLdWaVshK1sFZWAkxDUY UywA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dgoOqWPJe20h3F3t+kWJTAR37+M7sNOsPG89iz5Bulk=; b=YpWYDOHwpqhTnlbhFLLM0jYxwQFNc/OS6MJXr/dZGeXKRMOqWsZle67ZBgO3d61xxy CcZjYoAh7SROsO+hq1KqdzTC69qMSqQ5Zehsd6X7VSItyR5xpeC632A7tlROaPkUhoU3 u4bzhp0XfPeA7Suv1nGb4KBgfAVBcHu7FC2mmvz+ObU88hdFWKQMICw64ghy4Pf+J+fJ hM0YqEaD20wzGBgtt34nt21UtoMJWNaHiqFcFApHV5YMch4OwxChHM5QzRShoSFt3sSK ZzbfsbPU8qYuPcXBxGfuVeJuoaldpALuAbDw3YhhVynWVa/F9n63UJT8qlywKkQi259w ZuwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Pm4Lr3kA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a056a00168400b0056bfa55ed99si2059465pfc.119.2022.11.03.11.46.03; Thu, 03 Nov 2022 11:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Pm4Lr3kA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229570AbiKCSfM (ORCPT + 97 others); Thu, 3 Nov 2022 14:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230096AbiKCSfK (ORCPT ); Thu, 3 Nov 2022 14:35:10 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3BA5F14 for ; Thu, 3 Nov 2022 11:35:09 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id u8-20020a17090a5e4800b002106dcdd4a0so6096765pji.1 for ; Thu, 03 Nov 2022 11:35:09 -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=dgoOqWPJe20h3F3t+kWJTAR37+M7sNOsPG89iz5Bulk=; b=Pm4Lr3kAm7G9yhV3E+texinWexF8/BykknHnX+41QMhdAJg8Q6KGdsZlwDR9KsaQ03 q0oiA6QGnfMNaCLi6FwippomEY2Gxx8DIbtsls7Wm3K9Y5ntAz6T/fo5rOOGqR0XZexV IMpIarVZKtd2r4wbd6pBH2HWWgUKLdmEcjKjz7hr2eZWqilU2ZOjSL0LQYBIbuLk+an3 F080UdTs/Pl//2c4Y7M3MC5aXIj0L8ze9uKQnOS3RTfUxOdNjPBYkRT7wM2xznbkkPNf k6rWzEiCMkA6YZikO6kTaZUjEx2R8QJERpkjNDf1cNtL0uRiWX1pfQEgD4PMO8IN1GPi cqnA== 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=dgoOqWPJe20h3F3t+kWJTAR37+M7sNOsPG89iz5Bulk=; b=YRDfLzgcEZiGUXVXi14kzP7MLzc+wKj5SbLgt30MbIHJ/owkkfmzhW1c5DIyqSfePl 4Uu+MZq/jobJcUn4kauSeU6sG9ne9rbNDw8A4PJNEDdscxQ+orN7sw+tQlRCaRQGx120 doIWOgWtBZ3ySN/bwKujcrYO2T+YccdqXFgMOWMZ9GeHgynf0XMHo5dG3XfUVgClFWwu JyMZ+vjVZmx51fIvFWBA3+HGe3jiJmE4Q1JSbBZnOEEcSVaD8a35N7WWJU4/iZik3gEQ XaAxCsZJEYtJpT16WWI7Wpz6qjqwQvJPTXeBdCW7Konr2vzeDt5Io2C7JqiX9Ok1sDb+ 4FTg== X-Gm-Message-State: ACrzQf2kTASm5+zQBB2ZAHfxb/zo4PSYzlOuIYDW0q3BIvNygIsA5Jp3 V/6Wr1SnZNUpCZB91oAXrxnLTg== X-Received: by 2002:a17:903:1250:b0:185:40c6:3c2c with SMTP id u16-20020a170903125000b0018540c63c2cmr31387342plh.64.1667500509087; Thu, 03 Nov 2022 11:35:09 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id z4-20020a1709027e8400b0017da2798025sm914686pla.295.2022.11.03.11.35.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 11:35:08 -0700 (PDT) Date: Thu, 3 Nov 2022 18:35:05 +0000 From: Sean Christopherson To: Paolo Bonzini Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Matthew Rosato , Eric Farman , Vitaly Kuznetsov , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Atish Patra , David Hildenbrand , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, Isaku Yamahata , Fabiano Rosas , Michael Ellerman , Chao Gao , Thomas Gleixner , Yuan Yao Subject: Re: [PATCH 33/44] KVM: x86: Do VMX/SVM support checks directly in vendor code Message-ID: References: <20221102231911.3107438-1-seanjc@google.com> <20221102231911.3107438-34-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 On Thu, Nov 03, 2022, Paolo Bonzini wrote: > On 11/3/22 00:19, Sean Christopherson wrote: > > + if (!boot_cpu_has(X86_FEATURE_MSR_IA32_FEAT_CTL) || > > + !boot_cpu_has(X86_FEATURE_VMX)) { > > + pr_err("VMX not enabled in MSR_IA32_FEAT_CTL\n"); > > + return false; > > I think the reference to the BIOS should remain in these messages and in > svm.c (even though these days it's much less common for vendors to default > to disabled virtualization in the system setup). Ya, I'll figure out a way to mention BIOS/firmware. > The check for X86_FEATURE_MSR_IA32_FEAT_CTL is not needed because > init_ia32_feat_ctl() will clear X86_FEATURE_VMX if the rdmsr fail (and not > set X86_FEATURE_MSR_IA32_FEAT_CTL). It's technically required. IA32_FEAT_CTL and thus KVM_INTEL depends on any of CPU_SUP_{INTEL,CENATUR,ZHAOXIN}, but init_ia32_feat_ctl() is invoked if and only if the actual CPU type matches one of the aforementioned CPU_SUP_*. E.g. running a kernel built with CONFIG_CPU_SUP_INTEL=y CONFIG_CPU_SUP_AMD=y # CONFIG_CPU_SUP_HYGON is not set # CONFIG_CPU_SUP_CENTAUR is not set # CONFIG_CPU_SUP_ZHAOXIN is not set on a Cenatur or Zhaoxin CPU will leave X86_FEATURE_VMX set but not set X86_FEATURE_MSR_IA32_FEAT_CTL. If VMX isn't enabled in MSR_IA32_FEAT_CTL, KVM will get unexpected #UDs when trying to enable VMX.