From patchwork Sun Feb 4 12:12:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 770007 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2044.outbound.protection.outlook.com [40.107.100.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5A1F22314; Sun, 4 Feb 2024 12:13:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048801; cv=fail; b=Ut9R9QTgRMHFy0EKXqBGIHnr8OSffBXXHY9HqQ30eDM4Pihe7dPcKvhXigfOg/REQy5ChL+w3rLJDShGbYrso7KF20D5xfC663Qvxq+VaOzA+iJ4UJjh2MY3NVtSkgSLXZNVH9gRyUQxMjcLIYED4klaMFKPL5Q184py/Hf8VxY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048801; c=relaxed/simple; bh=6H19wzE8cNLuougZk13HeNichmIG5PrRuTrD629ah9w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KzZ4S40t1K0aePIsDfx1TlSDCC8/whZZs0tn49fRkw8bU2q9RB6p0RtZyvyF6Exa5650eQDT5Qna9qIcQVAZCTK5GwHvPw4gHipqYzpPAgR422xlsU+c11H5zK2PiBAzXtRq44vQuv5UC9W8ADso8fsUn9keo757bo5iumac6wk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=FOSG6dcm; arc=fail smtp.client-ip=40.107.100.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="FOSG6dcm" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ncNr9MJGtDPGrN/ZjOLSs44lbznk/ykanN62nrGncFQZHVqc9/DcQdUVjWemk8ktsPaRXBPtV5a4H2dVHBjBF/M/GTKi1wtnlg2yF9gdcLHT5MvAh1hJIcBKq7qw6rhUKPwyVGfkrjGV1g3QMBVj4KQr73IMeKgz+5IUZLaKjAVPptz9gVE1uM+EcMM6/M0q9lCSn7eLbu96A21C6NaD3ofmWquMWchPwdKHrt1hvVkPSMPaq3Dma/uwy1mKYeTEipejl8Kmjz1kYrvNfohCVl1m0vhpztRBqw9Lp51sFW7yc2XC6IIeEqJTRNSGDz72hyMxS3ONB2+pZBGroe1/KQ== 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=0UDi4yuSQkHg9RflKkBhqZ9SVi5rwVLhbSEtUYV8v8w=; b=fU6Wnx65LY0/KbrfnHiIvjThqypQcre+d8bS25oT9LtxvT4eXiWDMrY0Gz2BmY/10mgYcAJ8M8wn+QGLS/ECXv/cEqjgf9lZjHYN2lGhmqwxCfZB6pQdvqWkdYhw2x4aUf3bo6+4UiLMsXKi9JGGj9VzgfRHhXPg5vv7fUBhAssUsyyCg7qS5UHaFZjrDgnWniuJPAvDHeIP4PY61Bl29icDMAzqlt9WduTUD6eK3zfZz+R0i+NCRlX74gI3S196kIXaOOBbqLYJST9RxdoeJ527NCBhgPF/S1tBfOqgTllj0mI85yEXiY4EHCw11/3i74LmdH68kHzIO0J/c2we3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 (0) 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=0UDi4yuSQkHg9RflKkBhqZ9SVi5rwVLhbSEtUYV8v8w=; b=FOSG6dcmOud/69kHzMxvf84X2/Uaxs+gb/y2A3uGoEjhPx684YVlSr0HTt0vc1xfkn0h3/EyZ4Tn1wr5nenFmpK4gwogn3dZESx2stjXHCtSDuuwhn+DpKCc+aep41hN9Cws7SetDGRVeAws5lyD+opdgFkvUPdWPCFOphlPAqM= Received: from BL0PR05CA0024.namprd05.prod.outlook.com (2603:10b6:208:91::34) by DS0PR12MB7655.namprd12.prod.outlook.com (2603:10b6:8:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.14; Sun, 4 Feb 2024 12:13:16 +0000 Received: from BL6PEPF0001AB4F.namprd04.prod.outlook.com (2603:10b6:208:91:cafe::de) by BL0PR05CA0024.outlook.office365.com (2603:10b6:208:91::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17 via Frontend Transport; Sun, 4 Feb 2024 12:13:16 +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 BL6PEPF0001AB4F.mail.protection.outlook.com (10.167.242.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Sun, 4 Feb 2024 12:13:15 +0000 Received: from pyuan-Chachani-VN.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.34; Sun, 4 Feb 2024 06:13:12 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v2 1/6] cpufreq: amd-pstate: initialize new core precision boost state Date: Sun, 4 Feb 2024 20:12:52 +0800 Message-ID: <51d8381943c3cfa7841775b02a414355f6baa20c.1707047943.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4F:EE_|DS0PR12MB7655:EE_ X-MS-Office365-Filtering-Correlation-Id: 3939e072-265f-41c0-4248-08dc257aaa92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vZjUvKWwh8eJ4VLlmU8vP5RCRiOkM/LMy7jSxhc32eWaoyFMD90XoWO7dR9p2nu0midQNm3DDzFmjqpioriP2s3hnSDz3l8gb2nqAwdvBdHCw1a/RDU95wOK2mPtnuUZVQN5XIP24MX4TG+YQqW0p+wbop0Km7e0FlIjNWLSHLX4SVREuJEB0zaA0ZqvkgxPht9Dp5HVHLwSERJHutRRwUQZC88/3ovNtXlqWVAW+cFFfqeS3YW0shu9FMfUvCJ1Hu/wbmoSol7EYWiB0wQNGLKJGaslpN9mF7DuMSCDq8i8/uVzSLZKfQOQy9NBX/Nh28/J+5VUUsxsQxKMOXa2peXC3DCqKF+NKNytTU7Tue6xwm/1iERd7DH7BzWBsWrpp08EiFyx1bsHWS2DfCcLtzj9MUl6fldyYu0zwWCg6m+tovDu+dqrXN4azX1fLEcmi/vDJlKr2uK4zlPl2hc3RgdRPJ/KsaId/mbejsq8zp8NYAWyEA3UHC1wytMhqNEMjvy0nb9Y/wpts3INOyc8lcrK38WOoNuay2cfb1XawAzKvQehfhpZSCzUAHfrTd0SuUi4IwuIGcBuIGgB3IScmMTCouZHSeYt37n8A/CFrIgEwvt7VH8vE5IrU+gojziGvLh+S23zZRFE0mXPUYbWhc2cLuKaiJldxsnIwELGlFlQdXdTuQhwGxaxhFEn75ORZ0F3KRunA0IgfcJAhHdpmV56ImM91o/piWHePpRSBHj5h1Drsm6tON6onnY/6nxYwrZ75wTA4kpyg6MLHyxobzzbnwFg58JRk4YeJp/E3t8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(346002)(136003)(376002)(39860400002)(230922051799003)(1800799012)(451199024)(82310400011)(186009)(64100799003)(36840700001)(46966006)(40470700004)(478600001)(47076005)(26005)(83380400001)(16526019)(2616005)(336012)(426003)(356005)(82740400003)(81166007)(36860700001)(8676002)(8936002)(4326008)(110136005)(70586007)(316002)(6636002)(5660300002)(54906003)(2906002)(70206006)(44832011)(6666004)(7696005)(966005)(36756003)(86362001)(41300700001)(40460700003)(40480700001)(518174003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2024 12:13:15.7248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3939e072-265f-41c0-4248-08dc257aaa92 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: BL6PEPF0001AB4F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7655 From: Perry Yuan Add gloal global_params to represent current CPU Performance Boost(cpb) state for cpu frequency scaling, both active and passive modes all can support CPU cores frequency boosting control which is based on the BIOS setting, while BIOS turn on the "Core Performance Boost", it will allow OS control each core highest perf limitation from OS side. If core performance boost is disabled while a core is in a boosted P-state, the core transitions to the highest performance non-boosted P-state, that is the same as the nominal frequency limit. Reported-by: Artem S. Tashkinov" Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 61 +++++++++++++++++------------------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9a1e194d5cf8..921324ab9580 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -65,6 +65,19 @@ static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state = AMD_PSTATE_UNDEFINED; static bool cppc_enabled; +/** + * struct global_params - Global parameters, mostly tunable via sysfs. + * @cpb_boost: Whether or not to use boost CPU P-states. + * @cpb_supported: Whether or not CPU boost P-states are available + * based on the MSR_K7_HWCR bit[25] state + */ +struct global_params { + bool cpb_boost; + bool cpb_supported; +}; + +static struct global_params global; + /* * AMD Energy Preference Performance (EPP) * The EPP is used in the CCLK DPM controller to drive @@ -632,43 +645,21 @@ static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) return lowest_nonlinear_freq * 1000; } -static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) +static int amd_pstate_boost_init(struct amd_cpudata *cpudata) { - struct amd_cpudata *cpudata = policy->driver_data; + u64 boost_val; int ret; - if (!cpudata->boost_supported) { - pr_err("Boost mode is not supported by this processor or SBIOS\n"); - return -EINVAL; - } - - if (state) - policy->cpuinfo.max_freq = cpudata->max_freq; - else - policy->cpuinfo.max_freq = cpudata->nominal_freq; - - policy->max = policy->cpuinfo.max_freq; - - ret = freq_qos_update_request(&cpudata->req[1], - policy->cpuinfo.max_freq); - if (ret < 0) + ret = rdmsrl_on_cpu(cpudata->cpu, MSR_K7_HWCR, &boost_val); + if (ret) { + pr_err_once("failed to read initial CPU boost state!\n"); return ret; + } - return 0; -} - -static void amd_pstate_boost_init(struct amd_cpudata *cpudata) -{ - u32 highest_perf, nominal_perf; - - highest_perf = READ_ONCE(cpudata->highest_perf); - nominal_perf = READ_ONCE(cpudata->nominal_perf); - - if (highest_perf <= nominal_perf) - return; + global.cpb_supported = !((boost_val >> 25) & 0x1); + global.cpb_boost = global.cpb_supported; - cpudata->boost_supported = true; - current_pstate_driver->boost_enabled = true; + return ret; } static void amd_perf_ctl_reset(unsigned int cpu) @@ -701,6 +692,9 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) if (ret) goto free_cpudata1; + /* initialize cpu cores boot state */ + amd_pstate_boost_init(cpudata); + min_freq = amd_get_min_freq(cpudata); max_freq = amd_get_max_freq(cpudata); nominal_freq = amd_get_nominal_freq(cpudata); @@ -750,7 +744,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) policy->driver_data = cpudata; - amd_pstate_boost_init(cpudata); if (!current_pstate_driver->adjust_perf) current_pstate_driver->adjust_perf = amd_pstate_adjust_perf; @@ -1118,6 +1111,9 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) if (ret) goto free_cpudata1; + /* initialize cpu cores boot state */ + amd_pstate_boost_init(cpudata); + min_freq = amd_get_min_freq(cpudata); max_freq = amd_get_max_freq(cpudata); nominal_freq = amd_get_nominal_freq(cpudata); @@ -1168,7 +1164,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) return ret; WRITE_ONCE(cpudata->cppc_cap1_cached, value); } - amd_pstate_boost_init(cpudata); return 0; From patchwork Sun Feb 4 12:12:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 770256 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2076.outbound.protection.outlook.com [40.107.95.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 075A4224FB; Sun, 4 Feb 2024 12:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048805; cv=fail; b=U4yBw06pzugY8+/JvNTm0ZGB1POni7rxbaL8vvpbnVmIOrL5FfLzlCvW5MB1hIa7cluJMWGbokzCgHKzDx1nTksSY5egs1XybPOoufKMRLZQdE452TDVPkVCNDy9zj0Z9QrvmghRhCxlgUov/t+co4hog6ZlBQSWpFY95X0ZjZ4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048805; c=relaxed/simple; bh=Bf9NAfnoVQeHWcFTnv7Yw66NpniG2LtdK4UGBjshRNQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=D75UvCUgOTPxOKsBGJpv5bleQwr1bUeqkY7XqacT9UDllq5wcNh5q07/tZxW9FslhCmGZIDe9Pf8Rd6uH9bjMnwY9aTeut7z2W5yMF5BGY+bLkWSjG78TAnZuCl3RZ2LDfGhlWFXhrls/cqmK207i+C85/qWsJaE5wZsiH59y30= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=yD6Xo1Nf; arc=fail smtp.client-ip=40.107.95.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="yD6Xo1Nf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A0DeONGm54RRaDTkfHmODZChRTFV8g047kRy0PdV9M8V7J6dGTPM2DagrZ3HxZlNshOxI9qC6DF+n1ujLxbzuP0AB9uWqr3PPJn7B9zumMVXyJbKC+iw5dtCiH4HfDvXOpLgO+7OrNnLNhvi8wE+9jW46GIzqpmT7mqNC8QxYWSbGJXBw1eNvaGfI7EqXKNb9+CLQ1qqBjHNNIFk8b1fKzx5fMvOtGuRtYuHMFeC6rKlePa7l/5ELDuC42qjVB16VDAf4ikmHYCZCLlPxghi4gSL1pYmbIZHdjdL1NhQfFfm/jfxBHjeeXjfYev7C/WdRSetYJRJG/mcKekat1TE3g== 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=06udwbTp5ntp/oFXoO/P9xr7leCBwd4xSY8+IBn2Mkc=; b=Kd5OEToSxkBLq5frOcOF4uP1HmoQnfV/bkLhMZnPNSJGsXZlhUz3iaUrYMpar+uNk88BlEFnIWVZkxSdhYW4M2RruxcuajPsJJ9ICxgvVQiXZiOL2bTyyB28Nl79+gsnlsniES3UVfb8rqU27bWPRDwh7OaDHOr+YRw1NMfbTYHh3glIHthmPb0QrxNX+4f9QNGMaRGrBWstIT7YMo2LyunHiJF2q09G3tOaBZfT7AverpvK0FKiWO2F5PaHCvFD1U3jDuOI4Pphrz28IszgazfzAVUsFRJ7GL1xtnWsdh6tg6BAYyXpkH6XpB/EctfaVuAh/B6KxwE6ePFqpBpbMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 (0) 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=06udwbTp5ntp/oFXoO/P9xr7leCBwd4xSY8+IBn2Mkc=; b=yD6Xo1NfTLTNLTsiMjj4uzVp03iWcrwWKrSrvG+9Rr+wPmyaKMLst7WP3usRVTzoeaZPa/6DAJEzTOWZoVYBbtGauuPMt+h3OwZGokKHUBAyBrPv6I6FqKDUiZcJipkF1ASEerRDLEZwY0IK5gs76OMfLVxRa5cPlV0kgUv1YB0= Received: from BL0PR0102CA0067.prod.exchangelabs.com (2603:10b6:208:25::44) by IA1PR12MB6577.namprd12.prod.outlook.com (2603:10b6:208:3a3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.16; Sun, 4 Feb 2024 12:13:19 +0000 Received: from BL6PEPF0001AB51.namprd04.prod.outlook.com (2603:10b6:208:25:cafe::e6) by BL0PR0102CA0067.outlook.office365.com (2603:10b6:208:25::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.33 via Frontend Transport; Sun, 4 Feb 2024 12:13:19 +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 BL6PEPF0001AB51.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Sun, 4 Feb 2024 12:13:18 +0000 Received: from pyuan-Chachani-VN.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.34; Sun, 4 Feb 2024 06:13:15 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v2 2/6] cpufreq: amd-pstate: implement cpb_boost sysfs entry for boost control Date: Sun, 4 Feb 2024 20:12:53 +0800 Message-ID: <20e12e10aac1854507eaf512591694cbc0789c43.1707047943.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB51:EE_|IA1PR12MB6577:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f27dbc5-3b11-43c3-de91-08dc257aac7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Gyayu5kmehZFz5a5CBmtka3oL9VdrxU9GBXaPvS5GxIg548qBJVo1lit7PXTcUXuMbuOGLyahO4qKYMPktO9kp+C2bokj9b9LUotvLewhn66GbHgeQi/Wb5dC1ZCpTMq/K69+bTvXwYDiKW3a3Vz0LLFeS5GOBSo/tauslvv78cB26QFBQBxGAYQLj8UnbYnKP5yAVvritjWcQ+f918fBIoDFA0uFl+YrXF09Ky/kGDOC+sD29BQWHOMFDeoMksViHulY+kDyHcPxx9lXwRcqtY9pWIwp79aX117rU7dL1AkxJOQN1o+1GubF21E8+DFp8uWLiWxhZYKz2OVfYV5FZNhihPEOUJFYlV/DCeAcmWJW73OQOhU15QjMjZ3X3QGvhSy3l6zxtJRKKxgPJabOffOlEqr+l8pBl9N0Ye4RIJxy6iAb0f38BZuewm784J7LEI6uS8OJM1U21QzaLqZ+6u1wYx1nDA4Nekf9nbQfCI+lz3CXhK1PZxUobBN3Mn3yi0/kvmO+mv2b7Hj+aKhbwu+SUktFLwLuI/xHuJ/KP5nk1hah0iqQlYRsKZecYN5chj51xUd1L5PpASSzOuUC+n5JPc60SCwtEyb97VUH0qqsoUyQHxn4SEmpzXuGjYfSiWOOspBqu6GdXHaZQwJAaJXrBSGq8ZWpudXidHYDchC19wNrL9BjntdST/ggyYtKfI89BPBZ6xkPsj6lLdbPHdtY800zi14gbFKd7zv11MCIqrCBUwVpbnF5hTnco9FUhkfNL8R5MVRpLCXp+iVT9xxcAuf+Vpl+LBzqYHKpDN6Z4f+R2WQRwzM+eiSsvshfhrMZkNlgasRKeAgr9ibDw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(376002)(136003)(396003)(346002)(230922051799003)(186009)(82310400011)(1800799012)(451199024)(64100799003)(40470700004)(46966006)(36840700001)(41300700001)(26005)(70206006)(7696005)(6666004)(47076005)(426003)(16526019)(336012)(8936002)(8676002)(44832011)(4326008)(2906002)(86362001)(5660300002)(70586007)(478600001)(966005)(54906003)(110136005)(316002)(83380400001)(6636002)(81166007)(82740400003)(356005)(2616005)(36860700001)(36756003)(40460700003)(40480700001)(36900700001)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2024 12:13:18.9335 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f27dbc5-3b11-43c3-de91-08dc257aac7b 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: BL6PEPF0001AB51.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6577 From: Perry Yuan With this new sysfs entry `cpb_boost`created, user can change CPU boost state dynamically under `active`, `guided` and `passive` modes. And the highest perf and frequency will also be updated as the boost state changing. 0): check current boost state cat /sys/devices/system/cpu/amd_pstate/cpb_boost 1): disable CPU boost sudo bash -c "echo 0 > /sys/devices/system/cpu/amd_pstate/cpb_boost" 2): enable CPU boost sudo bash -c "echo 1 > /sys/devices/system/cpu/amd_pstate/cpb_boost" Link: https://bugzilla.kernel.org/show_bug.cgi?id=217931 Link: https://bugzilla.kernel.org/show_bug.cgi?id=217618 Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 97 ++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 921324ab9580..018ea7cdda2b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1030,6 +1030,101 @@ static ssize_t status_store(struct device *a, struct device_attribute *b, return ret < 0 ? ret : count; } +static int amd_cpu_boost_update(struct amd_cpudata *cpudata, u32 on) +{ + struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpudata->cpu); + struct cppc_perf_ctrls perf_ctrls; + u32 highest_perf, nominal_perf; + int ret; + + if (!policy) + return -ENODATA; + + highest_perf = READ_ONCE(cpudata->highest_perf); + nominal_perf = READ_ONCE(cpudata->nominal_perf); + + if (boot_cpu_has(X86_FEATURE_CPPC)) { + u64 value = READ_ONCE(cpudata->cppc_req_cached); + + value &= ~GENMASK_ULL(7, 0); + value |= on ? highest_perf : nominal_perf; + WRITE_ONCE(cpudata->cppc_req_cached, value); + + wrmsrl_on_cpu(cpudata->cpu, MSR_AMD_CPPC_REQ, value); + + } else { + perf_ctrls.max_perf = on ? highest_perf : nominal_perf; + ret = cppc_set_epp_perf(cpudata->cpu, &perf_ctrls, 1); + if (ret) { + pr_debug("failed to set energy perf value (%d)\n", ret); + return ret; + } + } + + if (on) + policy->cpuinfo.max_freq = cpudata->max_freq; + else + policy->cpuinfo.max_freq = cpudata->nominal_freq; + + policy->max = policy->cpuinfo.max_freq; + + if (cppc_state == AMD_PSTATE_PASSIVE) { + ret = freq_qos_update_request(&cpudata->req[1], + policy->cpuinfo.max_freq); + } + + cpufreq_cpu_release(policy); + + return ret; +} + +static ssize_t cpb_boost_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sysfs_emit(buf, "%u\n", global.cpb_boost); +} + +static ssize_t cpb_boost_store(struct device *dev, struct device_attribute *b, + const char *buf, size_t count) +{ + bool new_state; + ssize_t ret; + int cpu; + + mutex_lock(&amd_pstate_driver_lock); + if (!global.cpb_supported) { + pr_err("Boost mode is not supported by this processor or SBIOS\n"); + return -EINVAL; + } + + ret = kstrtobool(buf, &new_state); + if (ret) + return -EINVAL; + + global.cpb_boost = !!new_state; + + for_each_possible_cpu(cpu) { + + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); + struct amd_cpudata *cpudata = policy->driver_data; + + if (!cpudata) { + pr_err("cpudata is NULL\n"); + ret = -ENODATA; + cpufreq_cpu_put(policy); + goto err_exit; + } + + amd_cpu_boost_update(cpudata, global.cpb_boost); + refresh_frequency_limits(policy); + cpufreq_cpu_put(policy); + } + +err_exit: + mutex_unlock(&amd_pstate_driver_lock); + return ret < 0 ? ret : count; +} + cpufreq_freq_attr_ro(amd_pstate_max_freq); cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq); @@ -1037,6 +1132,7 @@ cpufreq_freq_attr_ro(amd_pstate_highest_perf); cpufreq_freq_attr_rw(energy_performance_preference); cpufreq_freq_attr_ro(energy_performance_available_preferences); static DEVICE_ATTR_RW(status); +static DEVICE_ATTR_RW(cpb_boost); static struct freq_attr *amd_pstate_attr[] = { &amd_pstate_max_freq, @@ -1056,6 +1152,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = { static struct attribute *pstate_global_attributes[] = { &dev_attr_status.attr, + &dev_attr_cpb_boost.attr, NULL }; From patchwork Sun Feb 4 12:12:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 770006 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2070.outbound.protection.outlook.com [40.107.223.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF15122611; Sun, 4 Feb 2024 12:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048808; cv=fail; b=Lo76Wa8EgJ42OuwbFutokYI0Nm3s1qCl9unTwLTNqAVg5Z2ypKxLTrZo6MVzDkvf/RlDBGWhbIF8ICZpPWfw9FwkZZ/kMt93gbZBJA5mv16QiMcUc/ZmfHke7+IFr649ygCP3rcf2zrPFKt6NKjYtKIne/fM+eNZIkoewRjy7j8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048808; c=relaxed/simple; bh=p6YIHsEmshgVwr8zNfOSfQef6HC6yEn2zPDiz+IX2Ag=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X7JzhjlnhlJgVWfnAv920Ceazr+WMsOyMji7oV/xEs6g8tHZBhaajbVbFbWhIuFYErjwxTIu1UZwmxRMfAViFyx/V/sicXlazVfmEf+jLE0W3fWEGY3lcZ2Zpr9n1bd64+DtM05SVLP55zTBO4g/n5PZ85BwY+O/5OznAEagbpI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=Zgim8a67; arc=fail smtp.client-ip=40.107.223.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Zgim8a67" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S72Fa+3soRLfFgz7wmiWRI17TiAZZM1nf+fl5ZaWw4RBbb3LJpl6nBD+hYkzzJBzNCh15O8F4W7WKPRMTXnAg/STH+CGCe8XqRQ8h7ar4t1wDnVSaOaO9O79+ufQLgUrUTsmwG+V7n75NOjJlAQOzSOwk1sOGJ4JyMyDSEiLm7QzW1Hw4zmBuFPN+IsSuWaTF7jYm/GOXhPyZd02QQI8k9Tqvz4qS90YphN4tUQzihtq0QjBEn4NvYPT6pflb9jMCZCj8DBVD7hzQW1sIAax/03IJ6vy+7cXmyjCDP8Uu/1cM8dG7KgBjaIHGb5kT9m++1q0Mto1pOz/Ido6Raak3w== 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=yWSFHE4PdTXGLrLjlXsOIy8ChwaYmHvL0SlWmXp5usM=; b=V10VlAj0XU4K/j160pFQBLsZJxYBjDvYSLmg3SK5dxJ4gVm6o7JY1tR9LMXbQMzVlFTyz3qedgGnP10LTy2Kjhbop73UO0DGtxRKNUtMcSN3801dqg1vnw6QtF2H5FPT/kTRjji9m78f0IobZCT/UknwpbA/QV1IUtqUKbKWrgqlCwZ6fc1vdJxqtCV0LAjw0EGyabd6/jrqdo4z+DW60+9RZT8VvmjnBA/1i70hjwcairV+Q4y8aUsrj4us/vDHClNnu/9ynGzcuncn6aoI1XoBTPjPM+H3NKYnyPsrsauUYlY1mrJAVMJzgh+hgzkctaonMvTviR1+RjcyS0k1ZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 (0) 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=yWSFHE4PdTXGLrLjlXsOIy8ChwaYmHvL0SlWmXp5usM=; b=Zgim8a67ir1dZXAQiQM1RJhmO7fv+MS01uL5HL4ViW/Q7q+PZpT83R4J99JFsW49vdw/Pc1pLeT3XU8uIVgRUMqOPfrgh+dcFsX7vDO1/4RuWr8NM5A3j8ZcKJHIGQZP1fPgy7hhTNnFL5Ianm403eRSk9EGc4bDicIlIp9RmsU= Received: from BL0PR02CA0043.namprd02.prod.outlook.com (2603:10b6:207:3d::20) by IA0PR12MB7674.namprd12.prod.outlook.com (2603:10b6:208:434::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.14; Sun, 4 Feb 2024 12:13:22 +0000 Received: from MN1PEPF0000ECD7.namprd02.prod.outlook.com (2603:10b6:207:3d:cafe::4c) by BL0PR02CA0043.outlook.office365.com (2603:10b6:207:3d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.34 via Frontend Transport; Sun, 4 Feb 2024 12:13:22 +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 MN1PEPF0000ECD7.mail.protection.outlook.com (10.167.242.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Sun, 4 Feb 2024 12:13:22 +0000 Received: from pyuan-Chachani-VN.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.34; Sun, 4 Feb 2024 06:13:18 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v2 3/6] cpufreq: amd-pstate: fix max_perf calculation for amd_get_max_freq() Date: Sun, 4 Feb 2024 20:12:54 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD7:EE_|IA0PR12MB7674:EE_ X-MS-Office365-Filtering-Correlation-Id: e96db40c-02b0-416c-e2ab-08dc257aaea6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H31s0R243jN0YyX6Pgq2LSlUFs+WKq/bmlY8YArdDZxbZfJIbmg9QLNCOX9FulVOZDvBvmFsSpIrxWMYZbafV6fgXWNT0Z5W5h+XFOV2C+CUVenBMk1YHIv2bRqS130aENqmyLVPuYkonGEgsk9+iZFQ6SfS8btXtVSRAYFl83ZjIInMefcR/qDbYiHSWDan2WEHRVNjeAPs0wQAqkL+gDCj0w1CyjflI/zOjM+VlEGXdTtj3UrbJ1uhTHOLs9MrJgUIfKBjaIpwgF7DUKCyrPaZE98ZHGxh2Ixv5kobl+LQl7FpPfyjrEKk2DrOxloIKvogAhwhgNSI6MNnzE9JiaF5OKnx3UBm/9BuqdP7i0MYuq1sZEyl8G6/GsGTodH7vpf6I5iUtH+loYxNbXCHOxv7tLYPUGCIrkUdttEOAmCCFLzjCxU+GqixSCepZRzYAt19eGAexCl6jBb4+lSVbDhEZU2H4pokybtYAoap32xdkymr0XOLyOP2r8huSnhbPW/EQpfzJz0rxaKUAEMfgH+cEN7psfh1WRh959YGEUlLQ7a7AzazFxFGM83Ay7aVdeT4NbbYXQZP83+3bfbuvyXw3bffJ+zoTz02zhpLiRDE+OcQS4KFLAz/3C8c4KJtkfN5O1WWkDN4VinFSpRzeBxXQlDDagWuULMbFvj5KtHf6AWsF+z0VdRoK0QkDpNyi5G2KsVO4vsPM6b59pvPdOyu6CDlnaxPWvtGlat8wOFN45vkYn1iEJCR/2c0s7sSOK8iRjI4u/B6Zl5jiRH2YA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(376002)(39860400002)(346002)(396003)(136003)(230922051799003)(186009)(64100799003)(451199024)(82310400011)(1800799012)(36840700001)(40470700004)(46966006)(40480700001)(40460700003)(36756003)(478600001)(86362001)(426003)(83380400001)(2616005)(336012)(356005)(82740400003)(41300700001)(47076005)(16526019)(26005)(70206006)(54906003)(4326008)(70586007)(6636002)(4744005)(5660300002)(6666004)(7696005)(81166007)(44832011)(36860700001)(110136005)(8936002)(2906002)(8676002)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2024 12:13:22.5865 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e96db40c-02b0-416c-e2ab-08dc257aaea6 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: MN1PEPF0000ECD7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7674 From: Perry Yuan When CPU core Precision Boost state changed, the max frequency will also need to be updated according to the current boost state, if boost is disabled now, the max perf will be limited to nominal perf values. otherwise the max frequency will be showed wrongly. Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 018ea7cdda2b..107883cf0877 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -599,6 +599,10 @@ static int amd_get_max_freq(struct amd_cpudata *cpudata) nominal_perf = READ_ONCE(cpudata->nominal_perf); max_perf = READ_ONCE(cpudata->highest_perf); + /* when boost is off, the highest perf will be limited to nominal_perf */ + if (!global.cpb_boost) + max_perf = nominal_perf; + boost_ratio = div_u64(max_perf << SCHED_CAPACITY_SHIFT, nominal_perf); From patchwork Sun Feb 4 12:12:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 770255 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00CBC22EF3; Sun, 4 Feb 2024 12:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048811; cv=fail; b=P7GTxpKGU0dx5tgRiIbpIuJojYDNCs7wQqxZGTYPO8vKqcH2qIDhstaa7jVMdyRywt9EzaPPkPxRt6PJ7PD4WmtggYiq/BiOjepEP7yQmpt44pVhK/yVt8jnH/HbP07Prfpixfq0KRQ0eq0G0JJq/Ud+n1D60nDCkB+UzbquRsg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048811; c=relaxed/simple; bh=45MaXr3YTERkJ7DQfyH5UxPqRMS9l4cB8PlpR4qtao8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=n3v558vKYhVRRK2zdEd4tHehsL6pNZkMnxZOKFYalj81p+cZaLFy7oQogszJ26pnl4NCVE8x2Qd4WvdAZ2UOFEsMab/bXCXwedIq6fjHvSWqWlRvHYq9oeMaUw82P3H3lo6F0HkIj34mdoY2As1Dc6n8rfm+zjO1CZOEMzSmqzY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=dI6j23oV; arc=fail smtp.client-ip=40.107.92.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="dI6j23oV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eI0IyztVvmAJLvHgrPj8gXk157lhNIjVJ4FoJOFkLXroYvGU+Gb6pt50gVrcwX18t0hdi3mi0ubQ5wq8ITWzTi5exw0pUVhHnARtUyndoyqkQEN6sW+sdxE+lK0IZ9ffApa2oC4ArX9UEkukRomxoOQSi4HtXggVwQCnAlQlgtU5jc7XpEQzGBpmAPhxMIryAUzJjNM2/ev9YgdRoady2nbMgVx7GPNuX8TYgNjYwJ/XoETGopg+4yN0KnE4Ww8NlMjKDNIF84dg/m1rakIE9kaZ4jdAqZjbXaHYM9UvnWOyQtheIE1YZoCE6m4seO9TwsRP/vuH7dGmfKmE4sIYFA== 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=hL7/kDrDkDwifdCPz6m3yDHXFfmRl+0gGOZRFG1jIsM=; b=UrLRqcmtxqWLy9L9PrCYGGc8d+f2BBFaKo8BMzF/2v7B2xkedJOqmd2wfvSB+JVZWBm/bZfGpAR+rI003cRpYawy3IkZhsl05+hGUeZPpK7roKhmHPjdeUc/8d9OzR6LW4ZcJWv/tsgs0EZ2cuWguUBqvhr03YL1s8tascpSGLKgCgkr06A40ua0o1SjZ6KHBzMnxI9C1gQcT5Logv1TUI5kijGQZRdBBf+GiE7y/TFyuCdKne4wJErPQainwwu7GnFOKjv97LXEVokOjFZPMrt8nUtpEgQ6yka1UK3VsSA04lVBB8i1+K7wWdMN5t/PNm7q/DgchG1Q22Grp6HN/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 (0) 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=hL7/kDrDkDwifdCPz6m3yDHXFfmRl+0gGOZRFG1jIsM=; b=dI6j23oV986QjiQtxCW1SFF9R7FbgpkE2UAluyyk64pSBCIJH4gS7VnzUDxtdiO4l279TpVpEpeCDOSTCARBVHRK8ew+TK8Ynmb8Db7McyBU57/b16K5+gohJgh8zONRhAqOXW7tFtqNxkRighekdlG+Z9J6cakIxgJoKvS3Wrc= Received: from BL0PR02CA0046.namprd02.prod.outlook.com (2603:10b6:207:3d::23) by PH7PR12MB6786.namprd12.prod.outlook.com (2603:10b6:510:1ac::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Sun, 4 Feb 2024 12:13:25 +0000 Received: from MN1PEPF0000ECD7.namprd02.prod.outlook.com (2603:10b6:207:3d:cafe::3a) by BL0PR02CA0046.outlook.office365.com (2603:10b6:207:3d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.33 via Frontend Transport; Sun, 4 Feb 2024 12:13: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 MN1PEPF0000ECD7.mail.protection.outlook.com (10.167.242.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Sun, 4 Feb 2024 12:13:25 +0000 Received: from pyuan-Chachani-VN.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.34; Sun, 4 Feb 2024 06:13:21 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v2 4/6] cpufreq: amd-pstate: fix the MSR highest perf will be reset issue while cpb boost off Date: Sun, 4 Feb 2024 20:12:55 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD7:EE_|PH7PR12MB6786:EE_ X-MS-Office365-Filtering-Correlation-Id: 809e9b7a-65dc-431e-5b27-08dc257ab024 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XGTnsyJrKHt55XVEIPpi+vM3Kgedja2BJlhcGnpCjGhQX0w95hc/FG4VeIhiPe1GkUDmJHBGZSz4F9qIevEI892u1KaEgyBgdGteNPCOhf+WEWmelD/j93Aks9Gr7pelTnYUQ7sG0yAW1ULjvlA9IiVxYXShpf/dxufguWh06/WAB+erfKzp8THTBYXY/Ggo8rnOXBzGkYke4Nn4h7+/7mizenNy0CwodIl/NTOY/4c3ykrdye7OIv5vFcu3sW4CTlaFhmUoBpZKhBu4QkLSv/nEvmDae4vo61nIEFYcgInAUaBKB4vNwE7Kuea/zh6LXRSULLv7rKSD+tR0F1qztJgx/nkGJWfVySfFVouN7Odm8w74Ygvo9TZ2A67Z9l3e8Lbi/F4haVg66K0cHFEbSCeozYiiHFlfy5RDm5XGbn17WN+oZdb5Gg8gWvL/ct7gRfHTwNkjxpvH/9wfm8XZooJTIq9rj/4wUqfL4GyM8/NNAsH/S0C5HO7z8mGzK9RxSC4TmTVNEz+wLhIBbuHhhlujC0iBn4PyLyWJvjILipBuw6ZFPeDAdDfEJWJagNXcqtWbmw9YKhiKzCaBSXxg6mEw5ElG1J2Acv81Xlc3laEJLJtd3RFzXanAYjZ0J2CyUqeaatTtNsWXJHxPdVuXfa0oi2A7RhZSJ5UpuAzsZfpzC4QLDuyCkX6R7HjgCfcrkWZ5ba1QjRtjPpK5OtxB4qYi6bdrqKTn6eLQKI8E1FRcX1gsa8MNTI6ZDNDy5XJ6n5JcjwGk1N48U+uDfYVQ9A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(136003)(396003)(376002)(39860400002)(230922051799003)(82310400011)(1800799012)(186009)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(2616005)(36756003)(6666004)(7696005)(26005)(86362001)(41300700001)(36860700001)(82740400003)(356005)(81166007)(83380400001)(426003)(336012)(16526019)(478600001)(47076005)(8676002)(4326008)(8936002)(40480700001)(2906002)(40460700003)(5660300002)(44832011)(70206006)(70586007)(110136005)(316002)(6636002)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2024 12:13:25.0709 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 809e9b7a-65dc-431e-5b27-08dc257ab024 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: MN1PEPF0000ECD7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6786 From: Perry Yuan Select the min perf to fix the highest perf value while update pstate CPPC request MSR register, here we need to limit the max perf value when CPU boost is disabled in case of that highest perf value in the MSR will be reset to original highest perf value which cause the BOOST control failed. Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 107883cf0877..02a76b8fb298 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -443,6 +443,7 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, u32 des_perf, u32 max_perf, bool fast_switch, int gov_flags) { u64 prev = READ_ONCE(cpudata->cppc_req_cached); + u32 nominal_perf = READ_ONCE(cpudata->nominal_perf); u64 value = prev; des_perf = clamp_t(unsigned long, des_perf, min_perf, max_perf); @@ -458,6 +459,10 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf, value &= ~AMD_CPPC_DES_PERF(~0L); value |= AMD_CPPC_DES_PERF(des_perf); + /* limit the max perf when core performance boost feature is disabled */ + if (!global.cpb_boost) + max_perf = min_t(unsigned long, nominal_perf, max_perf); + value &= ~AMD_CPPC_MAX_PERF(~0L); value |= AMD_CPPC_MAX_PERF(max_perf); From patchwork Sun Feb 4 12:12:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 770005 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2048.outbound.protection.outlook.com [40.107.243.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1557323758; Sun, 4 Feb 2024 12:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048814; cv=fail; b=bHk4YRYk3cg+vkV5qSoITtrY4MzS9h8booPwxgthnlH462LJaWsFPeb6S9/8nsnu5Wnwze3FT3bD9IJFRc/wvRPfACE5GF6zrmuGAVWD8OB5Mm6bCHOB8LCi/DR3jwtBWR/Q3ezTz0QRPXXLFtj0A6JA1Zfs1lBFdvLs1FCW7l0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048814; c=relaxed/simple; bh=lfnMTuSxQRcmVz1JYUsbXFPCaH3u40OXwehJzgE8ZJ4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tlVoqs7v01Ggr3o3D10bXMPIhnvoBui94FI9o1AcbklovtZSRo2wIDu3RgozcKdQHUtSUcB98l3tX7rKPP1wk6o7WhYALcA0ygvlOFcUk7Ur88se01gqLXaM5pWL5lTlkijYXzMDZbcjD0kxZDXuURMT03fcrMRlnmq4S3zFPZQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=liW9hAAp; arc=fail smtp.client-ip=40.107.243.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="liW9hAAp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qsx+ocgDEJG1fRuUkLz2+RTa3/GeShb1Yht8VqNqehmN1VlBRlrm6tlbyx0kbCRjfaTpc37luHP5cfMeJbUKW+ef2+0R+ovVbM0HWouAvgg8fgx8pDrZ0UVtQVrvn7xAmeeGB/2UUXIvRH7zkf2c+b4eOlSYqiLaL6c9YloQpQGFITlv1FU6NZB23dmz692f4ssR9FhcqT/dteM3Mx4bg6e8XR4xyOfbS7+09fz+0vkT2JhmvogYj9d75OEwib7KN0rYnIGRpQoSQqyCnBzAsjRnNVGeb17fC+9YHje9ki0dK8+qELGqHZ08xlNF1ttHiKQnzTIwvbCjC/fHDVfhHg== 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=WBO1HGna17IntBRshMuW9ckvitloaQt5inNr20K49PU=; b=GVdsW0+mi57xc1qETCh3THXVMNy2RtOwlq+sNNA25U9/Tn4E91AlpJaisyRxP9+deF1C1BG6fCt6L2xI9rA1GcDEzhb7InJx+X2p7Nw9InKhaoYOFNZfH+RzS+UCg6jUTrHQg1aS59tmyoqNkhOIVUL9bBWeuTu1YeG2UvzIytSZx5paKTu/ce0o7kiwX4coviv5Ias6AlJvh84KiB5kLl8hWAtkrww4l4HAC8m5bi2yJFNMzufM9/3xahO6zWDPw/y53eXbcffrEEdW6TstIgP4MSvt+yn3FvZCfcJegignZtApCaXtaldnOo82GAdohwN7mFBjOA1gG0jS9tYRHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 (0) 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=WBO1HGna17IntBRshMuW9ckvitloaQt5inNr20K49PU=; b=liW9hAApOPHGvs1MOaEsejcO9un1iZJGenc35I4AftqmJw5FBn2YRu5+lN1+L8dq5HiR+DKV/JSu6cBks3vTn8Jf1oTHE7I0OA03qr+wmdrVFTJ1a6a1LTatPM2C4HdEbR89qv9VyNWSAliyZg0S98Td77kUZUli1uuSXZ43ROY= Received: from BL1PR13CA0125.namprd13.prod.outlook.com (2603:10b6:208:2bb::10) by SN7PR12MB8131.namprd12.prod.outlook.com (2603:10b6:806:32d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.15; Sun, 4 Feb 2024 12:13:28 +0000 Received: from MN1PEPF0000ECD8.namprd02.prod.outlook.com (2603:10b6:208:2bb:cafe::1b) by BL1PR13CA0125.outlook.office365.com (2603:10b6:208:2bb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.14 via Frontend Transport; Sun, 4 Feb 2024 12:13: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 MN1PEPF0000ECD8.mail.protection.outlook.com (10.167.242.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Sun, 4 Feb 2024 12:13:28 +0000 Received: from pyuan-Chachani-VN.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.34; Sun, 4 Feb 2024 06:13:24 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v2 5/6] Documentation: cpufreq: amd-pstate: introduce the new cpu boost control method Date: Sun, 4 Feb 2024 20:12:56 +0800 Message-ID: <168bbc442811eece69a1c4a0353c23fd349db235.1707047943.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD8:EE_|SN7PR12MB8131:EE_ X-MS-Office365-Filtering-Correlation-Id: 1eaca03a-3ce4-474a-d2ba-08dc257ab1f8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6zLH1Y13YGDwJ0Ik0hYu1Q0SmRtJ9pcikY21jFuD6y3EkhV/qOHRIeDqbAoFx9i5G913H9xeKEsnTchM/L3R5XTP34uFAMm0OjcNtjUa7ovCUBVViEabwBSO2wtj2k7jN9tACzEpjWVRVN17apRpcHEaPpriXuOtcviXOBNlaV40vtCNHi+Wh65NujgUEv6Q/yRVcgFyZqQ5vqnynrekrG8nz4H7hViDJZhwGPdmnkSoF+hysLJbtiiOMb2XbLuBDdC06+kcMOvNtQdaeWvuGobRfUKdo5E9Kog/uQv5fhfXR58iw6LXcBpDrJaqC6cYc5+XWRI7CBRoMRLs7nbK29UwoE9QrV326yCVktrW4o5Dh9XxHUfTwp6djgo22Ew3L8C3NZwZ4yX0dMi7n9t4X1pqqZA8T0ANjxk/dDzkVQVjfhZzoXrtA9dbg8w7LsRDOcuwMgQsxVZ7Ryv76rueHnBwZaQRmwEfO/FfvYGNHOsTEZWiUpucf291A8zwIbkMLmH++lyAHbWPE4vxWxd+ZkRj802neUORgw3YGwCZq3ZFqIDHVoKn/c795lbr705hkJHEHc6OXHc6+9WaRK5TXgGYn9vf4Qmg8rFnUSrd/3hDS6tIZDX3mb+1HI7RiaS8aJ2XVcsB6qpsKQPjnKGe4tCY9n8VnlMXPpGGN8QjrmGQcdVZg1QcOwFV5TUwi6Ef6tmao+RV1/fnN+yJGhFav76yO2NdNXQwuFV93QkhjWI8QnahB97+2Dmza73stNAaxfFRRG8gBY5S/cSKDS0Cmg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(396003)(39860400002)(136003)(376002)(346002)(230922051799003)(1800799012)(451199024)(82310400011)(186009)(64100799003)(40470700004)(36840700001)(46966006)(47076005)(26005)(83380400001)(16526019)(2616005)(426003)(356005)(81166007)(82740400003)(36860700001)(4326008)(8936002)(8676002)(110136005)(70586007)(5660300002)(70206006)(6636002)(316002)(54906003)(2906002)(44832011)(6666004)(336012)(7696005)(478600001)(36756003)(86362001)(41300700001)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2024 12:13:28.1411 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1eaca03a-3ce4-474a-d2ba-08dc257ab1f8 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: MN1PEPF0000ECD8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8131 From: Perry Yuan Introduce AMD CPU frequency boosting control sysfs entry which used for switching boost on and boost off. If core performance boost is disabled while a core is in a boosted P-state, the core automatically transitions to the highest performance non-boosted P-state The highest perf and frequency will be limited by the setting value. Signed-off-by: Perry Yuan --- Documentation/admin-guide/pm/amd-pstate.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst index 1cf40f69278c..abea29ba3d54 100644 --- a/Documentation/admin-guide/pm/amd-pstate.rst +++ b/Documentation/admin-guide/pm/amd-pstate.rst @@ -385,6 +385,17 @@ control its functionality at the system level. They are located in the to the operation mode represented by that string - or to be unregistered in the "disable" case. +``cpb_boost`` + Specifies whether core performance boost is requested to be enabled or disabled + If core performance boost is disabled while a core is in a boosted P-state, the + core automatically transitions to the highest performance non-boosted P-state. + AMD Core Performance Boost(CPB) is controlled by this new attribute file which + allow user to change all cores frequency boosting state. It supports both + ``active``, ``passive`` and ``guided`` mode control with below value write to it. + + "0" Disable Core performance Boosting + "1" Enable Core performance Boosting + ``cpupower`` tool support for ``amd-pstate`` =============================================== From patchwork Sun Feb 4 12:12:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 770254 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2059.outbound.protection.outlook.com [40.107.237.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6053524A13; Sun, 4 Feb 2024 12:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048819; cv=fail; b=c7TdyxxzKMC/OSgP+TLk8qAdNMM22HMmPeXgGBRzD0GOCf6r/to1H9/COUzv5foIfJAa94A5lIZo/F7BzUE+EnVpOx0CUMnvps0g4xRX6x/n1p+34PKve9NQeUZKdVmp83uPmK8VwXSa4wFuXZgMtkOqxwuTEAJRAPYmNHFekQk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707048819; c=relaxed/simple; bh=SfOMU7sqP7IWAY5QPMluTtzgpipdi53spr0DF8MYbgw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GHCj5qNs5aOjlyeveLHTZC2kFGu178KxL53creWgY8oLL/Dq65y5jqGvzJD08y9VSTjC6V7GTADiu+IEsxTO70jK6Nch1xRun1j6azssFU7poXiknG73Yf8qX7kjm5wd/nS8SwtShttCX2KH+pSv6spMiqW/9dK4gWsfs6wNtac= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=iI24y+8V; arc=fail smtp.client-ip=40.107.237.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="iI24y+8V" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oc8wz98gbTxDnzTwGrZTwK1JGzRHk/FsORNYPCP3zJkw52SZo2Qy4BkkH2wyzp2Dt9mZGtwNtY1cRaQZ1i/QKqOD1EBH7cJGLIM7y7s5LzKb8fFyPqyPr0i8Qmub+GDxadZny4ccQ5Mpr8KYP402D/uQSqgAOnFP2Ct5dh/kRW5rzeAeedgHk7l3sNKVc1l8/YtS+boL0Np+5NyIsPmQ5T5aR8fKidLL201bp5+j2pKcOR9O/osYZ6ena69mH2WIoaYP/L83soGkw12424jYEjOszrNAWljeNudCS2+PoKbl01ff1iostY8alyUWFR9GyS0I9msjhq+T4IqDfPkpXw== 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=5zCI8pIG614ER69xydgIMnJNCLI28gBf+TOBAAw0E8I=; b=cbG0uVrdjbM3/chOKjqEs1tNkeuQGY8Y+7hwWemJqUwzCRpdISLafuHGzm6Dxm5wrlnBUb2OjW8b5017gPyNxCG1l4I1vnTC2WriK/k9om3RngsQK5QVJhDxxbt1aI/wy9fjuixryqcfgi2irO08ZzjdgbyNzm63Bc205pNVsj/zfPI8oDwWwwunXyuFVrwUUSolJ8ppqGTRW1+G3wuxFZRJNRcqrbKVZzleS9m1+V3Vj51rE+5j9ZpZggFpdq3OhSLkwgQY2Ls/xBJ4JKIc0i+hgpUJ95SGQsX3GhniPLYLowMzgZcViZjZ3aI60PRfgcJY9IjcWNIYwJMeF0/Uvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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 (0) 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=5zCI8pIG614ER69xydgIMnJNCLI28gBf+TOBAAw0E8I=; b=iI24y+8VDyNvsvfDpCL4GeYOMWaw68Ef9pwcqvH2e1oiiRnQSELg5eC1F8byCYQgtBFrO6YQfAvXtWZNhqhDACb3y7tc342Fy8EItp5i6gyQ9IUJK+CSo3vDfLR/1IEcNs5eTQ1ctg7lH/X9n5JCbZD1NkDQ41J83a+eNzHBqvU= Received: from BL1PR13CA0133.namprd13.prod.outlook.com (2603:10b6:208:2bb::18) by IA1PR12MB7733.namprd12.prod.outlook.com (2603:10b6:208:423::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.15; Sun, 4 Feb 2024 12:13:31 +0000 Received: from MN1PEPF0000ECD8.namprd02.prod.outlook.com (2603:10b6:208:2bb:cafe::b4) by BL1PR13CA0133.outlook.office365.com (2603:10b6:208:2bb::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22 via Frontend Transport; Sun, 4 Feb 2024 12:13:31 +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 MN1PEPF0000ECD8.mail.protection.outlook.com (10.167.242.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Sun, 4 Feb 2024 12:13:31 +0000 Received: from pyuan-Chachani-VN.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.34; Sun, 4 Feb 2024 06:13:28 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v2 6/6] cpufreq: amd-pstate: remove legacy set_boost callback for passive mode Date: Sun, 4 Feb 2024 20:12:57 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD8:EE_|IA1PR12MB7733:EE_ X-MS-Office365-Filtering-Correlation-Id: bc7b8f1f-c431-4935-d081-08dc257ab3dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PGN+z9lFddyRb9dwOyeBboYezJn+V+tTVQDMxdVq3lKVc9/XBgf+KYHiSRbC1oId4KXZ8+4kb0RrUpF9S/xfRd/5O38wNvv4zjvoG0gvFjUesxfRzwk/iehGgAutyeCZQjcMuGUW1iM/MXOnDFFhJAFNf4bjgO5NsLzPl0T3oRtcFhzOnKfQ1n2bDppDTaNHrQrT5sJKEFgkNKi9XiZtZIBOvo/pU7+AHVQzv0QgJLzAEzdqawtpi/JIuRNCxTqq/k7/7sVvF0c/yU6UJ1ugKTsc294CYwg4YYVcZhAiibXBuT67iOWYu/GrTUsOBUjQKGQUkRk9OtTUhxA4yxMt3o6eNRMYhkAp6cizoV9QW6e6URZ2z9lfDPFwbHsk0fWRlLnlagfvwXyxLKdzrJZEWjyupGHDHYGzyTH3fmG4q6e5w2oBz5/AqlH0WKDMQM23fG6pxKOkTVDt/SDKutWhCw5/5dtNdie08sciF79j/mf3VaHSbMLxR15J6BDFXK5+mvHRFriOoMw1tSHoR75ioWV+YCdRw3MtfwifdrB37Erf5hVyLFoFxZsyyyZBLCTacihj3xuoBzxISk8c0ubaICj/YvxUq1AHGfIR4YeQMu/xSFTxr+HNgypFwgcBDOuvaDiGwBNe0FShm7hbuH1ahvT9TQ45D4aCz1taDhDZyy5DBRXBNwRnlx2hh1kE5evnb/xaA2gxkaPVsj20aUvS9Ua5avReRdN0APUee0OouUoC6f/Oh95vCLlvKKn0vSUs/W/ug4GlStwmKFoiWnyXHg== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(346002)(39860400002)(136003)(396003)(376002)(230922051799003)(186009)(1800799012)(451199024)(82310400011)(64100799003)(36840700001)(40470700004)(46966006)(478600001)(47076005)(16526019)(26005)(2616005)(336012)(426003)(83380400001)(356005)(41300700001)(82740400003)(36860700001)(8676002)(8936002)(54906003)(110136005)(70206006)(316002)(6636002)(5660300002)(2906002)(4326008)(70586007)(44832011)(6666004)(7696005)(81166007)(86362001)(36756003)(40460700003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2024 12:13:31.3129 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc7b8f1f-c431-4935-d081-08dc257ab3dc 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: MN1PEPF0000ECD8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7733 With new freqency boost interface supported, legacy boost control doesn't make sense any more which only support passive mode. so it can remove the legacy set_boost interface from amd-pstate driver in case of there is conflict with new boost control logic. Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 1 - include/linux/amd-pstate.h | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 02a76b8fb298..4e377efdd4ed 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -1492,7 +1492,6 @@ static struct cpufreq_driver amd_pstate_driver = { .exit = amd_pstate_cpu_exit, .suspend = amd_pstate_cpu_suspend, .resume = amd_pstate_cpu_resume, - .set_boost = amd_pstate_set_boost, .name = "amd-pstate", .attr = amd_pstate_attr, }; diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index 446394f84606..66d939a344b1 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -80,7 +80,6 @@ struct amd_cpudata { struct amd_aperf_mperf prev; u64 freq; - bool boost_supported; /* EPP feature related attributes*/ s16 epp_policy;