From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D3F428366 for ; Wed, 27 Mar 2024 20:30:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711571432; cv=none; b=H7yoVyVOdzkiDHda2ptf2T2f2azksbet681Iz7aYqasrTvMh20RI6iMtxYQm7x1BNb+9/ER5JeUGOsnE/kZ8sWAWBL+4crIKCENafV1GvX+whUCXEtC8SVPrFamuLWjI6b+jio0mzSefGrhqiD12+nzvMLIYaIS9TH/MyntbDd0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711571432; c=relaxed/simple; bh=i4RzSnJIVBXLEMoRHN0dHZK+f1CyBdMmLnAd5LMh/gM=; h=Date:To:From:Subject:Message-Id; b=qAKCfpvXw4dKiHE6OSllTas3Ob54+96UppsqW2/Xj3E+yBMe0sdm9QaIXSIMebHp0mfC+KnP2wNvsbkWD27EIJRG9RD1FuBn7DoVG5D+52pUY7tgloxOMoFetUnKlwwI9CPm4d8sYgo5x/APxoYvSWD9nmCECecEjApahcPdY20= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=jM2Y14aa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="jM2Y14aa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B305C433F1; Wed, 27 Mar 2024 20:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1711571430; bh=i4RzSnJIVBXLEMoRHN0dHZK+f1CyBdMmLnAd5LMh/gM=; h=Date:To:From:Subject:From; b=jM2Y14aaI2C5Pga/oIOTiK2e0eeOHgOc6fyhakfjrAqpjbA6g6R+rKqULZzIoHF/g iolcl4YdDuQeCDVX4SMw3kvHJkcyQDVmad9+qmjy4q5KxxHg5+8zSl2YlP+9JNzFEC 8qGZRQnbXn1t/wKmN8bBsk4DEjwsLn4H2nMDz2pM= Date: Wed, 27 Mar 2024 13:30:29 -0700 To: mm-commits@vger.kernel.org,will@kernel.org,tglx@linutronix.de,palmer@rivosinc.com,nicolas@fjasle.eu,nathan@kernel.org,mpe@ellerman.id.au,mingo@redhat.com,masahiroy@kernel.org,linux@armlinux.org.uk,hch@lst.de,git@xen0n.name,dave.hansen@linux.intel.com,corbet@lwn.net,chenhuacai@kernel.org,catalin.marinas@arm.com,bp@alien8.de,alexander.deucher@amd.com,samuel.holland@sifive.com,akpm@linux-foundation.org From: Andrew Morton Subject: + selftests-fpu-allow-building-on-other-architectures.patch added to mm-nonmm-unstable branch Message-Id: <20240327203030.6B305C433F1@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: selftests/fpu: allow building on other architectures has been added to the -mm mm-nonmm-unstable branch. Its filename is selftests-fpu-allow-building-on-other-architectures.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-fpu-allow-building-on-other-architectures.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Samuel Holland Subject: selftests/fpu: allow building on other architectures Date: Wed, 27 Mar 2024 13:00:45 -0700 Now that ARCH_HAS_KERNEL_FPU_SUPPORT provides a common way to compile and run floating-point code, this test is no longer x86-specific. Link: https://lkml.kernel.org/r/20240327200157.1097089-15-samuel.holland@sifive.com Signed-off-by: Samuel Holland Reviewed-by: Christoph Hellwig Cc: Alex Deucher Cc: Borislav Petkov (AMD) Cc: Catalin Marinas Cc: Dave Hansen Cc: Huacai Chen Cc: Ingo Molnar Cc: Jonathan Corbet Cc: Masahiro Yamada Cc: Michael Ellerman Cc: Nathan Chancellor Cc: Nicolas Schier Cc: Palmer Dabbelt Cc: Russell King Cc: Thomas Gleixner Cc: WANG Xuerui Cc: Will Deacon Signed-off-by: Andrew Morton --- lib/Kconfig.debug | 2 +- lib/Makefile | 25 ++----------------------- lib/test_fpu_glue.c | 5 ++++- 3 files changed, 7 insertions(+), 25 deletions(-) --- a/lib/Kconfig.debug~selftests-fpu-allow-building-on-other-architectures +++ a/lib/Kconfig.debug @@ -2921,7 +2921,7 @@ config TEST_FREE_PAGES config TEST_FPU tristate "Test floating point operations in kernel space" - depends on X86 && !KCOV_INSTRUMENT_ALL + depends on ARCH_HAS_KERNEL_FPU_SUPPORT && !KCOV_INSTRUMENT_ALL help Enable this option to add /sys/kernel/debug/selftest_helpers/test_fpu which will trigger a sequence of floating point operations. This is used --- a/lib/Makefile~selftests-fpu-allow-building-on-other-architectures +++ a/lib/Makefile @@ -110,31 +110,10 @@ CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRAC obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o obj-$(CONFIG_TEST_OBJPOOL) += test_objpool.o -# -# CFLAGS for compiling floating point code inside the kernel. x86/Makefile turns -# off the generation of FPU/SSE* instructions for kernel proper but FPU_FLAGS -# get appended last to CFLAGS and thus override those previous compiler options. -# -FPU_CFLAGS := -msse -msse2 -ifdef CONFIG_CC_IS_GCC -# Stack alignment mismatch, proceed with caution. -# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 -# (8B stack alignment). -# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383 -# -# The "-msse" in the first argument is there so that the -# -mpreferred-stack-boundary=3 build error: -# -# -mpreferred-stack-boundary=3 is not between 4 and 12 -# -# can be triggered. Otherwise gcc doesn't complain. -FPU_CFLAGS += -mhard-float -FPU_CFLAGS += $(call cc-option,-msse -mpreferred-stack-boundary=3,-mpreferred-stack-boundary=4) -endif - obj-$(CONFIG_TEST_FPU) += test_fpu.o test_fpu-y := test_fpu_glue.o test_fpu_impl.o -CFLAGS_test_fpu_impl.o += $(FPU_CFLAGS) +CFLAGS_test_fpu_impl.o += $(CC_FLAGS_FPU) +CFLAGS_REMOVE_test_fpu_impl.o += $(CC_FLAGS_NO_FPU) # Some KUnit files (hooks.o) need to be built-in even when KUnit is a module, # so we can't just use obj-$(CONFIG_KUNIT). --- a/lib/test_fpu_glue.c~selftests-fpu-allow-building-on-other-architectures +++ a/lib/test_fpu_glue.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "test_fpu.h" @@ -38,6 +38,9 @@ static struct dentry *selftest_dir; static int __init test_fpu_init(void) { + if (!kernel_fpu_available()) + return -EINVAL; + selftest_dir = debugfs_create_dir("selftest_helpers", NULL); if (!selftest_dir) return -ENOMEM; _ Patches currently in -mm which might be from samuel.holland@sifive.com are arch-add-arch_has_kernel_fpu_support.patch arm-implement-arch_has_kernel_fpu_support.patch arm-crypto-use-cc_flags_fpu-for-neon-cflags.patch arm64-implement-arch_has_kernel_fpu_support.patch arm64-crypto-use-cc_flags_fpu-for-neon-cflags.patch lib-raid6-use-cc_flags_fpu-for-neon-cflags.patch loongarch-implement-arch_has_kernel_fpu_support.patch powerpc-implement-arch_has_kernel_fpu_support.patch x86-implement-arch_has_kernel_fpu_support.patch riscv-add-support-for-kernel-mode-fpu.patch drm-amd-display-use-arch_has_kernel_fpu_support.patch selftests-fpu-move-fp-code-to-a-separate-translation-unit.patch selftests-fpu-allow-building-on-other-architectures.patch