From patchwork Thu Dec 1 23:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 28602 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp541956wrr; Thu, 1 Dec 2022 15:32:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf4rTOKvDRzq/dcedjsBLFk3fe7/vJfEFVvLOlEkMzRJ6AEiitodh1zD2/Hpki7xAxgj5nx0 X-Received: by 2002:a17:906:79c4:b0:778:e3e2:8311 with SMTP id m4-20020a17090679c400b00778e3e28311mr44580856ejo.342.1669937534907; Thu, 01 Dec 2022 15:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669937534; cv=none; d=google.com; s=arc-20160816; b=UlyshVw60oUK4CnA70sv9mwXtOBpPMcS6Lh+jQufqLiW3w1oHDzB0PO4IphykzZ4BR 2fRYmn9lZi4UNFXaGNuLi63Z7n1R2fnrnoN9f+o16zb6LKxa7cLHA3S5Mc7Wx73Ir0pN uu7SH1JR9ew4BSKEWeRZRI9jV/rHDuahUTK3DDA2VJmT5BMYS6u2zu3lQ9xmEA0aJCC0 cAqg/ZqB9iW0T4mDr8tCb7S53VDEhdMMYX8wlGOp3wg9LoyR3yH8QmdHLB7nI5dDE0BT 5QmO+7LlIns0RJGyu+4PETJGIMtbMHdF/zan41sRVxNmuSliJWjIJTbG+fjhKlEXVWmP qS/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=xKO5gDHH6l2BFGRx+bAr/R/X/txGS/YMP3y88vo/DQs=; b=MOJCc+ywOtgYACu/IxvWslEE2fJZgAQdjhnD4CpHCxE0902XAD8RRIM2aMAPoXrVs2 txrIcTEM1/MSK8E5FJ050Wx7lSKEYrhe3Fr+SdF6Y7rWjOs4mntE9+8h2upr4gM01/Wl 9Wnd8U6xmGSTwEZC44QAg6GVhnL2yFUN0FYRhqYrqXJLhLWXbBfeML5VuzV76eBrBq0v uiUSpjxnDDVLeqm4zfIyfJwWHOIYWaO1ycd1k59t3SU7VDIWlBu+L5yDikG4nb5eNKIJ sdCTcmayQYFyp0Y7K45FhscrnrhlCDSZNGA08/DyjPnEHQH+VDNzNFnuXUI+sqIR4Et+ Pieg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=O6HXE5ml; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb10-20020a1709071c8a00b007a9d456583bsi5137286ejc.62.2022.12.01.15.31.50; Thu, 01 Dec 2022 15:32:14 -0800 (PST) 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=O6HXE5ml; 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 S231887AbiLAX2r (ORCPT + 99 others); Thu, 1 Dec 2022 18:28:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbiLAX2S (ORCPT ); Thu, 1 Dec 2022 18:28:18 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC63CE41E for ; Thu, 1 Dec 2022 15:27:23 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id f71-20020a25384a000000b006dd7876e98eso3289312yba.15 for ; Thu, 01 Dec 2022 15:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=xKO5gDHH6l2BFGRx+bAr/R/X/txGS/YMP3y88vo/DQs=; b=O6HXE5mlRidl0Q4rg3rTusA/uGWWbvzYZixtwdz2MUbik0b8Z6ICCGGqeQiqEoime7 L2AfiIVKS9WasGmJLtrCfdVsyTFPf0YlWz56R1E38/8w0f500LJAenTrT3AVUQu+q1dz 2wgGdMjtPJrgnEFXMeWyb+VyPnSBwX0LdNfpokDzQ8gCS38+Sb4zbTS066WOEl+djFle 9Kskm+wQwxdJNVTFMHKMxzvNjt37+Rt2yBgO4kuYpsqiKNSZWiIQbn1Z9p3I6T2vOnBX PFfgGe2Oj+l8DFaSFI4MgLtP9BvgCA6CYt8cSln717GUjOaqIuI2yds0V00PifmVFZQU EfaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xKO5gDHH6l2BFGRx+bAr/R/X/txGS/YMP3y88vo/DQs=; b=Ts50H8020oU9WL4U2VNovfiYgWZA6f/J+VxXBkd0Y9Y6cTEMYgTun49RB7U/XTHclg i2QdcCeOwk/JLIvt190mMN7WXd9MBh46cizjtSvrRc3AvYz9SACU2EWgB7XSgP6lgeuC Xb5lcnZllvNZdgoKfTdv18ySmMesHIOAng8gAVI9FyKcaIR/tugLYDxyBh72Hvme2k70 wynKj/AO569nkLfjur5XQ+85gH9jOI55/hiF09XEDVH5Q1+BzkAbU6GUoHKM2q/mc38y dADIODZ+BmyqPq+6YTqsTNN/CNXmnySRuziT1q8uJG6MgZAK/8Jagf64N1IvjMK/23k9 3jLg== X-Gm-Message-State: ANoB5pm4OkVnJSp3z52oqJACSzk0TnfQiQw+pCk0YU7apB9BdF8n+zto 0C17Nff3sDaJTfNyyBRATwG57WpGu4E= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:6c44:0:b0:6e9:b6ea:fc86 with SMTP id h65-20020a256c44000000b006e9b6eafc86mr47631850ybc.183.1669937242341; Thu, 01 Dec 2022 15:27:22 -0800 (PST) Reply-To: Sean Christopherson Date: Thu, 1 Dec 2022 23:26:51 +0000 In-Reply-To: <20221201232655.290720-1-seanjc@google.com> Mime-Version: 1.0 References: <20221201232655.290720-1-seanjc@google.com> X-Mailer: git-send-email 2.39.0.rc0.267.gcb52ba06e7-goog Message-ID: <20221201232655.290720-13-seanjc@google.com> Subject: [PATCH 12/16] x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm() From: Sean Christopherson To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Sean Christopherson , Paolo Bonzini Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Andrew Cooper X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751056420415590388?= X-GMAIL-MSGID: =?utf-8?q?1751056420415590388?= Drop the explicit check on the extended CPUID level in cpu_has_svm(), the kernel's cached CPUID info will leave the entire SVM leaf unset if said leaf is not supported by hardware. Prior to using cached information, the check was needed to avoid false positives due to Intel's rather crazy CPUID behavior of returning the values of the maximum supported leaf if the specified leaf is unsupported. Fixes: 682a8108872f ("x86/kvm/svm: Simplify cpu_has_svm()") Signed-off-by: Sean Christopherson --- arch/x86/include/asm/virtext.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h index 0b373543514f..eddc0eeb836f 100644 --- a/arch/x86/include/asm/virtext.h +++ b/arch/x86/include/asm/virtext.h @@ -39,12 +39,6 @@ static inline int cpu_has_svm(const char **msg) return 0; } - if (boot_cpu_data.extended_cpuid_level < SVM_CPUID_FUNC) { - if (msg) - *msg = "can't execute cpuid_8000000a"; - return 0; - } - if (!boot_cpu_has(X86_FEATURE_SVM)) { if (msg) *msg = "svm not available";