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

!444 LoongArch: some LS7a device drivers support and LoongArch bug fix

Merge Pull Request from: @Hongchen_Zhang 
 
- add cpufreq support
- add gpio support
- add i2c support
- add spi support
- add rtc support
- add gpio support
- add s3/s4 support
- add LS7A modesetting drivers upport
- add LSX/LASX support
- fix ltp prctl test error
- fix compile error when CONFIG_DEBUG_INFO_BTF enabled
 
 
Link:https://gitee.com/openeuler/kernel/pulls/444

 

Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 61798d1a ef895cd6
Loading
Loading
Loading
Loading
+57 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ config LOONGARCH
	select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPTION
	select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPTION
	select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPTION
	select ARCH_KEEP_MEMBLOCK
	select ARCH_MIGHT_HAVE_PC_PARPORT
	select ARCH_MIGHT_HAVE_PC_SERIO
	select ARCH_SPARSEMEM_ENABLE
@@ -75,6 +76,8 @@ config LOONGARCH
	select GENERIC_SCHED_CLOCK
	select GENERIC_SMP_IDLE_THREAD
	select GENERIC_TIME_VSYSCALL
	select CPU_SUPPORTS_LSX
	select CPU_SUPPORTS_LASX
	select GPIOLIB
	select HAVE_ARCH_AUDITSYSCALL
	select HAVE_ARCH_MMAP_RND_BITS if MMU
@@ -145,6 +148,36 @@ config CPU_HAS_PREFETCH
	bool
	default y

config CPU_HAS_LSX
	bool "Support for the Loongson SIMD Extension"
	depends on CPU_SUPPORTS_LSX
	depends on 64BIT
	help
	  Loongson SIMD Extension (LSX) introduces 128 bit wide vector registers
	  and a set of SIMD instructions to operate on them. When this option
	  is enabled the kernel will support allocating & switching LSX
	  vector register contexts. If you know that your kernel will only be
	  running on CPUs which do not support LSX or that your userland will
	  not be making use of it then you may wish to say N here to reduce
	  the size & complexity of your kernel.

	  If unsure, say Y.

config CPU_HAS_LASX
	bool "Support for the Loongson Advanced SIMD Extension"
	depends on CPU_SUPPORTS_LASX
	depends on 64BIT && CPU_HAS_LSX
	help
	  Loongson Advanced SIMD Extension is 256 bit wide SIMD extension.

	  If unsure, say Y.

config CPU_SUPPORTS_LSX
	bool

config CPU_SUPPORTS_LASX
	bool

config GENERIC_CALIBRATE_DELAY
	def_bool y

@@ -393,6 +426,13 @@ config NODES_SHIFT
	default "6"
	depends on NUMA

config VA_BITS_40
	bool "40-bits"
	default y
	depends on 64BIT
	help
	  Support a maximum at least 40 bits of application virtual memory.

config FORCE_MAX_ZONEORDER
	int "Maximum zone order"
	range 14 64 if PAGE_SIZE_64KB
@@ -457,6 +497,9 @@ config ARCH_SPARSEMEM_ENABLE
	  or have huge holes in the physical address space for other reasons.
	  See <file:Documentation/vm/numa.rst> for more.

config SYS_SUPPORTS_HUGETLBFS
        def_bool y

config ARCH_ENABLE_THP_MIGRATION
	def_bool y
	depends on TRANSPARENT_HUGEPAGE
@@ -477,8 +520,22 @@ config ARCH_MMAP_RND_BITS_MAX

menu "Power management options"

config ARCH_HIBERNATION_POSSIBLE
	def_bool y

config ARCH_SUSPEND_POSSIBLE
	def_bool y

source "kernel/power/Kconfig"

source "drivers/acpi/Kconfig"

endmenu

menu "CPU Power Management"

source "drivers/cpufreq/Kconfig"

endmenu

source "drivers/firmware/Kconfig"
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ LDFLAGS_vmlinux += -G0 -static -n -nostdlib
# upgrade the compiler or downgrade the assembler.
ifdef CONFIG_AS_HAS_EXPLICIT_RELOCS
cflags-y			+= -mexplicit-relocs
KBUILD_CFLAGS_KERNEL		+= -mdirect-extern-access
else
cflags-y			+= $(call cc-option,-mno-explicit-relocs)
KBUILD_AFLAGS_KERNEL		+= -Wa,-mla-global-with-pcrel
@@ -96,9 +97,13 @@ endif
head-y := arch/loongarch/kernel/head.o

core-y += arch/loongarch/

libs-y += arch/loongarch/lib/
libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a

# suspend and hibernation support
drivers-$(CONFIG_PM)	+= arch/loongarch/power/

