Adds support for Meteor Lake C-states, following the reference implementation in Linux.
Signed-off-by: Alex XZ Cypher Zero <me@alex0.net>
---
xen/arch/x86/cpu/mwait-idle.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index 5e98011bfd..1e90806c70 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -678,6 +678,28 @@ static struct cpuidle_state __read_mostly adl_l_cstates[] = {
{}
};
+static struct cpuidle_state __read_mostly mtl_l_cstates[] = {
+ {
+ .name = "C1E",
+ .flags = MWAIT2flg(0x01),
+ .exit_latency = 1,
+ .target_residency = 1,
+ },
+ {
+ .name = "C6",
+ .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
+ .exit_latency = 140,
+ .target_residency = 420
+ },
+ {
+ .name = "C10",
+ .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
+ .exit_latency = 310,
+ .target_residency = 930
+ },
+ {}
+};
+
static struct cpuidle_state __read_mostly spr_cstates[] = {
{
.name = "C1",
@@ -1083,6 +1105,10 @@ static struct idle_cpu __read_mostly idle_cpu_adl_l = {
.state_table = adl_l_cstates,
};
+static struct idle_cpu __read_mostly idle_cpu_mtl_l = {
+ .state_table = mtl_l_cstates,
+};
+
static struct idle_cpu __read_mostly idle_cpu_spr = {
.state_table = spr_cstates,
.c1e_promotion = C1E_PROMOTION_DISABLE,
@@ -1148,6 +1174,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
ICPU(ICELAKE_D, icx),
ICPU(ALDERLAKE, adl),
ICPU(ALDERLAKE_L, adl_l),
+ ICPU(METEORLAKE_L, mtl_l),
ICPU(SAPPHIRERAPIDS_X, spr),
ICPU(ATOM_GOLDMONT, bxt),
ICPU(ATOM_GOLDMONT_PLUS, bxt),
--
2.50.0
On 08.07.2025 12:09, Alex XZ Cypher Zero wrote:
> Adds support for Meteor Lake C-states, following the reference implementation in Linux.
>
> Signed-off-by: Alex XZ Cypher Zero <me@alex0.net>
I'm sorry, but this still isn't quite how it wants to be done. Besides some
of the metadata from the Linux commits that wants to be there, it's also
pretty helpful if what we pull in is done in the same order as Linux had
things appear. Unless of course this isn't possible or doesn't make sense
(yet), like e.g. for Linux commit 9f0112938277. That one we will want once
we gained AMX support.
Furthermore, ...
> --- a/xen/arch/x86/cpu/mwait-idle.c
> +++ b/xen/arch/x86/cpu/mwait-idle.c
> @@ -678,6 +678,28 @@ static struct cpuidle_state __read_mostly adl_l_cstates[] = {
> {}
> };
>
> +static struct cpuidle_state __read_mostly mtl_l_cstates[] = {
... this wants to be const, as well as ...
> + {
> + .name = "C1E",
> + .flags = MWAIT2flg(0x01),
> + .exit_latency = 1,
> + .target_residency = 1,
> + },
> + {
> + .name = "C6",
> + .flags = MWAIT2flg(0x20) | CPUIDLE_FLAG_TLB_FLUSHED,
> + .exit_latency = 140,
> + .target_residency = 420
> + },
> + {
> + .name = "C10",
> + .flags = MWAIT2flg(0x60) | CPUIDLE_FLAG_TLB_FLUSHED,
> + .exit_latency = 310,
> + .target_residency = 930
> + },
> + {}
> +};
> +
> static struct cpuidle_state __read_mostly spr_cstates[] = {
> {
> .name = "C1",
> @@ -1083,6 +1105,10 @@ static struct idle_cpu __read_mostly idle_cpu_adl_l = {
> .state_table = adl_l_cstates,
> };
>
> +static struct idle_cpu __read_mostly idle_cpu_mtl_l = {
... this. (Some of the entries can't be, which unfortunately makes it not
straightforward, i.e. you cannot simply copy such attributes from adjacent
entries in some of the cases.)
I've Cc-ed you on the one patch in the series that corresponds to this one.
Feel free to provide a Reviewed-by:.
Jan
© 2016 - 2025 Red Hat, Inc.