Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cppc_cpufreq: Remove HiSilicon CPPC workaround

Since commit 6c8d750f9784 ("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 <zhanjie9@hisilicon.com>
Reviewed-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: Huisong Li <lihuisong@huawei.com>
[ Viresh: Move fie_disabled withing CONFIG option to fix warning ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Jie Zhan and committed by
Viresh Kumar
ea1829d4 c4719563

+1 -72
+1 -72
drivers/cpufreq/cppc_cpufreq.c
··· 36 36 37 37 static bool boost_supported; 38 38 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 - 57 39 static struct cpufreq_driver cppc_cpufreq_driver; 58 40 41 + #ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE 59 42 static enum { 60 43 FIE_UNSET = -1, 61 44 FIE_ENABLED, 62 45 FIE_DISABLED 63 46 } fie_disabled = FIE_UNSET; 64 47 65 - #ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE 66 48 module_param(fie_disabled, int, 0444); 67 49 MODULE_PARM_DESC(fie_disabled, "Disable Frequency Invariance Engine (FIE)"); 68 50 ··· 60 78 static DEFINE_PER_CPU(struct cppc_freq_invariance, cppc_freq_inv); 61 79 static struct kthread_worker *kworker_fie; 62 80 63 - static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu); 64 81 static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, 65 82 struct cppc_perf_fb_ctrs *fb_ctrs_t0, 66 83 struct cppc_perf_fb_ctrs *fb_ctrs_t1); ··· 828 847 .name = "cppc_cpufreq", 829 848 }; 830 849 831 - /* 832 - * HISI platform does not support delivered performance counter and 833 - * reference performance counter. It can calculate the performance using the 834 - * platform specific mechanism. We reuse the desired performance register to 835 - * store the real performance calculated by the platform. 836 - */ 837 - static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu) 838 - { 839 - struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); 840 - struct cppc_cpudata *cpu_data; 841 - u64 desired_perf; 842 - int ret; 843 - 844 - if (!policy) 845 - return -ENODEV; 846 - 847 - cpu_data = policy->driver_data; 848 - 849 - cpufreq_cpu_put(policy); 850 - 851 - ret = cppc_get_desired_perf(cpu, &desired_perf); 852 - if (ret < 0) 853 - return -EIO; 854 - 855 - return cppc_perf_to_khz(&cpu_data->perf_caps, desired_perf); 856 - } 857 - 858 - static void cppc_check_hisi_workaround(void) 859 - { 860 - struct acpi_table_header *tbl; 861 - acpi_status status = AE_OK; 862 - int i; 863 - 864 - status = acpi_get_table(ACPI_SIG_PCCT, 0, &tbl); 865 - if (ACPI_FAILURE(status) || !tbl) 866 - return; 867 - 868 - for (i = 0; i < ARRAY_SIZE(wa_info); i++) { 869 - if (!memcmp(wa_info[i].oem_id, tbl->oem_id, ACPI_OEM_ID_SIZE) && 870 - !memcmp(wa_info[i].oem_table_id, tbl->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) && 871 - wa_info[i].oem_revision == tbl->oem_revision) { 872 - /* Overwrite the get() callback */ 873 - cppc_cpufreq_driver.get = hisi_cppc_cpufreq_get_rate; 874 - fie_disabled = FIE_DISABLED; 875 - break; 876 - } 877 - } 878 - 879 - acpi_put_table(tbl); 880 - } 881 - 882 850 static int __init cppc_cpufreq_init(void) 883 851 { 884 852 int ret; ··· 835 905 if (!acpi_cpc_valid()) 836 906 return -ENODEV; 837 907 838 - cppc_check_hisi_workaround(); 839 908 cppc_freq_invariance_init(); 840 909 populate_efficiency_class(); 841 910