Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp620611pxb; Wed, 16 Feb 2022 00:03:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMBQPY8Hzpo/2eewFccxGxRgZed8jZqTCDnk/5w8Fn8BghKUo98Etkm3zSyGc4GKM3OfL5 X-Received: by 2002:a17:902:b582:b0:14c:a63d:3df6 with SMTP id a2-20020a170902b58200b0014ca63d3df6mr1222453pls.51.1644998624080; Wed, 16 Feb 2022 00:03:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644998624; cv=pass; d=google.com; s=arc-20160816; b=ap9FfqpA5z2GHIsJuHdnBvFg26IIM9TuSjbG55kWiWaPbczDiqujC1ABs6LN5W8r9T VsmyoYxDS+Iz5FJSSLHuiLlySCXch15ZUc2U0BdEg16bCjfPusftyP+PLc1ljspTDvTW AhHQN6JBIbQabWUc9UrsHc2DQTwUHQ06sqGz20wgqlMFFO9Ws3CsC3DKcdPTQ6bWctAz GJ9FIfVwbPjJ9EEvUYwVXENZmVZ90R3rYo9pVm47J6kqLIjzUl4ix2ztsU7i6aZVGYY3 A+ENHj67pIQt0txuA95bw7s/L00QQHHuUR9lB2Ans8fMd1K18hqO0K8i0IzZIkAgzKFo WZ8g== 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=ntM2vAvRUEsIYU3tmYcaEbnt/SKffC1nD7ZJPLbXIKI=; b=iqq52wX/h709COE0S5TGxh7Sz27K7y2R0vfr/09FNoRHEAEDRDA60Oc49obuadHtiG 0HNQ/DPIqkOUrkjs3tmYHgRHMx01iMxYMBa5CVrGqXxU6+RgHnwy/EAV4o7DuSNyGJQb Y+zxKWR1ATOuuraNBGIPBlhFNWalGSe24A7ZCwNOezeMTM8gKTHOoocACy36UIBBTmM1 8G0Wx2mqoUzP7vSjIoQ8MFrORyunHq9U/1icuSSOvuJNVwWt2DVLQ2O6vQdYIZfkmCdi MPRl2cfAdkmJZHy9WP5EWEMAWh5ZqfSE+uMvxaIhZWn1QQ5yuRhRavun4lc3TFc6ybFn EfKQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IOBvRBHZ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id kk5si5007639pjb.176.2022.02.16.00.03.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 00:03:44 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IOBvRBHZ; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DA0FF9AE51; Tue, 15 Feb 2022 23:38:49 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbiBPHiS (ORCPT + 99 others); Wed, 16 Feb 2022 02:38:18 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:47404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbiBPHhu (ORCPT ); Wed, 16 Feb 2022 02:37:50 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2053.outbound.protection.outlook.com [40.107.101.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C111B19E70D; Tue, 15 Feb 2022 23:37:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CcdSdeE34mMyG0DDql+hMLnqrnTTJdNVr/WgjcYzMy8/OhYW9L54cceH92M6dQoUjgqoBHCFGYMia7clQ8IhuQFjjBNOeBfbQxAdyQgQCC2DtUxPfI9/01FFXKQmc1T40HMDKr+enIIizvYN1ktM/gQafTZrsHiK929bcAUK/O70zxTngwl9JhEOhcvlPGl8KhCoFyQasxphI0/gthWsr46l3F1y5Cb28DWI9IvGghTmYTTrEckiIGVcGGzPBqg8eOAtIki8+JZdB9OQq5FSVI+CbKMvvGr35hKZl+3tHNX9NpYDe2TYuR6NyancNOloFoppxV/rfkTbi5JniWtD0Q== 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=ntM2vAvRUEsIYU3tmYcaEbnt/SKffC1nD7ZJPLbXIKI=; b=UXZn7xrX7S18w5ZSVSVv06CwWso5s8213229akZo6bRugIy7mJJhFNisxxlPWFe4qpavPncpVZwrojy5Dz8gdKeX4mTTyaOKjbmDiL8ZmnLpt5BinX7hNLOfTY3dacJxuXfZ+7JullMTMQIuUtHxo7wa55hLsJrCsfDuffA5DKPdtbzRyiSLvkjp8kpvtgNO53Oc3DuoDcue2e/BbsVf4xD+sEPVTCLVVdG3goUHVvPhaUZYgqvrcGQfjtF47YSaJ5uVx64ggqkSqgB9CDBJv/VvVexwojmEkZPlEy7EY8TDhZBjo6xCVlSCdTVj7s/WmzVnhmHOxncROMZI5L3Z9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org 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=ntM2vAvRUEsIYU3tmYcaEbnt/SKffC1nD7ZJPLbXIKI=; b=IOBvRBHZWWXG2rBRlpl/x8WkncajSbi90xvgUHmTCzBx4MCsS7+VgtVWa7gryl3k3L8UzoTEn1QIIOna48fYQOTLqXHdAtRLRpoFsChWdnJioOUTq78fLXM6UMAVqixaAuRq2JjlHGpfFZDGB5MaC/5NMVWazKItZEPgPvqat5w= Received: from BN9PR03CA0659.namprd03.prod.outlook.com (2603:10b6:408:13b::34) by CH2PR12MB4808.namprd12.prod.outlook.com (2603:10b6:610:e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.15; Wed, 16 Feb 2022 07:37:13 +0000 Received: from BN8NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:408:13b:cafe::46) by BN9PR03CA0659.outlook.office365.com (2603:10b6:408:13b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4995.16 via Frontend Transport; Wed, 16 Feb 2022 07:37:12 +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; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT046.mail.protection.outlook.com (10.13.177.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Wed, 16 Feb 2022 07:37:12 +0000 Received: from hr-amd.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.18; Wed, 16 Feb 2022 01:37:07 -0600 From: Huang Rui To: Shuah Khan , "Rafael J . Wysocki" , CC: Deepak Sharma , Alex Deucher , Mario Limonciello , Steven Noonan , Nathan Fontenot , Jinzhou Su , Xiaojian Du , Perry Yuan , Jassmine Meng , Borislav Petkov , Peter Zijlstra , Ingo Molnar , Viresh Kumar , Steven Rostedt , "Giovanni Gherdovich" , , Huang Rui Subject: [PATCH RESEND v6 9/9] cpupower: Print AMD P-State information on cpupower Date: Wed, 16 Feb 2022 15:35:58 +0800 Message-ID: <20220216073558.751071-10-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220216073558.751071-1-ray.huang@amd.com> References: <20220216073558.751071-1-ray.huang@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-Office365-Filtering-Correlation-Id: 05e6cb64-6301-4147-5593-08d9f11f25c9 X-MS-TrafficTypeDiagnostic: CH2PR12MB4808:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:655; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5xhJC08v6QirdcOxpjUi3Jhg7DXWZS1VbmRaP8cSz2hvDVIoNt5J8Vzp1jmSN5heM37ENvTM+CYM5AezugL5pFK6MynwnT7Q2L5ueiiXEogyAH9pAp+qaZLkSh7jkAZ5fkDKww77VP8f8fDkbqMDk2GUzKDbe84b4BISB0DtRtxwSPiK8+JvlsNSzhrtMstHFM9w27BcUgpuWmaQR+X3wxBcvYma6j2XDPj/xn+t9zs6iNfMVWJNQxg4SkwxTqTGh9m+Gf2V7eaFRq6RnKGACm9++GM+zYJWmOaz8IMGQfiWQX5cvfPjL7pKYYg2GGQF/z2I91Vkb6VOaYAFzZ5FlCbRl3nMKHEaIOZ4I6uBX7GkJpIFyKmgBaxENrQsqvSg531QIquXap8E5lxhEG+x/LkBb4DW4f+wCZRdvqir2gB4/XzQP2lp2cIwrQ17sJ0a1f7cU00s98WyCNhvrad2zfNTqgWYUHc8RnNhF68MoRnLJbGTsvELJOBHhdsdP2nb8KgufWByBPZQrrH2APfykmK5hRegjLj1fMQrCCRUE+khZRiN8Pw/r5jwdswjucA8uQjN2ROhOiJe6X2tR+sEmqJeMVLN/12NKj8SUFOYCLlj7CeNZMKCX+1RRUn05pzsbvbNW9WA3iXgq/bEVNuw7uJQ2BqSxIqbbvHcK5JQEu8DUaLFPKgbAEcndLdmqcS91E00z5enXNCINsnMHUWSUw== 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(1076003)(5660300002)(336012)(16526019)(6666004)(2906002)(26005)(86362001)(83380400001)(8936002)(186003)(426003)(7416002)(356005)(40460700003)(110136005)(508600001)(2616005)(82310400004)(7696005)(8676002)(47076005)(4326008)(36756003)(70206006)(70586007)(316002)(81166007)(54906003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2022 07:37:12.9242 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05e6cb64-6301-4147-5593-08d9f11f25c9 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: BN8NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4808 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,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 AMD P-State kernel module is using the fine grain frequency instead of acpi hardware pstate. So the performance and frequency values should be printed in frequency-info. Signed-off-by: Huang Rui --- tools/power/cpupower/utils/cpufreq-info.c | 9 ++++-- tools/power/cpupower/utils/helpers/amd.c | 29 ++++++++++++++++++++ tools/power/cpupower/utils/helpers/helpers.h | 5 ++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/tools/power/cpupower/utils/cpufreq-info.c b/tools/power/cpupower/utils/cpufreq-info.c index b429454bf3ae..f828f3c35a6f 100644 --- a/tools/power/cpupower/utils/cpufreq-info.c +++ b/tools/power/cpupower/utils/cpufreq-info.c @@ -146,9 +146,12 @@ static int get_boost_mode_x86(unsigned int cpu) printf(_(" Supported: %s\n"), support ? _("yes") : _("no")); printf(_(" Active: %s\n"), active ? _("yes") : _("no")); - if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD && - cpupower_cpu_info.family >= 0x10) || - cpupower_cpu_info.vendor == X86_VENDOR_HYGON) { + if (cpupower_cpu_info.vendor == X86_VENDOR_AMD && + cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATE) { + amd_pstate_show_perf_and_freq(cpu, no_rounding); + } else if ((cpupower_cpu_info.vendor == X86_VENDOR_AMD && + cpupower_cpu_info.family >= 0x10) || + cpupower_cpu_info.vendor == X86_VENDOR_HYGON) { ret = decode_pstates(cpu, b_states, pstates, &pstate_no); if (ret) return ret; diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c index f5ba528dc7db..c519cc89c97f 100644 --- a/tools/power/cpupower/utils/helpers/amd.c +++ b/tools/power/cpupower/utils/helpers/amd.c @@ -193,5 +193,34 @@ void amd_pstate_boost_init(unsigned int cpu, int *support, int *active) *active = cpuinfo_max == amd_pstate_max ? 1 : 0; } +void amd_pstate_show_perf_and_freq(unsigned int cpu, int no_rounding) +{ + printf(_(" AMD PSTATE Highest Performance: %lu. Maximum Frequency: "), + amd_pstate_get_data(cpu, AMD_PSTATE_HIGHEST_PERF)); + /* + * If boost isn't active, the cpuinfo_max doesn't indicate real max + * frequency. So we read it back from amd-pstate sysfs entry. + */ + print_speed(amd_pstate_get_data(cpu, AMD_PSTATE_MAX_FREQ), no_rounding); + printf(".\n"); + + printf(_(" AMD PSTATE Nominal Performance: %lu. Nominal Frequency: "), + acpi_cppc_get_data(cpu, NOMINAL_PERF)); + print_speed(acpi_cppc_get_data(cpu, NOMINAL_FREQ) * 1000, + no_rounding); + printf(".\n"); + + printf(_(" AMD PSTATE Lowest Non-linear Performance: %lu. Lowest Non-linear Frequency: "), + acpi_cppc_get_data(cpu, LOWEST_NONLINEAR_PERF)); + print_speed(amd_pstate_get_data(cpu, AMD_PSTATE_LOWEST_NONLINEAR_FREQ), + no_rounding); + printf(".\n"); + + printf(_(" AMD PSTATE Lowest Performance: %lu. Lowest Frequency: "), + acpi_cppc_get_data(cpu, LOWEST_PERF)); + print_speed(acpi_cppc_get_data(cpu, LOWEST_FREQ) * 1000, no_rounding); + printf(".\n"); +} + /* AMD P-State Helper Functions ************************************/ #endif /* defined(__i386__) || defined(__x86_64__) */ diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h index 4c24c25a7b07..f913de87622a 100644 --- a/tools/power/cpupower/utils/helpers/helpers.h +++ b/tools/power/cpupower/utils/helpers/helpers.h @@ -142,6 +142,8 @@ extern int cpufreq_has_boost_support(unsigned int cpu, int *support, extern bool cpupower_amd_pstate_enabled(void); extern void amd_pstate_boost_init(unsigned int cpu, int *support, int *active); +extern void amd_pstate_show_perf_and_freq(unsigned int cpu, + int no_rounding); /* AMD P-State stuff **************************/ @@ -182,6 +184,9 @@ static inline bool cpupower_amd_pstate_enabled(void) static void amd_pstate_boost_init(unsigned int cpu, int *support, int *active) { return; } +static inline void amd_pstate_show_perf_and_freq(unsigned int cpu, + int no_rounding) +{ return; } /* cpuid and cpuinfo helpers **************************/ -- 2.25.1