Commit b9753d5e authored by Mark Brown's avatar Mark Brown Committed by yanhaitao
Browse files

arm64/sve: Add compile time checks for SVE hooks in generic functions

mainline inclusion
from mainline-v5.13-rc1
commit 087dfa5c
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8E73O
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=087dfa5ca7d89c3cf6f4e972e279406a5dee5f67



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

The FPSIMD code was relying on IS_ENABLED() checks in system_suppors_sve()
to cause the compiler to delete references to SVE functions in some places,
add explicit IS_ENABLED() checks back.

Fixes: ef9c5d09 ("arm64/sve: Remove redundant system_supports_sve() tests")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210415121742.36628-1-broonie@kernel.org


Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
parent d7ed7e3f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -285,7 +285,7 @@ static void task_fpsimd_load(void)
	WARN_ON(!system_supports_fpsimd());
	WARN_ON(!have_cpu_fpsimd_context());

	if (test_thread_flag(TIF_SVE))
	if (IS_ENABLED(CONFIG_ARM64_SVE) && test_thread_flag(TIF_SVE))
		sve_load_state(sve_pffr(&current->thread),
			       &current->thread.uw.fpsimd_state.fpsr,
			       sve_vq_from_vl(current->thread.sve_vl) - 1);
@@ -307,7 +307,8 @@ static void fpsimd_save(void)
	WARN_ON(!have_cpu_fpsimd_context());

	if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) {
		if (test_thread_flag(TIF_SVE)) {
		if (IS_ENABLED(CONFIG_ARM64_SVE) &&
		    test_thread_flag(TIF_SVE)) {
			if (WARN_ON(sve_get_vl() != last->sve_vl)) {
				/*
				 * Can't save the user regs, so current would