From patchwork Mon Sep 25 06:58:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ayush Jain X-Patchwork-Id: 144498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1346583vqu; Mon, 25 Sep 2023 09:47:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG0cyMJxDNRFNvblrZuoRAnIZpK65JGoEo5FvQEwxVKk1zuSfL9K1YChiAVjF9KyH8XdfDC X-Received: by 2002:a05:6a00:1a46:b0:68b:f3a4:ff6b with SMTP id h6-20020a056a001a4600b0068bf3a4ff6bmr5696114pfv.9.1695660449991; Mon, 25 Sep 2023 09:47:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695660449; cv=pass; d=google.com; s=arc-20160816; b=C1fTkUhJLU9hMko9KXk8TwwHS8AtW1TNcx5gBavk9LU4QFLx88Iy2dE7uaBZMfjl9R zHrvR1NUttZ5GQqwe7MtCMPFj95pvITLRE5fijZ7nelN9yGUV7LghwMECs/oSquI8kTZ SNJ9y+VnL95i1k7qAPC+pMfvSogR+CprJZ/HLuhbMoPN+K1lAX/QM5seawqmaVU9uJPN Fk+1q5dqG7aaAPBwTmH4AaLpDxU1dva7BMy2YNdbfU7w0/qqTx8ciTKmcQAHnMyt9E89 6fusiON08qSb6oQTRpFQR5F+GJInH0KZXHfhCIocHVSAdcbLIN4fkUjzFJrqbCLI8WL9 +7Kw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=jVJc7s+rNFVrNPhF90Yp4VSHKlhfUcR4qAlX2ZgHe+E=; fh=+L+ppV6nSwAo0N6igiubh5QwSZzYkzxdBuut9wia1YQ=; b=NpaYNXgWm5NyKG6CVde71AahXJZo5G48yLpZTkUuH6JHQhbI0hQgG28OJuLrcXMMmO whOXuDXQeNMvXgn3/Ldgo17SyaPPGOUgBPM8p9Qplo62y9CODTKX1XSTK+PKRSlwPTmL d4aRp1nmEOQSI2RTAJgIRXP3E1ToHREvBXpJ2c/J0MbeSOFULUUaMXm/o5NrlBULBb4u L6O6/VGRW0aDrZZdXdFY1ouEO8mg6ZWJNty+DciRrHr+QOeFY4gFByn7dBUs6HV1ZiKN HU9j/nks+ikcyS00sAtq2Pce9kdft1X9yK/jEazci24a04wfbxQH0mM443kNnInaQJF9 QfUw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FxBoWQjT; 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::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id 19-20020a630c53000000b00578d3f8d4d4si10136458pgm.448.2023.09.25.09.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 09:47:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FxBoWQjT; 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::3:6 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9DCD4816820E; Sun, 24 Sep 2023 23:59:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232301AbjIYG7D (ORCPT + 30 others); Mon, 25 Sep 2023 02:59:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232229AbjIYG7B (ORCPT ); Mon, 25 Sep 2023 02:59:01 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2070.outbound.protection.outlook.com [40.107.243.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B8ABF; Sun, 24 Sep 2023 23:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XIXeILk6NcWw4m8XwF9Pzck/gHaPGuux29I6cHTrhJosN6qtInmVSCUZeDDCAho9w1/dWMkRKJdLzvmIYU/MWYfu+So5bIokSCd0mzRQWRDwX3LPkSkvzPgAg+9ZvNiQTRpuIlx5pwDtaHWwmHpR9HjIDzoywNyyneTmPVktB0Rvl1SSbZwpoyiQfKEZDHjwnj+7Cl9WLcCBUe7SD2uzA59uD9CVZKI8G+njM1y56C7dH970ooRsmu+J/PtsHUlyoJSBEoml+eiWIsjC1XxzbIfnRzIQM5LNe3Kjplrp4RX5R/KF4EZZWkY08e9loeP6a8IiK2nPVa+z6NqjCy6wNA== 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=jVJc7s+rNFVrNPhF90Yp4VSHKlhfUcR4qAlX2ZgHe+E=; b=RZoXgByd28v8Oe3BqqqxoDew7h2yYqQfGxoy3ipz6uViTjf9JcOuzqTeHPMYcQON2jPIui+Ny63jTr2qWqrL1gfjt7Omg8kqlxtlrVQ6dFgeSZ/acd62OUjY2WfYcXXBNlKCFlMwJdzCnLCV7QEYvNBO4xgAK/f/IN61j9aI5amYa1Tbhi8RmQwwfiC/1axvVIhw+NrMBxwBA2IyKitye5EZPCnKWFYLaSf3hSAcVAU+RRWEdm8X61OaPAx5UfdAsLlqG5V0LNc6sjIFRsVe80Kb04zA1wYAtqD8IXrtw0tZE1ueNKxXZ89kWFq32titQO8nk0chUmKQJo8DKFjyjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.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=jVJc7s+rNFVrNPhF90Yp4VSHKlhfUcR4qAlX2ZgHe+E=; b=FxBoWQjTzU/90O7NcjCky6kDBcX4VinRTBGd/4/jACsNXPgbUzLINQ2N/la6k23o88yR9LpNg3bXuZMF0cCjl9rgwvIISpC63rAyeAFp5QyLmmrsB34pEFdmOgZHXExlPRM61AEEdUL8ri43iomIeMRmHo49AI5/sQv8Ute1l9A= Received: from MN2PR16CA0029.namprd16.prod.outlook.com (2603:10b6:208:134::42) by PH0PR12MB8031.namprd12.prod.outlook.com (2603:10b6:510:28e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Mon, 25 Sep 2023 06:58:51 +0000 Received: from BL6PEPF0001AB75.namprd02.prod.outlook.com (2603:10b6:208:134:cafe::3b) by MN2PR16CA0029.outlook.office365.com (2603:10b6:208:134::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.33 via Frontend Transport; Mon, 25 Sep 2023 06:58:51 +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 BL6PEPF0001AB75.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Mon, 25 Sep 2023 06:58:51 +0000 Received: from BLR-PF38F8CF.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.2507.27; Mon, 25 Sep 2023 01:58:47 -0500 From: Ayush Jain To: , , , , CC: , , , Ayush Jain Subject: [PATCH] amd-pstate: Only print supported epp values for performance governor Date: Mon, 25 Sep 2023 12:28:18 +0530 Message-ID: <20230925065818.1502-1-ayush.jain3@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB75:EE_|PH0PR12MB8031:EE_ X-MS-Office365-Filtering-Correlation-Id: 73a0bd2c-2ed6-43d9-83b3-08dbbd94e006 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q9cc4V5BX+UKNFXaAghxtBQIGfp1GBleUngUirn3/u//JU/6/ikZUlkntGA/Pammg2c12VLBD6cAxkI5oP4Q97tq6vMBxsH9Ez66w3IgGl4iBtCILHij9PtxC3qhLfpA0MH6ugnWgZSuCEyoD8YgKdUdIcbfRDKByjlzlxxOP93Lk2NkCN6NeITvivjrV6BCjsmqXzxjF6YOdv9RQcCkrcyaD3FP1jAL+DrvbpwUAMJOR3FiAfofkIBzroCqdCNDdyGvOB4jLrvyc46EKN9RbpYJdydr2RBf8Yc2mESAXgKLxxlLjfHanLXNAe59qxm/mV5KMSyAX20Su0v1snbPWhqXjzWirEJOUwJiXmAqY+/+sA85TVDybJrZZIyzPxINig0b0K5G9pr47g4Yz/ocv2T6hdBQJr3nLOB9f3VgB1GlGWuB0umzAiE49UCFirQy9YTMihwA91cT4ynI/tTiLt6u3IJPv/VbJYkElOadPR1Z7VXqxQHXBa06fYrM4MWUhXHg22THXULiqglmDnlZbgkQ6F6XXG1jcZ0znB58Pdlx5gCQP3fP+t+m2tRC94sk5kubKpex+LroZjFFGdROMbyOoMXUkyOagITsRtitS/Rz2vxc2usHUiB5qpN/YI8eHBRTQwTiLjwI4vRG3qMKSh2KRAex15QIdsdMl0c94yiYRPaRnqIN8jHUeKFHGWn87qqFZfwOJkA9n4CZulYGP2UnpiJQluBwNOdqHdyBnb5q2Bho/WEcQEO5Ln7SZSSEc+19dDyDnCk6H9cA9q8dAg== 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:(13230031)(4636009)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(186009)(82310400011)(1800799009)(451199024)(36840700001)(40470700004)(46966006)(40480700001)(40460700003)(2906002)(47076005)(36860700001)(83380400001)(82740400003)(356005)(81166007)(70206006)(70586007)(54906003)(110136005)(6666004)(5660300002)(26005)(16526019)(336012)(1076003)(316002)(6636002)(426003)(41300700001)(7696005)(478600001)(8936002)(8676002)(4326008)(2616005)(86362001)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2023 06:58:51.3921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73a0bd2c-2ed6-43d9-83b3-08dbbd94e006 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: BL6PEPF0001AB75.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8031 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sun, 24 Sep 2023 23:59:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778028851874070967 X-GMAIL-MSGID: 1778028851874070967 show_energy_performance_available_preferences() to show only supported values which is performance in performance governor policy. -------Before-------- $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver amd-pstate-epp $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor performance $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference performance $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences default performance balance_performance balance_power power -------After-------- $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_driver amd-pstate-epp $ cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor performance $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference performance $ cat /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_available_preferences performance Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors") Suggested-by: Wyes Karny Signed-off-by: Ayush Jain Reviewed-by: Wyes Karny --- Changes v1->v2 * Fixed spacebar and spelling issues * Using EPP_INDEX_PERFORMANCE instead of hardcoding index 1 * collected reviewed-by --- drivers/cpufreq/amd-pstate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9a1e194d5cf8..469461937fb6 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -850,11 +850,15 @@ static ssize_t show_energy_performance_available_preferences( { int i = 0; int offset = 0; + struct amd_cpudata *cpudata = policy->driver_data; + + if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) + return sysfs_emit_at(buf, offset, "%s\n", energy_perf_strings[EPP_INDEX_PERFORMANCE]); while (energy_perf_strings[i] != NULL) offset += sysfs_emit_at(buf, offset, "%s ", energy_perf_strings[i++]); - sysfs_emit_at(buf, offset, "\n"); + offset += sysfs_emit_at(buf, offset, "\n"); return offset; }