Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1579203imw; Tue, 5 Jul 2022 11:53:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1txQiqhzEvAk8386r4zCW3LpnUejPmcTGWIW7QpuyBaHDkvPqRFcVD6T5devtfXII2QjqR1 X-Received: by 2002:a17:906:77c8:b0:722:e753:fbbe with SMTP id m8-20020a17090677c800b00722e753fbbemr34048736ejn.692.1657047231724; Tue, 05 Jul 2022 11:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657047231; cv=none; d=google.com; s=arc-20160816; b=XawC29Yom24YsNGxiimDCrpbEjk+6PAPd0scwDRqqlBeL18jkijx3ptAoqlYyoxD6m LwNAV9zBcefQsSvb7/Zr7eFPWPcR3zdTOLxQwEAao3/Oa9M42qKvSCXfCzxdvnIpKP2t 5TuRXR8MVIoV4jJkZCi/sEEF/IGvP00NGh3z1hKJNaljV9e75oE2c/fzXLDnIjhO3A1k vsWCzF8WIR7I6KqMhbtolFQt2LiPTrQ5cvf8fmTQ68/K2lGE6eO6yDqvSv3DAKKZWNM2 dXn3uF7bYncgKU4OXj1j1Yjk2w+zBOGa3c3nAfem9zxtBXsIoMZ4igqyt0AFKnURTr8z WCPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=2IJa3F4chuHeeOTo8oUJNcMPecHREZFykKcSbqyP2C4=; b=q1Rq/n4Z2JhKbRLhWfoh4ZzFMM0G8D85QWo4U/pJbt1R1uT9TWUiO0SDcF0geirs2r vrcXXks33jL6KI89q4fdd6nikqH8e+qoq21ojzEDsY4qYNxsnSwuRueE0i2v8rdJsFPm c2sHLui659nCdpy3wHncmbKHK4bb9Lbjf6zrvtQVeZ1WxQfGt0sIqWiV8MCysXXil35U /vskR6bLaQZR+DbvELihsNPdqsz2aG+Ynn2QPruzW7hyRMf2z5a5ZwZ3AU6IgCyBrkj5 pY9LayaovrHSBTlwI0rxXebdPxNyPnNqMI14CcpKyH7OVim9qdPkEqeOH/lp0d4CiYkl eq6Q== 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o3-20020a056402444300b0043a67b8dc66si6237898edb.267.2022.07.05.11.53.24; Tue, 05 Jul 2022 11:53:51 -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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229525AbiGESp2 (ORCPT + 99 others); Tue, 5 Jul 2022 14:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231181AbiGESp0 (ORCPT ); Tue, 5 Jul 2022 14:45:26 -0400 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064B31C11F; Tue, 5 Jul 2022 11:45:25 -0700 (PDT) Received: by mail-yb1-f170.google.com with SMTP id i14so3693538yba.1; Tue, 05 Jul 2022 11:45:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2IJa3F4chuHeeOTo8oUJNcMPecHREZFykKcSbqyP2C4=; b=UBtG3OXsFipBmTyXEeF1jnYa3tUrwTz4FCs6p3YdSDSJvHGqIWTr6rFG2hcRtP7SZs pQZhFj1F6kOEcR3K6ijoJrUXAAcL4dEeVK7SUmQZupMwJQMxs0tfbiPFOUa0YVNL/7D5 TC5XN4paiEDdn8Qx+bIUmwBzsm2cSkTfde28UzSzU7O4lN2XkzoxKKvpBunWMpJnHIGz TJMiW67HHSS2CuByST+N8UQP0qysncbjoD9BJePCg24G3qpaC1qCJlXfNJagzeNC459k FAqDjuvQf+y/p9KOmEVT5Ri6WPgpJeFEKO4GrOgZ/WZgW1F7KUVMp3hTG9R2dK1zIxac HLOg== X-Gm-Message-State: AJIora/2chEuoFrqcBN0emU95XtOW8XxarbqaAhXi14MyoJpo2TbvGuw Y9LYk+PTkX0+MTZK874IYAlYI2vnewen11WS7Tg= X-Received: by 2002:a05:6902:50e:b0:66e:7f55:7a66 with SMTP id x14-20020a056902050e00b0066e7f557a66mr3495794ybs.365.1657046724197; Tue, 05 Jul 2022 11:45:24 -0700 (PDT) MIME-Version: 1.0 References: <1656659147-20396-1-git-send-email-TonyWWang-oc@zhaoxin.com> In-Reply-To: <1656659147-20396-1-git-send-email-TonyWWang-oc@zhaoxin.com> From: "Rafael J. Wysocki" Date: Tue, 5 Jul 2022 20:45:13 +0200 Message-ID: Subject: Re: [PATCH] x86/cstate: Replace vendor check with X86_FEATURE_MWAIT in ffh_cstate_init To: Tony W Wang-oc Cc: "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 , ACPI Devel Maling List , CobeChen@zhaoxin.com, TimGuo@zhaoxin.com, LindaChai@zhaoxin.com, LeoLiu@zhaoxin.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 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 or please let me know if I'm expected to pick up this one. Thanks! > --- > 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 >