From nobody Sat Jun 13 17:32:58 2026 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (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 182233EAC72 for ; Wed, 6 May 2026 10:18:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778062733; cv=none; b=KJBr56llbSEJ4fophzle8K0gc9uE8+ZmCIhpy2sBO31ObHgLg4EpdCbzvinrozUEOEJ4XKmrPPjg2+08eccejkgPNdh3gsUcRPyCQHmBFlbJVmepQyscH6+VO7+fvEhHpiU4j/At2JqIYnQZfqySZZYL1NQ+gYZBH+Ath8dsOqM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778062733; c=relaxed/simple; bh=KbpXX1Ym1bmxn0ZLZ/2SX9JWOdVZecC6m9Km1cJugQM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DajKw+03voVy5NWsv+Q5ag/8oeej5z5tClDm8gi2BiSzJ8eu1uMh7Np3Sai9FQbrT/L8+wUZ89QyueAnde7P1nLeruAXxj1gggsl3JZzuIVXVKGURbIgzoh6U3fu+UoYNBa/m6vQj1mOTGaa4CStlWBhZm7C98uOJ3d05i0cfA8= 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.210.195 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-pf1-f195.google.com with SMTP id d2e1a72fcca58-82fa8d6425bso2839423b3a.0 for ; Wed, 06 May 2026 03:18:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778062727; x=1778667527; 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=5hJfO0HN9ehRLvbvP5xDLTjyEfOl5gQpG4emVlBW6Xo=; b=WUCqAugvv5WK3TIIlkDLHX25TfLaQ58YeOE2w6xxPVSRbx4KC+bMskNCSP7tk3jGhr djesi/wdjFOU4BpO12WFM3v06Sc9hfkHYyQcNxHhc4TsPz8SWb0xDnYrfYwmupfE5GlB VoL4ooAnAgy41qmNAQFrTmc910C6Gzskdn7Zq8raFuIuD7+I5vtwYt+jZVu1zMq3ZB3e 75v4D78AgO5eIUO+4whIj0ros+OHzmWQmghdnA7Ez6iZ+slmI0j5GnOHGRYwaFYiQyBH BaYDi5CWv26YxkCg/JW6G+BkNcWdoT0pcLIO5VUE6JIogl/K+8xWYwgOO0eTfFOtH6+j yhdA== X-Forwarded-Encrypted: i=1; AFNElJ/0nZDCppFhffES1ilhwQSj7ntZ2lyTIPDP0e8qiB4tyHQrAiM/kYdYfq/lOa6In1HzDDKWukord6a8SMs=@vger.kernel.org X-Gm-Message-State: AOJu0YzY6PA0mRiVNxPIDLthBqrUcWkXxJb9Gn6xWnIze8SNavCKKahl a1wS7n3crL/BkgXbBaj2Ijsj8MdQv6Edb7AO477Y2xGYvjD0u5Pt4uo3 X-Gm-Gg: AeBDievDT8jPmwsdrSkMbFXEBzZP7SYy1pc3VEZZJOwNKVAmHzcaiy+hSe+iKvc/FSz d8L4ssyOHAY39V5LPB4xjub5fsBHZg5dRqK/XTv1WcbUH85wsSiMsM8VSJwAuaoS4g998ZKXjNU X+j8Bl6uamjFmSnJaKk+6/ulCY+gG5+TCaUdPbPJLzA6qG8j1u23r3+BPk045faY5WMRaXyv9am ksKvrp/DmX69z++82o+dFy+iqi2S9S6Tq3zdbK+2PJtiEi9G0H+nOvXSJ+wtDp8aCXZELhHPbbs SZDvDi1hkT30llBQYGmYjAUedK7VqnOX1KZbyEadAowobob1KNYg2jucK3X+DjSU83jCgzdGERx /ZQYQioAUvlB//W9vUw3PF5k1oYpoxVNoESBellzsWzmKhAer3Q3YPmYhqakqjs9OaBmug0nj85 H0q3ioxBpVZmvoMpfP2AL9xr9VZs2ZvVdWL63ZQEGfQISti73FB+dbo+8lAHQFo4InXLY= X-Received: by 2002:a05:6a00:288d:b0:82f:72e6:ed4 with SMTP id d2e1a72fcca58-83a58736dacmr2697578b3a.0.1778062726927; Wed, 06 May 2026 03:18:46 -0700 (PDT) Received: from kylin-XiaoXinPro-16-AHP9.. ([116.128.244.171]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-839682a52cesm4870070b3a.57.2026.05.06.03.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 03:18:46 -0700 (PDT) From: luoxueqin 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 v3] cpufreq: CPPC: mask Desired_Excursion when autonomous selection is enabled Date: Wed, 6 May 2026 18:18:34 +0800 Message-ID: <20260506101834.343001-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" From: Xueqin Luo According to the ACPI 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 --- v2->v3: - Use cached auto_sel from cpufreq driver data - Fall back to raw value when policy is unavailable - Keep sysfs ABI unchanged by using a wrapper around cppc_get_perf_limited() --- 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..a439d9621eed 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; + bool auto_sel_enabled =3D false; + int ret; + + policy =3D cpufreq_cpu_get_raw(cpu); + if (policy && policy->driver_data) { + cpu_data =3D policy->driver_data; + auto_sel_enabled =3D cpu_data->perf_ctrls.auto_sel; + } + + ret =3D cppc_get_perf_limited(cpu, perf_limited); + if (ret) + return ret; + + /* + * Desired_Excursion is ignored when Autonomous Selection is enabled. + * Mask it to avoid exposing misleading values to userspace. + */ + if (auto_sel_enabled) + *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