From nobody Sat Jun 13 08:49:36 2026 Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA2AC395DA9 for ; Fri, 8 May 2026 11:19:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778239201; cv=none; b=AsI4aYsBnBA2Z0YUHRD1TAfY8nGsxH8tMh4+NJzR+P1zKiB5dISyynYQvXVSufPJY0olnnSe2Fb53LlFUVSuuL+s8E/w1uYs2XKipmyQJTUgQKx569RSokmDcDpJWxtwnvdh1WEGDRK6G9eK7V4UK9Qu04Z+CIOSomxTaiwOIZ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778239201; c=relaxed/simple; bh=m9n7BT25+vHH/n7hjui+1I5GdOQU4U+9Q5f0iR5AvOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b8BnQjHMqhy0kvq7kuZv1BQ5ySYmjIjQ+dHy5lCBr22xdhsA0uxvcczfLJ241hRYhpmwqw8ir9LKfBFd3j+nY9HuPD/xhQ8MW7JJQ3vQ/Lpvft+ll9WN1WodEtTGT3/X+iogr4SQYaX+Y4ubIQgbpPHk5cTQALSBO3Wckq2up7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f194.google.com with SMTP id 41be03b00d2f7-c8021c8c42fso714167a12.3 for ; Fri, 08 May 2026 04:19:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778239199; x=1778843999; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=4mVqzfOQgFkCVMi9YwAzQslL8I8SYFxWQkm2YEukEH0=; b=iQUBMc7VnTGZSJ62p+WpZYEkkvHo8k2pFr3ygZNF2Rcm1RpBmUibkoEzCrUwTWUxgQ tCJoH/xbwImXAGVNEcAh/dMbxpMS3tMTKIDVQSgFZyJtRbDsoArwgPgXc0+5uqwTydnZ Yu+Fp2gO3Sd2ukJNgJNOyqobCZJ6Pw3PcKaGpZHWSVIzayV5sFQWuUYBuzYWofz4W4fR GuRxanGHelpn5OP8I2G7vkKtwMQz4BHz/cnNtejbRb0F5SwMmILs76tFX/6xPdhoFYVO 6sOARfzHdjHBx+O0hcZ6vRYPjFulie+XE/DgSMt6c1Kaz6O010b0H71ephWNa+cLDwnu 1TVQ== X-Forwarded-Encrypted: i=1; AFNElJ9+om8GVeHNMUxYdHv02DYkZUaNS/B9IsOSnvyZ2X+k+e+8SyVuEGaevufUp5hJGN8N3VlzBg30hG0FdgM=@vger.kernel.org X-Gm-Message-State: AOJu0YyVj9RsowTUsCXByQmbHiDQtrUsvngDiYUk9RNLlLk42BIbtYbj bh+0xSoNK22jHisOMe1fUIWpg+aDuPefV+Q5bWR96AYyV9cpQnEqvjfK X-Gm-Gg: AeBDieushrW3/e/nT1vOnVitLRxEpVWJuBSjatP4dVR6RedXpGD/IsmwtIB6yiQm65o p7pVkpKRHexrQnBke4+mvwHeCItueyCyhljTvoZ4xxeOIZBzfD5lGoLFwFWPN/I5kDXFtdffzI2 vUw02ieKzSRgRyLtxa2B/KEq8uFB+3p7m6+iAYVhr9PDedZlo8pEWK8mnJdUF957VJ6DAaG2SFj SaoSGDhY+oOAMuh5XJFWYwlKlZ6dk1gBnw8KB55MHaZD3SXxBQxmFge9RRLVviEiekUYidy2eZ0 A3c3DgdtE/1hbY588gYt7xDQJYwjcrWZGG6ArFrkZkpYZ5OBFXGcAclJ+FNU9Cf+iMHYutvyaXs MtbMjZpAB6Oa7wN46T+AoEs/sBFBienw3SJAqCbIY9XEUCGSrjRoHyyEDQgZU3T4ablO76PRJrN eassnPr4cW6aiTeZaiM3A9iPK3BOinUPPa7KWZaUYW2Fo4gdmxiR1VkfIdyEB6P+sD398= X-Received: by 2002:a05:6a20:3c90:b0:3a1:90fd:dcd6 with SMTP id adf61e73a8af0-3aab16e9e2bmr2827928637.31.1778239198883; Fri, 08 May 2026 04:19:58 -0700 (PDT) Received: from kylin-XiaoXinPro-16-AHP9.. ([116.128.244.171]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-839683a088fsm11947041b3a.58.2026.05.08.04.19.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 04:19:58 -0700 (PDT) From: Xueqin Luo To: rafael@kernel.org, viresh.kumar@linaro.org, zhanjie9@hisilicon.com, zhenglifeng1@huawei.com, pierre.gondois@arm.com, sumitg@nvidia.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xueqin Luo Subject: [PATCH] cpufreq: cppc: Add update_limits support for Highest Performance changes Date: Fri, 8 May 2026 19:19:32 +0800 Message-ID: <20260508111932.185886-3-luoxueqin@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260508111932.185886-1-luoxueqin@kylinos.cn> References: <20260508111932.185886-1-luoxueqin@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ACPI CPPC specification requires OSPM to re-evaluate the Highest Performance register when Notify(0x85) is received for a processor device. Implement cppc_cpufreq_update_limits() to refresh the cached highest_perf capability through cppc_get_highest_perf() and update policy->cpuinfo.max_freq accordingly. When autonomous selection mode is enabled, reprogram the runtime MIN_PERF/MAX_PERF envelope against the updated Highest Performance capability through cppc_cpufreq_set_autonomous_perf(). Signed-off-by: Xueqin Luo -- Changes in v2: Please ignore the previous version. Fix variable naming issue causing build failure --- drivers/cpufreq/cppc_cpufreq.c | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 7ddf4296c474..09c7f2ba0540 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -873,6 +873,50 @@ static int cppc_cpufreq_set_autonomous_perf(struct cpu= freq_policy *policy) return 0; } =20 +static void cppc_cpufreq_update_limits(struct cpufreq_policy *policy) +{ + struct cppc_cpudata *cpu_data =3D policy->driver_data; + u32 prev_highest_perf; + u32 highest_perf; + int ret; + + guard(cpufreq_policy_write)(policy); + + prev_highest_perf =3D cpu_data->perf_caps.highest_perf; + + ret =3D cppc_get_highest_perf(policy->cpu, &highest_perf); + if (ret) + return; + + if (highest_perf =3D=3D prev_highest_perf) + return; + + cpu_data->perf_caps.highest_perf =3D highest_perf; + if (cpu_data->perf_caps.nominal_perf > highest_perf) + cpu_data->perf_caps.nominal_perf =3D highest_perf; + + policy->max =3D cppc_perf_to_khz(&cpu_data->perf_caps, + policy->boost_enabled ? + highest_perf : + cpu_data->perf_caps.nominal_perf); + + policy->cpuinfo.max_freq =3D policy->max; + + /* + * Autonomous selection mode uses MIN/MAX performance as runtime + * hardware control bounds. + * + * Re-program them when highest_perf changes. + */ + if (cpu_data->perf_ctrls.auto_sel) + cppc_cpufreq_set_autonomous_perf(policy); + + pr_debug("CPU%d: highest_perf updated %llu -> %llu\n", + policy->cpu, + prev_highest_perf, + highest_perf); +} + static ssize_t show_freqdomain_cpus(struct cpufreq_policy *policy, char *b= uf) { struct cppc_cpudata *cpu_data =3D policy->driver_data; @@ -1027,6 +1071,7 @@ static struct cpufreq_driver cppc_cpufreq_driver =3D { .init =3D cppc_cpufreq_cpu_init, .exit =3D cppc_cpufreq_cpu_exit, .set_boost =3D cppc_cpufreq_set_boost, + .update_limits =3D cppc_cpufreq_update_limits, .attr =3D cppc_cpufreq_attr, .name =3D "cppc_cpufreq", }; --=20 2.43.0