From nobody Mon Jun 8 12:15:53 2026 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.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 148A433F582 for ; Fri, 29 May 2026 08:18:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780042701; cv=none; b=cAc0UALAI8f0KpGB7OZo0ZH1HXUcXdwhRqUJkSITmRYB1vEkmWERZ7Cg6IY7N6ENJyWjJYjwoYudFw0jMEApZuRFMXvnDpkjtavt8SJrPey4zsdsMQ6cwrWhXJSdUClX+metelLJJaxUpK0bYifCY9KjOdQ3QebqE0aDVTkYrhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780042701; c=relaxed/simple; bh=IM3BzY+gKDUbwOzi0elpTmXkAq0dg7APDtCwAuuGtNs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=u6o9OWAxTlgQBzuQlvGGAmKR8F49auNch6H8ypGmLT0xB420nvyuS1G1UJvY9f0Rhwkv+8PbRpVF5WxhayhRVmAh7fluVCLBctveFZZJdGVprgM2oc5O+rwPchY5rf8IFh4wEnFY2zOLWx1DSMjp79FoDG/M229c+aaiL3p4WeA= 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.214.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-pl1-f193.google.com with SMTP id d9443c01a7336-2bf114b0cf9so8672795ad.2 for ; Fri, 29 May 2026 01:18:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780042698; x=1780647498; 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=CO1vwp8sJ+t+jcxvi6cBiGKxFDrYU96NEUGJgzYEAbw=; b=WpszqqNJPSBW3mf06QWQ6nNWJ4av9gUyNrPQ96VLH236PlgCEmRtotFG38MjJkgjsP QXi//1k6lP8tdcY7y+X/QgokZEFa9t2yHvpOb/ck7JCRa0xxT85DbOkOgxZtRRDkNA3k HaVlllfmjUtEyBQW1UnkeY6nuzc3eSRe0ZYAb9a9Btnz95sUWCvOImPF1oVwxamSrdr5 L6fmr2ZGTYbIgiJp/M2cfHGpr20ndica8783ozw4xEW+5RIbKJAIgt7IQTvaoLK15G2I pcjiZeeAl2MHzsOmBG3lSlO0MiYvSBziz/53kPRXF0ToikqXBEDQ+7ji5CGW4g3ipJFc vAIQ== X-Forwarded-Encrypted: i=1; AFNElJ9Dj8fLpVKdlumf1CslNQuCggd8B/70X6+mImEeLkuIKIcJ10xq5X/BhjuhhHBsbWTn004AjXV87P7vGm0=@vger.kernel.org X-Gm-Message-State: AOJu0YxDeGCnIusdvLB79gHFazt64qv2rCMttOnXXXggSFz67Zi+DkHm OQQySqx1s+s51Br6pkj70heeCiHpvunRJAqwPh2zYjY3R9Xbpe0fVwSj X-Gm-Gg: Acq92OEAEbuDpEvXU3O4lov48Qk5WtZu3zD/Amk3JmwiRmYrRw7m7BVIs3DCnSo6VIN WT7vMH6JXENtab1RKSc1XyttFMYtZ7yJuz57nnN5YV3s1Bz3OvMw8f2Rz4l/X41WeLK2vJ2JLKK Ml1rRYaIFuWATUrPxXbiNcQpgAMTXRMK6pentONP976p1L2ogtjhRmJTi137MdSfTTcYLGfCr8n B+Fr5S8k8Na28i+jKBwKlLCNzVAOXmxf6wfvObXIK/YBQFRH+p0UGptiI2crw8vT3uiB79bFCuL pbT5w0Qz6Ct7qKsA0+KrKWkYkcyGU/XS9rM7Obbmvmb8eDQGrf4ITIDfBkO7kgqhXOckm9ujR9B yfmmAumAUGJWiDC55UoGkB39q9ToweG3tSV000mPJC1wzwLdZlNqPtKPy+UgPKHq+NASPmNXG4F YMPMoMTG6Skp8vTXzJo+6ZfR7oUlqPJ8UNrYg3QyeaHr7RKgElxHC6Ujo= X-Received: by 2002:a17:903:1ae6:b0:2bd:7191:5708 with SMTP id d9443c01a7336-2bf20bb8cbbmr26366445ad.29.1780042698270; Fri, 29 May 2026 01:18:18 -0700 (PDT) Received: from kylin-XiaoXinPro-16-AHP9.. ([116.128.244.171]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bf23c3a5c8sm10204315ad.71.2026.05.29.01.18.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 01:18:17 -0700 (PDT) From: Xueqin Luo To: rafael@kernel.org, lenb@kernel.org, srinivas.pandruvada@linux.intel.com, viresh.kumar@linaro.org, saket.dumbre@intel.com, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, acpica-devel@lists.linux.dev Cc: Xueqin Luo Subject: [PATCH] ACPI: CPPC: Add helper to get effective guaranteed performance Date: Fri, 29 May 2026 16:18:01 +0800 Message-ID: <20260529081801.29346-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 CPPC specification, if the Guaranteed Performance register is not implemented, OSPM assumes the guaranteed performance is equal to nominal performance. Add cppc_get_effective_guaranteed_perf() helper to provide a spec-compliant effective guaranteed performance value while preserving the raw values returned by cppc_get_perf_caps(). Signed-off-by: Xueqin Luo --- drivers/acpi/cppc_acpi.c | 26 ++++++++++++++++++++++++++ drivers/cpufreq/intel_pstate.c | 10 ++++------ include/acpi/cppc_acpi.h | 5 +++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index f370be8715ae..6dc11030707a 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1328,6 +1328,32 @@ int cppc_get_highest_perf(int cpunum, u64 *highest_p= erf) } EXPORT_SYMBOL_GPL(cppc_get_highest_perf); =20 +/** + * cppc_get_effective_guaranteed_perf - get effective guaranteed performan= ce + * @cpunum: CPU number + * @guaranteed_perf: Effective guaranteed performance value + * + * The ACPI CPPC specification states that if the Guaranteed + * Performance register is not implemented, OSPM assumes the + * guaranteed performance is equal to nominal performance. + * + * Return: 0 on success, negative errno on failure. + */ +int cppc_get_effective_guaranteed_perf(int cpunum, u64 *guaranteed_perf) +{ + struct cppc_perf_caps perf_caps; + int ret; + + ret =3D cppc_get_perf_caps(cpunum, &perf_caps); + if (ret) + return ret; + *guaranteed_perf =3D perf_caps.guaranteed_perf ?: + perf_caps.nominal_perf; + + return 0; +} +EXPORT_SYMBOL_GPL(cppc_get_effective_guaranteed_perf); + /** * cppc_get_epp_perf - Get the epp register value. * @cpunum: CPU from which to get epp preference value. diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 8dc22a65e025..8934e48f71a2 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -404,17 +404,15 @@ static void intel_pstate_set_itmt_prio(int cpu) =20 static int intel_pstate_get_cppc_guaranteed(int cpu) { - struct cppc_perf_caps cppc_perf; + u64 guaranteed_perf; int ret; =20 - ret =3D cppc_get_perf_caps(cpu, &cppc_perf); + ret =3D cppc_get_effective_guaranteed_perf(cpu, &guaranteed_perf); + if (ret) return ret; =20 - if (cppc_perf.guaranteed_perf) - return cppc_perf.guaranteed_perf; - - return cppc_perf.nominal_perf; + return guaranteed_perf; } =20 static int intel_pstate_cppc_get_scaling(int cpu) diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index d1f02ceec4f9..c02f3bc1fc1a 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -155,6 +155,7 @@ struct cppc_cpudata { extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf); extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf); extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf); +extern int cppc_get_effective_guaranteed_perf(int cpunum, u64 *guaranteed_= perf); extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_c= trs); extern int cppc_get_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls); @@ -198,6 +199,10 @@ static inline int cppc_get_highest_perf(int cpunum, u6= 4 *highest_perf) { return -EOPNOTSUPP; } +static inline int cppc_get_effective_guaranteed_perf(int cpunum, u64 *guar= anteed_perf) +{ + return -EOPNOTSUPP; +} static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *pe= rf_fb_ctrs) { return -EOPNOTSUPP; --=20 2.43.0