Commit af8e11f2 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Yingbao Jia
Browse files

intel_idle: add Sierra Forest SoC support

mainline inclusion
from mainline-v6.8-rc1
commit 92813fd5b1562e547120c8489137b040892fe1bc
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I94UVD

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=92813fd5b1562e547120c8489137b040892fe1bc



-------------------------------------------------

Add Sierra Forest SoC C-states, which are C1, C1E, C6S, and C6SP.

Sierra Forest SoC is built with modules, each module includes 4 cores
(Crestmont microarchitecture). There is one L2 cache per module, shared
between the 4 cores.

There is no core C6 state, but there is C6S state, which has module scope:
when all 4 cores request C6S, the entire module (4 cores + L2 cache)
enters the low power state.

C6SP state has package scope - when all modules in the package enter C6S,
the package enters the power state mode.

Intel-SIG: commit 92813fd5b156 intel_idle: add Sierra Forest SoC support.
Backport Intel_idle Sierra Forest SoC support.

Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
[ Yingbao Jia: amend commit log ]
Signed-off-by: default avatarYingbao Jia <yingbao.jia@intel.com>
parent 00e0396e
Loading
Loading
Loading
Loading
+44 −0
Original line number Diff line number Diff line
@@ -1063,6 +1063,43 @@ static struct cpuidle_state snr_cstates[] __initdata = {
		.enter = NULL }
};

static struct cpuidle_state srf_cstates[] __initdata = {
	{
		.name = "C1",
		.desc = "MWAIT 0x00",
		.flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_ALWAYS_ENABLE,
		.exit_latency = 1,
		.target_residency = 1,
		.enter = &intel_idle,
		.enter_s2idle = intel_idle_s2idle, },
	{
		.name = "C1E",
		.desc = "MWAIT 0x01",
		.flags = MWAIT2flg(0x01) | CPUIDLE_FLAG_ALWAYS_ENABLE,
		.exit_latency = 2,
		.target_residency = 10,
		.enter = &intel_idle,
		.enter_s2idle = intel_idle_s2idle, },
	{
		.name = "C6S",
		.desc = "MWAIT 0x22",
		.flags = MWAIT2flg(0x22) | CPUIDLE_FLAG_TLB_FLUSHED,
		.exit_latency = 270,
		.target_residency = 700,
		.enter = &intel_idle,
		.enter_s2idle = intel_idle_s2idle, },
	{
		.name = "C6SP",
		.desc = "MWAIT 0x23",
		.flags = MWAIT2flg(0x23) | CPUIDLE_FLAG_TLB_FLUSHED,
		.exit_latency = 310,
		.target_residency = 900,
		.enter = &intel_idle,
		.enter_s2idle = intel_idle_s2idle, },
	{
		.enter = NULL }
};

static const struct idle_cpu idle_cpu_nehalem __initconst = {
	.state_table = nehalem_cstates,
	.auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,
@@ -1196,6 +1233,12 @@ static const struct idle_cpu idle_cpu_snr __initconst = {
	.use_acpi = true,
};

static const struct idle_cpu idle_cpu_srf __initconst = {
	.state_table = srf_cstates,
	.disable_promotion_to_c1e = true,
	.use_acpi = true,
};

static const struct x86_cpu_id intel_idle_ids[] __initconst = {
	X86_MATCH_INTEL_FAM6_MODEL(NEHALEM_EP,		&idle_cpu_nhx),
	X86_MATCH_INTEL_FAM6_MODEL(NEHALEM,		&idle_cpu_nehalem),
@@ -1238,6 +1281,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
	X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_PLUS,	&idle_cpu_bxt),
	X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT_D,	&idle_cpu_dnv),
	X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D,	&idle_cpu_snr),
	X86_MATCH_INTEL_FAM6_MODEL(ATOM_CRESTMONT_X,	&idle_cpu_srf),
	{}
};