From patchwork Tue Mar 7 11:27:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 65389 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2380329wrd; Tue, 7 Mar 2023 03:43:22 -0800 (PST) X-Google-Smtp-Source: AK7set/H7ZqytN80ggN2p4LrIRkwXszzCZnjcQYiP6CjjGvZKqdhO4pfo3quhqxt+l401UUKch8z X-Received: by 2002:a17:902:c10a:b0:19e:7b09:bd4d with SMTP id 10-20020a170902c10a00b0019e7b09bd4dmr12871240pli.47.1678189402103; Tue, 07 Mar 2023 03:43:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678189402; cv=pass; d=google.com; s=arc-20160816; b=IgJighRVCT3+OvTmXGOpfIACWJDqvTbJj1Sfn4xEOhFO+8BLiyvW9UiXbBaWG2y4fI JhEskIUjMvUummChLSG2dC1eZzdUuxC8kqNwZQoUzQs1k8JwF5IL6NFBTMTy4B1Chdlm /K+Luc/oyts5bgY1viaJd/0L6S4bsKC+LpEvvfp2ObkAGJUGCxf5o24yK3wKDep1SKFF ojpVnFpfQlchA+LSvO7N5VUDjV5E8xDgHLj1AowCG3934f18Nip7kW4anrW2tkjqN0/b 8IuhzH7KOpHZEqY4XqHU5yDBWxqMDmQ63/gy+HADWq50jgx9wj5fbOvbhjHmE5W26qvZ /Brw== 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=/SrTyn5JzOOvna1mFPcfW0xvZh2iUlGl5TCSd8BQiNA=; b=ET2vnFWX20zHqz6rsiAnj3794egD4xSL+2EF74ZrZUCLiZEixMYcu8Nzj3ETOq6RVJ BEzl8xftlp2u5mueGSuQs5NhYnPnYonJk1YQV34FIspE0CCE2CGgVBZ2+gseokAvx3zC r2XEpomwVt5QdJebmaJFZypegstcmdsZO0+0n5TT+IV2FX98UhFNoG6r615gxMj58rKt vgEH7CzX4WzDeaXgjD4D/rtqWaj1VcO6TfkKrZcAxSVFKoKlRTq/tNSplGFRCxAX3EIq 4X1mD6xlaQPycys3OykSS9y5LBlh+Dudt/KDW7259Xhe//KbfZZuSNgVLN7XbMEU0IZJ dhLA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=o4Fotm8u; 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 3-20020a631143000000b00501f64fcef3si12310255pgr.230.2023.03.07.03.43.09; Tue, 07 Mar 2023 03:43:22 -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=o4Fotm8u; 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 S230151AbjCGL2q (ORCPT + 99 others); Tue, 7 Mar 2023 06:28:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbjCGL2n (ORCPT ); Tue, 7 Mar 2023 06:28:43 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2088.outbound.protection.outlook.com [40.107.243.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DE1430283; Tue, 7 Mar 2023 03:28:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCpB9axGZVChc42IdlFv/WVx4Yvx9v/g2jLJ3bsH/bduFgd2iWWaYmB5qCBWgIcWWCmHDP9fto0lKFVnuN+MZwmo0OmZe3Odl/YGFbNk8mIfTw/7Z4qshjhVrdVoleRcpQccPPlfwtaDR98hhqafaUg2t1xt68LROvDIMypXx1hyR1BG598f6C1JRyfa496syg6z2JYd6UdKptA5eu+PWEBrSs+QTP08ZpKpduf4jfyPmo9DYSEyO/A3noEYc52gAvBKmmwLgYxqOO3LcojTCupF/kOgU/z6wrFZCRaZNzp2Qd/PM5kXzYBVQpDFuyJYJliYwMsaqtPhYUpYfVBdLQ== 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=/SrTyn5JzOOvna1mFPcfW0xvZh2iUlGl5TCSd8BQiNA=; b=GOcAhIpEjLRwL61B017gmDOdhLmxCimX1zf4mDiLqUQPTho4yhQyT/AoLk8tcvLuQCeo33t/G05d6kWPnAZ+WwGUD9sCAOBHdgK3bd0PGrLzO4B+Pf1iDNrhPU7QIsAX2mzctKuoLDZkE38PtldZyX2uztUDXxpkK6B08YBgYxRdPor+rKiNkq0ia71RzfzJy37DF4mx1ioYq0r1cZBF8Ngy5Gr2ucBeyLtxDTF74xBWv1x/mj+5o1fsHMywIkQh56ItQe6vH53KDKCzGDzldx+oP6b9KG3c1HF8HVdC2L7/mGrlY0nPA1m9pzK2R1pT6A0AAT1aYhpxJqIMsY3tMQ== 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=/SrTyn5JzOOvna1mFPcfW0xvZh2iUlGl5TCSd8BQiNA=; b=o4Fotm8um0EUG36EHEmOrPJKHUyhs+Gibldi2Nq8ej80azalR6X7JZMAZtz07HLX9wKpm8BwyiDQd6zuBMw3OAhfOb4v/lw3ITKb0Yjosz/GYF/O+ObdX74xj3FyYnejF6Muk3qGWDrovtbw6pNc7pSSHjy/ZBlJ8H1aDW8IAxk= Received: from MW4PR04CA0299.namprd04.prod.outlook.com (2603:10b6:303:89::34) by CH3PR12MB8877.namprd12.prod.outlook.com (2603:10b6:610:170::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 11:28:39 +0000 Received: from CO1NAM11FT012.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::13) by MW4PR04CA0299.outlook.office365.com (2603:10b6:303:89::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28 via Frontend Transport; Tue, 7 Mar 2023 11:28:39 +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 CO1NAM11FT012.mail.protection.outlook.com (10.13.175.192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.16 via Frontend Transport; Tue, 7 Mar 2023 11:28:39 +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.2375.34; Tue, 7 Mar 2023 05:28:24 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Russell Haley , Wyes Karny , Mario Limonciello , Oleksandr Natalenko Subject: [PATCH v8 1/6] acpi: cppc: Add min and max perf reg writing support Date: Tue, 7 Mar 2023 11:27:35 +0000 Message-ID: <20230307112740.132338-2-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307112740.132338-1-wyes.karny@amd.com> References: <20230307112740.132338-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: CO1NAM11FT012:EE_|CH3PR12MB8877:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b194c00-0492-41e5-285a-08db1eff1944 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xD7VXBQtkKz9xwnXhG0J/Hlwl5xuv+Krlg9r129zl5WH+Rq2SpprUrxQHav3YA5PBwk/ADre1sT+u1hHKVwkoQ04ZnEkBNXOlBude8oUPW7xsGLSGB4OYjGZSIXtAv+PBZEz7oXkVIoVXkCqT6MqYrb+SUZcMRmr1ZNwNCtJXXk2iLOIoKnPUu22IJWkmQ9puVAKjxCTSYTzZZFvRYs22hlvtV/kO72hbKBoDWNL1dL7gAE8plnA0B+9R4oJnjRKASlkzd17TDnH1F33QBpe4CU5U5VOIKg88nmea3MTPidjhKwqDyNOh5agtupG4bZ40grdQ/rLPVL/gvJWoI9j7/faTx4nhQ2XwovSn9gwll1t/KwRdrhAEVYTaqpB4NFeWcBgB6KgxxLV74sbMza8bGZPg38xElmcGOepJNOuOCLMFaiPtvep8dGpPFovf8AjxyJO/lIK6CaUohUOgqQgg2yLRom+Qwy5eoJ45k+WLCF7dH6yDGOktoZBNMuzRKH3ZLeZ9OA8zwoPfTzpDjZTdfjtS5PMFqSo/BRFS1mNfdktMK9vnyZvwJnb84D5vdsevmZRBJlUaaz9+ORfw2j6hJc+HXjAHz14xe7eq1+eR09HDN9EaDuqdCU1wNGvta8dh4a+GUhr1sil9EcUHsTOm28p+JYus0NUE5WJ14219ByvcarOV8MOThHzM/uAN80CTdLB1BlO7L/ATG6Y79juD2i5WN46SkPYGdsM6GD7YkE= 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:(13230025)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199018)(46966006)(40470700004)(36840700001)(36860700001)(81166007)(86362001)(356005)(82740400003)(36756003)(6666004)(2906002)(44832011)(7416002)(5660300002)(40480700001)(70586007)(70206006)(4326008)(41300700001)(8936002)(8676002)(82310400005)(16526019)(336012)(186003)(47076005)(426003)(83380400001)(1076003)(26005)(2616005)(40460700003)(6636002)(110136005)(54906003)(478600001)(316002)(7696005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 11:28:39.0885 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5b194c00-0492-41e5-285a-08db1eff1944 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: CO1NAM11FT012.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8877 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759709130324636284?= X-GMAIL-MSGID: =?utf-8?q?1759709130324636284?= Currently writing of min and max perf register is deferred in cppc_set_perf function. In CPPC guided mode, these registers needed to be written to guide the platform about min and max perf levels. Add this support to make guided mode work properly on AMD shared memory systems. Acked-by: Huang Rui Reviewed-by: Mario Limonciello Tested-by: Oleksandr Natalenko Signed-off-by: Wyes Karny --- drivers/acpi/cppc_acpi.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index c51d3ccb4cca..4fea6b8a26cd 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1488,7 +1488,7 @@ EXPORT_SYMBOL_GPL(cppc_set_enable); int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) { struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu); - struct cpc_register_resource *desired_reg; + struct cpc_register_resource *desired_reg, *min_perf_reg, *max_perf_reg; int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); struct cppc_pcc_data *pcc_ss_data = NULL; int ret = 0; @@ -1499,6 +1499,8 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) } desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF]; + min_perf_reg = &cpc_desc->cpc_regs[MIN_PERF]; + max_perf_reg = &cpc_desc->cpc_regs[MAX_PERF]; /* * This is Phase-I where we want to write to CPC registers @@ -1507,7 +1509,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) * Since read_lock can be acquired by multiple CPUs simultaneously we * achieve that goal here */ - if (CPC_IN_PCC(desired_reg)) { + if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg)) { if (pcc_ss_id < 0) { pr_debug("Invalid pcc_ss_id\n"); return -ENODEV; @@ -1530,13 +1532,19 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) cpc_desc->write_cmd_status = 0; } - /* - * Skip writing MIN/MAX until Linux knows how to come up with - * useful values. - */ cpc_write(cpu, desired_reg, perf_ctrls->desired_perf); - if (CPC_IN_PCC(desired_reg)) + /** + * Only write if min_perf and max_perf not zero. Some drivers pass zero + * value to min and max perf, but they don't mean to set the zero value, + * they just don't want to write to those registers. + */ + if (perf_ctrls->min_perf) + cpc_write(cpu, min_perf_reg, perf_ctrls->min_perf); + if (perf_ctrls->max_perf) + cpc_write(cpu, max_perf_reg, perf_ctrls->max_perf); + + if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg)) up_read(&pcc_ss_data->pcc_lock); /* END Phase-I */ /* * This is Phase-II where we transfer the ownership of PCC to Platform @@ -1584,7 +1592,7 @@ int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls) * case during a CMD_READ and if there are pending writes it delivers * the write command before servicing the read command */ - if (CPC_IN_PCC(desired_reg)) { + if (CPC_IN_PCC(desired_reg) || CPC_IN_PCC(min_perf_reg) || CPC_IN_PCC(max_perf_reg)) { if (down_write_trylock(&pcc_ss_data->pcc_lock)) {/* BEGIN Phase-II */ /* Update only if there are pending write commands */ if (pcc_ss_data->pending_pcc_write_cmd) From patchwork Tue Mar 7 11:27:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 65386 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2379892wrd; Tue, 7 Mar 2023 03:42:01 -0800 (PST) X-Google-Smtp-Source: AK7set+zUPne/bmstJQ2q/zRdJHUlwr1xoSdABPJ7TKbcGN7MohCE3xTLfQdidxD9tcrxDUIpT1a X-Received: by 2002:a05:6a20:12cd:b0:cd:40b4:bc75 with SMTP id v13-20020a056a2012cd00b000cd40b4bc75mr16494496pzg.48.1678189321666; Tue, 07 Mar 2023 03:42:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678189321; cv=pass; d=google.com; s=arc-20160816; b=aRgIvy8pF/xU9nxGe/20we0Mhsbd7MPWPFiAPP3LvnCy4kPgzBq73Jva6MrirCS1JS UgzCrlSZdotBpNZGpHk048j4Gj6nND6S2YxvoOxE8NzIcPR/jCAK99WCnrXka4A9wccf ZHtZia03rMG57qbPt0BTj4fyNjVAg1Ddm04OJsk6x18KIQ9nPNm/7bUy+NDpQzKclV55 siqJDJgHd9AUGAyoTueTbB0NtAlh+g8/In3VafcIYROI/1da0LwCL14AXTrmUz+r/BQo AB+eZZ76M3TfcR9Xb25J+Wy5ZPquuz06foJrqdIh3lxTegImElLqCg4yHhqEyBDQIXl2 Un3A== 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=tSAa14i57gl9dPrA+j7A0e2pRxhBX9sWQf13LNpTdqc=; b=Y0FsMieCkO4TSpSw/6W7dZPvgShmKpxJ9PpNFjx7zNA8RvlE/scidMTmnQHyFtFJVX JPT4PDnn9y2f53Ld0RRv98y3seuIDLwWT3kwg8j8e+j8tCy10CAIfNYc44kRpqikbNZN E2vOaRX8sblWbmOhzOO4BEQomVzmj02qIK7SmalmgrlD9RVO+hM9TpqXVNP0lPLl4dhC bQwNMbAibV9AoWfeZsfOI1ShWRBUhrWYPSQjhPSfBn8twFf0Lconx6rOLmarFIyb1aK9 +BAhUIf0F6MBw/vGCYADf0k6nN2H8CpAoVQnEYpYLIJ9EodoQhAHP9gssy8xuZzYMJ7H uxnA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=E5uCQPHh; 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 i65-20020a625444000000b005941664b506si12227862pfb.224.2023.03.07.03.41.49; Tue, 07 Mar 2023 03:42:01 -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=E5uCQPHh; 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 S230395AbjCGLaG (ORCPT + 99 others); Tue, 7 Mar 2023 06:30:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbjCGL3r (ORCPT ); Tue, 7 Mar 2023 06:29:47 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2063.outbound.protection.outlook.com [40.107.244.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9178952F62; Tue, 7 Mar 2023 03:29:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KPJPSS51lt4mS0Hc9St3osuglShfxtJ2Yr1O732pXJtfiHPvR9XzIJ4egdhZa3zCCx2WtSLWLCcu4Lyr9Cnnh9iER1UB89ZbrvfyVd0ovi/kJhBgq8PjR6JZGbFcg4s3yis8btewDqLS/vm0Fv0Zpoywe8NRS5nUyio9ctckiCm+no0TqqcGIN89FRhLHs8/Q97PgzKJ+smR0/Rr1c+wALrnyTUowUSJLM3ins3tzw0yIEOFgXE/F/Hx5Y3vOOOn2ArJpijWci5+dNDaSvlqB9ej6LJsFrjACsdnqaAQ97NlNGDFJZ9x9POjOy1rGnzizMtHwJpBxtHsYWk5nxE5lQ== 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=tSAa14i57gl9dPrA+j7A0e2pRxhBX9sWQf13LNpTdqc=; b=nJyNAdfIUjtovu/YjvRj9TWCjTiDg5VZlDnH4QZUrEiTIInztxFXN4xz84aEX65deVoQL7p3t4HNp9Zbcoew3AsB3gtXiq2qe7dnKMfEURPbDYjmbC6DZeJ8Yo3ywKafgUCT5Wl4/TxDvGNtq3s20oCYJZodAtuqszKLGX2A8xQl9QsRKybDYBylTabjDsabA/NYmiaiS6ituOM5KNzjGthoTSkkqLcHqxBLLDd2Z3sYW27MaObAfplIdR2exdXOWyea9QGoxE7yp2rknroZEk+Y48pwtaMM0vtFqjFk2JCG4XURUUZkimQTqn/WR++Hmm2+3U11SAtErvVZJZEC8A== 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=tSAa14i57gl9dPrA+j7A0e2pRxhBX9sWQf13LNpTdqc=; b=E5uCQPHhzXHvfZ8IabO8Mv9IiN3H4ktN663bU3zsMK3KFDbge+YiNVf9/rM+xELrD+x+L2oMW2PaNG7h/i029yxcQiiUs94N/f5WxZNOSY5YGRVIdOxrYcxBYcfAndcbnearCY1m0Kkvp/GgMx5XAJlb+MOBq80pcokBSq+Dtz8= Received: from MW4PR03CA0158.namprd03.prod.outlook.com (2603:10b6:303:8d::13) by CY8PR12MB7753.namprd12.prod.outlook.com (2603:10b6:930:85::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28; Tue, 7 Mar 2023 11:29:13 +0000 Received: from CO1NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::93) by MW4PR03CA0158.outlook.office365.com (2603:10b6:303:8d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29 via Frontend Transport; Tue, 7 Mar 2023 11:29:13 +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 CO1NAM11FT110.mail.protection.outlook.com (10.13.175.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.16 via Frontend Transport; Tue, 7 Mar 2023 11:29:12 +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.2375.34; Tue, 7 Mar 2023 05:29:06 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Russell Haley , Wyes Karny , Mario Limonciello , Oleksandr Natalenko Subject: [PATCH v8 2/6] acpi: cppc: Add auto select register read/write support Date: Tue, 7 Mar 2023 11:27:36 +0000 Message-ID: <20230307112740.132338-3-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307112740.132338-1-wyes.karny@amd.com> References: <20230307112740.132338-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: CO1NAM11FT110:EE_|CY8PR12MB7753:EE_ X-MS-Office365-Filtering-Correlation-Id: 05108c1a-85c8-4427-2498-08db1eff2d5a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1eYyMRSXz17B7gQ+//c9Gwu7VXP3SKCuEEiGPcsLycU0NsC9BDQO0JndYpzcn4IvSm/9pwNbMPdxxR3YvLGF8RYncyzoK3tXhgPpjzdSZIUW2GCfCFGC+Ousw+5/32endtlmdaosC7PYfCaJyQp8Rv6FtJ0cftNTam1MJ+gaQkPizbJYBIyMh13Ex71lafKvlJYSvu3KW38zPCM4H/skxtArQwNb+GiUxH5QOYYI0huU58xQlyZFW+42mflZdxfwx9u3najDiIal5tq2wWs+KyX/Wz/p5aQTCJmJVh9uf9aH0iI5e+Ed5jbquMMk63yPoD2pn7zJY+q75Y4UWlf4ukYZqtU/jlGxFkXcXf9wv+lm6EOzYRqDEBi1DRRFdwY0UYZ8HZyHaHLulSe5ZaTpJRblXp+U6S29Vd/9aBvl9QmcPP3yzWUI1wwO+LF76ig3LUDvUneYcgOwgIzWtn5GjX7rAip10kaF8E6V/jybYGX0ws3DIVnsOclH+bOGA7Hk4FNDbt/mwuOo09cDLKcDXNIcuxZXeq5BoVWamFqNE5jfkJE6g0PXf+RaWwyn3Q3GltBR4rxTNjQvRgTJS6vXG+1xBnunzjCNJeC8JzLpWY8nI1IEizMV4TOGsBq+/78gQYLAzwpSVjudZYGSJtJYziAZkdAa9rs84wQKjkkk4yTIz/7g+Kd/FGG+XjtjKFllG4D4swJFtfsrBKQkxg6V2/yCuiI0SlqVOesbLrh5H9Q= 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:(13230025)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(4326008)(36756003)(70206006)(70586007)(41300700001)(7416002)(8676002)(8936002)(44832011)(1076003)(2906002)(5660300002)(82740400003)(81166007)(356005)(86362001)(36860700001)(40480700001)(7696005)(6636002)(6666004)(110136005)(54906003)(478600001)(316002)(47076005)(82310400005)(40460700003)(83380400001)(426003)(336012)(186003)(2616005)(26005)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 11:29:12.7871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05108c1a-85c8-4427-2498-08db1eff2d5a 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: CO1NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7753 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759709045967131467?= X-GMAIL-MSGID: =?utf-8?q?1759709045967131467?= For some AMD shared memory based systems, the autonomous selection bit needed to be set explicitly. Add autonomous selection register related APIs to acpi driver, which amd_pstate driver uses later. Acked-by: Huang Rui Reviewed-by: Mario Limonciello Tested-by: Oleksandr Natalenko Signed-off-by: Wyes Karny --- drivers/acpi/cppc_acpi.c | 97 ++++++++++++++++++++++++++++++++++++++++ include/acpi/cppc_acpi.h | 11 +++++ 2 files changed, 108 insertions(+) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 4fea6b8a26cd..02a4bfb54967 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1433,6 +1433,103 @@ int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable) } EXPORT_SYMBOL_GPL(cppc_set_epp_perf); +/* + * cppc_get_auto_sel_caps - Read autonomous selection register. + * @cpunum : CPU from which to read register. + * @perf_caps : struct where autonomous selection register value is updated. + */ +int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps) +{ + struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum); + struct cpc_register_resource *auto_sel_reg; + u64 auto_sel; + + if (!cpc_desc) { + pr_debug("No CPC descriptor for CPU:%d\n", cpunum); + return -ENODEV; + } + + auto_sel_reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE]; + + if (!CPC_SUPPORTED(auto_sel_reg)) + pr_warn_once("Autonomous mode is not unsupported!\n"); + + if (CPC_IN_PCC(auto_sel_reg)) { + int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpunum); + struct cppc_pcc_data *pcc_ss_data = NULL; + int ret = 0; + + if (pcc_ss_id < 0) + return -ENODEV; + + pcc_ss_data = pcc_data[pcc_ss_id]; + + down_write(&pcc_ss_data->pcc_lock); + + if (send_pcc_cmd(pcc_ss_id, CMD_READ) >= 0) { + cpc_read(cpunum, auto_sel_reg, &auto_sel); + perf_caps->auto_sel = (bool)auto_sel; + } else { + ret = -EIO; + } + + up_write(&pcc_ss_data->pcc_lock); + + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(cppc_get_auto_sel_caps); + +/* + * cppc_set_auto_sel - Write autonomous selection register. + * @cpu : CPU to which to write register. + * @enable : the desired value of autonomous selection resiter to be updated. + */ +int cppc_set_auto_sel(int cpu, bool enable) +{ + int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpu); + struct cpc_register_resource *auto_sel_reg; + struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpu); + struct cppc_pcc_data *pcc_ss_data = NULL; + int ret = -EINVAL; + + if (!cpc_desc) { + pr_debug("No CPC descriptor for CPU:%d\n", cpu); + return -ENODEV; + } + + auto_sel_reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE]; + + if (CPC_IN_PCC(auto_sel_reg)) { + if (pcc_ss_id < 0) { + pr_debug("Invalid pcc_ss_id\n"); + return -ENODEV; + } + + if (CPC_SUPPORTED(auto_sel_reg)) { + ret = cpc_write(cpu, auto_sel_reg, enable); + if (ret) + return ret; + } + + pcc_ss_data = pcc_data[pcc_ss_id]; + + down_write(&pcc_ss_data->pcc_lock); + /* after writing CPC, transfer the ownership of PCC to platform */ + ret = send_pcc_cmd(pcc_ss_id, CMD_WRITE); + up_write(&pcc_ss_data->pcc_lock); + } else { + ret = -ENOTSUPP; + pr_debug("_CPC in PCC is not supported\n"); + } + + return ret; +} +EXPORT_SYMBOL_GPL(cppc_set_auto_sel); + + /** * cppc_set_enable - Set to enable CPPC on the processor by writing the * Continuous Performance Control package EnableRegister field. diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index 6b487a5bd638..6126c977ece0 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -109,6 +109,7 @@ struct cppc_perf_caps { u32 lowest_freq; u32 nominal_freq; u32 energy_perf; + bool auto_sel; }; struct cppc_perf_ctrls { @@ -153,6 +154,8 @@ extern int cpc_read_ffh(int cpunum, struct cpc_reg *reg, u64 *val); extern int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val); extern int cppc_get_epp_perf(int cpunum, u64 *epp_perf); extern int cppc_set_epp_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls, bool enable); +extern int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps); +extern int cppc_set_auto_sel(int cpu, bool enable); #else /* !CONFIG_ACPI_CPPC_LIB */ static inline int cppc_get_desired_perf(int cpunum, u64 *desired_perf) { @@ -214,6 +217,14 @@ static inline int cppc_get_epp_perf(int cpunum, u64 *epp_perf) { return -ENOTSUPP; } +static inline int cppc_set_auto_sel(int cpu, bool enable) +{ + return -ENOTSUPP; +} +static inline int cppc_get_auto_sel_caps(int cpunum, struct cppc_perf_caps *perf_caps) +{ + return -ENOTSUPP; +} #endif /* !CONFIG_ACPI_CPPC_LIB */ #endif /* _CPPC_ACPI_H*/ From patchwork Tue Mar 7 11:27:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 65394 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2384818wrd; Tue, 7 Mar 2023 03:56:58 -0800 (PST) X-Google-Smtp-Source: AK7set/3ms9H8sT7kq8KL4lk5Mzt33U1cO2Bd6mx+XAo2UOopcqvOhzqx8WAPIWcFFYsRuhrlvMG X-Received: by 2002:a17:902:e748:b0:19e:d89a:cf41 with SMTP id p8-20020a170902e74800b0019ed89acf41mr4027836plf.64.1678190218223; Tue, 07 Mar 2023 03:56:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678190218; cv=pass; d=google.com; s=arc-20160816; b=FZ+uvhqMlqw00JtVWpVl1Vl9/W0vba1DVbLGoEbgiKKXzV9NpxzGu84MdL8xLolYou +4/lLFcR3DkA0P4fgL/KqOXPEe7sWpxdEluvlXAyJxhkrhBpHLDPzy+TESsoIbBf+4ag VMyI3NM85HrzoUx6JHtQpjFzFVcT1WpM2lv00Bv7Ru8VwRJpnN+k84o5LdWQkk8DiJXP yi/rJNnS55v0oyC8dC/It8VNGU+p5tDls+rsomCUbauwpgkZLqB/5sFDW8uW5gxA1nu8 YjN2Ku9a1Dmxe+HzNovioQgCExKVyxipq8zyIzhork8sRAcMirlViUAjsWHqcpTpoN0s B89Q== 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=Y6K56Vtva2K4+MI78IjTL4CHbuBG3tnEi6JeH3Niey0=; b=a86HzXRAKZOd3ENy9aVBHGNJWDjV7o2INVEzwNSOn/pmydEW/XzNdko5tZTiI/DA2F BVCHmEHB0J8+N6xjAabQZQfMpalYTUWcDs2L7OOFD4kEzmYV/CtqlxvI3012dzRKWvsU 3sraUyyQ74N9iV8X8v66NZktCf3D9zTyJVRVTkxvt/rdQIgG8cdIjUluAsHWTQZFjFyM XUsoeYV3NwPgM1uW8VJidlVuA/ULxH4+ofpSU2zUktFOrDcQI41kBtPobwysg4xUojMJ UUXYh6F/jZI06OsTucWEzKgqTORtvEPMO7KO/KnQ5M4DK5/rJUMnD9Yh4RwD65O5pkh7 V4mg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=5d8sZaTz; 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 p15-20020a170902ebcf00b0019c91fd0065si10312232plg.297.2023.03.07.03.56.45; Tue, 07 Mar 2023 03:56:58 -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=5d8sZaTz; 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 S230371AbjCGLax (ORCPT + 99 others); Tue, 7 Mar 2023 06:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjCGLap (ORCPT ); Tue, 7 Mar 2023 06:30:45 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2063.outbound.protection.outlook.com [40.107.92.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CBEC567B0; Tue, 7 Mar 2023 03:30:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ago1p5S2Zi7U/v3X+MOaxC7hhqq58JVQ5IjLBGnnXPQMigLmxM37O5tdRvY9K69INv25zvYJgkio0Jp6yN+LPgjeAr63UEjtc3bKKFvTNWZOMu1TdwRXoTtzPHqewLoTmVrNzoQu6bq4K/s2qu/N68J8skpHqIrZphsjt7OPEioLkM1qAgvLzukE6juxa+fPK2DQQScoD2i8LUHk9WzgjYVhxuL8XRXR5jdR8I99WIEg9kowP8Y8k+S8CJ3aamf/sL0puhT77NRGr0RGAE8pWeACcuros/m1ZqDTLoE1baJ/uCufbc6EugGGFwauIbleqWbMAKzRnECkTspLF9DxNA== 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=Y6K56Vtva2K4+MI78IjTL4CHbuBG3tnEi6JeH3Niey0=; b=DhuaRyJyabZAKq9Cvd7nXc+UCZKWAPeqsTcRMdqtPt5/1/j9EzdbS98tDlvyUldHlHY14qYNgkVsAcirvNeSi2lTVdAvx0eCFR1lD0JXkfiz+M/PRwQngBaTGx11xMUsojGIcxN0XkwC4Xvg0PwNn48ZqJ27xVB14q/e5ogWHRQKIBjqiS4MqFM+TMXS1n2CvYpRXt6mm0dNQsVg13nMpl9J/OxW0nnNprjozRIonPYeKBwvT4rtY4fk0mJ4SPMlz8/uen3YfBmvENnDnVeKK7lsaLAz0G2U/YR6g8ZP7zmsXFH8H1jNTxWGgyx0WO3LbWg0PtsqV+eIExML0pC9Ag== 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=Y6K56Vtva2K4+MI78IjTL4CHbuBG3tnEi6JeH3Niey0=; b=5d8sZaTzTYF3rNUP5eiB+zBNfiCQMttMa/IqwpgHpS6HtSNAjCei29bj6ofhGfpeX6jvoPxNPKOxVBAe4+tUrYuYexFmFOgIfbedi3eIE1XCU7fx2IdRITystMlirGkhFtmOQUokSF6f/Fg0+63D4926MOnInFs/+WZb+A5xl1Y= Received: from MW4PR03CA0134.namprd03.prod.outlook.com (2603:10b6:303:8c::19) by SJ0PR12MB6808.namprd12.prod.outlook.com (2603:10b6:a03:47a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 11:29:36 +0000 Received: from CO1NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8c:cafe::80) by MW4PR03CA0134.outlook.office365.com (2603:10b6:303:8c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28 via Frontend Transport; Tue, 7 Mar 2023 11:29:36 +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 CO1NAM11FT009.mail.protection.outlook.com (10.13.175.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.16 via Frontend Transport; Tue, 7 Mar 2023 11:29:36 +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.2375.34; Tue, 7 Mar 2023 05:29:30 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Russell Haley , Wyes Karny , Mario Limonciello , Oleksandr Natalenko Subject: [PATCH v8 3/6] Documentation: cpufreq: amd-pstate: Move amd_pstate param to alphabetical order Date: Tue, 7 Mar 2023 11:27:37 +0000 Message-ID: <20230307112740.132338-4-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307112740.132338-1-wyes.karny@amd.com> References: <20230307112740.132338-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: CO1NAM11FT009:EE_|SJ0PR12MB6808:EE_ X-MS-Office365-Filtering-Correlation-Id: fe3369cc-bad3-42b0-2467-08db1eff3b9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rblhgAAoP3d5cC4BzXKUMnX8GHBfRtifH/4udRFaUwJcsQeqPaxbcDiu1QsZfRAnizcXZrO68az7UB7QnvypPVAA03U8LJSO7LVA5MxgzKvSclox6/1GAzVgOnb8HVzwY8hRsSM+IlAlEalIts/KyC4pVOdWMoJS9sLkbJjU6hXdagDgZc0GCfcmBfzD0etPWVYhxODeVHNK/RFAaOpBYTWAaijPMkmshfpEgCD3yG6hVZzytNDx3wHPQeiCfh4OhoB7gQOLew5JbsmjSOMI7CU7V8CioKbWs8s7084H5AimB2KdtTnvMoQRpRfIoGgWQnmOjuiJ3DaZ0JHOMd/js1quztNkWgU3u08wUo8zEf0K1oCZMEpiLfI0vXXMo/gjqW0n8MRlQVU/fQqr7Lxuy3tesCNZiMCexyssqn6xdBCmFeH/KkBigoR/OP3/xfhuCslP9+FmNcvJOEpTdFgjCTDC7WzWmNGXwFwiYrI1d+8px9h4eNbnzrjwYrBflgg7fQGc1HyEH59gfKat32ddfBxBrDJnGeBvkF+lDz+0O58Zh0Sz4HP73rtNowYyH/ROVzCVD6Io3rbEHpg7E77PATAZGiuoAkJKJqGPgD/JQf2NWsuzvJ+Ik/+RkqiqyNHGKEpJz/IlnUTqxZE331YI9LUL5ue40hyPs1tfR36t4BVCwGzWKkq+39PDxo4Ws6X7WpjItbtARMIlMFdKEX2t+q1lq1nYdZ9YHyNbcotSuog= 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:(13230025)(4636009)(376002)(39860400002)(346002)(396003)(136003)(451199018)(40470700004)(46966006)(36840700001)(82740400003)(81166007)(36860700001)(86362001)(356005)(36756003)(5660300002)(2906002)(70206006)(4326008)(70586007)(8936002)(40480700001)(7416002)(44832011)(8676002)(41300700001)(82310400005)(186003)(2616005)(40460700003)(47076005)(83380400001)(16526019)(336012)(426003)(54906003)(110136005)(6636002)(316002)(26005)(1076003)(7696005)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 11:29:36.7142 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe3369cc-bad3-42b0-2467-08db1eff3b9d 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: CO1NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6808 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759709985977100630?= X-GMAIL-MSGID: =?utf-8?q?1759709985977100630?= Move amd_pstate command line param description to correct alphabetical order. Acked-by: Huang Rui Reviewed-by: Mario Limonciello Tested-by: Oleksandr Natalenko Signed-off-by: Wyes Karny --- .../admin-guide/kernel-parameters.txt | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 6221a1d057dd..1e38f3ae0e62 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -339,6 +339,24 @@ This mode requires kvm-amd.avic=1. (Default when IOMMU HW support is present.) + amd_pstate= [X86] + disable + Do not enable amd_pstate as the default + scaling driver for the supported processors + passive + Use amd_pstate as a scaling driver, driver requests a + desired performance on this abstract scale and the power + management firmware translates the requests into actual + hardware states (core frequency, data fabric and memory + clocks etc.) + active + Use amd_pstate_epp driver instance as the scaling driver, + driver provides a hint to the hardware if software wants + to bias toward performance (0x0) or energy efficiency (0xff) + to the CPPC firmware. then CPPC power algorithm will + calculate the runtime workload and adjust the realtime cores + frequency. + amijoy.map= [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT Format: , @@ -7059,20 +7077,3 @@ xmon commands. off xmon is disabled. - amd_pstate= [X86] - disable - Do not enable amd_pstate as the default - scaling driver for the supported processors - passive - Use amd_pstate as a scaling driver, driver requests a - desired performance on this abstract scale and the power - management firmware translates the requests into actual - hardware states (core frequency, data fabric and memory - clocks etc.) - active - Use amd_pstate_epp driver instance as the scaling driver, - driver provides a hint to the hardware if software wants - to bias toward performance (0x0) or energy efficiency (0xff) - to the CPPC firmware. then CPPC power algorithm will - calculate the runtime workload and adjust the realtime cores - frequency. From patchwork Tue Mar 7 11:27:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 65390 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2381121wrd; Tue, 7 Mar 2023 03:45:51 -0800 (PST) X-Google-Smtp-Source: AK7set+pEMUrDZ0lg7I+Akhk+gToG5quenqTvY2kFBMOkXMv4XkVGT5Ckv1XFLzOsYWSMlu1VZIC X-Received: by 2002:a05:6a20:7d88:b0:cc:a5d6:4471 with SMTP id v8-20020a056a207d8800b000cca5d64471mr19000520pzj.58.1678189551587; Tue, 07 Mar 2023 03:45:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678189551; cv=pass; d=google.com; s=arc-20160816; b=vlRXSt/ADu+SKNdU1TPW6j8o17KM1vIuvzZ4sJUtxzr0pLNGbxmWBJ+eiiPIJ47oqe 8kXOUbU6WMOao4WpjYEp/HokcJFvW1uMWfiT47NVWGPePP8Jlinugt5ag9vyVhVt99QJ CNr5jB5XhbD690wee21tDBKdHGSJS2vkCyvZzOVYbaGYi86ulmAMggPPUuZTNqkqzgUJ C+aN+qkbTAjZ9ZfRUEVHgfWo4ZFxUprMbRJg4pm4Z5rm6ciW4mNF1LCrQOHz6HCYAdH8 I7siG02X+EkzsbXX0MmgC+ROGSkTgNRZmRPOEXzh3ZsE1ByTcLMLw2huTN2EARWg+qsw 9u0g== 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=5cYgxY7jS9RkiNJddweKT7G3Fpt9JgJeRru7SxRPUno=; b=gI672OumL7FjQKkj9Mgzfosk2YXpdy74+TKcqQ5MqXK/2xXJusVHkI/4egLGX28vYp lVrIeQXkJ1672Wjok+SrAEpp/5bmPb2bN3GlQRdfaDCThMngXTkgB49V+a3HK4oqjQp7 u+IVScgXJZqugfjtrEEJwZxWjHrN2KnNj5+07hmBDWF3Kx6QuwBsJc3fXRMcVLWUYYgq iMO/jwUzWZSdtjLZfes43wbeS5GPaykSsgVMhoE4Jg6gOFJARYFsyXlpwRrdoJ0nLa37 w3OC4aXpsnszvhx/eS5RXj3FYLB60j+E3YlO88LP7Sksn6Sp3reYOiQKMFKxhsW+eRHC lFwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=YyYdfraE; 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 x186-20020a6363c3000000b004fb9504a5e7si11870797pgb.730.2023.03.07.03.45.38; Tue, 07 Mar 2023 03:45:51 -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=YyYdfraE; 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 S230445AbjCGLbN (ORCPT + 99 others); Tue, 7 Mar 2023 06:31:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230422AbjCGLbH (ORCPT ); Tue, 7 Mar 2023 06:31:07 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2082.outbound.protection.outlook.com [40.107.212.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23516A1C7; Tue, 7 Mar 2023 03:30:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UGU+xn9xzYrY599TAFzTzOe5pwcjzQI2tjL8gQYc0v6hl31tg4ccH7DoNnUXIUofM1jjOTc4vormJlx19Gif68GMrGRd+1gfmWL1yX10gKV4hRExEqzS6d9bq6VyBSmv7YiTOjQxWIQHshgduAHLnJQqbeUv/e5VwxZvCMHYyZ45IjhTAGpmgWU0i3a4J8RyVM4XheeD3cqETkkbW1j74kKNHmVKUCgYIxaGvdoy6VnZf5EAf/nXRQ2oBFuyiAA0YjgG15j5CVOL0cOwO14PLQPFjXZwWsgcRNoTKYR5C6z9yqFL6ZV3Hln/N09ZMqiHKuFFZNEeqiPyqSKzsEqN3Q== 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=5cYgxY7jS9RkiNJddweKT7G3Fpt9JgJeRru7SxRPUno=; b=ceIvr3Xmnpt57RcQX/9UbgmicFRzRqKjcriKc78FS0qJDw8g7KqgWjfKTSoTMNWkSnBP8IEA2aCa6C04OH0kcbmdtrAGE9fIyhWmz13HUrLAOVoZyidbxlHufuYmn4y3VbKrXJu4wPShwGiT7vaHib1uQIW6khXkBn/MTCacNZ4a0626OSsAVzNhC84h9K1XeNcC9SFApv/JhU50GiVe7EEFEBEOqbSLiJerjIuqKuSQpGudfHoUX+y6yWsQPs3QCQS9D1wcTihyhdLHc2yTN+AUM2ix28u3BkGnoC3oed6gtWUmcwCO0y308oGqZoeUS2iCY9InCfKwHK+ZPZj1yQ== 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=5cYgxY7jS9RkiNJddweKT7G3Fpt9JgJeRru7SxRPUno=; b=YyYdfraE1Kx+aITe/LtqyWDJKq3vdxdWg5lUWsjvrro10QWIxjixj2zD1Y713a/dvmp0WFWBr3DKRlkTu3m4pXYCnIbRSpU0eiFrQl/AoJQhs9LpfX9iK+QkmcG/J0KqYmnw7kC09kYNJzzhUa2XbrBmvib1PjStfbxI9bS/IvQ= Received: from MW4PR04CA0352.namprd04.prod.outlook.com (2603:10b6:303:8a::27) by MN2PR12MB4208.namprd12.prod.outlook.com (2603:10b6:208:1d0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 11:30:01 +0000 Received: from CO1NAM11FT112.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8a:cafe::b4) by MW4PR04CA0352.outlook.office365.com (2603:10b6:303:8a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29 via Frontend Transport; Tue, 7 Mar 2023 11:30:01 +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 CO1NAM11FT112.mail.protection.outlook.com (10.13.174.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.16 via Frontend Transport; Tue, 7 Mar 2023 11:30:00 +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.2375.34; Tue, 7 Mar 2023 05:29:54 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Russell Haley , Wyes Karny , Mario Limonciello , Oleksandr Natalenko Subject: [PATCH v8 4/6] cpufreq: amd-pstate: Add guided autonomous mode Date: Tue, 7 Mar 2023 11:27:38 +0000 Message-ID: <20230307112740.132338-5-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307112740.132338-1-wyes.karny@amd.com> References: <20230307112740.132338-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: CO1NAM11FT112:EE_|MN2PR12MB4208:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ab298db-f4c1-4dc7-8840-08db1eff4a1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f6GJiI4EnrAnqL7YSqT9gBxD+PjWPXrLoXXZYZd2QEE819PDUNo9EZ3FJRi/RIiJnpItHwdODh6A5ATD6QhuGOW38QhJh0MPDW63v/25waFPID0J8zFRTBFhN0M5pz0IP16IFUwnI48kBJm+xZCeBvwwt9Cw2q1OevyY7QmkRrEkLwXZhIky06yfXNvSiynDUF6nEBANchi+9BrnAvZIfEI/+//Z5kWdslwQOM6B7cnkNd3OuDTEybwmp3ap9EJole6EVa45sN2akrFTPOgWHm2CXUGeT51ONrWZwl0q0lDhG65JH3yf9rqkHmQ/r9FKm1kfDPpyPt6CUyxDjzQajVyiDAme59RY/P5mOmwswKvytbKWCZj79kHU0iLYpkkmyAkzdaPv7K23hI5x6fvSZxKCkguhOVhA337EJ0420V24o7gGr9RVT/dEby0Ze22iIwWWVRuX1AyRNGAk7ucx8NW+68AmEOj5H/JII1gadEIfVUAUuLMNd8oEqDaq0MwG4Ah2AQuz0pc6YnRraLBNETHSo+mcfYiMPtxH/J9DJk/1qTkE4xXLRc9nzfadiGCQjXj7Aur0RZH9IGXWwWKI1NEIDtDRWR/XUUenwLZA6lSrWHWn7kC5pBCBAu3G/JQYPdAOWgQYsvKgBRS95qisz2CatZmolP9vO3sNimk1RlRFDbHjADCRyO2fS7leybo27fzNAUjGMsY4UFOyIULke5ZxUvQBIiJt1R+90UfASQM= 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:(13230025)(4636009)(376002)(39860400002)(396003)(136003)(346002)(451199018)(40470700004)(36840700001)(46966006)(8936002)(44832011)(5660300002)(7416002)(2906002)(41300700001)(4326008)(70206006)(83380400001)(70586007)(8676002)(316002)(54906003)(6636002)(6666004)(478600001)(110136005)(7696005)(40460700003)(426003)(1076003)(336012)(40480700001)(2616005)(186003)(86362001)(16526019)(47076005)(82310400005)(81166007)(356005)(82740400003)(26005)(36756003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 11:30:00.9656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ab298db-f4c1-4dc7-8840-08db1eff4a1d 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: CO1NAM11FT112.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4208 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759709287079378352?= X-GMAIL-MSGID: =?utf-8?q?1759709287079378352?= From ACPI spec below 3 modes for CPPC can be defined: 1. Non autonomous: OS scaling governor specifies operating frequency/ performance level through `Desired Performance` register and platform follows that. 2. Guided autonomous: OS scaling governor specifies min and max frequencies/ performance levels through `Minimum Performance` and `Maximum Performance` register, and platform can autonomously select an operating frequency in this range. 3. Fully autonomous: OS only hints (via EPP) to platform for the required energy performance preference for the workload and platform autonomously scales the frequency. Currently (1) is supported by amd_pstate as passive mode, and (3) is implemented by EPP support. This change is to support (2). In guided autonomous mode the min_perf is based on the input from the scaling governor. For example, in case of schedutil this value depends on the current utilization. And max_perf is set to max capacity. To activate guided auto mode ``amd_pstate=guided`` command line parameter has to be passed in the kernel. Acked-by: Huang Rui Reviewed-by: Mario Limonciello Tested-by: Oleksandr Natalenko Signed-off-by: Wyes Karny --- .../admin-guide/kernel-parameters.txt | 15 +++++--- drivers/cpufreq/amd-pstate.c | 34 +++++++++++++++---- include/linux/amd-pstate.h | 2 ++ 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 1e38f3ae0e62..1e5fe4891dd7 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -344,11 +344,11 @@ Do not enable amd_pstate as the default scaling driver for the supported processors passive - Use amd_pstate as a scaling driver, driver requests a - desired performance on this abstract scale and the power - management firmware translates the requests into actual - hardware states (core frequency, data fabric and memory - clocks etc.) + Use amd_pstate with passive mode as a scaling driver. + In this mode autonomous selection is disabled. + Driver requests a desired performance level and platform + tries to match the same performance level if it is + satisfied by guaranteed performance level. active Use amd_pstate_epp driver instance as the scaling driver, driver provides a hint to the hardware if software wants @@ -356,6 +356,11 @@ to the CPPC firmware. then CPPC power algorithm will calculate the runtime workload and adjust the realtime cores frequency. + guided + Activate guided autonomous mode. Driver requests minimum and + maximum performance level and the platform autonomously + selects a performance level in this range and appropriate + to the current workload. amijoy.map= [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 73c7643b2697..61dcd7b89b26 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -308,7 +308,22 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) cppc_perf.lowest_nonlinear_perf); WRITE_ONCE(cpudata->lowest_perf, cppc_perf.lowest_perf); - return 0; + if (cppc_state == AMD_PSTATE_ACTIVE) + return 0; + + ret = cppc_get_auto_sel_caps(cpudata->cpu, &cppc_perf); + if (ret) { + pr_warn("failed to get auto_sel, ret: %d\n", ret); + return 0; + } + + ret = cppc_set_auto_sel(cpudata->cpu, + (cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1); + + if (ret) + pr_warn("failed to set auto_sel, ret: %d\n", ret); + + return ret; } DEFINE_STATIC_CALL(amd_pstate_init_perf, pstate_init_perf); @@ -385,12 +400,18 @@ static inline bool amd_pstate_sample(struct amd_cpudata *cpudata) } static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, - u32 des_perf, u32 max_perf, bool fast_switch) + u32 des_perf, u32 max_perf, bool fast_switch, int gov_flags) { u64 prev = READ_ONCE(cpudata->cppc_req_cached); u64 value = prev; des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf); + + if ((cppc_state == AMD_PSTATE_GUIDED) && (gov_flags & CPUFREQ_GOV_DYNAMIC_SWITCHING)) { + min_perf = des_perf; + des_perf = 0; + } + value &= ~AMD_CPPC_MIN_PERF(~0L); value |= AMD_CPPC_MIN_PERF(min_perf); @@ -445,7 +466,7 @@ static int amd_pstate_target(struct cpufreq_policy *policy, cpufreq_freq_transition_begin(policy, &freqs); amd_pstate_update(cpudata, min_perf, des_perf, - max_perf, false); + max_perf, false, policy->governor->flags); cpufreq_freq_transition_end(policy, &freqs, false); return 0; @@ -479,7 +500,8 @@ static void amd_pstate_adjust_perf(unsigned int cpu, if (max_perf < min_perf) max_perf = min_perf; - amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true); + amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true, + policy->governor->flags); cpufreq_cpu_put(policy); } @@ -1279,7 +1301,7 @@ static int __init amd_pstate_init(void) /* capability check */ if (boot_cpu_has(X86_FEATURE_CPPC)) { pr_debug("AMD CPPC MSR based functionality is supported\n"); - if (cppc_state == AMD_PSTATE_PASSIVE) + if (cppc_state != AMD_PSTATE_ACTIVE) current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; } else { pr_debug("AMD CPPC shared memory based functionality is supported\n"); @@ -1341,7 +1363,7 @@ static int __init amd_pstate_param(char *str) if (cppc_state == AMD_PSTATE_ACTIVE) current_pstate_driver = &amd_pstate_epp_driver; - if (cppc_state == AMD_PSTATE_PASSIVE) + if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED) current_pstate_driver = &amd_pstate_driver; return 0; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index f5f22418e64b..c10ebf8c42e6 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -97,6 +97,7 @@ enum amd_pstate_mode { AMD_PSTATE_DISABLE = 0, AMD_PSTATE_PASSIVE, AMD_PSTATE_ACTIVE, + AMD_PSTATE_GUIDED, AMD_PSTATE_MAX, }; @@ -104,6 +105,7 @@ static const char * const amd_pstate_mode_string[] = { [AMD_PSTATE_DISABLE] = "disable", [AMD_PSTATE_PASSIVE] = "passive", [AMD_PSTATE_ACTIVE] = "active", + [AMD_PSTATE_GUIDED] = "guided", NULL, }; #endif /* _LINUX_AMD_PSTATE_H */ From patchwork Tue Mar 7 11:27:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 65384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2379355wrd; Tue, 7 Mar 2023 03:40:37 -0800 (PST) X-Google-Smtp-Source: AK7set9Gc2XVEjGK1WMnj6oYx5ZhYDxiOHdg76dTvYdeaLzdPwDCzctsXd/DyXvOjusvBGJTVuHk X-Received: by 2002:a17:903:124e:b0:19e:d6f2:feea with SMTP id u14-20020a170903124e00b0019ed6f2feeamr4130166plh.9.1678189237449; Tue, 07 Mar 2023 03:40:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678189237; cv=pass; d=google.com; s=arc-20160816; b=AxwrXRmr9pabOh88+wUP658qc6LyjwcEBYg83NQT1MhJtTR9ULZAKpGXqgt1UWnRt7 LVnJKN+fk/uQi+/a+8Qlr/LyX2v9lNt+pbh+LkyWwcpOiHHBIieMr4UeTDPiehJi3Sbc v178JQ5OsaXV8FbHe+eGeDdSwa8c8V1IbXvmM49YqaWpnYsAVNnUOtM2Etj1UaB/qDAv FBxLHXmladQB5SfJOsN14A+9YHP/bngL4HS6XUcbVUvBPtLVFc44xVB24No77sj3cKBD sLpbc48RX1oH0z/27iSomsdZIHN4hs9iWCwLeBHxdZLYhCJTRkrH3dIUckctHlBv3xVf uz5g== 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=UOnZlLrGEYf1/bHyJj+hOsRjUJ2z2CxK+Pf03tzIqFM=; b=L0ZFXiirU2GaoQqc6pAeA6vGZ/A53oBgDMrSjdzvA3L1dgoBaiPcXQvHSyIjpUzB0m ZkYuIYyTHm1q2xVn86Q9Ty3jSa55q9XpvYJ+QP9YarMJA6BuLhV5kWHnX9zsjGSYlhJd y2uz3pQGLsVZ7PnHieMRwOCouNEsIAhyyd+0jBaDBvaR7GkCNF1mguuiQUQjQ1CLyAEx jjJLw25jqb5rgDQebYO8EVgZlbWay9P5t9fIb3/Xzz4JA828HQCpSD4WWYXIKnpNoDvi 52qCM/V2D7Bi+P9017TenITmBtTa1P4e13y+5zaZ08NADuwx3nLHCo1uvi8LlCmo87oR exiw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=h03eehkl; 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 t3-20020a170902d20300b0019cd6d089b7si11618444ply.385.2023.03.07.03.40.23; Tue, 07 Mar 2023 03:40:37 -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=h03eehkl; 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 S230501AbjCGLbq (ORCPT + 99 others); Tue, 7 Mar 2023 06:31:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230161AbjCGLbc (ORCPT ); Tue, 7 Mar 2023 06:31:32 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C6E454C85; Tue, 7 Mar 2023 03:30:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oPhlRy5r8eMTrnquTz0yCmJQbnGrecdGU/7wMdlCtnnW19vSbpUHOGnu/dzPhlMtc+fVEMiNpq1sPj3sFgIp7K06z1Ny81k5qLKANrl/bx1YOzFP+Hd0O1l966NOsSmbDnz31YdmILnVEmriBb4Py5HlYdH/bwx+Eh1P/QOVuAGU8sAZE+9cVMmTSGJUzzspDHFZHj3jeJnjs/rkMQkTmAxr3rq3LtBv20nunQXqAxZWOmJ5VsgYPuCc0iihtiPSeSehmRh9zXWUO3isyRHoIu3NNtQA68SZO0ZEu+qBVGYpVrtPFP8TfQgv6XODkxw5/F7AUoGwCsbK9xyChDaPCw== 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=UOnZlLrGEYf1/bHyJj+hOsRjUJ2z2CxK+Pf03tzIqFM=; b=NN/PW7tFbvwKZGz6Q7MPQaA5OTCcselLkjfLGrgMw1UjyD14C7XRMEWQRUq/xufDGwkzPwQI2QiHwX8poa5G6UMmX0CwWI06kM6gltfLbG+zdy4cXyIZS1d0W4HDVD7b9ZUblem5uXpv+SYWxFptET8jGxb9N0t1Rz0JY97coC8USrL7k8H0oSZl/CJE2BhmSYVkPYOuXzQfK4GPYPoYi2LBJWVEsZO0+XQnQOw/o19swBclVq0ZpyCXne/AbuYc/C6FzX+T64KWPd1yslFF8O8XgTZmsr+K1AQw7ewXbS4LO1jObaaDJHfAqeGMKcXj1Bn4XlsSb5NZwa9WPXu5tw== 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=UOnZlLrGEYf1/bHyJj+hOsRjUJ2z2CxK+Pf03tzIqFM=; b=h03eehklU2syzUzCmtlsoo3E/Fn29cXtBXe/nYt9WnrkFmd6ArXIyIs5vHphLRDcC0VfB3EDtjjc+ctnHTTmglEJq/+bgHkFyxxdoT38n9gRjn51VQze5zfvkfhP4QtyTJ2HWYQ1kTrC2eMouTzNe1FLI+5EvaLrBzFsNCg6jE8= Received: from DS7PR03CA0244.namprd03.prod.outlook.com (2603:10b6:5:3b3::9) by BY5PR12MB4243.namprd12.prod.outlook.com (2603:10b6:a03:20f::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29; Tue, 7 Mar 2023 11:30:25 +0000 Received: from DS1PEPF0000B07A.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::c7) by DS7PR03CA0244.outlook.office365.com (2603:10b6:5:3b3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.28 via Frontend Transport; Tue, 7 Mar 2023 11:30:25 +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 DS1PEPF0000B07A.mail.protection.outlook.com (10.167.17.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.13 via Frontend Transport; Tue, 7 Mar 2023 11:30: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.2375.34; Tue, 7 Mar 2023 05:30:19 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Russell Haley , Wyes Karny , Mario Limonciello , Oleksandr Natalenko Subject: [PATCH v8 5/6] cpufreq: amd-pstate: Add guided mode control support via sysfs Date: Tue, 7 Mar 2023 11:27:39 +0000 Message-ID: <20230307112740.132338-6-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307112740.132338-1-wyes.karny@amd.com> References: <20230307112740.132338-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: DS1PEPF0000B07A:EE_|BY5PR12MB4243:EE_ X-MS-Office365-Filtering-Correlation-Id: a5867b76-837c-4455-60e9-08db1eff58ae X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JY5kw0sn8HoqDGWNwgX6gxZReGkH0R88wOi+dconLSC7f2dk7juFrxJXm8//2y46F589d7KkKFDkpw6B7RGY3KHd2DrDaDAOqDhn1ZeVg79Jir0bhQpYpKYe6hKQiVmPTdTspGbZNomA2BxvqGNX9CvI8r031SZjU21VMqBG6EQ5suVTWkmEotUtLlJvoKVFs+AjZpAkk6sPa+33tx/iufnNISNluexdfH5W/xaQu8Dz4qkw82//E25wbjuRu7hx6V+mangh9q6/106L0doKE5RCiHOQHdjjh7EKve+VNw8IZTVOqgRkfTTEEbJUmo53JhSYc+781JWSD/nh8uc9MoB42v1iC/ZyPGv5Px4+jc6rYtkNQJCQglaDF24qCu3a5U38HiP3s9dm9vl68RZNFYDl0DjU2vf0+DjJb3VyOAgi443E5eAA0xn3CTifG//fdTrtfKmHBvkT1YWtnZQK0UTvFmxFhcX+5XSnjOz3YKXSBg3QJxrJhHepYWKZLI4RAPIf4jQIn1aN+6xKSrsB84MXJ3ErzOYwik9BNPxVcQaW8yk9wFGdcOOLKROdDYFrW4fKmQ0ogZMLPhY820PRR6R5ote/u7klVOdxqHX4n/NsB5xNIc+ucnwpp/B1cNNOfdfBk55Qo0Ct4HHPrHvq92La+2Up1LcpI/O5APqrK8WZRv3hNHq/HEcmpfGF5B8eqLuGbRdFovQIe7gKl2ClWYwU360CIL6z/iRQwcq8WhM= 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:(13230025)(4636009)(376002)(39860400002)(136003)(396003)(346002)(451199018)(36840700001)(40470700004)(46966006)(2906002)(356005)(81166007)(36860700001)(336012)(82740400003)(186003)(26005)(16526019)(2616005)(1076003)(44832011)(7696005)(6666004)(40460700003)(82310400005)(478600001)(70586007)(70206006)(5660300002)(8936002)(7416002)(40480700001)(41300700001)(47076005)(110136005)(426003)(54906003)(6636002)(36756003)(4326008)(8676002)(316002)(86362001)(83380400001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 11:30:25.5592 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5867b76-837c-4455-60e9-08db1eff58ae 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: DS1PEPF0000B07A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4243 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759708957659870236?= X-GMAIL-MSGID: =?utf-8?q?1759708957659870236?= amd_pstate driver's `status` sysfs entry helps to control the driver's mode dynamically by user. After the addition of guided mode the combinations of mode transitions have been increased (16 combinations). Therefore optimise the amd_pstate_update_status function by implementing a state transition table. There are 4 states amd_pstate supports, namely: 'disable', 'passive', 'active', and 'guided'. The transition from any state to any other state is possible after this change. Sysfs interface: To disable amd_pstate driver: # echo disable > /sys/devices/system/cpu/amd_pstate/status To enable passive mode: # echo passive > /sys/devices/system/cpu/amd_pstate/status To change mode to active: # echo active > /sys/devices/system/cpu/amd_pstate/status To change mode to guided: # echo guided > /sys/devices/system/cpu/amd_pstate/status Acked-by: Huang Rui Reviewed-by: Mario Limonciello Tested-by: Oleksandr Natalenko Signed-off-by: Wyes Karny --- drivers/cpufreq/amd-pstate.c | 143 +++++++++++++++++++++++++---------- 1 file changed, 101 insertions(+), 42 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 61dcd7b89b26..7955cfc91c31 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -106,6 +106,8 @@ static unsigned int epp_values[] = { [EPP_INDEX_POWERSAVE] = AMD_CPPC_EPP_POWERSAVE, }; +typedef int (*cppc_mode_transition_fn)(int); + static inline int get_mode_idx_from_str(const char *str, size_t size) { int i; @@ -838,6 +840,98 @@ static ssize_t show_energy_performance_preference( return sysfs_emit(buf, "%s\n", energy_perf_strings[preference]); } +static void amd_pstate_driver_cleanup(void) +{ + amd_pstate_enable(false); + cppc_state = AMD_PSTATE_DISABLE; + current_pstate_driver = NULL; +} + +static int amd_pstate_register_driver(int mode) +{ + int ret; + + if (mode == AMD_PSTATE_PASSIVE || mode == AMD_PSTATE_GUIDED) + current_pstate_driver = &amd_pstate_driver; + else if (mode == AMD_PSTATE_ACTIVE) + current_pstate_driver = &amd_pstate_epp_driver; + else + return -EINVAL; + + cppc_state = mode; + ret = cpufreq_register_driver(current_pstate_driver); + if (ret) { + amd_pstate_driver_cleanup(); + return ret; + } + return 0; +} + +static int amd_pstate_unregister_driver(int dummy) +{ + cpufreq_unregister_driver(current_pstate_driver); + amd_pstate_driver_cleanup(); + return 0; +} + +static int amd_pstate_change_mode_without_dvr_change(int mode) +{ + int cpu = 0; + + cppc_state = mode; + + if (boot_cpu_has(X86_FEATURE_CPPC) || cppc_state == AMD_PSTATE_ACTIVE) + return 0; + + for_each_present_cpu(cpu) { + cppc_set_auto_sel(cpu, (cppc_state == AMD_PSTATE_PASSIVE) ? 0 : 1); + } + + return 0; +} + +static int amd_pstate_change_driver_mode(int mode) +{ + int ret; + + ret = amd_pstate_unregister_driver(0); + if (ret) + return ret; + + ret = amd_pstate_register_driver(mode); + if (ret) + return ret; + + return 0; +} + +cppc_mode_transition_fn mode_state_machine[AMD_PSTATE_MAX][AMD_PSTATE_MAX] = { + [AMD_PSTATE_DISABLE] = { + [AMD_PSTATE_DISABLE] = NULL, + [AMD_PSTATE_PASSIVE] = amd_pstate_register_driver, + [AMD_PSTATE_ACTIVE] = amd_pstate_register_driver, + [AMD_PSTATE_GUIDED] = amd_pstate_register_driver, + }, + [AMD_PSTATE_PASSIVE] = { + [AMD_PSTATE_DISABLE] = amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] = NULL, + [AMD_PSTATE_ACTIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] = amd_pstate_change_mode_without_dvr_change, + }, + [AMD_PSTATE_ACTIVE] = { + [AMD_PSTATE_DISABLE] = amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_ACTIVE] = NULL, + [AMD_PSTATE_GUIDED] = amd_pstate_change_driver_mode, + }, + [AMD_PSTATE_GUIDED] = { + [AMD_PSTATE_DISABLE] = amd_pstate_unregister_driver, + [AMD_PSTATE_PASSIVE] = amd_pstate_change_mode_without_dvr_change, + [AMD_PSTATE_ACTIVE] = amd_pstate_change_driver_mode, + [AMD_PSTATE_GUIDED] = NULL, + }, +}; + static ssize_t amd_pstate_show_status(char *buf) { if (!current_pstate_driver) @@ -846,57 +940,22 @@ static ssize_t amd_pstate_show_status(char *buf) return sysfs_emit(buf, "%s\n", amd_pstate_mode_string[cppc_state]); } -static void amd_pstate_driver_cleanup(void) -{ - current_pstate_driver = NULL; -} - static int amd_pstate_update_status(const char *buf, size_t size) { - int ret = 0; int mode_idx; - if (size > 7 || size < 6) + if (size > strlen("passive") || size < strlen("active")) return -EINVAL; - mode_idx = get_mode_idx_from_str(buf, size); - switch(mode_idx) { - case AMD_PSTATE_DISABLE: - if (!current_pstate_driver) - return -EINVAL; - if (cppc_state == AMD_PSTATE_ACTIVE) - return -EBUSY; - cpufreq_unregister_driver(current_pstate_driver); - amd_pstate_driver_cleanup(); - break; - case AMD_PSTATE_PASSIVE: - if (current_pstate_driver) { - if (current_pstate_driver == &amd_pstate_driver) - return 0; - cpufreq_unregister_driver(current_pstate_driver); - cppc_state = AMD_PSTATE_PASSIVE; - current_pstate_driver = &amd_pstate_driver; - } + mode_idx = get_mode_idx_from_str(buf, size); - ret = cpufreq_register_driver(current_pstate_driver); - break; - case AMD_PSTATE_ACTIVE: - if (current_pstate_driver) { - if (current_pstate_driver == &amd_pstate_epp_driver) - return 0; - cpufreq_unregister_driver(current_pstate_driver); - current_pstate_driver = &amd_pstate_epp_driver; - cppc_state = AMD_PSTATE_ACTIVE; - } + if (mode_idx < 0 || mode_idx >= AMD_PSTATE_MAX) + return -EINVAL; - ret = cpufreq_register_driver(current_pstate_driver); - break; - default: - ret = -EINVAL; - break; - } + if (mode_state_machine[cppc_state][mode_idx]) + return mode_state_machine[cppc_state][mode_idx](mode_idx); - return ret; + return 0; } static ssize_t show_status(struct kobject *kobj, From patchwork Tue Mar 7 11:27:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wyes Karny X-Patchwork-Id: 65383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2379072wrd; Tue, 7 Mar 2023 03:39:54 -0800 (PST) X-Google-Smtp-Source: AK7set/ydGtWG2viJo/1PYu96MLn3HVwIT3nNS8YMkV6AYgRPMnLpamogtq4AOeDmz14kvlvObPS X-Received: by 2002:a17:90b:38c3:b0:234:159:4003 with SMTP id nn3-20020a17090b38c300b0023401594003mr14738749pjb.25.1678189194302; Tue, 07 Mar 2023 03:39:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678189194; cv=pass; d=google.com; s=arc-20160816; b=XvXWrWsgnDIqdXUAvUZRrGceztNW7cLS6OWwPGgVS0rzG/6jMn8P3mlhD4O7mwWFv5 H20i5/G/BD3BAU9QrYu+0dDIl6qw/HmMlGyBrnSIgJhzgtr/R9mC9AEyBV+jVgCGaaaX d872uP6skq7H+DTfghTngWOWUsThCzjVEVzUCbnT2ablLXtCpqaz2Y7LVUavt6fbqNC1 Mx4Ou/cdXXjJOXMjmDUxJGbulFTh3Phj0GUMkUDWKmyxt0/SRpnUTd4SaTscJyNJsuc5 tc08HUGaj9xxvLuk9wYpYx84OGA06OCSQVKvGoa1ScTEbIbdq20zxpvaOpMW3PfAJvpN byhw== 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=oqrccLHy/K9iCZa7u8ey+Sxd+xqfVbX3jNE54cX1UI0=; b=DzpEO53sz3shSV0VTzC2MN7deGxf8wP3z5iZSA+tCXbttpYlpkj2W/YFKEr16vH2bA wPCSMwZVcQKTJwa8TiOBV17CnUqHiEpz3i/bYs6L2pvQL458XBIHCVTfwn3lalEnqzJn f8sTHzKxsqrsXWho9rRSnVyC0NIZeYraZyqqbyG5F7nICuLHWT2uucKbDK/fTn3ftfOG u8j6o08TUG/MbHb7OrpI+I3IeBZvIZTcMkaAivN6N+/2f5JJqoV+DlB3EOkQEf8BU6Vd BfyzYz47RTKcJt+yrqrbKTCZ6ygSfIa6LXdT6alZj19ltpW6e6O03tP0eOrhM0SQSbu+ hm2A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=KJuRE412; 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 8-20020a17090a004800b0023739dcb925si14030789pjb.66.2023.03.07.03.39.39; Tue, 07 Mar 2023 03:39:54 -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=KJuRE412; 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 S230386AbjCGLcS (ORCPT + 99 others); Tue, 7 Mar 2023 06:32:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbjCGLcD (ORCPT ); Tue, 7 Mar 2023 06:32:03 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20630.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C784843475; Tue, 7 Mar 2023 03:31:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=diujgsvmhBVoHCCWnBRwkiQCAc+800K8j1d2KwrMOxx29ZwU2PdNc9Bj9dxVuFbGU5Shwo40QtvLDtmZDq/SXFN9kKuKvIRphaVybdx6GD68DJvkvlu4q9iXu7Ow+oO1Ia9jwb3bKnY0FXS5MmIbDOv7j4ulAOheTNFi/kyxwMNXNJ0YesN9QeUZ/HWuS3JA8ayfz5G1abQ2SElszPm0bl9ftTX1NJl331uAPcT3zHnqexXSMmTH67FSo+jjIqSdiHJzL2c/UZBSrr+u3AdrfSJvCYJJA7DC0sWLpgf2KTwlfiBb2/QO4I+j0TId002dtcV3G4clPPiIjlhnmNOu7A== 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=oqrccLHy/K9iCZa7u8ey+Sxd+xqfVbX3jNE54cX1UI0=; b=mE3dhRmEFwOSCUhPUHFk8opibbmNrsMBRUW7HVSD37red+C87IcAgFplS8pJH7q5U375QZhaFmdye1fdcwIZL5dKGlpGoIQwL7KarNxh7ThXQs7o1YIihT/wnU1nrD5DVCZ+REK6BA98lX3vZ4LSt3IAEFY88VXtwJDFsN/R3ciuKMja+rI3VwUlwe/bgIDOOi+Mcb/megXl1fOkuN53siWwAztvxlwoRz9HRTdm0M4PxOhO86SK4uNNpCkKFI3zpnPyWK8fvfIMr6HFTVyNU3etKkmg+ZDcCkcd6EW/l5Td+kFoB84zrJwDmRsCXevbB0gex0Oq92waZldLaAeZnQ== 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=oqrccLHy/K9iCZa7u8ey+Sxd+xqfVbX3jNE54cX1UI0=; b=KJuRE4125cBYBbeyr30LE1GKwAgLza94azU66UI7zcag/cnaEEXJ0IEmLaljgJtMJamLvVlbOp8NjVtbOzrktCJ0AU5YR92lPKc9tthqKWwDXscvj1uwbDaFhHHEAshQvSsL7raNBr3pf+7IbdXlH8BPeuH5ppLYCs8E5s/4zls= Received: from DS7P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::19) by DM4PR12MB5988.namprd12.prod.outlook.com (2603:10b6:8:6b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.23; Tue, 7 Mar 2023 11:31:14 +0000 Received: from DS1PEPF0000B078.namprd05.prod.outlook.com (2603:10b6:8:2e:cafe::a1) by DS7P222CA0003.outlook.office365.com (2603:10b6:8:2e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.29 via Frontend Transport; Tue, 7 Mar 2023 11:31:14 +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 DS1PEPF0000B078.mail.protection.outlook.com (10.167.17.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.16 via Frontend Transport; Tue, 7 Mar 2023 11:31:14 +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.2375.34; Tue, 7 Mar 2023 05:31:08 -0600 From: Wyes Karny To: Rafael J Wysocki , Huang Rui , Jonathan Corbet , Viresh Kumar , , CC: , , , Bagas Sanjaya , , Len Brown , Robert Moore , Borislav Petkov , Ananth Narayan , , Tor Vic , Russell Haley , Wyes Karny , Mario Limonciello , Oleksandr Natalenko Subject: [PATCH v8 6/6] Documentation: cpufreq: amd-pstate: Update amd_pstate status sysfs for guided Date: Tue, 7 Mar 2023 11:27:40 +0000 Message-ID: <20230307112740.132338-7-wyes.karny@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230307112740.132338-1-wyes.karny@amd.com> References: <20230307112740.132338-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: DS1PEPF0000B078:EE_|DM4PR12MB5988:EE_ X-MS-Office365-Filtering-Correlation-Id: 651aabe1-ae6f-485b-8560-08db1eff75b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H4nJyLVBaZwV3BgL+ogLwUt+cPAU2BfrOROLEooVGL/xMLNdflGo+mz3gAaveYa9au3ANfy1X80Sd59aNSpNjFVfXxuQUh/Tt6NC33/QJ4isWTti8IXF0QJ//P649FyFV7cWfR999Sn2Ebqki8ajQi4kpZUPy9O6uXOlPj/KHluTG+ih+21IPv50NbFDgNJ8fHfJ+vFu0c0oDVaV9H8aLz3DfqvBgcPA4jz7UNKUbvkKHAC7oHCR5OquKhDf1VBwBBo64m8CWB/c7LrV43eMiVGGkQelwWpS2qb3FjQ1w0IJ5s7D2vk25oEnPnheQavMLH+5Ajf9MmaZqBqf4lbtnCLRRMc3F7GcZAPczwFGRVkRjNbrveJ8306/De+vZ0ceEMJu7J26B2Sy02Ji5wfOYxD6WRYkIHT512SUCe79O7TplhBgulIlgSYNlGC7zmcuDSrasKD8ajXP5qVm2FdBvdWUhzxH06uyC7RlJaAGrkuxcK9uhLY4qnMTDH0KX3A3Krq6M8cegbyxmrwe2VNKOeTyHU49oP8/V14tOorfJDy1nw2wkBHzZXq3VED/TIkl1SFgdgxiKkBsOBo+82xWd+EC22hhodxv1e1RgOIHpYG7Oiqdh55xDmpQA2+VBbmj8/cV8i0n7KKQW95fwM8JjC+UmWrWzZ4y35fM6s+WBgj5Xj0e+z66zzyKEEFtkcMMKxOTu3Rn25N7baZuiZzOJ6+EJcMO6ygO6/JBRMTYPGc= 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:(13230025)(4636009)(136003)(396003)(376002)(346002)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(82310400005)(82740400003)(6666004)(47076005)(36860700001)(83380400001)(36756003)(478600001)(6636002)(81166007)(316002)(356005)(110136005)(7696005)(336012)(16526019)(5660300002)(41300700001)(1076003)(54906003)(40460700003)(26005)(15650500001)(426003)(70586007)(7416002)(186003)(44832011)(8676002)(2616005)(8936002)(2906002)(40480700001)(70206006)(4326008)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2023 11:31:14.2600 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 651aabe1-ae6f-485b-8560-08db1eff75b5 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: DS1PEPF0000B078.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5988 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,SPF_HELO_PASS, SPF_NONE,URIBL_BLOCKED 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759708912873966204?= X-GMAIL-MSGID: =?utf-8?q?1759708912873966204?= Update amd_pstate status sysfs for guided mode. Acked-by: Huang Rui Reviewed-by: Bagas Sanjaya Reviewed-by: Mario Limonciello Tested-by: Oleksandr Natalenko Signed-off-by: Wyes Karny --- Documentation/admin-guide/pm/amd-pstate.rst | 31 ++++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 6e5298b521b1..1cf40f69278c 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -303,13 +303,18 @@ efficiency frequency management method on AMD processors. AMD Pstate Driver Operation Modes ================================= -``amd_pstate`` CPPC has two operation modes: CPPC Autonomous(active) mode and -CPPC non-autonomous(passive) mode. -active mode and passive mode can be chosen by different kernel parameters. -When in Autonomous mode, CPPC ignores requests done in the Desired Performance -Target register and takes into account only the values set to the Minimum requested -performance, Maximum requested performance, and Energy Performance Preference -registers. When Autonomous is disabled, it only considers the Desired Performance Target. +``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode, +non-autonomous (passive) mode and guided autonomous (guided) mode. +Active/passive/guided mode can be chosen by different kernel parameters. + +- In autonomous mode, platform ignores the desired performance level request + and takes into account only the values set to the minimum, maximum and energy + performance preference registers. +- In non-autonomous mode, platform gets desired performance level + from OS directly through Desired Performance Register. +- In guided-autonomous mode, platform sets operating performance level + autonomously according to the current workload and within the limits set by + OS through min and max performance registers. Active Mode ------------ @@ -338,6 +343,15 @@ to the Performance Reduction Tolerance register. Above the nominal performance l processor must provide at least nominal performance requested and go higher if current operating conditions allow. +Guided Mode +----------- + +``amd_pstate=guided`` + +If ``amd_pstate=guided`` is passed to kernel command line option then this mode +is activated. In this mode, driver requests minimum and maximum performance +level and the platform autonomously selects a performance level in this range +and appropriate to the current workload. User Space Interface in ``sysfs`` - General =========================================== @@ -358,6 +372,9 @@ control its functionality at the system level. They are located in the "passive" The driver is functional and in the ``passive mode`` + "guided" + The driver is functional and in the ``guided mode`` + "disable" The driver is unregistered and not functional now.