ifeq ($(KBUILD_EXTMOD),)
prepare: vdso_prepare
vdso_prepare: prepare0
+26 −5
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT=y
CONFIG_PREEMPT_VOLUNTARY=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
@@ -35,12 +35,18 @@ CONFIG_BPF_SYSCALL=y
CONFIG_USERFAULTFD=y
CONFIG_PERF_EVENTS=y
# CONFIG_COMPAT_BRK is not set
CONFIG_HOTPLUG_CPU=y
CONFIG_CPU_HAS_LSX=y
CONFIG_CPU_HAS_LASX=y
CONFIG_NUMA=y
CONFIG_HIBERNATION=y
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
@@ -275,10 +281,17 @@ CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_NETEM=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_CLS_BASIC=m
CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m
CONFIG_NET_CLS_CGROUP=m
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_FLOW=m
CONFIG_NET_CLS_CGROUP=y
CONFIG_NET_CLS_BPF=m
CONFIG_NET_CLS_FLOWER=m
CONFIG_NET_CLS_MATCHALL=m
CONFIG_NET_CLS_ACT=y
CONFIG_NET_ACT_POLICE=m
CONFIG_NET_ACT_GACT=m
@@ -464,7 +477,7 @@ CONFIG_TXGBE=m
# CONFIG_NET_VENDOR_RDC is not set
CONFIG_8139CP=m
CONFIG_8139TOO=m
CONFIG_R8169=y
CONFIG_R8169=m
# CONFIG_NET_VENDOR_RENESAS is not set
# CONFIG_NET_VENDOR_ROCKER is not set
# CONFIG_NET_VENDOR_SAMSUNG is not set
@@ -561,6 +574,11 @@ CONFIG_SENSORS_LM75=m
CONFIG_SENSORS_LM93=m
CONFIG_SENSORS_W83795=m
CONFIG_SENSORS_W83627HF=m
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
CONFIG_WATCHDOG_SYSFS=y
CONFIG_SOFT_WATCHDOG=m
CONFIG_GPIO_WATCHDOG=m
CONFIG_RC_CORE=m
CONFIG_LIRC=y
CONFIG_RC_DECODERS=y
@@ -588,6 +606,7 @@ CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMDGPU_USERPTR=y
CONFIG_DRM_AST=y
CONFIG_DRM_LOONGSON=y
CONFIG_DRM_QXL=m
CONFIG_DRM_VIRTIO_GPU=m
CONFIG_FB_EFI=y
@@ -649,7 +668,8 @@ CONFIG_USB_SERIAL_OPTION=m
CONFIG_USB_GADGET=y
CONFIG_INFINIBAND=m
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_EFI=y
CONFIG_RTC_DRV_EFI=m
CONFIG_RTC_DRV_LS2X=y
CONFIG_DMADEVICES=y
CONFIG_UIO=m
CONFIG_UIO_PDRV_GENIRQ=m
@@ -726,6 +746,7 @@ CONFIG_FAT_DEFAULT_IOCHARSET="gb2312"
CONFIG_PROC_KCORE=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_HUGETLBFS=y
CONFIG_CONFIGFS_FS=y
CONFIG_HFS_FS=m
CONFIG_HFSPLUS_FS=m
+8 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@

#ifndef _ASM_LOONGARCH_ACPI_H
#define _ASM_LOONGARCH_ACPI_H

#include <asm/suspend.h>
#ifdef CONFIG_ACPI
extern int acpi_strict;
extern int acpi_disabled;
@@ -15,7 +15,7 @@ extern int acpi_pci_disabled;
extern int acpi_noirq;

#define acpi_os_ioremap acpi_os_ioremap
void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);

static inline void disable_acpi(void)
{
@@ -35,4 +35,10 @@ extern struct list_head acpi_wakeup_device_list;

#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT

static inline unsigned long acpi_get_wakeup_address(void)
{
	return (unsigned long)loongarch_wakeup_start;
}
extern int loongarch_acpi_suspend(void);
extern int (*acpi_suspend_lowlevel)(void);
#endif /* _ASM_LOONGARCH_ACPI_H */
+82 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_ALTERNATIVE_ASM_H
#define _ASM_ALTERNATIVE_ASM_H

#ifdef __ASSEMBLY__

#include <asm/asm.h>

/*
 * Issue one struct alt_instr descriptor entry (need to put it into
 * the section .altinstructions, see below). This entry contains
 * enough information for the alternatives patching code to patch an
 * instruction. See apply_alternatives().
 */
.macro altinstruction_entry orig alt feature orig_len alt_len
	.long \orig - .
	.long \alt - .
	.short \feature
	.byte \orig_len
	.byte \alt_len
.endm

/*
 * Define an alternative between two instructions. If @feature is
 * present, early code in apply_alternatives() replaces @oldinstr with
 * @newinstr. ".fill" directive takes care of proper instruction padding
 * in case @newinstr is longer than @oldinstr.
 */
.macro ALTERNATIVE oldinstr, newinstr, feature
140 :
	\oldinstr
141 :
	.fill - (((144f-143f)-(141b-140b)) > 0) * ((144f-143f)-(141b-140b)) / 4, 4, 0x03400000
142 :

	.pushsection .altinstructions, "a"
	altinstruction_entry 140b, 143f, \feature, 142b-140b, 144f-143f
	.popsection

	.subsection 1
143 :
	\newinstr
144 :
	.previous
.endm

#define old_len			(141b-140b)
#define new_len1		(144f-143f)
#define new_len2		(145f-144f)

#define alt_max_short(a, b)	((a) ^ (((a) ^ (b)) & -(-((a) < (b)))))

/*
 * Same as ALTERNATIVE macro above but for two alternatives. If CPU
 * has @feature1, it replaces @oldinstr with @newinstr1. If CPU has
 * @feature2, it replaces @oldinstr with @feature2.
 */
.macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2
140 :
	\oldinstr
141 :
	.fill - ((alt_max_short(new_len1, new_len2) - (old_len)) > 0) * \
		(alt_max_short(new_len1, new_len2) - (old_len)) / 4, 4, 0x03400000
142 :

	.pushsection .altinstructions, "a"
	altinstruction_entry 140b, 143f, \feature1, 142b-140b, 144f-143f, 142b-141b
	altinstruction_entry 140b, 144f, \feature2, 142b-140b, 145f-144f, 142b-141b
	.popsection

	.subsection 1
143 :
	\newinstr1
144 :
	\newinstr2
145 :
	.previous
.endm

#endif  /*  __ASSEMBLY__  */

#endif /* _ASM_ALTERNATIVE_ASM_H */
Loading