From patchwork Fri Apr 8 02:38:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1614681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KZMs63JRjz9sFy for ; Fri, 8 Apr 2022 12:39:22 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nceWn-0003zd-C2; Fri, 08 Apr 2022 02:39:13 +0000 Received: from mail-pg1-f181.google.com ([209.85.215.181]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nceWh-0003j1-B4 for kernel-team@lists.ubuntu.com; Fri, 08 Apr 2022 02:39:07 +0000 Received: by mail-pg1-f181.google.com with SMTP id t4so6611356pgc.1 for ; Thu, 07 Apr 2022 19:39:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4kiTzq4fuaGZBzwqDq080hHmfjYqiWjZTmwM3XHXglQ=; b=6X63jiOeT9lKDr/7vUDnzB/mEPoC4vSlgwGjeARvKi27hKD5UbtSm7BjNYHPObZrIT bae5K06OYdKsEfweXeFXn9XYmYOupFEC+JrqLdz2ZRuIhDOBPMug+jUHiXs9s0Zp/9Y1 Bd/6kygXE0Y1ZVpmSFVzdkLuN6f07+29QRPdAcJ5blmRDcgGyi3noPbOr4yxkN1uobks 1Hz2JkK2nAzWsC61ibYFlMivomLnHh74doOw41j6YZiADZKmZU1bqeyE0C0O/fO4JwqN RfCVXBU3p+qOxbcQjucnvWkOo+jxQErbxPNv8PchsD5fCZC194GehhnwQQ33O7WBCLHQ 12yA== X-Gm-Message-State: AOAM5315lVTyB9fhePrVX5xu3HwPDpxKO/GZVAJ2juPnxVKCHSdn8gVP Q5/zgBWOVKXh38Gn05jD8vy5Z28Bb+4= X-Google-Smtp-Source: ABdhPJwnP1JrEtlHIEU9BZlWYKS689pRK8M0Q5H+InKWxJiIn7S+4P4eOTYEjHa7tDo2Fwf9gGgVXQ== X-Received: by 2002:a65:6e82:0:b0:381:71c9:9856 with SMTP id bm2-20020a656e82000000b0038171c99856mr13853691pgb.316.1649385542040; Thu, 07 Apr 2022 19:39:02 -0700 (PDT) Received: from localhost (114-40-204-238.dynamic-ip.hinet.net. [114.40.204.238]) by smtp.gmail.com with ESMTPSA id p27-20020a056a000a1b00b004f3f63e3cf2sm26774464pfh.58.2022.04.07.19.39.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 19:39:01 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 11/16][SRU][OEM-5.14/Jammy] cpufreq: amd-pstate: Add AMD P-State performance attributes Date: Fri, 8 Apr 2022 10:38:33 +0800 Message-Id: <20220408023840.1379420-12-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220408023840.1379420-1-vicamo.yang@canonical.com> References: <20220408023840.1379420-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.181; envelope-from=vicamo@gmail.com; helo=mail-pg1-f181.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Huang Rui BugLink: https://bugs.launchpad.net/bugs/1956509 Introduce sysfs attributes to get the different level AMD P-State performances. Signed-off-by: Huang Rui Signed-off-by: Rafael J. Wysocki (cherry picked from commit 3ad7fde16a04aa70df8a59cba99e225ef9adf42f) Signed-off-by: You-Sheng Yang --- drivers/cpufreq/amd-pstate.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index dbb7eee11170..40ceb031abf5 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -546,12 +546,30 @@ static ssize_t show_amd_pstate_lowest_nonlinear_freq(struct cpufreq_policy *poli return sprintf(&buf[0], "%u\n", freq); } +/* + * In some of ASICs, the highest_perf is not the one in the _CPC table, so we + * need to expose it to sysfs. + */ +static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy, + char *buf) +{ + u32 perf; + struct amd_cpudata *cpudata = policy->driver_data; + + perf = READ_ONCE(cpudata->highest_perf); + + return sprintf(&buf[0], "%u\n", perf); +} + cpufreq_freq_attr_ro(amd_pstate_max_freq); cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); +cpufreq_freq_attr_ro(amd_pstate_highest_perf); + static struct freq_attr *amd_pstate_attr[] = { &amd_pstate_max_freq, &amd_pstate_lowest_nonlinear_freq, + &amd_pstate_highest_perf, NULL, };