From patchwork Mon Jun 12 11:36:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 691886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0205C7EE2E for ; Mon, 12 Jun 2023 11:43:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234772AbjFLLnb (ORCPT ); Mon, 12 Jun 2023 07:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234745AbjFLLmi (ORCPT ); Mon, 12 Jun 2023 07:42:38 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA59F4EE1; Mon, 12 Jun 2023 04:37:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c/i09m6LLH6+fAq/6zNzIEJZv15TEDPadO03B7DkyJD9nxGAWzv2yOmjq5Pnd3NSXb/OT9sy32C32qMoxXnHYeZmykFdHeiVES2GpoE7EJwsdVycUjkJIqJxSOwmwwxTZ1pWOj/dZaUQhaHfbdE7vsdgXsubz/R17eXgXkzPqP+TWublARoJcYmMsymbkkOD1G1XnSomyX7K/DQwdbpoNipiYsfYjNexQzN3DTmy07Svya5NKy3mU9OZbtarqTMXmGfYgaZI2IeMNUqteyFsdWfqm2dWHHbNONz3jFsKhgMc6uB8lpS7TZXAI9Y5d+XqHImipmDeNhh8sW423K9WhA== 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=08dezVOyliFmCB4PBHoFHMu3G3BJpz2Cw90gGGoJX/g=; b=UgW4hP33CvOIqywW7QhyWu23sEABELX97gRO4tN1+ad3ULryt2h1u/e0JM/1sNZ7KJK1yq+T6aOYdXK8yPuVQabRPnTkpkVjM6OUR3InyRowr8ecLHfIMhTtZqWzW5Qjqh5iy4GsSBRpCvZgPXva9dhxEyzs4S63QRKmxfVcb4HyvYWqMjcdHIui+/0+VHgF8N3m75+2xYClBVnJrsbLmJX24eRXT/hnzi245Kiw43cEZTt1WGO65Tk4+Z8SuUwdSqUNM/a9lgpX13LjseKDoClKDRLvWv/NXA+Ow+47573RF5LF1462Tf6LYZRO6iXb8qO3Zm4gSvusskieobgNCg== 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=08dezVOyliFmCB4PBHoFHMu3G3BJpz2Cw90gGGoJX/g=; b=m0eebZQPY9XLzaIRIUWp+MGpFvYgZmAJXp7vmUBk8opWIVenlulX6BJqvVb6Ij6+Gx0u0o9RLsANvUWW/H7HDCL6UoBQ8SGS4Q4QDyDNeg2LLtN9VFwT+2PFyVCclN5pTDpYMhtgYxPFEYTPSimJVj83Vflw+iOa2tnqpXYNGj8= Received: from BN0PR03CA0015.namprd03.prod.outlook.com (2603:10b6:408:e6::20) by IA1PR12MB6652.namprd12.prod.outlook.com (2603:10b6:208:38a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.39; Mon, 12 Jun 2023 11:37:06 +0000 Received: from BN8NAM11FT113.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::81) by BN0PR03CA0015.outlook.office365.com (2603:10b6:408:e6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.34 via Frontend Transport; Mon, 12 Jun 2023 11:37:05 +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 BN8NAM11FT113.mail.protection.outlook.com (10.13.176.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.22 via Frontend Transport; Mon, 12 Jun 2023 11:37:05 +0000 Received: from beas.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.23; Mon, 12 Jun 2023 06:37:01 -0500 From: Wyes Karny To: , , , , CC: , , , , , Wyes Karny , Subject: [PATCH 1/6] amd-pstate: Make amd-pstate epp driver name hyphenated Date: Mon, 12 Jun 2023 11:36:10 +0000 Message-ID: <20230612113615.205353-2-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612113615.205353-1-wyes.karny@amd.com> References: <20230612113615.205353-1-wyes.karny@amd.com> MIME-Version: 1.0 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: BN8NAM11FT113:EE_|IA1PR12MB6652:EE_ X-MS-Office365-Filtering-Correlation-Id: 92f5581b-1df7-4aa7-dde1-08db6b395951 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EVk2bFUzt7xuFYgfh1435EUBET5zRAaf9j4j8mVY4akYODMBPQgL015DhIBrMgpVctbHvKtHC68S+HR9feIa6vQnvhEL3nrvzmpDESlkmHqXe1lo7j8JJbAC4xH7Q0Y1s/BmwRu9VhrfXefI1jN8DfdLvCnW4qfwyMsSqmouzWU9AuJEayOD0iH9+AJiIHVHXYv9LNrf4UQ1pQ4kGKZCC13qOaBvsgHulKvpUlkZlspzKsuwYLQag7+ISuZdS+oeMVnQeRAeLi7eLQUZ9FSYlxivbdKJHjDdfhsX7UZNJzo5CkAFU66CSjppnmEr5Jp8/znu7h7505+FgOf2jUV9wzpPb+rxGJRm2Rjfkat0kjyia0Wbc+v6TvouhlqxcC/5nCASubeRP0MFuloYNucdA2C61hyUG9iiiEf81EFuc9jUIYaQkODCT0AcmygT3URk3PHGW9mm3R/8Jr2cMrlbwDIz6vV2LxOUSfvCIe9UIyE2qSmvrLny5EZoBDYP/MS7uOXce8E3RJsYOR/s7rvfECkQ8TNMQJB3P53AIgcPUgle3bheK4ru+GLRU3O40cFvkctMEFSQWk7fiVdrT8f9PvzBH7r279AENESWS5LTIgoJtAQd9NnEqvYkHb9VWHXh8xq3UnM1FmlCUbYF9laYJYB2OnESDFCzwqD/EWPoRsxChnD90k0ykyLvD8V9ynvUiMvZnH/nDbSBMmfYl3X2yEDSOnHjy4sQg93p88h7cTxl7hqhYLC4H7SeS+QXcW8+gfmK0/UTFkd/BwYhpvGVzTrhwmpIx03+d4+CssURilE= 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:(13230028)(4636009)(136003)(396003)(376002)(39860400002)(346002)(451199021)(36840700001)(40470700004)(46966006)(86362001)(82310400005)(2906002)(4744005)(44832011)(36756003)(40480700001)(83380400001)(47076005)(7696005)(26005)(1076003)(16526019)(336012)(426003)(186003)(36860700001)(6666004)(82740400003)(478600001)(356005)(110136005)(40460700003)(81166007)(54906003)(316002)(4326008)(8936002)(41300700001)(70206006)(70586007)(8676002)(5660300002)(2616005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 11:37:05.8590 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92f5581b-1df7-4aa7-dde1-08db6b395951 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: BN8NAM11FT113.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6652 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd-pstate passive mode driver is hyphenated. So make amd-pstate active mode driver consistent with that rename "amd_pstate_epp" to "amd-pstate-epp". Cc: stable@vger.kernel.org Fixes: ffa5096a7c33 ("cpufreq: amd-pstate: implement Pstate EPP support for the AMD processors") Reviewed-by: Gautham R. Shenoy Signed-off-by: Wyes Karny Acked-by: Huang Rui Reviewed-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index ddd346a239e0..a5764946434c 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1356,7 +1356,7 @@ static struct cpufreq_driver amd_pstate_epp_driver = { .online = amd_pstate_epp_cpu_online, .suspend = amd_pstate_epp_suspend, .resume = amd_pstate_epp_resume, - .name = "amd_pstate_epp", + .name = "amd-pstate-epp", .attr = amd_pstate_epp_attr, }; From patchwork Mon Jun 12 11:36:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 692472 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 777CCC7EE25 for ; Mon, 12 Jun 2023 11:44:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236247AbjFLLoF (ORCPT ); Mon, 12 Jun 2023 07:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235207AbjFLLnd (ORCPT ); Mon, 12 Jun 2023 07:43:33 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060.outbound.protection.outlook.com [40.107.92.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5E0C526D; Mon, 12 Jun 2023 04:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JOROSHLgGXlNsbAgsWY/B6DDWrx8rd+4JZb0zMBLA40K7swYGdg78ivcV+xJ1FalCTk5OfJSBDvM0bs1xBb6w+2TPuDLG4mk4CAWW4C1CbNpf85REJXKW54xk9REilK851KBZ2G9g1Sijl0Cq11beoZg3+RBEVkTNpeVAoGG3DcRctV9BxJzkM/iJRwmudok2MkctCAEEz3/1DQ5UOnCUFDimn2MkwL+Jbgq2/RYec/t96dzeBrOuBR6yT+QmVjN6fMiE/L/9hvM/n/yDJnF1L0Eik1g44ieTgmoPT78PMW9KkM4HdIDg29TpbucMutVDewnVGMsKOV62YqsIyrClg== 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=AlYkodrzglfXDTN5fkJDf+04scGep/JAEY4NiAyB7BU=; b=EoouEi6a09HRt7CKW7E8eeiqXTwcSSD5//a5nV8lmNXN8D44CvHvEbK6S/b0N/2R3oEOzurc//zpfHwrEdLJ8eOJrLbIq4yS9kccu8sHTbfTI6W0xALz0j2sYFjNiOTSk5oA7SOMeUJLY0UrjqrVQgQ0Z0RnA+pt0eJYQN2iCkLwx1N18Ph33209LgQ8CjCV5Y36j1xLDOCikFmRAsQ9vadMxyww6vp2rBdgRVW00O8+phMpcmW3weRdmdMq1ASs4rB4k6MkeFGYHe178Ye3ZCxBL74p8LG2Wht14vkC1oLEH0tB8OJhZN6sJkJBtqQswFTXhncHQRZSJR2ZA0uCyw== 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=AlYkodrzglfXDTN5fkJDf+04scGep/JAEY4NiAyB7BU=; b=GrujtZjGptjwIPtcH2v2534dJ4n4MGogilbqPqxFk/ajz37eVpiqWSy6+vLapNT4Uogy3P4DgPtXWI+2tr9jFpYkJXv6iQdiU4fRneTDLGb6XabHOhiOWhdyMuWBm5d3FJ6gWCQffxTLS/OHsDxfExeaUo1szGm0HbQsAIqrVVs= Received: from BN0PR03CA0010.namprd03.prod.outlook.com (2603:10b6:408:e6::15) by MN2PR12MB4319.namprd12.prod.outlook.com (2603:10b6:208:1dc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 11:37:30 +0000 Received: from BN8NAM11FT074.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e6:cafe::d0) by BN0PR03CA0010.outlook.office365.com (2603:10b6:408:e6::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.33 via Frontend Transport; Mon, 12 Jun 2023 11:37:30 +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 BN8NAM11FT074.mail.protection.outlook.com (10.13.176.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.21 via Frontend Transport; Mon, 12 Jun 2023 11:37:30 +0000 Received: from beas.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.23; Mon, 12 Jun 2023 06:37:27 -0500 From: Wyes Karny To: , , , , CC: , , , , , Wyes Karny Subject: [PATCH 2/6] cpupower: Recognise amd-pstate active mode driver Date: Mon, 12 Jun 2023 11:36:11 +0000 Message-ID: <20230612113615.205353-3-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612113615.205353-1-wyes.karny@amd.com> References: <20230612113615.205353-1-wyes.karny@amd.com> MIME-Version: 1.0 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: BN8NAM11FT074:EE_|MN2PR12MB4319:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b7c7a62-8fa6-4824-cdf7-08db6b396830 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ekmj5NOoEMIak/Wb7OCYsLsy5OHcbVzVZ88/bNzxMuWGKz0G3xOi+IruIUsm3Dw3jE8wQZqOxKeh4BmqfTqrOMcbExxtatWkA1fkGI8wZ0fNISg8Qrr1lkxxhgmoBq30zfMU9f3GHWDzmQUmLtBvxEgpOiLjdGQYhP0/z58oppU2pEuN2NVU+nd9WH7kZuw2JEwPmSHO6Gs6Y8vnO0Gc94suOsli/GIm4EO7lI+5v/y0bI3Gb0diKilccF04FO9eHEKDlvNDndqvAdG3y8LL4/K5NMsqhYchv7py7kL1J5qmPwPECYkmawHFS5GoK5qvU6CUdkv6x4pD8XwHaLkY2c7FDvP2zJEi1S9uAFHSdgJvTDan8Q0ITIOzRpttGYqFYsy+ZmGzDAuSDbhHh++jMolpfRv1FEXOar7QaEiCGxvgVk+BnSWYWpxMx/ysJ1PDdqTx93rxbsMmU8lR690dMFiPDS2/AuS3kHPqsflAN3Yjwb4cbKSccybfU2xql4VZk57xOIxhciWvKhPKDZWW1mDX2jSaznzL7zYh19ExYKPMlvZFJBfY9CqRmy6At+oGWP3MNkQfETZRLJ7qvK74+G0fhrmGwitLTo5Q21Smn0r4XUxLq60yS7ZARdYLVWPYGJj2MNp2yQKNSU+wLpcH2v0TlbnaOCZTLkxMSk35UMyJ3NZCHhlfprH9uExHz00FXcRk0ys8mPKrdeJqqF6AyGAJ/kCYhLN/Uz7yPdxDHxz5bZr+APTPPPSzHlWTbpAi3RnoxSQIYzqEHpLPqs1Gm9iETt0LECKGET5tvC6I8HQ= 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:(13230028)(4636009)(39860400002)(136003)(396003)(376002)(346002)(451199021)(36840700001)(46966006)(40470700004)(4326008)(426003)(47076005)(70206006)(70586007)(336012)(36756003)(16526019)(186003)(478600001)(110136005)(2616005)(4744005)(2906002)(54906003)(8676002)(316002)(41300700001)(82310400005)(86362001)(7696005)(40460700003)(356005)(6666004)(36860700001)(1076003)(44832011)(8936002)(83380400001)(82740400003)(5660300002)(26005)(40480700001)(81166007)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 11:37:30.7925 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b7c7a62-8fa6-4824-cdf7-08db6b396830 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: BN8NAM11FT074.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4319 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd-pstate active mode driver name is "amd-pstate-epp". Add this to the string matching condition to recognise amd-pstate active mode driver. Reviewed-by: Gautham R. Shenoy Signed-off-by: Wyes Karny --- tools/power/cpupower/utils/helpers/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 9547b29254a7..21f653cd472c 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -95,7 +95,7 @@ bool cpupower_amd_pstate_enabled(void) if (!driver) return ret; - if (!strcmp(driver, "amd-pstate")) + if (!strcmp(driver, "amd-pstate") || !strcmp(driver, "amd-pstate-epp")) ret = true; cpufreq_put_driver(driver); From patchwork Mon Jun 12 11:36:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 691885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37B3AC7EE25 for ; Mon, 12 Jun 2023 11:44:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233010AbjFLLoW (ORCPT ); Mon, 12 Jun 2023 07:44:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236813AbjFLLoD (ORCPT ); Mon, 12 Jun 2023 07:44:03 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2060.outbound.protection.outlook.com [40.107.212.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A488055AF; Mon, 12 Jun 2023 04:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9lzk/xEPta2660TynZjS4syXi2AJH8ZGPUXVyrrdw64AA5p5tcEqi82uKjCv1NOkxSreN3WuVouvw1gGxSL2Xt+01unlGos3+xq0y0C6UdYZj0AgWQPVstK7ccHl2bSHG+PBDAV/jOgcyxTUzZU1eBV8B29OYEGZsq92RaGn+b0cZYLKMqP9PgzrS2WQUOnc4O7z1lS/qzf9Nc4ultMi2NALmyFeQZSfz6abPGCdsNSiL2Uf9jsT6L7eFLJHGhAPbyiK/u6xyJZy35msa3QQwcQ4wFIbL5/tsdjUz2p2soh5oBAYe2hWpRBYIP2+BShZSoBpISDnACBrsML+KRWWg== 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=vAQO8W+cZB3/dnu4eAjRqnSdODd5IkUHjNJwXvSLIWg=; b=X9xi+qYGoMNAULBfiLJtWsTca7uREvavul8NmOEkGxeBWkG0MKiVdNLByrniLHJAkXcwrmgtXf2OzjJEdR2oUrj2nPAd76LzHd4W/yVy+pbvw0ly9ZVdncHLhLtAJweSJJy6qJdAa9TmxT3UC8jRabcChWZtcqken+8tpfRXdocSqjGySmdMDsxXP1Nm0f1GUFBMGvamToJzukLBjF4CtcEHlTTJYe8h1JcTMAYH3PFYKaDm/rwY6YsDrYazXrhKRRDAqDU+bKdMaMqm4MwLAYcY7J7C3kJsnRXWW7r5k2Q2WLQDln6g3+bMRqwNu9BO5vOdWNOJz2BxckYAaeW0sA== 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=vAQO8W+cZB3/dnu4eAjRqnSdODd5IkUHjNJwXvSLIWg=; b=AEp/JvvhCK7vNDkP48mEJfksP5RwYR53qs+T0cytVl6nV/zJRzXIc2mnS/4/m5cc5/9sTGvHd+G9bC5AihB4oCUKReap7yQT2zL1sZSB97NMtByVPW8Txl0iuD+8wq4w8yVsTd0mIprfaAvn+OrFp+SGQ2hAld02VwusdDQ7XkM= Received: from BN9PR03CA0989.namprd03.prod.outlook.com (2603:10b6:408:109::34) by DM4PR12MB6061.namprd12.prod.outlook.com (2603:10b6:8:b3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Mon, 12 Jun 2023 11:37:58 +0000 Received: from BN8NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::d0) by BN9PR03CA0989.outlook.office365.com (2603:10b6:408:109::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.34 via Frontend Transport; Mon, 12 Jun 2023 11:37:58 +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 BN8NAM11FT080.mail.protection.outlook.com (10.13.176.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.29 via Frontend Transport; Mon, 12 Jun 2023 11:37:58 +0000 Received: from beas.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.23; Mon, 12 Jun 2023 06:37:54 -0500 From: Wyes Karny To: , , , , CC: , , , , , Wyes Karny Subject: [PATCH 3/6] cpupower: Add is_sysfs_present API Date: Mon, 12 Jun 2023 11:36:12 +0000 Message-ID: <20230612113615.205353-4-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612113615.205353-1-wyes.karny@amd.com> References: <20230612113615.205353-1-wyes.karny@amd.com> MIME-Version: 1.0 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: BN8NAM11FT080:EE_|DM4PR12MB6061:EE_ X-MS-Office365-Filtering-Correlation-Id: aa174fa0-fccd-4817-f23d-08db6b39788d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RMz7RU3hMbQ4wE6JaWyBf2bibG07kOsoxzuQdG/EBIQkrlCH3FKOCUgpSccfWTKHfcK8o0mk2/L7EtfzRkNfqaWJPhAb8+OAO2fzsnqN6okts+TNiFmj46bKk7g5wKBsHrBwNj5Zd1sYxA1UElVWiqcMaXSn0Pxng+0AbUA+JEm85vJPmNpdZtIDFe13b0ar0eTA4LhaUyoRA7FGFf5m0o4y0M/3gb+YbwzRRR0s2ZhW1/hgudqPprjRI05lkmZsXxkh1ngP5SlibpiZ6dHzwww/3ZFPK+VKf0ORE+AO6yp4p7BxHZj/fbQbKaBc2F0zFBzaQwpP5kWuTS6E/6XeF3iWZHYiv9XEf7aHNJWTfylghMowWYVbE+ufo3L9LI/fzsqqK4rmofJh3YDp4oBP/bubc1/XoEvvUM9N1coIeYfVBf/2S+cj/Hge7O8/VY2Ta5EHbfkTXzE+g1qf8f87+7hW+wwXKnxYCA2Hzf0pTL54JjG4i9bsmmt6MQu2HiM2CmNU4s3f7W3XD+Mgh2pr/eCX0+M50iQjrSj3cCfYfZsHC+Sgb5zd71zde41pHmwMrYL3wfklYzFWIiRbNlHkrXK5dMWpyrku9qLIeYsPlTkzGlS0RmOx6P7vpfupXmS/tH9+btBzJG7h3+tiETfojMx7hzTsXkY2Fnt7FDgblmwC2XS5IfxxygG39AWYvf8IJqyelDqLJnaWcZtuWIOIrT5w1s3BlcsZtHmAwp7nnDA4awLxOfwJMtmnWJrv++0dHupoOoM3eGTauFfDIKmLl5F/I2+J+VPinZaAkru3EqM= 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:(13230028)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199021)(46966006)(36840700001)(40470700004)(40460700003)(5660300002)(8676002)(36860700001)(8936002)(47076005)(2906002)(426003)(83380400001)(36756003)(336012)(2616005)(81166007)(356005)(82740400003)(82310400005)(86362001)(40480700001)(1076003)(26005)(44832011)(16526019)(186003)(70206006)(70586007)(4326008)(6666004)(478600001)(7696005)(110136005)(316002)(54906003)(41300700001)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 11:37:58.2621 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa174fa0-fccd-4817-f23d-08db6b39788d 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: BN8NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6061 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add is_sysfs_present API to check whether the sysfs file is present or not. Suggested-by: Gautham R. Shenoy Signed-off-by: Wyes Karny --- tools/power/cpupower/lib/cpupower.c | 7 +++++++ tools/power/cpupower/lib/cpupower_intern.h | 1 + 2 files changed, 8 insertions(+) diff --git a/tools/power/cpupower/lib/cpupower.c b/tools/power/cpupower/lib/cpupower.c index 3f7d0c0c5067..7a2ef691b20e 100644 --- a/tools/power/cpupower/lib/cpupower.c +++ b/tools/power/cpupower/lib/cpupower.c @@ -14,6 +14,13 @@ #include "cpupower.h" #include "cpupower_intern.h" +int is_valid_path(const char *path) +{ + if (access(path, F_OK) == -1) + return 0; + return 1; +} + unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen) { ssize_t numread; diff --git a/tools/power/cpupower/lib/cpupower_intern.h b/tools/power/cpupower/lib/cpupower_intern.h index ac1112b956ec..5fdb8620d41b 100644 --- a/tools/power/cpupower/lib/cpupower_intern.h +++ b/tools/power/cpupower/lib/cpupower_intern.h @@ -7,5 +7,6 @@ #define SYSFS_PATH_MAX 255 +int is_valid_path(const char *path); unsigned int cpupower_read_sysfs(const char *path, char *buf, size_t buflen); unsigned int cpupower_write_sysfs(const char *path, char *buf, size_t buflen); From patchwork Mon Jun 12 11:36:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 692471 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E622C7EE25 for ; Mon, 12 Jun 2023 11:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229576AbjFLLqA (ORCPT ); Mon, 12 Jun 2023 07:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234148AbjFLLom (ORCPT ); Mon, 12 Jun 2023 07:44:42 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2046.outbound.protection.outlook.com [40.107.95.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 775035FDD; Mon, 12 Jun 2023 04:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QP+UUTi5UMQOqTLnDmcOKx3tyUTxJJXNAl9ym0639QAsLj1Xs5VvY29+C0xfFtfDZodPjDE2AbcwOO1LsfThjz7d6Mex1rzl59pbVAWBl+s5m5Tb7kXUO1Gzxgv9w6a00x2vXpC7gFhQWKbPC2K8giH98SbYURatFbtGs4hSAUzMpHpd58DNHsE1UG40N03CBFiP/xdRldZhsFiblY+vsziEqrwhKjc/IpBWyAV59UYJ4LeyTxqhqLaZRUHeKMoQ8tymEmc2dKW63rmT5+l/Pn+lpkX964ZjdqCCIUA5tAr5z4cLL6OiK21ppnk/isT4mWmwFbt/WaDSIz6YdZTbcg== 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=9TERMzjVqf1BUCKOG11qcP7PHls/ICBgjVODltQVQCE=; b=LHbZd3cysZPSE6ynNozHpobiMgNIdvKhw9Uw9EV6hwSLptpqqSomh81ayQN2fW55tP8g7CH6+7eTMf740pTAlrlN7m3KSmFgKc8ymmovPZf5EPZLNxDXi0l4eBJZgBH4j5l/YvX0gjv7NIHMQOxMeWD3qEQo+Hu56SiwVflr+jwAvLIy4mCgXGsWghTx2e0uMQRkgi8p+CZtrsF/f4sdPccN6PJc+9V5L0mI858Ya/UlKj0FkPpi271YV3M6uxWS4urszihpnf8vFVx0qBShGO/JGQ/4uV1tAWN44d1s3IhY4yPY6gKQNqBFEzu9isfneWqmPIWHtBuoalL9vRUPwA== 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=9TERMzjVqf1BUCKOG11qcP7PHls/ICBgjVODltQVQCE=; b=arMEY1yv788G/+/34OGdvSuekzQPOoBkVeyXCLspp63tNI0oH7/6wu1BcZwpxiaMy2X11iM7kdL+fa8/HLKK79Erdw4D3e76JnxiwgQyWILmWUXgCIIzTN6TlsxF4SzJXmIPUMRoxMalqq3+n4K8meQ6yNzF7DCzAV7dd8FcvoQ= Received: from BN9PR03CA0110.namprd03.prod.outlook.com (2603:10b6:408:fd::25) by IA0PR12MB8896.namprd12.prod.outlook.com (2603:10b6:208:493::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.33; Mon, 12 Jun 2023 11:38:28 +0000 Received: from BN8NAM11FT098.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fd:cafe::db) by BN9PR03CA0110.outlook.office365.com (2603:10b6:408:fd::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.34 via Frontend Transport; Mon, 12 Jun 2023 11:38:28 +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 BN8NAM11FT098.mail.protection.outlook.com (10.13.177.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.21 via Frontend Transport; Mon, 12 Jun 2023 11:38:28 +0000 Received: from beas.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.23; Mon, 12 Jun 2023 06:38:25 -0500 From: Wyes Karny To: , , , , CC: , , , , , Wyes Karny Subject: [PATCH 4/6] cpupower: Add EPP value change support Date: Mon, 12 Jun 2023 11:36:13 +0000 Message-ID: <20230612113615.205353-5-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612113615.205353-1-wyes.karny@amd.com> References: <20230612113615.205353-1-wyes.karny@amd.com> MIME-Version: 1.0 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: BN8NAM11FT098:EE_|IA0PR12MB8896:EE_ X-MS-Office365-Filtering-Correlation-Id: e50bde08-921a-46c3-d80f-08db6b398aae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bxl6wRZ4k5SHIGPUtEIBybX3wVOnuKj9oksd5IXmLCEg8cshU6lL3ytok6aMiTp0RmmKWMGm0sybbOPOUE6jSZim8BqtjMW0gobO7abdc5wqzTFU7eKX7rfiMvrd6j2lTzATcyUZFVkgsin1sVj1lodmCGALm0JLY11xgqWplVpblk9hSwm2iMtMv4zlo2PLtgnPRCjhkVUHgl/+RAZDE0Ome5iwJPKqRdkt2RAyRXPDWfcNGSv7HUiqa1KnI6APBx5quIQehrg+0WqaPbO8oqWlda+nd9Z4b7U+k8VCF0V073T++4BVEwXqdfH+NC/0C3e0tvHPxEIjFqGqzoiWnBPF0M48SwGOiF8jHKdw9zeMS9F2OXu9kviS/8kZ7Flo9Zmp6LSG4z/ijQiT0O8PXQ4IHnrJVJ9ZxIlnNTW/YM178IxQh2veOJqO5rJS24gd40hkPTC/17zKzz03f5q838nDQIRoG68FObMTWG9P2IeE8ePYNhTad5MAghaPz/gCpllteL8LwBxGHvV81FpxQHDokesq9NCJOtPC9HLioXzQR/zy+M32hAnm5EmqL+qhAo4KaFxbdvZGqZMZ0K8OCQcxf/9EdhjLSo5I/UvqLlGzUS1aBx0p8PVOzSTo18ggSi2ID0Af4OK6cS/bhJeok83owp7uYe4o/JEWwTSz4kvh8p3bg3wDsM3gWWToJx5vvQe/L2oU5LxV0EirQMwqaNULYWy2wYgKhyhk4wQ9mhsapzQN/DJbDcV+FojiCceQPvwMyi/ix40EK6GRikByoXUpPGyrSwbBqQwrmoMzVoM= 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:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199021)(40470700004)(36840700001)(46966006)(83380400001)(40460700003)(336012)(426003)(47076005)(2906002)(2616005)(40480700001)(36860700001)(36756003)(86362001)(82310400005)(82740400003)(81166007)(356005)(316002)(41300700001)(5660300002)(6666004)(8936002)(186003)(8676002)(7696005)(478600001)(110136005)(54906003)(70206006)(4326008)(70586007)(26005)(16526019)(1076003)(44832011)(2101003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 11:38:28.6766 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e50bde08-921a-46c3-d80f-08db6b398aae 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: BN8NAM11FT098.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8896 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd_pstate and intel_pstate active mode drivers support energy performance preference feature. Through this user can convey it's energy/performance preference to platform. Add this value change capability to cpupower. To change the EPP value use below command: cpupower set --epp performance Signed-off-by: Wyes Karny --- tools/power/cpupower/utils/cpupower-set.c | 23 +++++++++++++++++++- tools/power/cpupower/utils/helpers/helpers.h | 5 +++++ tools/power/cpupower/utils/helpers/misc.c | 19 ++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index 180d5ba877e6..a789b123dbd4 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c @@ -18,6 +18,7 @@ static struct option set_opts[] = { {"perf-bias", required_argument, NULL, 'b'}, + {"epp", required_argument, NULL, 'e'}, { }, }; @@ -37,11 +38,13 @@ int cmd_set(int argc, char **argv) union { struct { int perf_bias:1; + int epp:1; }; int params; } params; int perf_bias = 0; int ret = 0; + char epp[30]; ret = uname(&uts); if (!ret && (!strcmp(uts.machine, "ppc64le") || @@ -55,7 +58,7 @@ int cmd_set(int argc, char **argv) params.params = 0; /* parameter parsing */ - while ((ret = getopt_long(argc, argv, "b:", + while ((ret = getopt_long(argc, argv, "b:e:", set_opts, NULL)) != -1) { switch (ret) { case 'b': @@ -69,6 +72,15 @@ int cmd_set(int argc, char **argv) } params.perf_bias = 1; break; + case 'e': + if (params.epp) + print_wrong_arg_exit(); + if (sscanf(optarg, "%29s", epp) != 1) { + print_wrong_arg_exit(); + return -EINVAL; + } + params.epp = 1; + break; default: print_wrong_arg_exit(); } @@ -102,6 +114,15 @@ int cmd_set(int argc, char **argv) break; } } + + if (params.epp) { + ret = cpupower_set_epp(cpu, epp); + if (ret) { + fprintf(stderr, + "Error setting epp value on CPU %d\n", cpu); + break; + } + } } return ret; } diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h index 96e4bede078b..5d998de2d291 100644 --- a/tools/power/cpupower/utils/helpers/helpers.h +++ b/tools/power/cpupower/utils/helpers/helpers.h @@ -116,6 +116,8 @@ extern int cpupower_intel_set_perf_bias(unsigned int cpu, unsigned int val); extern int cpupower_intel_get_perf_bias(unsigned int cpu); extern unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu); +extern int cpupower_set_epp(unsigned int cpu, char *epp); + /* Read/Write msr ****************************/ /* PCI stuff ****************************/ @@ -173,6 +175,9 @@ static inline int cpupower_intel_get_perf_bias(unsigned int cpu) static inline unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu) { return 0; }; +static inline int cpupower_set_epp(unsigned int cpu, char *epp) +{ return -1; }; + /* Read/Write msr ****************************/ static inline int cpufreq_has_boost_support(unsigned int cpu, int *support, diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 21f653cd472c..63c3f26ef874 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -87,6 +87,25 @@ int cpupower_intel_set_perf_bias(unsigned int cpu, unsigned int val) return 0; } +int cpupower_set_epp(unsigned int cpu, char *epp) +{ + char path[SYSFS_PATH_MAX]; + char linebuf[30] = {}; + + snprintf(path, sizeof(path), + PATH_TO_CPU "cpu%u/cpufreq/energy_performance_preference", cpu); + + if (!is_valid_path(path)) + return -1; + + snprintf(linebuf, sizeof(linebuf), "%s", epp); + + if (cpupower_write_sysfs(path, linebuf, 30) <= 0) + return -1; + + return 0; +} + bool cpupower_amd_pstate_enabled(void) { char *driver = cpufreq_get_driver(0); From patchwork Mon Jun 12 11:36:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 691884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F82C7EE2E for ; Mon, 12 Jun 2023 11:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbjFLLqA (ORCPT ); Mon, 12 Jun 2023 07:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238738AbjFLLpJ (ORCPT ); Mon, 12 Jun 2023 07:45:09 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on20622.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e83::622]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FD6C6591; Mon, 12 Jun 2023 04:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jJGZPzmL7NwoiOETrFhQKjnjgBkFP+/ESbliz30W3to4g8xMuJmiLSyDFfVt3VVvlqAsEmiqXnplyPDRErDaMljUxO9kd0f+MW+ku05Eq/iuHbNPS7wMtCPcvqvkVrTLmvphcHP3iMVr4PDUmveuKXIXgtXhY10pgRs2AKVzdjF9qjggIaR1sd4kaMJJqVymO3U7DQ1D9Q458CE/mxaM0EjR73KqwnrGEkWNpk2YCP2ON8IHsmC+X+uguBXc5+UuppaVwKiAQ2FNO/eDS+hGCAuzhpL8tHczykMu5n86sVhK/vC0OjJNhxDI42sG0plXP1nHbE1feiaLXdYhRUPC8Q== 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=ZyPTI9OCW2bMoA0WggyKjaLJ33NMPH+RNdjMWE3lWx4=; b=ElLdsnteCdGJImGu6O3+XDEXeDss56QqHI7CwOCtESYwPCimZ9sA3fqCSmET3ReSwQG3Sw6PY3C7ONJaRw+b9E53mExzSmAQGitW3IKXza6Sj/SP3tMSadPNdb22pWYxJNZ1osSBNdgtaM+EkefXuEDm0+On4PPOUL4uyRld1zMHFIFnu9fY9Bsh1Oox1NVUkZl1s0CwiOE6as/dRbpzc4DDQoigU+M8O3wjJz3aNN/TirqBsRWYdn6kliz14qrusWkZCqfbW1PnTcAsC0PljY6My7aa/qf30ZD13xSUw5wtdiNhVburTsn/zIgY4YOh7FB2oHjNdsKndt534S/s+g== 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=ZyPTI9OCW2bMoA0WggyKjaLJ33NMPH+RNdjMWE3lWx4=; b=n/nUTaykKUIllTc5WwAiDr/vWWZySpeiwzrfLCqfhZeTB6GWC1o/zM4OiG1tS7KAk5cZbCzk8v2AD0yhc9MHzyCiKmcP9vvUmfU7r28nNKbJv1uOwcLhI6VOFPzTK9lBrpiG1kTL5/3C05kw9o58dt6xi36QmwZ2J2eBp4fNu5o= Received: from BN9PR03CA0032.namprd03.prod.outlook.com (2603:10b6:408:fb::7) by PH7PR12MB6740.namprd12.prod.outlook.com (2603:10b6:510:1ab::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Mon, 12 Jun 2023 11:38:56 +0000 Received: from BN8NAM11FT024.eop-nam11.prod.protection.outlook.com (2603:10b6:408:fb:cafe::be) by BN9PR03CA0032.outlook.office365.com (2603:10b6:408:fb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.33 via Frontend Transport; Mon, 12 Jun 2023 11:38:56 +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 BN8NAM11FT024.mail.protection.outlook.com (10.13.177.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.21 via Frontend Transport; Mon, 12 Jun 2023 11:38:56 +0000 Received: from beas.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.23; Mon, 12 Jun 2023 06:38:52 -0500 From: Wyes Karny To: , , , , CC: , , , , , Wyes Karny Subject: [PATCH 5/6] cpupower: Add support for amd_pstate mode change Date: Mon, 12 Jun 2023 11:36:14 +0000 Message-ID: <20230612113615.205353-6-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612113615.205353-1-wyes.karny@amd.com> References: <20230612113615.205353-1-wyes.karny@amd.com> MIME-Version: 1.0 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: BN8NAM11FT024:EE_|PH7PR12MB6740:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f882063-9418-4a50-f0e6-08db6b399b47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TtnfbBegS0ONiub/WQrW2GyJo5UWF88gqrejCAYRgFgISTavoNrqbRdhb/sj+k3iCxEMT4gQcJrzD/KYyQ60E2D0UI11fpHUiBtKyk8cWQsgd43EFEV/Z4HJJ73O3qLtIsWG4EB/Pkj2yA1tsDTLmSNOfCyTtmJroht6BjD8jfCbgV2ve1/iY7i4vZ55B6xsfg0VtzSkcOJMdg/jzem2kWnspNIXze1jee9mEDe/0Feuw1jqClZKKx2PW2S7BHuSwm8gRsWit5kCmH9jk9PB3vcchns0mPdLv/NHyESHP7yprjprFwEO+tJ4dQH4me7DvH24EVemQrjOnYkd4LBkxcmO2ZjPK1y/krwsS44+yOfKgJewAPOyK8UnhzZ7N0ru4ZgI0RgsMcRPjPg1tsloJLUMOq7ZE1/I56AF6doF9bGR6/EterHoCX6KzJ4usQvLUZ4d4yV8N8EYpXebmNH/JsZFLlJFDCIXkAOYtKxYPjObYpi3EENrScvVuc33xiiGQ0+0IyYsP1GmCOrYmyNEnC8eQa/tuTrk2O8hVn9dUFLVhTCOW7mbYnt4KrqBd7IKbXtQ1B53RjUF3hyJRLl9xK8P1a8GSx3v+mKkXyLWZOB1jOVch9lZXi7fM95VpeucsyU45ooA/n2TJdEZGqBBZtkaHKe9Z7XxT0AM1vaHhAqnseE2MrjYoJ/F3zdlBjCPLCIAjVrMFFZW5sH+W0s++5ZWM+tuws403wHaaQVaGaYlauBOh+guo/4AvaebSOsmfgpFbg4D26AX4w30kKGfwmJNVgZv8rr0TWKSyWtBW+M= 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:(13230028)(4636009)(136003)(39860400002)(396003)(376002)(346002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(7696005)(6666004)(47076005)(36756003)(426003)(336012)(83380400001)(2616005)(86362001)(82310400005)(82740400003)(356005)(81166007)(1076003)(26005)(40480700001)(36860700001)(186003)(16526019)(2906002)(110136005)(54906003)(316002)(4326008)(44832011)(70586007)(70206006)(41300700001)(5660300002)(478600001)(8936002)(8676002)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 11:38:56.5079 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f882063-9418-4a50-f0e6-08db6b399b47 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: BN8NAM11FT024.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6740 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org amd_pstate supports changing of its mode dynamically via `status` sysfs file. Add the same capability in cpupower. To change the mode to active mode use below command: cpupower set --amd-pstate-mode active Reviewed-by: Gautham R. Shenoy Signed-off-by: Wyes Karny Acked-by: Huang Rui --- tools/power/cpupower/utils/cpupower-set.c | 24 ++++++++++++++++++-- tools/power/cpupower/utils/helpers/helpers.h | 3 +++ tools/power/cpupower/utils/helpers/misc.c | 18 +++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index a789b123dbd4..c2ba69b7ea54 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c @@ -19,6 +19,7 @@ static struct option set_opts[] = { {"perf-bias", required_argument, NULL, 'b'}, {"epp", required_argument, NULL, 'e'}, + {"amd-pstate-mode", required_argument, NULL, 'm'}, { }, }; @@ -39,12 +40,13 @@ int cmd_set(int argc, char **argv) struct { int perf_bias:1; int epp:1; + int mode:1; }; int params; } params; int perf_bias = 0; int ret = 0; - char epp[30]; + char epp[30], mode[20]; ret = uname(&uts); if (!ret && (!strcmp(uts.machine, "ppc64le") || @@ -58,7 +60,7 @@ int cmd_set(int argc, char **argv) params.params = 0; /* parameter parsing */ - while ((ret = getopt_long(argc, argv, "b:e:", + while ((ret = getopt_long(argc, argv, "b:e:m:", set_opts, NULL)) != -1) { switch (ret) { case 'b': @@ -81,6 +83,17 @@ int cmd_set(int argc, char **argv) } params.epp = 1; break; + case 'm': + if (cpupower_cpu_info.vendor != X86_VENDOR_AMD) + print_wrong_arg_exit(); + if (params.mode) + print_wrong_arg_exit(); + if (sscanf(optarg, "%19s", mode) != 1) { + print_wrong_arg_exit(); + return -EINVAL; + } + params.mode = 1; + break; default: print_wrong_arg_exit(); } @@ -89,6 +102,12 @@ int cmd_set(int argc, char **argv) if (!params.params) print_wrong_arg_exit(); + if (params.mode) { + ret = cpupower_set_amd_pstate_mode(mode); + if (ret) + fprintf(stderr, "Error setting mode\n"); + } + /* Default is: set all CPUs */ if (bitmask_isallclear(cpus_chosen)) bitmask_setall(cpus_chosen); @@ -123,6 +142,7 @@ int cmd_set(int argc, char **argv) break; } } + } return ret; } diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h index 5d998de2d291..d35596631eef 100644 --- a/tools/power/cpupower/utils/helpers/helpers.h +++ b/tools/power/cpupower/utils/helpers/helpers.h @@ -117,6 +117,7 @@ extern int cpupower_intel_get_perf_bias(unsigned int cpu); extern unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu); extern int cpupower_set_epp(unsigned int cpu, char *epp); +extern int cpupower_set_amd_pstate_mode(char *mode); /* Read/Write msr ****************************/ @@ -177,6 +178,8 @@ static inline unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu) static inline int cpupower_set_epp(unsigned int cpu, char *epp) { return -1; }; +static inline int cpupower_set_amd_pstate_mode(char *mode) +{ return -1; }; /* Read/Write msr ****************************/ diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 63c3f26ef874..9df9af8a969e 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -106,6 +106,24 @@ int cpupower_set_epp(unsigned int cpu, char *epp) return 0; } +int cpupower_set_amd_pstate_mode(char *mode) +{ + char path[SYSFS_PATH_MAX]; + char linebuf[20] = {}; + + snprintf(path, sizeof(path), PATH_TO_CPU "amd_pstate/status"); + + if (!is_valid_path(path)) + return -1; + + snprintf(linebuf, sizeof(linebuf), "%s\n", mode); + + if (cpupower_write_sysfs(path, linebuf, 20) <= 0) + return -1; + + return 0; +} + bool cpupower_amd_pstate_enabled(void) { char *driver = cpufreq_get_driver(0); From patchwork Mon Jun 12 11:36:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 692470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87417C7EE25 for ; Mon, 12 Jun 2023 11:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234745AbjFLLqs (ORCPT ); Mon, 12 Jun 2023 07:46:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233212AbjFLLqb (ORCPT ); Mon, 12 Jun 2023 07:46:31 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20624.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::624]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF5EF4210; Mon, 12 Jun 2023 04:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L0ugB7WKvRebMEpx3s+94brAplwclReg4EsJiQCCdAYqCR9SRC8yKtWOoUpvD+iDSKtOwftDKIeAvVa78e24apmlFFdl8fmgCtVLNYsgPWWbUBOqc0oUCPp7qttZjvOqQs8CPLwBjzQ9Ecz4tCl788hDsc5hlgHudKlutylueNIDCNRVD3qscf8veviB8o3hy55a5oC6w1UKRnKCXZq2dMQ3mmdvgdzA9QONlWfmooRczopZO3I1ZF3/U0rdfLPIatwcFBELbXubOeS6dlwLqm8I9GTUmGFAB3fr77puxi3IHGKOk+MVGq1A/lpKSIiKSOYzH59jxi34zKsr99kyug== 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=S/OfkqtXHGtnTQ41FrSv3qvkmd08vd5RMmzrq1BhSY0=; b=C+QVFCF0ZdQ+/aZjaujXpHIjXAAbpyAv/U+jxZW0q+GYN1VAc4g2VwS6WRGAfENfIsqQtRMGUzhRsM9aHtYPKYkrHP3SuKUB9N8N56d25tTlK01rPYjobV8xx2mMLVmuH5qJ9JrqYVaDyOVxBPtV3d+ERSiFMv5fodrJv4/aiwNsGkY0P7eh3ghjD5BvXixX4nwzxF4cCvh13Yhkd3gtLNm9jv2HGWQvQwlyBhgmmGDR7CIz5RjhodW8Pt8+swCoYrQVYwU5DYtHIPJGShXfb/wpIQytJj5bBBMk2D6oZRSTVFjy07Kenp2ozPZmDyHUZ8JMJsoNr7A6orhyr6sQ0Q== 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=S/OfkqtXHGtnTQ41FrSv3qvkmd08vd5RMmzrq1BhSY0=; b=uPBxP9rWT5bG6JFNQflLk1ZEFule1JVJ38G7TkumLyKVNSf4sStnzosgot46ascrUUl0yf84wJ4C4+DY4mXYnq7/ukbTI+YEGB9WvmLH5j1xryh6dbk1X/i0wXnPSD8cMrzzWqyZ1DVZpyIcSdaHcBECQOli47fp7PhQ1pQ51M0= Received: from BN7PR06CA0046.namprd06.prod.outlook.com (2603:10b6:408:34::23) by CO6PR12MB5443.namprd12.prod.outlook.com (2603:10b6:303:13a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Mon, 12 Jun 2023 11:39:26 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:34:cafe::1b) by BN7PR06CA0046.outlook.office365.com (2603:10b6:408:34::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.34 via Frontend Transport; Mon, 12 Jun 2023 11:39:26 +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 BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.29 via Frontend Transport; Mon, 12 Jun 2023 11:39:25 +0000 Received: from beas.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.23; Mon, 12 Jun 2023 06:39:22 -0500 From: Wyes Karny To: , , , , CC: , , , , , Wyes Karny Subject: [PATCH 6/6] cpupower: Add turbo-boost support in cpupower Date: Mon, 12 Jun 2023 11:36:15 +0000 Message-ID: <20230612113615.205353-7-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230612113615.205353-1-wyes.karny@amd.com> References: <20230612113615.205353-1-wyes.karny@amd.com> MIME-Version: 1.0 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: BN8NAM11FT079:EE_|CO6PR12MB5443:EE_ X-MS-Office365-Filtering-Correlation-Id: 7728e7c0-0bf4-4f0f-2cb1-08db6b39acd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9dYneIIAK8dfcz+p24E0U2eseAkQuJG0CuSGYal+CKCd2sOtFFtHLnZJrDXGh/b3cE5qnSSZuMDIkXPMYhsbdgrucdVdCWb+tyVqkZd7/sGQt5ivyWmeWnr3DDt5wR7Tehwr2BtdepoaOzYKHtTCTV749/VZGEiY/ugQkYXGhb42Dfw9d6rDDj26luf1itE0642okP7K4BjU2TZSP5n1D/3eZDuA0FqfNGWM9H+YjtuY2nYemgE4YmOiFR9fEHf4IkxR9GSKHjx2KS9qdcZqnFvjoWWTfMeWZs2j3MeDPzXa56Ld8057Pr9lq14ouTqjNGiPNBPOe0iaJM1HTcjFkGLItkWmSEM6wmsKVxntnhCnLZ0I/SVPSQIbbqkyEMusKjqJeXFZTwEJGhK/ia0VtaxbEn198zqmNo5oT3dj0LQN2mMvCA5leK4IRXBi54alS5AMNcAjqV9q1a4VSZ3Y1dZeJGKqhZU3QxzCX8byEsCHWlcpSdmJApq+ff3y46ZsPbaD3E4eEHePxE/gxQqdPS7D9kkkEO6mYBk/DY1QkWU53QSX/BAtt1nUtreAixt60eZLYBYIGRgn4ezjR5vS/F0+QZ/sX6xfezeIaL93/R+ktU3ZtgeWwtN/G1CB8bDQY8Um5MqdYaloU2sl6Q6rXcoD9EAgEGg5/n1l1/VWMO8Lf+U017sn8wuFM+4sTeOvquIj7X4VBdU7+yijGa3rDyEaEwpUwYzf/AXehaPflAzA+uiZ1KolKe1GLfT3ylSEUSRtZS4czmmGAghijLXe9oqoEs0grA29PTfaLmgk+/E= 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:(13230028)(4636009)(136003)(346002)(39860400002)(396003)(376002)(451199021)(46966006)(36840700001)(40470700004)(44832011)(4326008)(70586007)(70206006)(41300700001)(316002)(5660300002)(110136005)(54906003)(8676002)(8936002)(2906002)(6666004)(40460700003)(478600001)(7696005)(82740400003)(40480700001)(1076003)(26005)(16526019)(186003)(426003)(2616005)(336012)(83380400001)(36860700001)(47076005)(356005)(81166007)(36756003)(86362001)(82310400005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 11:39:25.9548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7728e7c0-0bf4-4f0f-2cb1-08db6b39acd5 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: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5443 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org If boost sysfs (/sys/devices/system/cpu/cpufreq/boost) file is present turbo-boost is feature is supported in the hardware. By default this feature should be enabled. But to disable/enable it write to the sysfs file. Use the same to control this feature via cpupower. To enable: cpupower set --turbo-boost 1 To disable: cpupower set --turbo-boost 0 Reviewed-by: Gautham R. Shenoy Signed-off-by: Wyes Karny Acked-by: Huang Rui --- tools/power/cpupower/utils/cpupower-set.c | 22 +++++++++++++++++++- tools/power/cpupower/utils/helpers/helpers.h | 3 +++ tools/power/cpupower/utils/helpers/misc.c | 18 ++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c index c2ba69b7ea54..0677b58374ab 100644 --- a/tools/power/cpupower/utils/cpupower-set.c +++ b/tools/power/cpupower/utils/cpupower-set.c @@ -20,6 +20,7 @@ static struct option set_opts[] = { {"perf-bias", required_argument, NULL, 'b'}, {"epp", required_argument, NULL, 'e'}, {"amd-pstate-mode", required_argument, NULL, 'm'}, + {"turbo-boost", required_argument, NULL, 't'}, { }, }; @@ -41,10 +42,11 @@ int cmd_set(int argc, char **argv) int perf_bias:1; int epp:1; int mode:1; + int turbo_boost:1; }; int params; } params; - int perf_bias = 0; + int perf_bias = 0, turbo_boost = 1; int ret = 0; char epp[30], mode[20]; @@ -94,6 +96,18 @@ int cmd_set(int argc, char **argv) } params.mode = 1; break; + case 't': + if (params.turbo_boost) + print_wrong_arg_exit(); + turbo_boost = atoi(optarg); + if (turbo_boost < 0 || turbo_boost > 1) { + printf("--turbo-boost param out of range [0-1]\n"); + print_wrong_arg_exit(); + } + params.turbo_boost = 1; + break; + + default: print_wrong_arg_exit(); } @@ -108,6 +122,12 @@ int cmd_set(int argc, char **argv) fprintf(stderr, "Error setting mode\n"); } + if (params.turbo_boost) { + ret = cpupower_set_turbo_boost(turbo_boost); + if (ret) + fprintf(stderr, "Error setting turbo-boost\n"); + } + /* Default is: set all CPUs */ if (bitmask_isallclear(cpus_chosen)) bitmask_setall(cpus_chosen); diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h index d35596631eef..95749b8ee475 100644 --- a/tools/power/cpupower/utils/helpers/helpers.h +++ b/tools/power/cpupower/utils/helpers/helpers.h @@ -118,6 +118,7 @@ extern unsigned long long msr_intel_get_turbo_ratio(unsigned int cpu); extern int cpupower_set_epp(unsigned int cpu, char *epp); extern int cpupower_set_amd_pstate_mode(char *mode); +extern int cpupower_set_turbo_boost(int turbo_boost); /* Read/Write msr ****************************/ @@ -180,6 +181,8 @@ static inline int cpupower_set_epp(unsigned int cpu, char *epp) { return -1; }; static inline int cpupower_set_amd_pstate_mode(char *mode) { return -1; }; +static inline int cpupower_set_turbo_boost(int turbo_boost) +{ return -1; }; /* Read/Write msr ****************************/ diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 9df9af8a969e..fc822a0e6b7b 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -124,6 +124,24 @@ int cpupower_set_amd_pstate_mode(char *mode) return 0; } +int cpupower_set_turbo_boost(int turbo_boost) +{ + char path[SYSFS_PATH_MAX]; + char linebuf[2] = {}; + + snprintf(path, sizeof(path), PATH_TO_CPU "cpufreq/boost"); + + if (!is_valid_path(path)) + return -1; + + snprintf(linebuf, sizeof(linebuf), "%d", turbo_boost); + + if (cpupower_write_sysfs(path, linebuf, 2) <= 0) + return -1; + + return 0; +} + bool cpupower_amd_pstate_enabled(void) { char *driver = cpufreq_get_driver(0);