forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/arch/x86/kernel/acpi/cstate.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2005 Intel Corporation
34 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
....@@ -51,6 +52,48 @@
5152 if (c->x86_vendor == X86_VENDOR_INTEL &&
5253 (c->x86 > 0xf || (c->x86 == 6 && c->x86_model >= 0x0f)))
5354 flags->bm_control = 0;
55
+ /*
56
+ * For all recent Centaur CPUs, the ucode will make sure that each
57
+ * core can keep cache coherence with each other while entering C3
58
+ * type state. So, set bm_check to 1 to indicate that the kernel
59
+ * doesn't need to execute a cache flush operation (WBINVD) when
60
+ * entering C3 type state.
61
+ */
62
+ if (c->x86_vendor == X86_VENDOR_CENTAUR) {
63
+ if (c->x86 > 6 || (c->x86 == 6 && c->x86_model == 0x0f &&
64
+ c->x86_stepping >= 0x0e))
65
+ flags->bm_check = 1;
66
+ }
67
+
68
+ if (c->x86_vendor == X86_VENDOR_ZHAOXIN) {
69
+ /*
70
+ * All Zhaoxin CPUs that support C3 share cache.
71
+ * And caches should not be flushed by software while
72
+ * entering C3 type state.
73
+ */
74
+ flags->bm_check = 1;
75
+ /*
76
+ * On all recent Zhaoxin platforms, ARB_DISABLE is a nop.
77
+ * So, set bm_control to zero to indicate that ARB_DISABLE
78
+ * is not required while entering C3 type state.
79
+ */
80
+ flags->bm_control = 0;
81
+ }
82
+ if (c->x86_vendor == X86_VENDOR_AMD && c->x86 >= 0x17) {
83
+ /*
84
+ * For all AMD Zen or newer CPUs that support C3, caches
85
+ * should not be flushed by software while entering C3
86
+ * type state. Set bm->check to 1 so that kernel doesn't
87
+ * need to execute cache flush operation.
88
+ */
89
+ flags->bm_check = 1;
90
+ /*
91
+ * In current AMD C state implementation ARB_DIS is no longer
92
+ * used. So set bm_control to zero to indicate ARB_DIS is not
93
+ * required while entering C3 type state.
94
+ */
95
+ flags->bm_control = 0;
96
+ }
5497 }
5598 EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
5699