Skip to content

Commit ea1829d

Browse files
Jie Zhanvireshk
authored andcommitted
cppc_cpufreq: Remove HiSilicon CPPC workaround
Since commit 6c8d750 ("cpufreq / cppc: Work around for Hisilicon CPPC cpufreq"), we introduce a workround for HiSilicon platforms that do not support performance feedback counters, whereas they can get the actual frequency from the desired perf register. Later on, FIE is disabled in that workaround as well. Now the workround can be handled by the common code. Desired perf would be read and converted to frequency if feedback counters don't change. FIE would be disabled if the CPPC regs are in PCC region. Hence, the workaround is no longer needed and can be safely removed, in an effort to consolidate the driver procedure. Signed-off-by: Jie Zhan <[email protected]> Reviewed-by: Xiongfeng Wang <[email protected]> Reviewed-by: Huisong Li <[email protected]> [ Viresh: Move fie_disabled withing CONFIG option to fix warning ] Signed-off-by: Viresh Kumar <[email protected]>
1 parent c471956 commit ea1829d

File tree

1 file changed

+1
-72
lines changed

1 file changed

+1
-72
lines changed

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,15 @@ static LIST_HEAD(cpu_data_list);
3636

3737
static bool boost_supported;
3838

39-
struct cppc_workaround_oem_info {
40-
char oem_id[ACPI_OEM_ID_SIZE + 1];
41-
char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
42-
u32 oem_revision;
43-
};
44-
45-
static struct cppc_workaround_oem_info wa_info[] = {
46-
{
47-
.oem_id = "HISI ",
48-
.oem_table_id = "HIP07 ",
49-
.oem_revision = 0,
50-
}, {
51-
.oem_id = "HISI ",
52-
.oem_table_id = "HIP08 ",
53-
.oem_revision = 0,
54-
}
55-
};
56-
5739
static struct cpufreq_driver cppc_cpufreq_driver;
5840

41+
#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
5942
static enum {
6043
FIE_UNSET = -1,
6144
FIE_ENABLED,
6245
FIE_DISABLED
6346
} fie_disabled = FIE_UNSET;
6447

65-
#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
6648
module_param(fie_disabled, int, 0444);
6749
MODULE_PARM_DESC(fie_disabled, "Disable Frequency Invariance Engine (FIE)");
6850

@@ -78,7 +60,6 @@ struct cppc_freq_invariance {
7860
static DEFINE_PER_CPU(struct cppc_freq_invariance, cppc_freq_inv);
7961
static struct kthread_worker *kworker_fie;
8062

81-
static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu);
8263
static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data,
8364
struct cppc_perf_fb_ctrs *fb_ctrs_t0,
8465
struct cppc_perf_fb_ctrs *fb_ctrs_t1);
@@ -847,65 +828,13 @@ static struct cpufreq_driver cppc_cpufreq_driver = {
847828
.name = "cppc_cpufreq",
848829
};
849830

850-
/*
851-
* HISI platform does not support delivered performance counter and
852-
* reference performance counter. It can calculate the performance using the
853-
* platform specific mechanism. We reuse the desired performance register to
854-
* store the real performance calculated by the platform.
855-
*/
856-
static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu)
857-
{
858-
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
859-
struct cppc_cpudata *cpu_data;
860-
u64 desired_perf;
861-
int ret;
862-
863-
if (!policy)
864-
return -ENODEV;
865-
866-
cpu_data = policy->driver_data;
867-
868-
cpufreq_cpu_put(policy);
869-
870-
ret = cppc_get_desired_perf(cpu, &desired_perf);
871-
if (ret < 0)
872-
return -EIO;
873-
874-
return cppc_perf_to_khz(&cpu_data->perf_caps, desired_perf);
875-
}
876-
877-
static void cppc_check_hisi_workaround(void)
878-
{
879-
struct acpi_table_header *tbl;
880-
acpi_status status = AE_OK;
881-
int i;
882-
883-
status = acpi_get_table(ACPI_SIG_PCCT, 0, &tbl);
884-
if (ACPI_FAILURE(status) || !tbl)
885-
return;
886-
887-
for (i = 0; i < ARRAY_SIZE(wa_info); i++) {
888-
if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) &&
889-
!memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
890-
wa_info[i].oem_revision == tbl->oem_revision) {
891-
/* Overwrite the get() callback */
892-
cppc_cpufreq_driver.get = hisi_cppc_cpufreq_get_rate;
893-
fie_disabled = FIE_DISABLED;
894-
break;
895-
}
896-
}
897-
898-
acpi_put_table(tbl);
899-
}
900-
901831
static int __init cppc_cpufreq_init(void)
902832
{
903833
int ret;
904834

905835
if (!acpi_cpc_valid())
906836
return -ENODEV;
907837

908-
cppc_check_hisi_workaround();
909838
cppc_freq_invariance_init();
910839
populate_efficiency_class();
911840

0 commit comments

Comments
 (0)