From ed5aacc81cd41efc4d561e14af408d1003f7b855 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Wed, 26 May 2021 00:03:37 -0700 Subject: xtensa: fix kconfig unmet dependency warning for HAVE_FUTEX_CMPXCHG XTENSA should only select HAVE_FUTEX_CMPXCHG when FUTEX is set/enabled. This prevents a kconfig warning. WARNING: unmet direct dependencies detected for HAVE_FUTEX_CMPXCHG Depends on [n]: FUTEX [=n] Selected by [y]: - XTENSA [=y] && !MMU [=n] Fixes: d951ba21b959 ("xtensa: nommu: select HAVE_FUTEX_CMPXCHG") Signed-off-by: Randy Dunlap Cc: Max Filippov Cc: Chris Zankel Cc: linux-xtensa@linux-xtensa.org Message-Id: <20210526070337.28130-1-rdunlap@infradead.org> Signed-off-by: Max Filippov --- arch/xtensa/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 3878880469d1..b843902ad9fd 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -30,7 +30,7 @@ config XTENSA select HAVE_DMA_CONTIGUOUS select HAVE_EXIT_THREAD select HAVE_FUNCTION_TRACER - select HAVE_FUTEX_CMPXCHG if !MMU + select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX select HAVE_HW_BREAKPOINT if PERF_EVENTS select HAVE_IRQ_TIME_ACCOUNTING select HAVE_PCI -- cgit From 43ba2237281a59b40ea2393da9e89ea3a68de2a5 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Fri, 9 Jul 2021 04:13:23 -0700 Subject: xtensa: add fairness to IRQ handling Track which IRQs have been served at each level to make sure that no IRQ is served more than once while other IRQs at the same level are pending. Signed-off-by: Max Filippov --- arch/xtensa/kernel/traps.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index efc3a29cde80..874b6efc6fb3 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c @@ -268,6 +268,7 @@ void do_interrupt(struct pt_regs *regs) XCHAL_INTLEVEL7_MASK, }; struct pt_regs *old_regs; + unsigned unhandled = ~0u; trace_hardirqs_off(); @@ -283,6 +284,10 @@ void do_interrupt(struct pt_regs *regs) for (level = LOCKLEVEL; level > 0; --level) { if (int_at_level & int_level_mask[level]) { int_at_level &= int_level_mask[level]; + if (int_at_level & unhandled) + int_at_level &= unhandled; + else + unhandled |= int_level_mask[level]; break; } } @@ -290,6 +295,8 @@ void do_interrupt(struct pt_regs *regs) if (level == 0) break; + /* clear lowest pending irq in the unhandled mask */ + unhandled ^= (int_at_level & -int_at_level); do_IRQ(__ffs(int_at_level), regs); } -- cgit From 13066c303769b5c6bc67c0b990a4eb80058fb1b4 Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Tue, 10 Aug 2021 16:08:06 -0700 Subject: xtensa: ISS: don't use string pointer before NULL check Move strlen call inside the if block that checks string pointer for NULL. While at it also fix the following coccicheck warning: ./arch/xtensa/platforms/iss/console.c:204:10-11: WARNING comparing pointer to 0. Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong Signed-off-by: Max Filippov --- arch/xtensa/platforms/iss/console.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c index 21184488c277..f6e5fc5579be 100644 --- a/arch/xtensa/platforms/iss/console.c +++ b/arch/xtensa/platforms/iss/console.c @@ -186,10 +186,10 @@ late_initcall(rs_init); static void iss_console_write(struct console *co, const char *s, unsigned count) { - int len = strlen(s); - - if (s != 0 && *s != 0) + if (s && *s != 0) { + int len = strlen(s); simc_write(1, s, count < len ? count : len); + } } static struct tty_driver* iss_console_device(struct console *c, int *index) -- cgit From ef71db4845c02fe9f898e09046857ab1a9ff4be8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Aug 2021 01:37:28 +0900 Subject: xtensa: remove unneeded exports These are not used in any of subdirectories. Signed-off-by: Masahiro Yamada Message-Id: <20210811163731.186125-1-masahiroy@kernel.org> Signed-off-by: Max Filippov --- arch/xtensa/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index e9c8f064c44d..6fab7fc87579 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile @@ -17,7 +17,6 @@ variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) VARIANT = $(variant-y) -export VARIANT ifneq ($(VARIANT),) ifdef cross_compiling @@ -34,7 +33,6 @@ platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga PLATFORM = $(platform-y) -export PLATFORM # temporarily until string.h is fixed KBUILD_CFLAGS += -ffreestanding -D__linux__ -- cgit From c548584438d1a447900797a40571d95fb36a605f Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Aug 2021 01:37:29 +0900 Subject: xtensa: do not build variants directory None of arch/xtensa/variants/*/ has Makefile, so 'buildvar' is always empty. Perhaps, downstream variant code might be dropped in, but given the fact that none of upstream variants builds anything in their variant directory, I doubt this is needed. Signed-off-by: Masahiro Yamada Message-Id: <20210811163731.186125-2-masahiroy@kernel.org> Signed-off-by: Max Filippov --- arch/xtensa/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 6fab7fc87579..3c0573fe6761 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile @@ -55,9 +55,7 @@ KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs)) KBUILD_DEFCONFIG := iss_defconfig -# Only build variant and/or platform if it includes a Makefile - -buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/) +# Only build platform if it includes a Makefile buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/) # Find libgcc.a @@ -66,7 +64,7 @@ LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) head-y := arch/xtensa/kernel/head.o core-y += arch/xtensa/kernel/ arch/xtensa/mm/ -core-y += $(buildvar) $(buildplf) +core-y += $(buildplf) core-y += arch/xtensa/boot/dts/ libs-y += arch/xtensa/lib/ $(LIBGCC) -- cgit From 59210499a02a58e5b2c6da763d08adecb760d74b Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Aug 2021 01:37:30 +0900 Subject: xtensa: build platform directories unconditionally All of arch/xtensa/platforms/*/ have Makefile. You do not need to check the presence of Makefile. Signed-off-by: Masahiro Yamada Message-Id: <20210811163731.186125-3-masahiroy@kernel.org> Signed-off-by: Max Filippov --- arch/xtensa/Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 3c0573fe6761..093e87b889be 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile @@ -32,8 +32,6 @@ platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga -PLATFORM = $(platform-y) - # temporarily until string.h is fixed KBUILD_CFLAGS += -ffreestanding -D__linux__ KBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals @@ -55,16 +53,13 @@ KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs)) KBUILD_DEFCONFIG := iss_defconfig -# Only build platform if it includes a Makefile -buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/) - # Find libgcc.a LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) head-y := arch/xtensa/kernel/head.o core-y += arch/xtensa/kernel/ arch/xtensa/mm/ -core-y += $(buildplf) +core-y += arch/xtensa/platforms/$(platform-y)/ core-y += arch/xtensa/boot/dts/ libs-y += arch/xtensa/lib/ $(LIBGCC) -- cgit From 7b7cec477fc3cd42ce565dfc3e53f144504fc95c Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 12 Aug 2021 01:37:31 +0900 Subject: xtensa: move core-y in arch/xtensa/Makefile to arch/xtensa/Kbuild Use obj-y to clean up Makefile. Signed-off-by: Masahiro Yamada Message-Id: <20210811163731.186125-4-masahiroy@kernel.org> Signed-off-by: Max Filippov --- arch/xtensa/Kbuild | 1 + arch/xtensa/Makefile | 3 --- arch/xtensa/platforms/Makefile | 4 ++++ 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 arch/xtensa/platforms/Makefile diff --git a/arch/xtensa/Kbuild b/arch/xtensa/Kbuild index a4e40e534e6a..fd12f61745ba 100644 --- a/arch/xtensa/Kbuild +++ b/arch/xtensa/Kbuild @@ -1 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-y += kernel/ mm/ platforms/ boot/dts/ diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 093e87b889be..96714ef7c89e 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile @@ -58,9 +58,6 @@ KBUILD_DEFCONFIG := iss_defconfig LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) head-y := arch/xtensa/kernel/head.o -core-y += arch/xtensa/kernel/ arch/xtensa/mm/ -core-y += arch/xtensa/platforms/$(platform-y)/ -core-y += arch/xtensa/boot/dts/ libs-y += arch/xtensa/lib/ $(LIBGCC) diff --git a/arch/xtensa/platforms/Makefile b/arch/xtensa/platforms/Makefile new file mode 100644 index 000000000000..e2e7e0726979 --- /dev/null +++ b/arch/xtensa/platforms/Makefile @@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_XTENSA_PLATFORM_XT2000) += xt2000/ +obj-$(CONFIG_XTENSA_PLATFORM_ISS) += iss/ +obj-$(CONFIG_XTENSA_PLATFORM_XTFPGA) += xtfpga/ -- cgit