Unverified Commit 7e3bcc81 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3323 LoongArch: add cpufreq and ls2k500 bmc support

Merge Pull Request from: @ci-robot 
 
PR sync from: Hongchen Zhang <zhanghongchen@loongson.cn>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/ZHOBACGPUAPXKVC7WKRCM65GHBJNGWD7/ 
Chong Qiao (4):
  fbdev: add ls2k500sfb driver for ls2k500 bmc.
  ipmi: add ls2k500 bmc ipmi support.
  LoongArch: defconfig: enable CONFIG_FB_LS2K500=m.
  LoongArch: fix ls2k500 bmc not work when installing iso

liuyun (1):
  cpufreq: Add cpufreq driver for LoongArch


-- 
2.33.0
 
https://gitee.com/openeuler/kernel/issues/I6BWFP
https://gitee.com/openeuler/kernel/issues/I76XQZ 
 
Link:https://gitee.com/openeuler/kernel/pulls/3323

 

Reviewed-by: default avatarJuxin Gao <gaojuxin@loongson.cn>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents a707c289 af3db82a
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"

+5 −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
@@ -670,6 +674,7 @@ CONFIG_DRM_LOONGSON=y
CONFIG_FB=y
CONFIG_FB_EFI=y
CONFIG_FB_RADEON=y
CONFIG_FB_LS2K500=m
CONFIG_LCD_CLASS_DEVICE=y
CONFIG_LCD_PLATFORM=m
# CONFIG_VGA_CONSOLE is not set
+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)
+4 −0
Original line number Diff line number Diff line
@@ -13,6 +13,10 @@ ifdef CONFIG_PARISC
ipmi_si-y += ipmi_si_parisc.o
endif

ifdef CONFIG_LOONGARCH
ipmi_si-y += ipmi_si_ls2k500.o
endif

obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
obj-$(CONFIG_IPMI_SI) += ipmi_si.o
+92 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __BTLOCK_H__
#define __BTLOCK_H__

#include <linux/delay.h>
#include <asm/timex.h>

union btlock {
	char b[2];
	unsigned int u;
};

/*
 *wait delay us if lock failed.
 *lock fail if another one get lock or both try get lock.
 *c must compile b with byte access.
 */
static inline int btlock_lock(volatile union btlock *p, int n, unsigned char delay)
{
	union btlock t, t1;
	unsigned long flags;
	unsigned long c0 = get_cycles(), c1;

	if (n > 1)
		return -1;
	delay |= 0x80;
	t1.u = 0;
	t1.b[n] = delay;

	while (1) {
		local_irq_save(flags);
		p->b[n] = delay;
		t.u = p->u;
		if (t.u == t1.u) {
			wmb(); /* flush write out immediately */
			local_irq_restore(flags);
			return 0;
		}
		p->b[n] = 0;
		t.u = p->u;
		wmb(); /* flush write out immediately */
		local_irq_restore(flags);
		c1 = get_cycles();
		if (c1 - c0 > *mscycles * 1000)
			return -1;
		ndelay(((t.b[1 - n] & 0x7f) + (c1 & 1)) * 100);
	}
	return 0;
}

static inline int btlock_trylock(volatile union btlock *p, int n, unsigned char delay)
{
	union btlock t, t1;
	unsigned long flags;

	if (n > 1)
		return -1;
	delay |= 0x80;
	t1.u = 0;
	t1.b[n] = delay;

	local_irq_save(flags);
	p->b[n] = delay;
	t.u = p->u;
	if (t.u == t1.u) {
		wmb(); /* flush write out immediately */
		local_irq_restore(flags);
		return 0;
	}
	p->b[n] = 0;
	t.u = p->u;
	wmb(); /* flush write out immediately */
	local_irq_restore(flags);
	ndelay(((t.b[1 - n] & 0x7f) + (get_cycles() & 1)) * 100);
	return -1;
}

static inline int btlock_unlock(volatile union btlock *p, int n)
{
		p->b[n] = 0;
		wmb(); /* flush write out immediately */
		return p->u;
}

static inline int btlock_islocked(volatile union btlock *p, int n)
{
	union btlock t;

	t.u = p->u;
	return t.b[n] && !t.b[1 - n];
}
#endif
Loading