Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8778927rwd; Tue, 20 Jun 2023 21:31:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48Vmgi6XXivDxew3/CbTof2J0txes31P3B6dcJKdVqBKkE7wrVT2MhQyAfnoE3Fb+sFGK5 X-Received: by 2002:a05:6359:6384:b0:131:72:1941 with SMTP id sg4-20020a056359638400b0013100721941mr3113883rwb.6.1687321894683; Tue, 20 Jun 2023 21:31:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687321894; cv=pass; d=google.com; s=arc-20160816; b=r9jQeXjxkU9DiDujXQNcfwvzmjKMgM41ldfh/ZOMt2WlpThcWr/XOJdMYNBN3g2aCH NRxKkAk0NcvFdwo6ZVPkgKUIJXHI0ZDmroUjOal2oXl3DKNAQ5Ks+TMIMuR48tN/aMkG gqIbx60Ab3WuvtTgFndNc1geAIssyh0M2R/Wosu9fa1uhxu3Lj9AtOKqAWSX24OhUxmt nO7htvda9NWz2cAfq2EcLR++cKifI/2dWhUVMr4jfDb4Mi5Hlji6XqrZqFcEvNYr3KB1 BlJ9hl6RtPDJbL4xNMSsqdPFVg2rnVci5pCeHGMDCS7ppjcmETFZ+b7Bn4QgGgDF2j+q QOIQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=2Ydbz+wSY3xZzbfU5gk2pkHlv45OmaHNsIf/D7uUTlg=; b=wiBOtMBoA41SS6h6QdDLj69D/5HhQerkOP0h06lSWhYi14jXViL5DvNb0gZ4J4GL0W HC2l2tcGouSLuZ7NjXiSGIi6D2pg1P3slp7nKqt3aMdtnH7knZVuzmZHglLzoN9HB6nI 3WMwAkiWeju88RsuMlxT1E6Yz4KVX2j95Rz08dL3D27vChhS73DArjJ5mn2EWoyBWT0z tBnRECTAFiOM15PmBfiiQCejV+adRZkPVteORkiS8hX+cz1umVuRIwxm23xHqzKpAa2i F3C7EYJhxcu9s3LzbBzZQNwm2ImNr3D3FwKagWO+ReQXurNXroqHP+r3L6nKEjg1zflj K7Kw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=iXaP9mMr; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a656944000000b00543cc3151f9si236933pgq.461.2023.06.20.21.31.21; Tue, 20 Jun 2023 21:31:34 -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; dkim=pass header.i=@amd.com header.s=selector1 header.b=iXaP9mMr; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbjFUEZL (ORCPT + 99 others); Wed, 21 Jun 2023 00:25:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjFUEZI (ORCPT ); Wed, 21 Jun 2023 00:25:08 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35F51172C; Tue, 20 Jun 2023 21:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d5AeONkgc8E+KewmeQjiMNsc6oGyBImxxMd9UieTJFabkV95XtZnzbZtPy2ylPzL4kocuRh9bEPAWkWUCnfzJ2SO6cG7Fuy2StxmbXsKU6NQq24Ut72mhQKc/2NarWRGBLeFhWBXeQEBejddcGPxZeT7nbTCecPVMKYbpjKZNChkLr1yPBV4WiVWtF05DL1N/kAnbWt5zVadblMAgaALQqwqhecMFhpW1LsSnF2MoRK63tSUkV/f40SMOJaWYvC2E35SV59EOok3TAzAyYtF5hhAgM9rnI/6lpS4EjAKVtIFekx7hYK9Gq8QtW0w1ZM8KgQASxPY77j/Pvcop+qQdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2Ydbz+wSY3xZzbfU5gk2pkHlv45OmaHNsIf/D7uUTlg=; b=RnTjbwwdhqDExG7rWQEpFrvKVfi3rOlywkK0irj55up6sPPKYjH68orPVou/mQlqIl4QXfwXtybWK93DTPa4A8tDJQqyTbA9Y6xIHfC/3u1lPwj9RQeWm+aSaCBCnq7iB4Q8tZigWyZd52UQ04fMWqHFUlBKkg2a8w7mHlIW39kB8b0HqlgHc39/Vllag7IgvHNAUE9/zyeFxm6jb6s8q5dwJgYrcRTFPm64Q5Nlckoq1Eq2DwISX8CqkPtsBBL1JRSxedccfSEinrMvPqHg3NLq+qMGO8wIetGczqqF7ZG37pVYjt/FUvfkz1y+QEwe9BGZZLHCFiDJVJM43su3PQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2Ydbz+wSY3xZzbfU5gk2pkHlv45OmaHNsIf/D7uUTlg=; b=iXaP9mMr+HLsqJJpQ22IKDbUbe8l1dEm5d2DRSjcke01UgaGV1NKdH23Q1pDZYRjf2UFTnJuoqBqzCHOc1fVahf6S80z1/37sr5DF73ZWGGVSqq9F7UWJuxova2FrV6XQZwi1+wo0sQBYFiUIxZgvuW+nDqfcPO+4K7G9lOpnos= Received: from CYYPR12MB8655.namprd12.prod.outlook.com (2603:10b6:930:c4::19) by DM4PR12MB6469.namprd12.prod.outlook.com (2603:10b6:8:b6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.37; Wed, 21 Jun 2023 04:25:04 +0000 Received: from CYYPR12MB8655.namprd12.prod.outlook.com ([fe80::8d99:5e7c:3ab:a882]) by CYYPR12MB8655.namprd12.prod.outlook.com ([fe80::8d99:5e7c:3ab:a882%7]) with mapi id 15.20.6500.036; Wed, 21 Jun 2023 04:25:04 +0000 From: "Yuan, Perry" To: "Limonciello, Mario" , "Rafael J . Wysocki" CC: Len Brown , "Huang, Ray" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" , "Shenoy, Gautham Ranjal" , "Karny, Wyes" Subject: RE: [PATCH v3 2/3] cpufreq: amd-pstate: Set a fallback policy based on preferred_profile Thread-Topic: [PATCH v3 2/3] cpufreq: amd-pstate: Set a fallback policy based on preferred_profile Thread-Index: AQHZo5yBMSRG81IwBEOekQRdyHNwE6+UqW7Q Date: Wed, 21 Jun 2023 04:25:04 +0000 Message-ID: References: <20230620172433.21325-1-mario.limonciello@amd.com> <20230620172433.21325-3-mario.limonciello@amd.com> In-Reply-To: <20230620172433.21325-3-mario.limonciello@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=6d5fd617-d590-4951-8fdc-044a43be1135;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-06-21T04:24:53Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CYYPR12MB8655:EE_|DM4PR12MB6469:EE_ x-ms-office365-filtering-correlation-id: d19cf6d6-3421-4f38-29b1-08db720f7cbc x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uHe8Zr0wEaG1NBfddILmdwc6lB2EKHupxB46z2x+HFYc5tyB55/dS9Wsd1Ags7aohjQ+SKUeVA4Dx7wvm+rY4AN44ri9mxB13B7oRd46zWDqI1XlOpqWy07wJOsohc4KGJqDNKNAgM3yIepgEnKjmutTBplQoPCdkjytcv2jmCfQMRr76MIVr25t290LRCwkgDqedK62ghA/KImF8kqG6u/kazLMbt6D8WawNExB6owbJFTJOB6OzWzeNFXrrY0MwZwRdhKgP92xEkXrkLjIxGTnuGlWne2/lIrOKv4GghtSXVbjtdKm9kmeRbdK8ZPHNuRVSRi7pgOh0rjGNaM9lJW0TPcEKsLo7zLlRgh2En715f2z7YelUlY7scr6ON51dPCDFIC7dhnPqvNL9cfTq87Z346vP4rik0yqeM0wPE61riu3pNJSzxfCQj5DL8I4yFXn6g3DtgANz+UIDnAoRZGYUUA8ufcjHi9lek5KXdEj1kkOT1MObjbftU1DxyHwqjBZWLWwF+buyaHf8mq89ZeXDtqAwlASESCj018CNI6ZNl6RuMYRm53PgXBDwtfa3kI/dCKQiIGlSfrLNuBj72IMUykK9ECxMd2dnOs4nBk= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYYPR12MB8655.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(396003)(376002)(366004)(39860400002)(451199021)(71200400001)(86362001)(52536014)(83380400001)(2906002)(38070700005)(122000001)(5660300002)(4326008)(110136005)(54906003)(66946007)(8936002)(66556008)(186003)(64756008)(66446008)(66476007)(9686003)(966005)(38100700002)(478600001)(76116006)(55016003)(53546011)(6506007)(41300700001)(26005)(7696005)(33656002)(316002)(8676002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?aS7yMu+3CBXmt1UnPfusmxcc54S6noatDfVgnFIHBPz1WQ2YyNeCiceMn3aj?= =?us-ascii?Q?BPz1be3gStK3QFCgxX8VgKVPP+n95rw3N2Q4GjkzCsJYjPVUtd09FEZzkitR?= =?us-ascii?Q?vhUMJvpa3CI+O9bpAFR94k17Z73QGezqipNo4cFxxwWpllxrE0u0lbd4nzeB?= =?us-ascii?Q?fgrAY3wIMKJ37BioSMC0dx3C/FIiucBcsftoE2SMFWMeE1VspyHMMJDL0/Sq?= =?us-ascii?Q?FzLwWyTHk9gNBYFbYlAr0roDMQ8wcAtdZPG9u3u0NgaluGs/CyEatQGVRAun?= =?us-ascii?Q?Mtc9+jYmAIRhui7ZPxOogRagZQIbMsnNJxVqlJnBSCeUnoX4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u7HyLEBIvl4gIHw6F32Fj3gSaJAP?= =?us-ascii?Q?wCiGkJgcNIZxxUtqtBeBM0ZGXaW0226WQ1WMHTPe1Ybn9irKlGJXr8HHTSZx?= =?us-ascii?Q?YMqu0lYdXY2d88XazU1JdGpNz80XEbBS0SXgN6LKphVK2sAZso44GorXKVqC?= =?us-ascii?Q?H/b/AauFp0u4CS8UyDmPv5z1qWetDXH9IuwmgBDcrMuFSiNdmdzlIqYJ9H9+?= =?us-ascii?Q?WFTEyLKWx9Ugp1gHlUj/U2nfZavf9FEGdx9SXTwwFBrWUOsmXDRVWve2SkXn?= =?us-ascii?Q?Q+BWS2R5/srA82DIs2lCZbjbx6OrgsIgWIVWU0xuqP6ForBqrkyjomJjphSo?= =?us-ascii?Q?j7TGUllzMpcSB6DHv0Q=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CYYPR12MB8655.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d19cf6d6-3421-4f38-29b1-08db720f7cbc X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jun 2023 04:25:04.5754 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: k1Aw+qtxSL9W0G+xVqrGft8NtE6SYOg+LI9OjsW1azedU1MWFMsJqYuetW5URQrlnlyL3xxVj2sO0tQiNM6zEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6469 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 [AMD Official Use Only - General] > -----Original Message----- > From: Limonciello, Mario > Sent: Wednesday, June 21, 2023 1:25 AM > To: Rafael J . Wysocki > Cc: Len Brown ; Huang, Ray ; > linux-acpi@vger.kernel.org; linux-kernel@vger.kernel.org; linux- > pm@vger.kernel.org; Shenoy, Gautham Ranjal > ; Karny, Wyes ; > Yuan, Perry ; Limonciello, Mario > > Subject: [PATCH v3 2/3] cpufreq: amd-pstate: Set a fallback policy based = on > preferred_profile > > If a user's configuration doesn't explicitly specify the cpufreq scaling = governor > then the code currently explicitly falls back to 'powersave'. This defaul= t is fine > for notebooks and desktops, but servers and undefined machines should > default to 'performance'. > > Look at the 'preferred_profile' field from the FADT to set this policy > accordingly. > > Link: > https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Progr > amming_Model/ACPI_Software_Programming_Model.html#fixed-acpi- > description-table-fadt > Acked-by: Huang Rui > Suggested-by: Wyes Karny > Reviewed-by: Gautham R. Shenoy > Signed-off-by: Mario Limonciello > --- > v2->v3: > * Move new symbols out of patch 1 into this patch > * Add Ray's tag > --- > drivers/cpufreq/amd-pstate.c | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index d8269994322e..3546d7db614d 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -1071,6 +1071,26 @@ static const struct attribute_group > amd_pstate_global_attr_group =3D { > .attrs =3D pstate_global_attributes, > }; > > +static bool amd_pstate_acpi_pm_profile_server(void) > +{ > + switch (acpi_gbl_FADT.preferred_profile) { > + case PM_ENTERPRISE_SERVER: > + case PM_SOHO_SERVER: > + case PM_PERFORMANCE_SERVER: > + return true; > + } > + return false; > +} > + > +static bool amd_pstate_acpi_pm_profile_undefined(void) > +{ > + if (acpi_gbl_FADT.preferred_profile =3D=3D PM_UNSPECIFIED) > + return true; > + if (acpi_gbl_FADT.preferred_profile >=3D NR_PM_PROFILES) > + return true; > + return false; > +} > + > static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) { > int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; > @@ -1128,10 +1148,14 @@ static int amd_pstate_epp_cpu_init(struct > cpufreq_policy *policy) > policy->max =3D policy->cpuinfo.max_freq; > > /* > - * Set the policy to powersave to provide a valid fallback value in= case > + * Set the policy to provide a valid fallback value in case > * the default cpufreq governor is neither powersave nor > performance. > */ > - policy->policy =3D CPUFREQ_POLICY_POWERSAVE; > + if (amd_pstate_acpi_pm_profile_server() || > + amd_pstate_acpi_pm_profile_undefined()) > + policy->policy =3D CPUFREQ_POLICY_PERFORMANCE; > + else > + policy->policy =3D CPUFREQ_POLICY_POWERSAVE; > > if (boot_cpu_has(X86_FEATURE_CPPC)) { > ret =3D rdmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, > &value); > -- > 2.34.1 Reviewed-by: Perry Yuan