Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4071879imw; Mon, 18 Jul 2022 21:48:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vYrNWJj+Fxbbv/MKj25QjtrC0tWOgEOLACwRj7neOSUmtFnWD2Wo0op/9BW50H4UTdXs3Z X-Received: by 2002:a17:90b:4c0e:b0:1ef:e8dd:8572 with SMTP id na14-20020a17090b4c0e00b001efe8dd8572mr36435091pjb.211.1658206110836; Mon, 18 Jul 2022 21:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658206110; cv=none; d=google.com; s=arc-20160816; b=npDk6IG0Qvn3UsgLrKOjKzJJlv33oTfjIazW07QjbQUrNxkiHR2WiLgTgwYIAbTdOx UgLI3TdZwCiHotFv9UANfdxrEjyTR67Zpg25Okp6mj7rOdMFltGzYPW13fizyrPzuZWX sErIRDXojtLwW1w9xl2lkl2qdxVLHiXwjQYcLqYJcr/h7RLZI2IfSGJ6E5XzwCOzNHRj bGnW2zG1wFNA9z95FIyjc6wmyiyrDsGiQde5I+ThnsYFV96RHtiL2vQsq4l92k6XjiZR 4jetio3/S4HFDzJ1eZsSkp5sjqKwpRbELY56P3TOjsYWePn3XV3MwnuHF/NKwpNVMuiz LHHQ== 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=DaDnuPlylmVxeZhkfk009FoMKpZIqxMIbEINANCURyc=; b=Bf4P3hwgww6b73OAUEXNIkg16B1IfTaZBpSF96xYb3egdXTOFmsQD1x0Fr3Qo9pO0R X3c551rrLPbVzqVTrn29FBT2tD+edkxioPyIDbAFNjUC8+aCY7wBhG1o1AtacBQzIYbP 30iqZzIczKAUZiyeK8pEoQbFBCIbT2e0ZlXhCkhTtKoDfxB+2p7dpI2cLE/iosZ0SoCU i1BuTHaDi2qkOyZOYTJ6JyqJ9Tvld/7c7Kguw1Ia2AcOKH3B++nswu9InJKv7bpy7AZl Usz1Kg+ZbQDhtW09yANeyNXNyMENs1eUuWAufnEwm9HGMTapeVPa+gCzvN6HW6ftPaEO XUfA== 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 s8-20020a17090aba0800b001f07221b2dcsi17207000pjr.185.2022.07.18.21.48.16; Mon, 18 Jul 2022 21:48:30 -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 S235635AbiGSDve (ORCPT + 99 others); Mon, 18 Jul 2022 23:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234591AbiGSDvc (ORCPT ); Mon, 18 Jul 2022 23:51:32 -0400 X-Greylist: delayed 903 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 18 Jul 2022 20:51:30 PDT Received: from ZXBJCAS.zhaoxin.com (zxbjcas.zhaoxin.com [124.127.214.139]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E51A28E1F; Mon, 18 Jul 2022 20:51:29 -0700 (PDT) Received: from zxbjmbx1.zhaoxin.com (10.29.252.163) by ZXBJCAS.zhaoxin.com (10.29.252.3) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Tue, 19 Jul 2022 11:36:11 +0800 Received: from [10.32.64.15] (10.32.64.15) 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; Tue, 19 Jul 2022 11:36:09 +0800 Subject: Re: [PATCH] x86/cstate: Replace vendor check with X86_FEATURE_MWAIT in ffh_cstate_init To: "Rafael J. Wysocki" CC: 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 , ACPI Devel Maling List , , , , , , , References: <1656659147-20396-1-git-send-email-TonyWWang-oc@zhaoxin.com> From: Tony W Wang-oc Message-ID: <993cf518-0ec6-639d-039a-6a2a1b1b5793@zhaoxin.com> Date: Tue, 19 Jul 2022 11:36:01 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 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.64.15] 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 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 2022/7/6 上午2:45, Rafael J. Wysocki wrote: > On Fri, Jul 1, 2022 at 9:05 AM Tony W Wang-oc wrote: >> >> 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 > > Reviewed-by: Rafael J. Wysocki > Thanks a lot. Add some original commit authors this patch related to. > or please let me know if I'm expected to pick up this one. Thanks! > Yes for me. Thanks a lot. > >> --- >> 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 >> > . >