Received: by 2002:a05:6512:e85:0:0:0:0 with SMTP id bi5csp128299lfb; Thu, 23 Jun 2022 20:38:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t2kNK2veraT5SJpc14n+OMhOrktULIXg8kZHNJEncQGAaXoKNR584wq9hmez/ykWBkMx5s X-Received: by 2002:a05:6402:2396:b0:435:775b:b136 with SMTP id j22-20020a056402239600b00435775bb136mr14773911eda.299.1656041883224; Thu, 23 Jun 2022 20:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656041883; cv=none; d=google.com; s=arc-20160816; b=yVQVJEhRiij5V1d8SRiqp+YmRZccvSKar3ec0tEDijZZImXZqOQWEmt+m4Z1wSGaPC KWchBVE/sukp38ZMvBtDzxg33xDCbFxHYjKs6tTEutqWC/SC4FLH5Ln7BfI7qDM8iNkm lr6Nxv1e9eLpDmx2RNLG2wKbLLqdrqrimVDQgq2PSIEdvy29KT45JGrxhd7KOu1DH+c2 LNjZAsQy6DMdEnj2kRyu5kFoJQh2SFfUwaWBBKRKpedg8Aq2DOWacN0V1siPuMkT0j3+ yDQFqiSeLKLwLE7GBzgu22VQHJmSkPMuliVIaipCAMpb460nXy4h+72bRkIXslGg+AFV rB/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=knzqN/ZRB8E3OC2cQzOjEICS0AjZDL+6KNE9Rb9dka4=; b=HgOlfUzbeRXanL27BlL9mP6dkslVxSJTJaZiVdWOopdbNk62fhfqc/2B1FuieyPH5i 0P86jco9jlj6QdGVUwi81LzW3dCZHpQ9N75+MWcslMuiK5tLhF5IwURptfMU6Cq4YJCQ 9MsltrhrihL0BGhPs2OKxUo/3qdDiMOL8e0VJBD/+ZaXmnRqjQVUWsjdPBCZWqlD0gFj zQAwqkiIxvDNbQPTMBqBfOlJUWjD1jdKYzaQ1TxSn18qG1IkCyfYtzlhKQhX6/TVUD05 k7lr6k07ff86uzJE+fC34XEx1mqKVtn/ISYvD7fW+ybulJ9RWETadJx23RUFHGsy01Q/ zAeg== 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 w3-20020a056402070300b0043048556c45si1511878edx.250.2022.06.23.20.37.38; Thu, 23 Jun 2022 20:38:02 -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 S230185AbiFXDF0 (ORCPT + 99 others); Thu, 23 Jun 2022 23:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229889AbiFXDFX (ORCPT ); Thu, 23 Jun 2022 23:05:23 -0400 Received: from ZXSHCAS2.zhaoxin.com (ZXSHCAS2.zhaoxin.com [210.0.225.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99DBE33F; Thu, 23 Jun 2022 20:05:17 -0700 (PDT) Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXSHCAS2.zhaoxin.com (10.28.252.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 24 Jun 2022 11:05:15 +0800 Received: from [10.32.56.37] (10.32.56.37) 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, 24 Jun 2022 11:05:13 +0800 Subject: Re: [PATCH V1] x86/cstate: Add Zhaoxin/Centaur ACPI Cx FFH MWAIT support To: Dave Hansen , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , the arch/x86 maintainers , "H. Peter Anvin" , Linux PM , "Linux Kernel Mailing List" CC: , , , , ACPI Devel Maling List References: <0b583b7e-dcd3-be51-f367-1c12ac841d3f@zhaoxin.com> From: Tony W Wang-oc Message-ID: Date: Fri, 24 Jun 2022 11:05:12 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.32.56.37] X-ClientProxiedBy: ZXSHCAS1.zhaoxin.com (10.28.252.161) To zxbjmbx1.zhaoxin.com (10.29.252.163) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 On 23/6/2022 23:55, Dave Hansen wrote: > On 6/22/22 18:26, Tony W Wang-oc wrote: >> Recent Zhaoxin/Centaur CPUs support X86_FEATURE_MWAIT that implies >> the MONITOR/MWAIT instructions can be used for ACPI Cx state. >> The BIOS declares Cx state in _CST object to use FFH on Zhaoxin/Centaur >> systems. So let function ffh_cstate_init() support These CPUs too. >> >> Signed-off-by: Tony W Wang-oc >> --- >>  arch/x86/kernel/acpi/cstate.c | 4 +++- >>  1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c >> index 7945eae..d4185e1 100644 >> --- a/arch/x86/kernel/acpi/cstate.c >> +++ b/arch/x86/kernel/acpi/cstate.c >> @@ -213,7 +213,9 @@ static int __init ffh_cstate_init(void) >> >>      if (c->x86_vendor != X86_VENDOR_INTEL && >>          c->x86_vendor != X86_VENDOR_AMD && >> -        c->x86_vendor != X86_VENDOR_HYGON) >> +        c->x86_vendor != X86_VENDOR_HYGON && >> +        c->x86_vendor != X86_VENDOR_CENTAUR && >> +        c->x86_vendor != X86_VENDOR_ZHAOXIN) >>          return -1; > > Many of the changelogs that add new vendors here go on about particular > C states declared in the _CST object and contents of CPUID leaf 5. > > Why do we even _have_ a vendor check here? Shouldn't the code just be > going and doing the validation of the _CST object and CPUID that the > changelogs blather on about? > Yes, agree! Will change as below. Please help to check if it is OK. Thanks a lot. 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; > Intel certainly made the original sin on this one (see 991528d7348), but > I hope _something_ changed in the 16 years since that patch went in. > . > -- Sincerely TonyWWang-oc