[v6,03/11] cpufreq: intel_pstate: use common macro definition for Energy Preference Performance(EPP)
Message ID | 20221202074719.623673-4-perry.yuan@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp702762wrr; Thu, 1 Dec 2022 23:52:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6z5vWJ2meK277qzFBL4oMgxzVBtMCICr/Ym8VeEznqvELT56LFnIwRWl3XZCNJDqH+tVTa X-Received: by 2002:a62:1d54:0:b0:576:27e4:3b2d with SMTP id d81-20020a621d54000000b0057627e43b2dmr5757872pfd.23.1669967561992; Thu, 01 Dec 2022 23:52:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669967561; cv=pass; d=google.com; s=arc-20160816; b=k1hRUSIT7nOKY5OA4j3JTUv1qMYiEKkbr1QqCXdVCrdYcvC8qf4+1Apd67B4qzG87m nwumBv2XEqdmbvweWs2D9f8y1E4QlGxQU4DHljG6WWGeWlZJgltysEutQ+w6+/sdnbe/ /AmBqk6xW02ElMBs38mKwnq+g6Fj8mBVa9SckVTL6JgfkJLIlxmVHLUB3YIly0jajipq BaH6rJn398ajEFIAd0qxyLXVUAyFM1HJ6iYNbhST2Ldz7JvPHxkG+bmLmpwbGBChxLx6 t2x27aQFmyiqduM4KWBwoJb6KAv5Ue9x7SMfGFJeTvnbCO75ifuUxW2IHf5NEQmjNGNH wb+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q+C4iUKjwXwEm0UuOYNQXdTkPvGvjj1IuenIn3mTcD4=; b=FwvUHh/J7cZWwbhMhD8cOI17XtpkbsZbjXjdc5MVwLkGFdVADzOFmuboaSkMe6vZt1 xacoge1MGD9O/cYbY1m+rx4j2ECSoxhACpY7i4+2oxgUg4K4d15bxi5h0dAde9MQrche Sf9Ut+kRld64S0aii6f70VzxLBn/G+rNk8tn/c0Xq+4hV6roov4VvP0yw5kKDcFEarzs bLmxDOjN9l+5ic/DzbOKQlo39uul76TEACUwaf9aBO6vh+O814gQ6+WbrKHKJZcugyby l8GwhjKlUZecdVkvoxGq+cLfh6xuhsHCn3jvivs8sJY+Bz++Wg9bevWTrStPPdCqT1mU reMA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=C1DnVSJe; arc=pass (i=1 spf=pass spfdomain=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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a056a00168c00b0056bc9b188c6si7543624pfc.245.2022.12.01.23.52.29; Thu, 01 Dec 2022 23:52:41 -0800 (PST) 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=C1DnVSJe; arc=pass (i=1 spf=pass spfdomain=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 S232479AbiLBHu7 (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Fri, 2 Dec 2022 02:50:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232465AbiLBHus (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 2 Dec 2022 02:50:48 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF545A054A; Thu, 1 Dec 2022 23:50:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iYG7UGc3iR0y7VJYKnuUqNd+p28sCy/o2J8qEEvBqAC9mJu4e9nkhDkhDg3cp5FyWzxq8KO4ZRuFweYzXLDOVD549IERwfgu6R0w9NGaCZ8WArcA5NsFsgcK2/YuDeBw6m0P5lVOuQsNTrdynFSRLHIKorQxhDGM58JRdbQih6438/u8RQwzRzinFn9fN6KO9RwmHgFqshQpPuydBcMSJAWxlpgC7wV2LTJmud1kMs9dcgr3X9DZqtKZm/blnaD5TLQH8wLqTsHXR3l8tGXaicN8lNxfVBhUhFZx6kYl9LEZnop91tK1JzW1Ye6WjspS1byyaKJzYjZX2sX6O8iY8w== 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=Q+C4iUKjwXwEm0UuOYNQXdTkPvGvjj1IuenIn3mTcD4=; b=glVp9sgAIIUOpnuLAPHpG3lsiO+rkiUK0zVPfOSC1tY5Fl4XSvrefFnfCkZDM4wX5jlnj9gVEEePDCuOfLLr11V9IQilSYTl1N8sOHM8GUTq/u5wueQkDiS2QqntR94hBOBi0oncG5coTZFLPlFmBWoBMO0PBEK/ZTnUbv19gIzSes62GuMmNCLRU4OQUYE2PuMl71p3OvB7ApA/9YqG2/UPIP6DNdlV5TD91C68FHiiaF1AaRTOd6lHi3WI6SeLovpFK7IkYGZDcyg7X1dUNMt+cuP1hQjhJOdwV05uKqwh0UWhmh6UJ6LksWCa4oVdwA1mixv0zAOE3S4XNAOhBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=Q+C4iUKjwXwEm0UuOYNQXdTkPvGvjj1IuenIn3mTcD4=; b=C1DnVSJeDOxJqyEWHHvT3gP6+Fk0zFE8Yj5WUX5C6wycBmOLqbhPz1ljcrmf+Jb7MZdyyyIkk89Rtekkd8qrV/gLKtyw2b63zGa1qTa/kYAdBKmrptKHfaoz/tZT2Uc2pcilkvZCsTxD4ORSP7UJAY59PeuYNd0tH2iHWhyVD/s= Received: from DM6PR08CA0040.namprd08.prod.outlook.com (2603:10b6:5:1e0::14) by DM8PR12MB5445.namprd12.prod.outlook.com (2603:10b6:8:24::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Fri, 2 Dec 2022 07:50:35 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1e0:cafe::d5) by DM6PR08CA0040.outlook.office365.com (2603:10b6:5:1e0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8 via Frontend Transport; Fri, 2 Dec 2022 07:50:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5880.10 via Frontend Transport; Fri, 2 Dec 2022 07:50:35 +0000 Received: from pyuan-Cloudripper.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Fri, 2 Dec 2022 01:50:31 -0600 From: Perry Yuan <perry.yuan@amd.com> To: <rafael.j.wysocki@intel.com>, <Mario.Limonciello@amd.com>, <ray.huang@amd.com>, <viresh.kumar@linaro.org> CC: <Deepak.Sharma@amd.com>, <Nathan.Fontenot@amd.com>, <Alexander.Deucher@amd.com>, <Shimmer.Huang@amd.com>, <Xiaojian.Du@amd.com>, <Li.Meng@amd.com>, <wyes.karny@amd.com>, <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro definition for Energy Preference Performance(EPP) Date: Fri, 2 Dec 2022 15:47:11 +0800 Message-ID: <20221202074719.623673-4-perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221202074719.623673-1-perry.yuan@amd.com> References: <20221202074719.623673-1-perry.yuan@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT065:EE_|DM8PR12MB5445:EE_ X-MS-Office365-Filtering-Correlation-Id: ca69a75b-3585-41cc-d23e-08dad439e589 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s2xGcXB04kYD+BkrAFFKCIWvgXhNf2rF3Fbp63+bSiuOjIAQ77F86+DlHrQPJXg/yegace0kIiHOdIpjZmQtEADMvJpfNGGl7OJsY0eqbUl6Zpm5MHaz0LHcHSRs3dFBAmJq+/yIE5rXSf2nEQM4M4quW8kq3LE4dKLXPg7aC2IvjGUcMoFWOkx2lq/zjDI57veAsiWdtf1ST9KzNDKoQf45955g66mcA0s+qiX2D/9+U/Lqc0cE2F2dCJWW3Bm8ZCHOSzBH4H/mxJgTrERhvDor1f7a2LAMApCLtvBNx29GABWHXBHQY5rqA1zirRwyq4WctQBhS3E0QX4xld+2oHVjbe7PJvXNYVah2612jL9zw7HDYy80jAr0DHPryv0dYKmuc4twYmJ0lwmTYSOEwPu7ogOCMm2Iqz4J2aNNoOamSA8I262NRV2e7bwBy1SQEBGxuunj2692UUc4/lDy9Ace1+qFyhnVe97+/xFpNx03tfQx+44l4E6o5hHqpmDMPVMDuxWz6ex+PNhRnnYhULZqg+hEqIt/tuPTrshT9buAmy08GnsLrNQsQXcPnp0lt/Zmi/rDUy1RaX/XzFcfRtNQ+EGjDNqVykz/H+4rstPmR/e/9htFXGMQdFbN0tMN+AMwvxPHOg4LmosM4pxOQrLqdD9gXS/aJaQcDlPRoB3MfuD8a9A7BX9KuUQggsPvSlHmnBKRgbD5bCt23zpZCURIRcqdeVyuhWA0ZpOxtsU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(346002)(376002)(136003)(396003)(451199015)(36840700001)(46966006)(40470700004)(2906002)(44832011)(5660300002)(41300700001)(8936002)(8676002)(70586007)(316002)(110136005)(4326008)(54906003)(70206006)(36860700001)(36756003)(6666004)(1076003)(336012)(16526019)(82310400005)(478600001)(86362001)(47076005)(26005)(186003)(2616005)(426003)(82740400003)(40460700003)(83380400001)(7696005)(356005)(81166007)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2022 07:50:35.4804 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca69a75b-3585-41cc-d23e-08dad439e589 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5445 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751087906290181777?= X-GMAIL-MSGID: =?utf-8?q?1751087906290181777?= |
Series |
Implement AMD Pstate EPP Driver
|
|
Commit Message
Yuan, Perry
Dec. 2, 2022, 7:47 a.m. UTC
make the energy preference performance strings and profiles using one
common header for intel_pstate driver, then the amd_pstate epp driver can
use the common header as well. This will simpify the intel_pstate and
amd_pstate driver.
Signed-off-by: Perry Yuan <perry.yuan@amd.com>
---
arch/x86/include/asm/msr-index.h | 4 ---
drivers/cpufreq/intel_pstate.c | 37 +--------------------
include/linux/cpufreq_common.h | 56 ++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 40 deletions(-)
create mode 100644 include/linux/cpufreq_common.h
Comments
On Fri, Dec 02, 2022 at 03:47:11PM +0800, Yuan, Perry wrote: > make the energy preference performance strings and profiles using one > common header for intel_pstate driver, then the amd_pstate epp driver can > use the common header as well. This will simpify the intel_pstate and > amd_pstate driver. > > Signed-off-by: Perry Yuan <perry.yuan@amd.com> > --- > arch/x86/include/asm/msr-index.h | 4 --- > drivers/cpufreq/intel_pstate.c | 37 +-------------------- > include/linux/cpufreq_common.h | 56 ++++++++++++++++++++++++++++++++ I don't find any specific reason why you have to use another common cpufreq_common header instead of include/linux/cpufreq.h. Thanks, Ray > 3 files changed, 57 insertions(+), 40 deletions(-) > create mode 100644 include/linux/cpufreq_common.h > > diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h > index 4a2af82553e4..3983378cff5b 100644 > --- a/arch/x86/include/asm/msr-index.h > +++ b/arch/x86/include/asm/msr-index.h > @@ -472,10 +472,6 @@ > #define HWP_MAX_PERF(x) ((x & 0xff) << 8) > #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) > #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) x & 0xff) << 24) > -#define HWP_EPP_PERFORMANCE 0x00 > -#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > -#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > -#define HWP_EPP_POWERSAVE 0xFF > #define HWP_ACTIVITY_WINDOW(x) ((unsigned long long)(x & 0xff3) << 32) > #define HWP_PACKAGE_CONTROL(x) ((unsigned long long)(x & 0x1) << 42) > > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c > index ad9be31753b6..65036ca21719 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -25,6 +25,7 @@ > #include <linux/acpi.h> > #include <linux/vmalloc.h> > #include <linux/pm_qos.h> > +#include <linux/cpufreq_common.h> > #include <trace/events/power.h> > > #include <asm/cpu.h> > @@ -628,42 +629,6 @@ static int intel_pstate_set_epb(int cpu, s16 pref) > return 0; > } > > -/* > - * EPP/EPB display strings corresponding to EPP index in the > - * energy_perf_strings[] > - * index String > - *------------------------------------- > - * 0 default > - * 1 performance > - * 2 balance_performance > - * 3 balance_power > - * 4 power > - */ > - > -enum energy_perf_value_index { > - EPP_INDEX_DEFAULT = 0, > - EPP_INDEX_PERFORMANCE, > - EPP_INDEX_BALANCE_PERFORMANCE, > - EPP_INDEX_BALANCE_POWERSAVE, > - EPP_INDEX_POWERSAVE, > -}; > - > -static const char * const energy_perf_strings[] = { > - [EPP_INDEX_DEFAULT] = "default", > - [EPP_INDEX_PERFORMANCE] = "performance", > - [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > - [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > - [EPP_INDEX_POWERSAVE] = "power", > - NULL > -}; > -static unsigned int epp_values[] = { > - [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > - [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > - [EPP_INDEX_BALANCE_PERFORMANCE] = HWP_EPP_BALANCE_PERFORMANCE, > - [EPP_INDEX_BALANCE_POWERSAVE] = HWP_EPP_BALANCE_POWERSAVE, > - [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, > -}; > - > static int intel_pstate_get_energy_pref_index(struct cpudata *cpu_data, int *raw_epp) > { > s16 epp; > diff --git a/include/linux/cpufreq_common.h b/include/linux/cpufreq_common.h > new file mode 100644 > index 000000000000..2d14b0b0f55c > --- /dev/null > +++ b/include/linux/cpufreq_common.h > @@ -0,0 +1,56 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * linux/include/linux/cpufreq_common.h > + * > + * Copyright (C) 2022 Advanced Micro Devices, Inc. > + * > + * Author: Perry Yuan <Perry.Yuan@amd.com> > + */ > + > +#ifndef _LINUX_CPUFREQ_COMMON_H > +#define _LINUX_CPUFREQ_COMMON_H > + > +#include <asm/msr.h> > +/* > + * EPP/EPB display strings corresponding to EPP index in the > + * energy_perf_strings[] > + * index String > + *------------------------------------- > + * 0 default > + * 1 performance > + * 2 balance_performance > + * 3 balance_power > + * 4 power > + */ > + > +#define HWP_EPP_PERFORMANCE 0x00 > +#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > +#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > +#define HWP_EPP_POWERSAVE 0xFF > + > +enum energy_perf_value_index { > + EPP_INDEX_DEFAULT = 0, > + EPP_INDEX_PERFORMANCE, > + EPP_INDEX_BALANCE_PERFORMANCE, > + EPP_INDEX_BALANCE_POWERSAVE, > + EPP_INDEX_POWERSAVE, > +}; > + > +static const char * const energy_perf_strings[] = { > + [EPP_INDEX_DEFAULT] = "default", > + [EPP_INDEX_PERFORMANCE] = "performance", > + [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > + [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > + [EPP_INDEX_POWERSAVE] = "power", > + NULL > +}; > + > +static unsigned int epp_values[] = { > + [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > + [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > + [EPP_INDEX_BALANCE_PERFORMANCE] = HWP_EPP_BALANCE_PERFORMANCE, > + [EPP_INDEX_BALANCE_POWERSAVE] = HWP_EPP_BALANCE_POWERSAVE, > + [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, > +}; > + > +#endif /* _LINUX_CPUFREQ_COMMON_H */ > \ No newline at end of file > -- > 2.34.1 >
[AMD Official Use Only - General] Hi Ray. > -----Original Message----- > From: Huang, Ray <Ray.Huang@amd.com> > Sent: Monday, December 5, 2022 7:49 PM > To: Yuan, Perry <Perry.Yuan@amd.com> > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, Deepak > <Deepak.Sharma@amd.com>; Fontenot, Nathan > <Nathan.Fontenot@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Meng, > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>; > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > definition for Energy Preference Performance(EPP) > > On Fri, Dec 02, 2022 at 03:47:11PM +0800, Yuan, Perry wrote: > > make the energy preference performance strings and profiles using one > > common header for intel_pstate driver, then the amd_pstate epp driver > > can use the common header as well. This will simpify the intel_pstate > > and amd_pstate driver. > > > > Signed-off-by: Perry Yuan <perry.yuan@amd.com> > > --- > > arch/x86/include/asm/msr-index.h | 4 --- > > drivers/cpufreq/intel_pstate.c | 37 +-------------------- > > include/linux/cpufreq_common.h | 56 > ++++++++++++++++++++++++++++++++ > > I don't find any specific reason why you have to use another common > cpufreq_common header instead of include/linux/cpufreq.h. > > Thanks, > Ray That is fine for me to use the cpufreq.h to store the common vars. I will move the declaration to that header file. Thanks for the review. Perry. > > > 3 files changed, 57 insertions(+), 40 deletions(-) create mode > > 100644 include/linux/cpufreq_common.h > > > > diff --git a/arch/x86/include/asm/msr-index.h > > b/arch/x86/include/asm/msr-index.h > > index 4a2af82553e4..3983378cff5b 100644 > > --- a/arch/x86/include/asm/msr-index.h > > +++ b/arch/x86/include/asm/msr-index.h > > @@ -472,10 +472,6 @@ > > #define HWP_MAX_PERF(x) ((x & 0xff) << 8) > > #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) > > #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) > x & 0xff) << 24) > > -#define HWP_EPP_PERFORMANCE 0x00 > > -#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > -#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > -#define HWP_EPP_POWERSAVE 0xFF > > #define HWP_ACTIVITY_WINDOW(x) ((unsigned long > long)(x & 0xff3) << 32) > > #define HWP_PACKAGE_CONTROL(x) ((unsigned long > long)(x & 0x1) << 42) > > > > diff --git a/drivers/cpufreq/intel_pstate.c > > b/drivers/cpufreq/intel_pstate.c index ad9be31753b6..65036ca21719 > > 100644 > > --- a/drivers/cpufreq/intel_pstate.c > > +++ b/drivers/cpufreq/intel_pstate.c > > @@ -25,6 +25,7 @@ > > #include <linux/acpi.h> > > #include <linux/vmalloc.h> > > #include <linux/pm_qos.h> > > +#include <linux/cpufreq_common.h> > > #include <trace/events/power.h> > > > > #include <asm/cpu.h> > > @@ -628,42 +629,6 @@ static int intel_pstate_set_epb(int cpu, s16 pref) > > return 0; > > } > > > > -/* > > - * EPP/EPB display strings corresponding to EPP index in the > > - * energy_perf_strings[] > > - * index String > > - *------------------------------------- > > - * 0 default > > - * 1 performance > > - * 2 balance_performance > > - * 3 balance_power > > - * 4 power > > - */ > > - > > -enum energy_perf_value_index { > > - EPP_INDEX_DEFAULT = 0, > > - EPP_INDEX_PERFORMANCE, > > - EPP_INDEX_BALANCE_PERFORMANCE, > > - EPP_INDEX_BALANCE_POWERSAVE, > > - EPP_INDEX_POWERSAVE, > > -}; > > - > > -static const char * const energy_perf_strings[] = { > > - [EPP_INDEX_DEFAULT] = "default", > > - [EPP_INDEX_PERFORMANCE] = "performance", > > - [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > > - [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > - [EPP_INDEX_POWERSAVE] = "power", > > - NULL > > -}; > > -static unsigned int epp_values[] = { > > - [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > - [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > - [EPP_INDEX_BALANCE_PERFORMANCE] = > HWP_EPP_BALANCE_PERFORMANCE, > > - [EPP_INDEX_BALANCE_POWERSAVE] = > HWP_EPP_BALANCE_POWERSAVE, > > - [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, > > -}; > > - > > static int intel_pstate_get_energy_pref_index(struct cpudata > > *cpu_data, int *raw_epp) { > > s16 epp; > > diff --git a/include/linux/cpufreq_common.h > > b/include/linux/cpufreq_common.h new file mode 100644 index > > 000000000000..2d14b0b0f55c > > --- /dev/null > > +++ b/include/linux/cpufreq_common.h > > @@ -0,0 +1,56 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * linux/include/linux/cpufreq_common.h > > + * > > + * Copyright (C) 2022 Advanced Micro Devices, Inc. > > + * > > + * Author: Perry Yuan <Perry.Yuan@amd.com> */ > > + > > +#ifndef _LINUX_CPUFREQ_COMMON_H > > +#define _LINUX_CPUFREQ_COMMON_H > > + > > +#include <asm/msr.h> > > +/* > > + * EPP/EPB display strings corresponding to EPP index in the > > + * energy_perf_strings[] > > + * index String > > + *------------------------------------- > > + * 0 default > > + * 1 performance > > + * 2 balance_performance > > + * 3 balance_power > > + * 4 power > > + */ > > + > > +#define HWP_EPP_PERFORMANCE 0x00 > > +#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > +#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > +#define HWP_EPP_POWERSAVE 0xFF > > + > > +enum energy_perf_value_index { > > + EPP_INDEX_DEFAULT = 0, > > + EPP_INDEX_PERFORMANCE, > > + EPP_INDEX_BALANCE_PERFORMANCE, > > + EPP_INDEX_BALANCE_POWERSAVE, > > + EPP_INDEX_POWERSAVE, > > +}; > > + > > +static const char * const energy_perf_strings[] = { > > + [EPP_INDEX_DEFAULT] = "default", > > + [EPP_INDEX_PERFORMANCE] = "performance", > > + [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > > + [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > + [EPP_INDEX_POWERSAVE] = "power", > > + NULL > > +}; > > + > > +static unsigned int epp_values[] = { > > + [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > + [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > + [EPP_INDEX_BALANCE_PERFORMANCE] = > HWP_EPP_BALANCE_PERFORMANCE, > > + [EPP_INDEX_BALANCE_POWERSAVE] = > HWP_EPP_BALANCE_POWERSAVE, > > + [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, }; > > + > > +#endif /* _LINUX_CPUFREQ_COMMON_H */ > > \ No newline at end of file > > -- > > 2.34.1 > >
[Public] > -----Original Message----- > From: Yuan, Perry <Perry.Yuan@amd.com> > Sent: Monday, December 5, 2022 08:41 > To: Huang, Ray <Ray.Huang@amd.com> > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, Deepak > <Deepak.Sharma@amd.com>; Fontenot, Nathan > <Nathan.Fontenot@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Meng, > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>; > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: RE: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > definition for Energy Preference Performance(EPP) > > [AMD Official Use Only - General] > > Hi Ray. > > > -----Original Message----- > > From: Huang, Ray <Ray.Huang@amd.com> > > Sent: Monday, December 5, 2022 7:49 PM > > To: Yuan, Perry <Perry.Yuan@amd.com> > > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, Deepak > > <Deepak.Sharma@amd.com>; Fontenot, Nathan > > <Nathan.Fontenot@amd.com>; Deucher, Alexander > > <Alexander.Deucher@amd.com>; Huang, Shimmer > > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; > Meng, > > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes > <Wyes.Karny@amd.com>; > > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: Re: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > > definition for Energy Preference Performance(EPP) > > > > On Fri, Dec 02, 2022 at 03:47:11PM +0800, Yuan, Perry wrote: > > > make the energy preference performance strings and profiles using one > > > common header for intel_pstate driver, then the amd_pstate epp driver > > > can use the common header as well. This will simpify the intel_pstate > > > and amd_pstate driver. > > > > > > Signed-off-by: Perry Yuan <perry.yuan@amd.com> > > > --- > > > arch/x86/include/asm/msr-index.h | 4 --- > > > drivers/cpufreq/intel_pstate.c | 37 +-------------------- > > > include/linux/cpufreq_common.h | 56 > > ++++++++++++++++++++++++++++++++ > > > > I don't find any specific reason why you have to use another common > > cpufreq_common header instead of include/linux/cpufreq.h. > > > > Thanks, > > Ray > > That is fine for me to use the cpufreq.h to store the common vars. > I will move the declaration to that header file. > > Thanks for the review. > > Perry. > > > > > > 3 files changed, 57 insertions(+), 40 deletions(-) create mode > > > 100644 include/linux/cpufreq_common.h > > > > > > diff --git a/arch/x86/include/asm/msr-index.h > > > b/arch/x86/include/asm/msr-index.h > > > index 4a2af82553e4..3983378cff5b 100644 > > > --- a/arch/x86/include/asm/msr-index.h > > > +++ b/arch/x86/include/asm/msr-index.h > > > @@ -472,10 +472,6 @@ > > > #define HWP_MAX_PERF(x) ((x & 0xff) << 8) > > > #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) > > > #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) > > x & 0xff) << 24) > > > -#define HWP_EPP_PERFORMANCE 0x00 > > > -#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > > -#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > > -#define HWP_EPP_POWERSAVE 0xFF > > > #define HWP_ACTIVITY_WINDOW(x) ((unsigned long > > long)(x & 0xff3) << 32) > > > #define HWP_PACKAGE_CONTROL(x) ((unsigned long > > long)(x & 0x1) << 42) > > > > > > diff --git a/drivers/cpufreq/intel_pstate.c > > > b/drivers/cpufreq/intel_pstate.c index ad9be31753b6..65036ca21719 > > > 100644 > > > --- a/drivers/cpufreq/intel_pstate.c > > > +++ b/drivers/cpufreq/intel_pstate.c > > > @@ -25,6 +25,7 @@ > > > #include <linux/acpi.h> > > > #include <linux/vmalloc.h> > > > #include <linux/pm_qos.h> > > > +#include <linux/cpufreq_common.h> > > > #include <trace/events/power.h> > > > > > > #include <asm/cpu.h> > > > @@ -628,42 +629,6 @@ static int intel_pstate_set_epb(int cpu, s16 pref) > > > return 0; > > > } > > > > > > -/* > > > - * EPP/EPB display strings corresponding to EPP index in the > > > - * energy_perf_strings[] > > > - * index String > > > - *------------------------------------- > > > - * 0 default > > > - * 1 performance > > > - * 2 balance_performance > > > - * 3 balance_power > > > - * 4 power > > > - */ > > > - > > > -enum energy_perf_value_index { > > > - EPP_INDEX_DEFAULT = 0, > > > - EPP_INDEX_PERFORMANCE, > > > - EPP_INDEX_BALANCE_PERFORMANCE, > > > - EPP_INDEX_BALANCE_POWERSAVE, > > > - EPP_INDEX_POWERSAVE, > > > -}; > > > - > > > -static const char * const energy_perf_strings[] = { > > > - [EPP_INDEX_DEFAULT] = "default", > > > - [EPP_INDEX_PERFORMANCE] = "performance", > > > - [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > > > - [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > > - [EPP_INDEX_POWERSAVE] = "power", > > > - NULL > > > -}; > > > -static unsigned int epp_values[] = { > > > - [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > > - [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > > - [EPP_INDEX_BALANCE_PERFORMANCE] = > > HWP_EPP_BALANCE_PERFORMANCE, > > > - [EPP_INDEX_BALANCE_POWERSAVE] = > > HWP_EPP_BALANCE_POWERSAVE, > > > - [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, > > > -}; > > > - > > > static int intel_pstate_get_energy_pref_index(struct cpudata > > > *cpu_data, int *raw_epp) { > > > s16 epp; > > > diff --git a/include/linux/cpufreq_common.h > > > b/include/linux/cpufreq_common.h new file mode 100644 index > > > 000000000000..2d14b0b0f55c > > > --- /dev/null > > > +++ b/include/linux/cpufreq_common.h > > > @@ -0,0 +1,56 @@ > > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > > +/* > > > + * linux/include/linux/cpufreq_common.h > > > + * > > > + * Copyright (C) 2022 Advanced Micro Devices, Inc. > > > + * > > > + * Author: Perry Yuan <Perry.Yuan@amd.com> */ > > > + > > > +#ifndef _LINUX_CPUFREQ_COMMON_H > > > +#define _LINUX_CPUFREQ_COMMON_H > > > + > > > +#include <asm/msr.h> > > > +/* > > > + * EPP/EPB display strings corresponding to EPP index in the > > > + * energy_perf_strings[] > > > + * index String > > > + *------------------------------------- > > > + * 0 default > > > + * 1 performance > > > + * 2 balance_performance > > > + * 3 balance_power > > > + * 4 power > > > + */ > > > + > > > +#define HWP_EPP_PERFORMANCE 0x00 > > > +#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > > +#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > > +#define HWP_EPP_POWERSAVE 0xFF > > > + > > > +enum energy_perf_value_index { > > > + EPP_INDEX_DEFAULT = 0, > > > + EPP_INDEX_PERFORMANCE, > > > + EPP_INDEX_BALANCE_PERFORMANCE, > > > + EPP_INDEX_BALANCE_POWERSAVE, > > > + EPP_INDEX_POWERSAVE, > > > +}; > > > + > > > +static const char * const energy_perf_strings[] = { > > > + [EPP_INDEX_DEFAULT] = "default", > > > + [EPP_INDEX_PERFORMANCE] = "performance", > > > + [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > > > + [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > > + [EPP_INDEX_POWERSAVE] = "power", > > > + NULL > > > +}; > > > + > > > +static unsigned int epp_values[] = { > > > + [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > > + [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > > + [EPP_INDEX_BALANCE_PERFORMANCE] = > > HWP_EPP_BALANCE_PERFORMANCE, > > > + [EPP_INDEX_BALANCE_POWERSAVE] = > > HWP_EPP_BALANCE_POWERSAVE, > > > + [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, }; > > > + I don't believe you should be making these static in the header file. > > > +#endif /* _LINUX_CPUFREQ_COMMON_H */ > > > \ No newline at end of file > > > -- > > > 2.34.1 > > >
[Public] Hi Mario. > -----Original Message----- > From: Limonciello, Mario <Mario.Limonciello@amd.com> > Sent: Tuesday, December 6, 2022 12:45 AM > To: Yuan, Perry <Perry.Yuan@amd.com>; Huang, Ray <Ray.Huang@amd.com> > Cc: rafael.j.wysocki@intel.com; viresh.kumar@linaro.org; Sharma, Deepak > <Deepak.Sharma@amd.com>; Fontenot, Nathan > <Nathan.Fontenot@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Meng, > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>; > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: RE: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > definition for Energy Preference Performance(EPP) > > [Public] > > > > > -----Original Message----- > > From: Yuan, Perry <Perry.Yuan@amd.com> > > Sent: Monday, December 5, 2022 08:41 > > To: Huang, Ray <Ray.Huang@amd.com> > > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, Deepak > > <Deepak.Sharma@amd.com>; Fontenot, Nathan > <Nathan.Fontenot@amd.com>; > > Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Shimmer > > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; > Meng, Li > > (Jassmine) <Li.Meng@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>; > > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: RE: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > > definition for Energy Preference Performance(EPP) > > > > [AMD Official Use Only - General] > > > > Hi Ray. > > > > > -----Original Message----- > > > From: Huang, Ray <Ray.Huang@amd.com> > > > Sent: Monday, December 5, 2022 7:49 PM > > > To: Yuan, Perry <Perry.Yuan@amd.com> > > > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > > > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, > Deepak > > > <Deepak.Sharma@amd.com>; Fontenot, Nathan > <Nathan.Fontenot@amd.com>; > > > Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Shimmer > > > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; > > Meng, > > > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes > > <Wyes.Karny@amd.com>; > > > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > > > Subject: Re: [PATCH v6 03/11] cpufreq: intel_pstate: use common > > > macro definition for Energy Preference Performance(EPP) > > > > > > On Fri, Dec 02, 2022 at 03:47:11PM +0800, Yuan, Perry wrote: > > > > make the energy preference performance strings and profiles using > > > > one common header for intel_pstate driver, then the amd_pstate epp > > > > driver can use the common header as well. This will simpify the > > > > intel_pstate and amd_pstate driver. > > > > > > > > Signed-off-by: Perry Yuan <perry.yuan@amd.com> > > > > --- > > > > arch/x86/include/asm/msr-index.h | 4 --- > > > > drivers/cpufreq/intel_pstate.c | 37 +-------------------- > > > > include/linux/cpufreq_common.h | 56 > > > ++++++++++++++++++++++++++++++++ > > > > > > I don't find any specific reason why you have to use another common > > > cpufreq_common header instead of include/linux/cpufreq.h. > > > > > > Thanks, > > > Ray > > > > That is fine for me to use the cpufreq.h to store the common vars. > > I will move the declaration to that header file. > > > > Thanks for the review. > > > > Perry. > > > > > > > > > 3 files changed, 57 insertions(+), 40 deletions(-) create mode > > > > 100644 include/linux/cpufreq_common.h > > > > > > > > diff --git a/arch/x86/include/asm/msr-index.h > > > > b/arch/x86/include/asm/msr-index.h > > > > index 4a2af82553e4..3983378cff5b 100644 > > > > --- a/arch/x86/include/asm/msr-index.h > > > > +++ b/arch/x86/include/asm/msr-index.h > > > > @@ -472,10 +472,6 @@ > > > > #define HWP_MAX_PERF(x) ((x & 0xff) << 8) > > > > #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) > > > > #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) > > > x & 0xff) << 24) > > > > -#define HWP_EPP_PERFORMANCE 0x00 > > > > -#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > > > -#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > > > -#define HWP_EPP_POWERSAVE 0xFF > > > > #define HWP_ACTIVITY_WINDOW(x) ((unsigned long > > > long)(x & 0xff3) << 32) > > > > #define HWP_PACKAGE_CONTROL(x) ((unsigned long > > > long)(x & 0x1) << 42) > > > > > > > > diff --git a/drivers/cpufreq/intel_pstate.c > > > > b/drivers/cpufreq/intel_pstate.c index ad9be31753b6..65036ca21719 > > > > 100644 > > > > --- a/drivers/cpufreq/intel_pstate.c > > > > +++ b/drivers/cpufreq/intel_pstate.c > > > > @@ -25,6 +25,7 @@ > > > > #include <linux/acpi.h> > > > > #include <linux/vmalloc.h> > > > > #include <linux/pm_qos.h> > > > > +#include <linux/cpufreq_common.h> > > > > #include <trace/events/power.h> > > > > > > > > #include <asm/cpu.h> > > > > @@ -628,42 +629,6 @@ static int intel_pstate_set_epb(int cpu, s16 pref) > > > > return 0; > > > > } > > > > > > > > -/* > > > > - * EPP/EPB display strings corresponding to EPP index in the > > > > - * energy_perf_strings[] > > > > - * index String > > > > - *------------------------------------- > > > > - * 0 default > > > > - * 1 performance > > > > - * 2 balance_performance > > > > - * 3 balance_power > > > > - * 4 power > > > > - */ > > > > - > > > > -enum energy_perf_value_index { > > > > - EPP_INDEX_DEFAULT = 0, > > > > - EPP_INDEX_PERFORMANCE, > > > > - EPP_INDEX_BALANCE_PERFORMANCE, > > > > - EPP_INDEX_BALANCE_POWERSAVE, > > > > - EPP_INDEX_POWERSAVE, > > > > -}; > > > > - > > > > -static const char * const energy_perf_strings[] = { > > > > - [EPP_INDEX_DEFAULT] = "default", > > > > - [EPP_INDEX_PERFORMANCE] = "performance", > > > > - [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > > > > - [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > > > - [EPP_INDEX_POWERSAVE] = "power", > > > > - NULL > > > > -}; > > > > -static unsigned int epp_values[] = { > > > > - [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > > > - [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > > > - [EPP_INDEX_BALANCE_PERFORMANCE] = > > > HWP_EPP_BALANCE_PERFORMANCE, > > > > - [EPP_INDEX_BALANCE_POWERSAVE] = > > > HWP_EPP_BALANCE_POWERSAVE, > > > > - [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, > > > > -}; > > > > - > > > > static int intel_pstate_get_energy_pref_index(struct cpudata > > > > *cpu_data, int *raw_epp) { > > > > s16 epp; > > > > diff --git a/include/linux/cpufreq_common.h > > > > b/include/linux/cpufreq_common.h new file mode 100644 index > > > > 000000000000..2d14b0b0f55c > > > > --- /dev/null > > > > +++ b/include/linux/cpufreq_common.h > > > > @@ -0,0 +1,56 @@ > > > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > > > +/* > > > > + * linux/include/linux/cpufreq_common.h > > > > + * > > > > + * Copyright (C) 2022 Advanced Micro Devices, Inc. > > > > + * > > > > + * Author: Perry Yuan <Perry.Yuan@amd.com> */ > > > > + > > > > +#ifndef _LINUX_CPUFREQ_COMMON_H > > > > +#define _LINUX_CPUFREQ_COMMON_H > > > > + > > > > +#include <asm/msr.h> > > > > +/* > > > > + * EPP/EPB display strings corresponding to EPP index in the > > > > + * energy_perf_strings[] > > > > + * index String > > > > + *------------------------------------- > > > > + * 0 default > > > > + * 1 performance > > > > + * 2 balance_performance > > > > + * 3 balance_power > > > > + * 4 power > > > > + */ > > > > + > > > > +#define HWP_EPP_PERFORMANCE 0x00 > > > > +#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > > > +#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > > > +#define HWP_EPP_POWERSAVE 0xFF > > > > + > > > > +enum energy_perf_value_index { > > > > + EPP_INDEX_DEFAULT = 0, > > > > + EPP_INDEX_PERFORMANCE, > > > > + EPP_INDEX_BALANCE_PERFORMANCE, > > > > + EPP_INDEX_BALANCE_POWERSAVE, > > > > + EPP_INDEX_POWERSAVE, > > > > +}; > > > > + > > > > +static const char * const energy_perf_strings[] = { > > > > + [EPP_INDEX_DEFAULT] = "default", > > > > + [EPP_INDEX_PERFORMANCE] = "performance", > > > > + [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", > > > > + [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > > > + [EPP_INDEX_POWERSAVE] = "power", > > > > + NULL > > > > +}; > > > > + > > > > +static unsigned int epp_values[] = { > > > > + [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > > > + [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > > > + [EPP_INDEX_BALANCE_PERFORMANCE] = > > > HWP_EPP_BALANCE_PERFORMANCE, > > > > + [EPP_INDEX_BALANCE_POWERSAVE] = > > > HWP_EPP_BALANCE_POWERSAVE, > > > > + [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, }; > > > > + > > I don't believe you should be making these static in the header file. If I do not make these arrays as static type, it will be reporting lots of build errors. ld: drivers/scsi/lpfc/lpfc_sli.o:(.data+0xa0): multiple definition of `epp_values'; drivers/scsi/lpfc/lpfc_mem.o:(.data+0x0): first defined here ld: drivers/scsi/lpfc/lpfc_sli.o:(.rodata+0x120): multiple definition of `energy_perf_strings'; drivers/scsi/lpfc/lpfc_mem.o:(.rodata+0x0): first defined here ld: drivers/scsi/lpfc/lpfc_ct.o:(.data+0x150): multiple definition of `epp_values'; drivers/scsi/lpfc/lpfc_mem.o:(.data+0x0): first defined here ld: drivers/scsi/lpfc/lpfc_ct.o:(.rodata+0x60): multiple definition of `energy_perf_strings'; drivers/scsi/lpfc/lpfc_mem.o:(.rodata+0x0): first defined here ld: drivers/scsi/lpfc/lpfc_els.o:(.data+0x0): multiple definition of `epp_values'; drivers/scsi/lpfc/lpfc_mem.o:(.data+0x0): first defined here .... I will check how to get this fixed if we really need set it as static in V8. Perry. > > > > > +#endif /* _LINUX_CPUFREQ_COMMON_H */ > > > > \ No newline at end of file > > > > -- > > > > 2.34.1 > > > >
[Public] > -----Original Message----- > From: Yuan, Perry <Perry.Yuan@amd.com> > Sent: Thursday, December 8, 2022 08:40 > To: Limonciello, Mario <Mario.Limonciello@amd.com>; Huang, Ray > <Ray.Huang@amd.com> > Cc: rafael.j.wysocki@intel.com; viresh.kumar@linaro.org; Sharma, Deepak > <Deepak.Sharma@amd.com>; Fontenot, Nathan > <Nathan.Fontenot@amd.com>; Deucher, Alexander > <Alexander.Deucher@amd.com>; Huang, Shimmer > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Meng, > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes <Wyes.Karny@amd.com>; > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: RE: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > definition for Energy Preference Performance(EPP) > > [Public] > > Hi Mario. > > > -----Original Message----- > > From: Limonciello, Mario <Mario.Limonciello@amd.com> > > Sent: Tuesday, December 6, 2022 12:45 AM > > To: Yuan, Perry <Perry.Yuan@amd.com>; Huang, Ray > <Ray.Huang@amd.com> > > Cc: rafael.j.wysocki@intel.com; viresh.kumar@linaro.org; Sharma, Deepak > > <Deepak.Sharma@amd.com>; Fontenot, Nathan > > <Nathan.Fontenot@amd.com>; Deucher, Alexander > > <Alexander.Deucher@amd.com>; Huang, Shimmer > > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; > Meng, > > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes > <Wyes.Karny@amd.com>; > > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: RE: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > > definition for Energy Preference Performance(EPP) > > > > [Public] > > > > > > > > > -----Original Message----- > > > From: Yuan, Perry <Perry.Yuan@amd.com> > > > Sent: Monday, December 5, 2022 08:41 > > > To: Huang, Ray <Ray.Huang@amd.com> > > > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > > > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, > Deepak > > > <Deepak.Sharma@amd.com>; Fontenot, Nathan > > <Nathan.Fontenot@amd.com>; > > > Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Shimmer > > > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; > > Meng, Li > > > (Jassmine) <Li.Meng@amd.com>; Karny, Wyes > <Wyes.Karny@amd.com>; > > > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > > > Subject: RE: [PATCH v6 03/11] cpufreq: intel_pstate: use common macro > > > definition for Energy Preference Performance(EPP) > > > > > > [AMD Official Use Only - General] > > > > > > Hi Ray. > > > > > > > -----Original Message----- > > > > From: Huang, Ray <Ray.Huang@amd.com> > > > > Sent: Monday, December 5, 2022 7:49 PM > > > > To: Yuan, Perry <Perry.Yuan@amd.com> > > > > Cc: rafael.j.wysocki@intel.com; Limonciello, Mario > > > > <Mario.Limonciello@amd.com>; viresh.kumar@linaro.org; Sharma, > > Deepak > > > > <Deepak.Sharma@amd.com>; Fontenot, Nathan > > <Nathan.Fontenot@amd.com>; > > > > Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, > Shimmer > > > > <Shimmer.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; > > > Meng, > > > > Li (Jassmine) <Li.Meng@amd.com>; Karny, Wyes > > > <Wyes.Karny@amd.com>; > > > > linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org > > > > Subject: Re: [PATCH v6 03/11] cpufreq: intel_pstate: use common > > > > macro definition for Energy Preference Performance(EPP) > > > > > > > > On Fri, Dec 02, 2022 at 03:47:11PM +0800, Yuan, Perry wrote: > > > > > make the energy preference performance strings and profiles using > > > > > one common header for intel_pstate driver, then the amd_pstate > epp > > > > > driver can use the common header as well. This will simpify the > > > > > intel_pstate and amd_pstate driver. > > > > > > > > > > Signed-off-by: Perry Yuan <perry.yuan@amd.com> > > > > > --- > > > > > arch/x86/include/asm/msr-index.h | 4 --- > > > > > drivers/cpufreq/intel_pstate.c | 37 +-------------------- > > > > > include/linux/cpufreq_common.h | 56 > > > > ++++++++++++++++++++++++++++++++ > > > > > > > > I don't find any specific reason why you have to use another common > > > > cpufreq_common header instead of include/linux/cpufreq.h. > > > > > > > > Thanks, > > > > Ray > > > > > > That is fine for me to use the cpufreq.h to store the common vars. > > > I will move the declaration to that header file. > > > > > > Thanks for the review. > > > > > > Perry. > > > > > > > > > > > > 3 files changed, 57 insertions(+), 40 deletions(-) create mode > > > > > 100644 include/linux/cpufreq_common.h > > > > > > > > > > diff --git a/arch/x86/include/asm/msr-index.h > > > > > b/arch/x86/include/asm/msr-index.h > > > > > index 4a2af82553e4..3983378cff5b 100644 > > > > > --- a/arch/x86/include/asm/msr-index.h > > > > > +++ b/arch/x86/include/asm/msr-index.h > > > > > @@ -472,10 +472,6 @@ > > > > > #define HWP_MAX_PERF(x) ((x & 0xff) << 8) > > > > > #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) > > > > > #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) > > > > x & 0xff) << 24) > > > > > -#define HWP_EPP_PERFORMANCE 0x00 > > > > > -#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > > > > -#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > > > > -#define HWP_EPP_POWERSAVE 0xFF > > > > > #define HWP_ACTIVITY_WINDOW(x) ((unsigned long > > > > long)(x & 0xff3) << 32) > > > > > #define HWP_PACKAGE_CONTROL(x) ((unsigned long > > > > long)(x & 0x1) << 42) > > > > > > > > > > diff --git a/drivers/cpufreq/intel_pstate.c > > > > > b/drivers/cpufreq/intel_pstate.c index ad9be31753b6..65036ca21719 > > > > > 100644 > > > > > --- a/drivers/cpufreq/intel_pstate.c > > > > > +++ b/drivers/cpufreq/intel_pstate.c > > > > > @@ -25,6 +25,7 @@ > > > > > #include <linux/acpi.h> > > > > > #include <linux/vmalloc.h> > > > > > #include <linux/pm_qos.h> > > > > > +#include <linux/cpufreq_common.h> > > > > > #include <trace/events/power.h> > > > > > > > > > > #include <asm/cpu.h> > > > > > @@ -628,42 +629,6 @@ static int intel_pstate_set_epb(int cpu, s16 > pref) > > > > > return 0; > > > > > } > > > > > > > > > > -/* > > > > > - * EPP/EPB display strings corresponding to EPP index in the > > > > > - * energy_perf_strings[] > > > > > - * index String > > > > > - *------------------------------------- > > > > > - * 0 default > > > > > - * 1 performance > > > > > - * 2 balance_performance > > > > > - * 3 balance_power > > > > > - * 4 power > > > > > - */ > > > > > - > > > > > -enum energy_perf_value_index { > > > > > - EPP_INDEX_DEFAULT = 0, > > > > > - EPP_INDEX_PERFORMANCE, > > > > > - EPP_INDEX_BALANCE_PERFORMANCE, > > > > > - EPP_INDEX_BALANCE_POWERSAVE, > > > > > - EPP_INDEX_POWERSAVE, > > > > > -}; > > > > > - > > > > > -static const char * const energy_perf_strings[] = { > > > > > - [EPP_INDEX_DEFAULT] = "default", > > > > > - [EPP_INDEX_PERFORMANCE] = "performance", > > > > > - [EPP_INDEX_BALANCE_PERFORMANCE] = > "balance_performance", > > > > > - [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > > > > - [EPP_INDEX_POWERSAVE] = "power", > > > > > - NULL > > > > > -}; > > > > > -static unsigned int epp_values[] = { > > > > > - [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > > > > - [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > > > > - [EPP_INDEX_BALANCE_PERFORMANCE] = > > > > HWP_EPP_BALANCE_PERFORMANCE, > > > > > - [EPP_INDEX_BALANCE_POWERSAVE] = > > > > HWP_EPP_BALANCE_POWERSAVE, > > > > > - [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, > > > > > -}; > > > > > - > > > > > static int intel_pstate_get_energy_pref_index(struct cpudata > > > > > *cpu_data, int *raw_epp) { > > > > > s16 epp; > > > > > diff --git a/include/linux/cpufreq_common.h > > > > > b/include/linux/cpufreq_common.h new file mode 100644 index > > > > > 000000000000..2d14b0b0f55c > > > > > --- /dev/null > > > > > +++ b/include/linux/cpufreq_common.h > > > > > @@ -0,0 +1,56 @@ > > > > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > > > > +/* > > > > > + * linux/include/linux/cpufreq_common.h > > > > > + * > > > > > + * Copyright (C) 2022 Advanced Micro Devices, Inc. > > > > > + * > > > > > + * Author: Perry Yuan <Perry.Yuan@amd.com> */ > > > > > + > > > > > +#ifndef _LINUX_CPUFREQ_COMMON_H > > > > > +#define _LINUX_CPUFREQ_COMMON_H > > > > > + > > > > > +#include <asm/msr.h> > > > > > +/* > > > > > + * EPP/EPB display strings corresponding to EPP index in the > > > > > + * energy_perf_strings[] > > > > > + * index String > > > > > + *------------------------------------- > > > > > + * 0 default > > > > > + * 1 performance > > > > > + * 2 balance_performance > > > > > + * 3 balance_power > > > > > + * 4 power > > > > > + */ > > > > > + > > > > > +#define HWP_EPP_PERFORMANCE 0x00 > > > > > +#define HWP_EPP_BALANCE_PERFORMANCE 0x80 > > > > > +#define HWP_EPP_BALANCE_POWERSAVE 0xC0 > > > > > +#define HWP_EPP_POWERSAVE 0xFF > > > > > + > > > > > +enum energy_perf_value_index { > > > > > + EPP_INDEX_DEFAULT = 0, > > > > > + EPP_INDEX_PERFORMANCE, > > > > > + EPP_INDEX_BALANCE_PERFORMANCE, > > > > > + EPP_INDEX_BALANCE_POWERSAVE, > > > > > + EPP_INDEX_POWERSAVE, > > > > > +}; > > > > > + > > > > > +static const char * const energy_perf_strings[] = { > > > > > + [EPP_INDEX_DEFAULT] = "default", > > > > > + [EPP_INDEX_PERFORMANCE] = "performance", > > > > > + [EPP_INDEX_BALANCE_PERFORMANCE] = > "balance_performance", > > > > > + [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", > > > > > + [EPP_INDEX_POWERSAVE] = "power", > > > > > + NULL > > > > > +}; > > > > > + > > > > > +static unsigned int epp_values[] = { > > > > > + [EPP_INDEX_DEFAULT] = 0, /* Unused index */ > > > > > + [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, > > > > > + [EPP_INDEX_BALANCE_PERFORMANCE] = > > > > HWP_EPP_BALANCE_PERFORMANCE, > > > > > + [EPP_INDEX_BALANCE_POWERSAVE] = > > > > HWP_EPP_BALANCE_POWERSAVE, > > > > > + [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, }; > > > > > + > > > > I don't believe you should be making these static in the header file. > > If I do not make these arrays as static type, it will be reporting lots of build > errors. > > ld: drivers/scsi/lpfc/lpfc_sli.o:(.data+0xa0): multiple definition of > `epp_values'; drivers/scsi/lpfc/lpfc_mem.o:(.data+0x0): first defined here > ld: drivers/scsi/lpfc/lpfc_sli.o:(.rodata+0x120): multiple definition of > `energy_perf_strings'; drivers/scsi/lpfc/lpfc_mem.o:(.rodata+0x0): first > defined here > ld: drivers/scsi/lpfc/lpfc_ct.o:(.data+0x150): multiple definition of > `epp_values'; drivers/scsi/lpfc/lpfc_mem.o:(.data+0x0): first defined here > ld: drivers/scsi/lpfc/lpfc_ct.o:(.rodata+0x60): multiple definition of > `energy_perf_strings'; drivers/scsi/lpfc/lpfc_mem.o:(.rodata+0x0): first > defined here > ld: drivers/scsi/lpfc/lpfc_els.o:(.data+0x0): multiple definition of > `epp_values'; drivers/scsi/lpfc/lpfc_mem.o:(.data+0x0): first defined here > .... > > > I will check how to get this fixed if we really need set it as static in V8. > Right; What I think you should do is have in the header (.h) something like extern int epp_values[]; and then declare the actual definitions in a source file used by all the consumers (.c). > Perry. > > > > > > > > +#endif /* _LINUX_CPUFREQ_COMMON_H */ > > > > > \ No newline at end of file > > > > > -- > > > > > 2.34.1 > > > > >
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 4a2af82553e4..3983378cff5b 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -472,10 +472,6 @@ #define HWP_MAX_PERF(x) ((x & 0xff) << 8) #define HWP_DESIRED_PERF(x) ((x & 0xff) << 16) #define HWP_ENERGY_PERF_PREFERENCE(x) (((unsigned long long) x & 0xff) << 24) -#define HWP_EPP_PERFORMANCE 0x00 -#define HWP_EPP_BALANCE_PERFORMANCE 0x80 -#define HWP_EPP_BALANCE_POWERSAVE 0xC0 -#define HWP_EPP_POWERSAVE 0xFF #define HWP_ACTIVITY_WINDOW(x) ((unsigned long long)(x & 0xff3) << 32) #define HWP_PACKAGE_CONTROL(x) ((unsigned long long)(x & 0x1) << 42) diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index ad9be31753b6..65036ca21719 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -25,6 +25,7 @@ #include <linux/acpi.h> #include <linux/vmalloc.h> #include <linux/pm_qos.h> +#include <linux/cpufreq_common.h> #include <trace/events/power.h> #include <asm/cpu.h> @@ -628,42 +629,6 @@ static int intel_pstate_set_epb(int cpu, s16 pref) return 0; } -/* - * EPP/EPB display strings corresponding to EPP index in the - * energy_perf_strings[] - * index String - *------------------------------------- - * 0 default - * 1 performance - * 2 balance_performance - * 3 balance_power - * 4 power - */ - -enum energy_perf_value_index { - EPP_INDEX_DEFAULT = 0, - EPP_INDEX_PERFORMANCE, - EPP_INDEX_BALANCE_PERFORMANCE, - EPP_INDEX_BALANCE_POWERSAVE, - EPP_INDEX_POWERSAVE, -}; - -static const char * const energy_perf_strings[] = { - [EPP_INDEX_DEFAULT] = "default", - [EPP_INDEX_PERFORMANCE] = "performance", - [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", - [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", - [EPP_INDEX_POWERSAVE] = "power", - NULL -}; -static unsigned int epp_values[] = { - [EPP_INDEX_DEFAULT] = 0, /* Unused index */ - [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, - [EPP_INDEX_BALANCE_PERFORMANCE] = HWP_EPP_BALANCE_PERFORMANCE, - [EPP_INDEX_BALANCE_POWERSAVE] = HWP_EPP_BALANCE_POWERSAVE, - [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, -}; - static int intel_pstate_get_energy_pref_index(struct cpudata *cpu_data, int *raw_epp) { s16 epp; diff --git a/include/linux/cpufreq_common.h b/include/linux/cpufreq_common.h new file mode 100644 index 000000000000..2d14b0b0f55c --- /dev/null +++ b/include/linux/cpufreq_common.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * linux/include/linux/cpufreq_common.h + * + * Copyright (C) 2022 Advanced Micro Devices, Inc. + * + * Author: Perry Yuan <Perry.Yuan@amd.com> + */ + +#ifndef _LINUX_CPUFREQ_COMMON_H +#define _LINUX_CPUFREQ_COMMON_H + +#include <asm/msr.h> +/* + * EPP/EPB display strings corresponding to EPP index in the + * energy_perf_strings[] + * index String + *------------------------------------- + * 0 default + * 1 performance + * 2 balance_performance + * 3 balance_power + * 4 power + */ + +#define HWP_EPP_PERFORMANCE 0x00 +#define HWP_EPP_BALANCE_PERFORMANCE 0x80 +#define HWP_EPP_BALANCE_POWERSAVE 0xC0 +#define HWP_EPP_POWERSAVE 0xFF + +enum energy_perf_value_index { + EPP_INDEX_DEFAULT = 0, + EPP_INDEX_PERFORMANCE, + EPP_INDEX_BALANCE_PERFORMANCE, + EPP_INDEX_BALANCE_POWERSAVE, + EPP_INDEX_POWERSAVE, +}; + +static const char * const energy_perf_strings[] = { + [EPP_INDEX_DEFAULT] = "default", + [EPP_INDEX_PERFORMANCE] = "performance", + [EPP_INDEX_BALANCE_PERFORMANCE] = "balance_performance", + [EPP_INDEX_BALANCE_POWERSAVE] = "balance_power", + [EPP_INDEX_POWERSAVE] = "power", + NULL +}; + +static unsigned int epp_values[] = { + [EPP_INDEX_DEFAULT] = 0, /* Unused index */ + [EPP_INDEX_PERFORMANCE] = HWP_EPP_PERFORMANCE, + [EPP_INDEX_BALANCE_PERFORMANCE] = HWP_EPP_BALANCE_PERFORMANCE, + [EPP_INDEX_BALANCE_POWERSAVE] = HWP_EPP_BALANCE_POWERSAVE, + [EPP_INDEX_POWERSAVE] = HWP_EPP_POWERSAVE, +}; + +#endif /* _LINUX_CPUFREQ_COMMON_H */ \ No newline at end of file