You need to sign in or sign up before continuing.
提交 cbf1b67a 编写于 作者: L liuyun 提交者: openeuler-sync-bot

cpufreq: Add cpufreq driver for LoongArch

LoongArch inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6BWFP

--------------------------------
Signed-off-by: Nzhangtianyang <zhangtianyang@loongson.cn>
Change-Id: Ic9390a1c78e1670422be1b03d35e3f0fdec1367f
(cherry picked from commit 6def0ea3)
上级 7c1b4a93
......@@ -514,4 +514,10 @@ source "drivers/acpi/Kconfig"
endmenu
menu "CPU Power Management"
source "drivers/cpufreq/Kconfig"
endmenu
source "drivers/firmware/Kconfig"
......@@ -43,6 +43,10 @@ CONFIG_ACPI_SPCR_TABLE=y
CONFIG_ACPI_DOCK=y
CONFIG_ACPI_IPMI=m
CONFIG_ACPI_PCI_SLOT=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_LOONGSON3_ACPI_CPUFREQ=y
CONFIG_EFI_CAPSULE_LOADER=m
CONFIG_EFI_TEST=m
CONFIG_MODULES=y
......
......@@ -45,6 +45,10 @@ static inline void disable_lasx(void);
static inline void save_lasx(struct task_struct *t);
static inline void restore_lasx(struct task_struct *t);
#ifdef CONFIG_LOONGSON3_ACPI_CPUFREQ
DECLARE_PER_CPU(unsigned long, msa_count);
DECLARE_PER_CPU(unsigned long, lasx_count);
#endif
/*
* Mask the FCSR Cause bits according to the Enable bits, observing
* that Unimplemented is always enabled.
......@@ -198,6 +202,9 @@ static inline void enable_lsx(void)
{
if (cpu_has_lsx)
csr_xchg32(CSR_EUEN_LSXEN, CSR_EUEN_LSXEN, LOONGARCH_CSR_EUEN);
#ifdef CONFIG_LOONGSON3_ACPI_CPUFREQ
per_cpu(msa_count, raw_smp_processor_id())++;
#endif
}
static inline void disable_lsx(void)
......@@ -251,8 +258,12 @@ static inline void restore_lsx_upper(struct task_struct *t) {}
static inline void enable_lasx(void)
{
if (cpu_has_lasx)
if (cpu_has_lasx) {
csr_xchg32(CSR_EUEN_LASXEN, CSR_EUEN_LASXEN, LOONGARCH_CSR_EUEN);
#ifdef CONFIG_LOONGSON3_ACPI_CPUFREQ
per_cpu(lasx_count, raw_smp_processor_id())++;
#endif
}
}
static inline void disable_lasx(void)
......
......@@ -287,6 +287,17 @@ config LOONGSON1_CPUFREQ
If in doubt, say N.
endif
if LOONGARCH
config LOONGSON3_ACPI_CPUFREQ
bool "Loongson3 ACPI cpufreq driver"
depends on ACPI_PROCESSOR
help
This driver adds a CPUFreq driver which utilizes the ACPI
Processor Performance States.
This driver supports Loongson 3A5000 compatible CPUs.
If in doubt, say N.
endif
if SPARC64
config SPARC_US3_CPUFREQ
tristate "UltraSPARC-III CPU Frequency driver"
......
......@@ -106,6 +106,7 @@ obj-$(CONFIG_BMIPS_CPUFREQ) += bmips-cpufreq.o
obj-$(CONFIG_IA64_ACPI_CPUFREQ) += ia64-acpi-cpufreq.o
obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o
obj-$(CONFIG_LOONGSON1_CPUFREQ) += loongson1-cpufreq.o
obj-$(CONFIG_LOONGSON3_ACPI_CPUFREQ) += loongson3-acpi-cpufreq.o
obj-$(CONFIG_SH_CPU_FREQ) += sh-cpufreq.o
obj-$(CONFIG_SPARC_US2E_CPUFREQ) += sparc-us2e-cpufreq.o
obj-$(CONFIG_SPARC_US3_CPUFREQ) += sparc-us3-cpufreq.o
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册