]> git.baikalelectronics.ru Git - kernel.git/commit
arm64/sve: Report SVE to userspace via CPUID only if supported
authorDave Martin <Dave.Martin@arm.com>
Thu, 14 Dec 2017 14:03:44 +0000 (14:03 +0000)
committerWill Deacon <will.deacon@arm.com>
Thu, 14 Dec 2017 15:14:30 +0000 (15:14 +0000)
commit47bd0a9af9ad490d6448743652aa5728a484c38d
treeeaf191d0def5b13d26c93f53365a52795e693f69
parent7cf68b655e84235efedc692d8abb1193bf99529c
arm64/sve: Report SVE to userspace via CPUID only if supported

Currently, the SVE field in ID_AA64PFR0_EL1 is visible
unconditionally to userspace via the CPU ID register emulation,
irrespective of the kernel config.  This means that if a kernel
configured with CONFIG_ARM64_SVE=n is run on SVE-capable hardware,
userspace will see SVE reported as present in the ID regs even
though the kernel forbids execution of SVE instructions.

This patch makes the exposure of the SVE field in ID_AA64PFR0_EL1
conditional on CONFIG_ARM64_SVE=y.

Since future architecture features are likely to encounter a
similar requirement, this patch adds a suitable helper macros for
use when declaring config-conditional ID register fields.

Fixes: d3d6d6abaf42 ("arm64/sve: Detect SVE and activate runtime support")
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Suzuki Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/cpufeature.h
arch/arm64/kernel/cpufeature.c