Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp999690imi; Fri, 1 Jul 2022 00:18:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tRQ2AB/PbGn5saFIgfjHtRQjHZQeqjO0fTB9Rf/Hb7Sy+UY72M5ZqYZxl16BkrwrAAGIEm X-Received: by 2002:a17:902:c443:b0:16b:ad0d:7c4b with SMTP id m3-20020a170902c44300b0016bad0d7c4bmr7781466plm.111.1656659892773; Fri, 01 Jul 2022 00:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656659892; cv=none; d=google.com; s=arc-20160816; b=ab5cCra1CuQpNxTuRnwMaGVjwsjwX49cj8Z1+o4UZXnsHXmvsYwqEWVN6aHd2Xx6ye cB1OwXw44h0Gt3qD3si/DS/Xx4Zc/rfdxUryjB4fS3LGekR7V+VF6PLh6+oaxcfIHBQC 1u9YklnkfQRKEhGl5qMyGbXF4mpFhVJje9wOKCCey6T3swaevBi2DWR00NF1YXNq5XB2 khzsG6CLhtUVxzbCa1mJw22PG5WKoR/gXLDil2TAiCaFBgGICRx9sHwH0TkrU/nhrG7k uboyX8Q78L0rUh5nX6kfmFQ34Sjzmci312/fJf2t79o/kycuG4yy1f35rpbcZUJLkf/O BR1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=8926rx3DEMJIEKDI9JMu72Vd+yvTTq2EgNg8RQC+hYQ=; b=GMcFHG1o0hAANPfKwKykrXlF5VjDrb/kvvTjt9Y9AMQw0I7QvMkJ5512pSScBKhMB5 tcLMYtAfc8XjGlrfBHlC1P8fPB2HfW8y7eBInKFSvUdweHwWqn6qppKXH8GqaSpas9kA q51QFfAFJ+wa8+ROhWfZNiKzBbfH9ZsLdZWqhu6E9MX/1yZbC+BPlVkjeOXNIHDEDcPQ NZU0txAHI6QKdR5EFjS9LYLrf0O3DUPvz7t1xBhTmMkoLt1MmDqDEgEpr5GXcD1T8pdc iJ/btU3sYa7M3M3MqzKLkonI3vPHa3CQEtCkkzZSk0p8/4uuHg8DZjo3hCwagXDwvzC7 JWSg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a632c0f000000b0040d9515c0ffsi27228775pgs.355.2022.07.01.00.17.59; Fri, 01 Jul 2022 00:18:12 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235154AbiGAHF6 (ORCPT + 99 others); Fri, 1 Jul 2022 03:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235025AbiGAHFy (ORCPT ); Fri, 1 Jul 2022 03:05:54 -0400 Received: from ZXSHCAS1.zhaoxin.com (ZXSHCAS1.zhaoxin.com [210.0.225.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09B55677C2; Fri, 1 Jul 2022 00:05:53 -0700 (PDT) Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS1.zhaoxin.com (10.28.252.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 1 Jul 2022 15:05:49 +0800 Received: from tony-HX002EA0.zhaoxin.com (10.32.64.1) by zxbjmbx1.zhaoxin.com (10.29.252.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 1 Jul 2022 15:05:47 +0800 From: Tony W Wang-oc To: , , , , , , , , , , CC: , , , , Subject: [PATCH] x86/cstate: Replace vendor check with X86_FEATURE_MWAIT in ffh_cstate_init Date: Fri, 1 Jul 2022 15:05:47 +0800 Message-ID: <1656659147-20396-1-git-send-email-TonyWWang-oc@zhaoxin.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.32.64.1] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 The original commit 991528d73486 ("ACPI: Processor native C-states using MWAIT") has a vendor check for Intel in the function of ffh_cstate_init(). Commit 5209654a46ee ("x86/ACPI/cstate: Allow ACPI C1 FFH MWAIT use on AMD systems") and commit 280b68a3b3b9 ("x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems") add vendor check for AMD and HYGON in the function of ffh_cstate_init(). Recent Zhaoxin and Centaur CPUs support MONITOR/MWAIT instructions that can be used for ACPI Cx state in the same way as Intel. So expected to add the support of these CPUs in the function of ffh_cstate_init() too. The CPU feature X86_FEATURE_MWAIT indicates processor supports MONITOR/ MWAIT instructions. So the check for many CPU vendors in ffh_cstate_init() is unnecessary, use X86_FEATURE_MWAIT to replace the CPU vendor check. Signed-off-by: Tony W Wang-oc --- arch/x86/kernel/acpi/cstate.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c index 7945eae..a64c38f 100644 --- a/arch/x86/kernel/acpi/cstate.c +++ b/arch/x86/kernel/acpi/cstate.c @@ -209,11 +209,7 @@ EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_enter); static int __init ffh_cstate_init(void) { - struct cpuinfo_x86 *c = &boot_cpu_data; - - if (c->x86_vendor != X86_VENDOR_INTEL && - c->x86_vendor != X86_VENDOR_AMD && - c->x86_vendor != X86_VENDOR_HYGON) + if (!boot_cpu_has(X86_FEATURE_MWAIT)) return -1; cpu_cstate_entry = alloc_percpu(struct cstate_entry); -- 2.7.4