From nobody Fri Jun 12 18:57:36 2026 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) (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 A79F536404B for ; Wed, 13 May 2026 04:42:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778647348; cv=none; b=uMmA2ULRWqEfn2QbLeLsfZ0QHKsheNh9Q/yKuxs23tWx/tuuOy9UKEd/LkJIWWo0uf/qpaBQDVh+RQWq3RbzjRakOl2Pi50lCR2LXCeOYUrqPA2QRfRFeJKQ0wtibwRzccwj3P/0sji9agNpKltkgwgfj+zsEx63VUW6ChI8tuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778647348; c=relaxed/simple; bh=oULNC3UZCvjN2UcusK8Nb9sPh9TgG408pjBtAGXwaIA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Xj3c8Aw/x37Ojvb/wUVoJEYI8KMOfVqDYNYMzt0j0Dov5HWbVSbo5BbVqr0728OnoN8SswOfUDIp8lhSsUtLI9rcZ9S5jkpoK1X8+z4MWCYh2k9d69EsRcsC2vNeheISdNGpQ00DqWWrCJ2Tx+fidfN4MyOYV+x+G27aKTtzq5I= 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.193 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-f193.google.com with SMTP id 41be03b00d2f7-c80148ae949so2744467a12.2 for ; Tue, 12 May 2026 21:42:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778647345; x=1779252145; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GUZqKHflH2DuRsg4tco5F2JeMX5q65irGwlJ5N7+VuA=; b=fQpol6P0Rf84m1RTg7fJI8MBIpLcp04Zj9W3CyXTCdl94lGMCMTxtNqhAdIQ0SCSE8 4xU+TjqKxRoqD4GgzwwMUBLKdRlt64G807qMouI3oEu9xB22iZU3NDMBBM7LWxbf5Ej4 klJjvsMGPKp3kLKFVF4Zo9YpFnfNtbptIb8Bd1G8sJSAGcFKzCCPOrQsqDYuKDBmPjeA vYCq+hrnwPO48YyIKQsVvsb9wyt2HpY6/16iPben/ATl67bT8gM93kN/h3VE5ednYHyd y0XXzIUvp1WxxIhtac6OzE/CNxVTrcjvFDmzE+doty3UIRPKZF8uYaVbZc7NxmLunNrh sBsA== X-Forwarded-Encrypted: i=1; AFNElJ8DmiddRGz3PVN3wPn77goCIjGLRHI0vVsaFP1ZkrIBQwRKcuBtgqNJ9tGj6Zvkyj9lCgx7NsLkLFc3i7Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yxh4cUuifbE0RpWVy7kLVvsQoVbrUmIG0g5fxGN3ycl7oa0n2cQ pCqt5iV3J3TsgTgJpWIvtXNusW5fYjBOH/QjXSHTx+rRRwztiT0A9TK7 X-Gm-Gg: Acq92OF86pRljrgpYAiRnL3blPOSMI+Kn23WCZMKmuxSiU9bpbR9OfbbFxNFTY3nuSz fjNTJZhEordW5WV7tqE3UXDyV2c0r5y5rNlEOaAjkRbEdZuVHHzaLaz3YZguuFV+pqiXbZOrLAk pC6Flh/mVMiVMoqXrX0EuAP92ynWJRgKtiKJ7GKKbYmZGQimU00iyZJ34+fd8MYHBQkAGSjaryS WHqRzDBkjx86FsLUsh08zN+0WK0mZf8gIq1R7pGHIta8aW11LnQYEs7cQg4GUnG9VkYUjhfQoUd iXwIxdus6JMfEurX5vo11a2ETlQF6f29mWRlGL3AGRR6+DiojTrovWXUMen6/ehthdMJkDJG3zv LJfXrFNptJdkL0OVtyrrWBE0Al4o6pRZ14ataiN8PC4zI4oD/OAcDY+h5y9NcdEmUY97BSQ2s6o QDtDwFQxLrpX0BMsxnhwJBB79JluoYrgwq39f9V9zkUs5u X-Received: by 2002:a05:6a21:107:b0:3a1:1120:796e with SMTP id adf61e73a8af0-3af8187657emr1851509637.41.1778647344746; Tue, 12 May 2026 21:42:24 -0700 (PDT) Received: from kylin-XiaoXinPro-16-AHP9.. ([116.128.244.171]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c8267711513sm13445457a12.16.2026.05.12.21.42.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 21:42:24 -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 v4] cpufreq: cppc: mask Desired_Excursion when autonomous selection is enabled Date: Wed, 13 May 2026 12:42:08 +0800 Message-ID: <20260513044208.161607-1-luoxueqin@kylinos.cn> X-Mailer: git-send-email 2.43.0 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" According to the ACPI 6.6 specification, the Desired_Excursion field is not utilized when autonomous selection is enabled. In this mode, the bit is architecturally ignored and does not carry meaningful information. Currently, the kernel exposes the raw Performance Limited register value to userspace through the cpufreq sysfs interface. This may lead to misinterpretation, as userspace may assume Desired_Excursion is valid even when autonomous selection is active. To provide a stable and semantically correct ABI, mask out the Desired_Excursion bit when autonomous selection is enabled, so that userspace does not observe undefined or misleading values. Writes are left unchanged, as the field is architecturally ignored in this mode and write attempts are harmless. Signed-off-by: Xueqin Luo Reviewed-by: Pierre Gondois Reviewed-by: Sumit Gupta >, with a nit --- v3 -> v4: - Address Sumit Gupta's review comments by reordering the error check and simplifying auto_sel handling in the perf_limited getter --- drivers/cpufreq/cppc_cpufreq.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 7e7f9dfb7a24..d2f86df06129 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -982,7 +982,34 @@ store_energy_performance_preference_val(struct cpufreq= _policy *policy, return count; } =20 -CPPC_CPUFREQ_ATTR_RW_U64(perf_limited, cppc_get_perf_limited, +static int cppc_get_perf_limited_filtered(int cpu, u64 *perf_limited) +{ + struct cpufreq_policy *policy; + struct cppc_cpudata *cpu_data; + int ret; + + ret =3D cppc_get_perf_limited(cpu, perf_limited); + if (ret) + return ret; + + policy =3D cpufreq_cpu_get_raw(cpu); + if (!policy) + return 0; + + cpu_data =3D policy->driver_data; + + /* + * Desired Excursion is ignored when autonomous selection is + * enabled. Clear the bit to avoid exposing meaningless state + * to userspace. + */ + if (cpu_data && cpu_data->perf_ctrls.auto_sel) + *perf_limited &=3D ~CPPC_PERF_LIMITED_DESIRED_EXCURSION; + + return 0; +} + +CPPC_CPUFREQ_ATTR_RW_U64(perf_limited, cppc_get_perf_limited_filtered, cppc_set_perf_limited) =20 cpufreq_freq_attr_ro(freqdomain_cpus); --=20 2.43.0