Commit 47a0b6f3 authored by liuyun's avatar liuyun Committed by Hongchen Zhang
Browse files

cpufreq: Add cpufreq driver for LoongArch

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



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

Signed-off-by: default avatarzhangtianyang <zhangtianyang@loongson.cn>
Signed-off-by: default avatarliuyun <liuyun@loongson.cn>
parent 7f688be7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -673,6 +673,7 @@ config ARCH_SUSPEND_POSSIBLE
config ARCH_HIBERNATION_POSSIBLE
	def_bool y

source "drivers/cpufreq/Kconfig"
source "kernel/power/Kconfig"
source "drivers/acpi/Kconfig"

+4 −0
Original line number Diff line number Diff line
@@ -61,6 +61,10 @@ CONFIG_ACPI_DOCK=y
CONFIG_ACPI_IPMI=m
CONFIG_ACPI_HOTPLUG_CPU=y
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_ACPI_HOTPLUG_MEMORY=y
CONFIG_EFI_ZBOOT=y
CONFIG_EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER=y
+12 −1
Original line number Diff line number Diff line
@@ -48,6 +48,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.
@@ -210,6 +214,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)
@@ -256,8 +263,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)
+11 −0
Original line number Diff line number Diff line
@@ -273,6 +273,17 @@ config LOONGSON2_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"
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ obj-$(CONFIG_POWERNV_CPUFREQ) += powernv-cpufreq.o
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_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
Loading