xen/arm: Missing N1/A76/A75 FP registers in vCPU context switch
authorWei Chen <wei.chen@arm.com>
Fri, 28 Aug 2020 02:34:03 +0000 (02:34 +0000)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 15 Sep 2020 00:20:20 +0000 (17:20 -0700)
commit174be04403be87eaa217c47a59665fc5fe317c05
treea248aa786b0baa7062ad78a1c23c11991f2e907d
parent158c3bdc499aa860d7218803867e48534f4d6730
xen/arm: Missing N1/A76/A75 FP registers in vCPU context switch

Xen has cpu_has_fp/cpu_has_simd to detect whether the CPU supports
FP/SIMD or not. But currently, these two MACROs only consider value 0
of ID_AA64PFR0_EL1.FP/SIMD as FP/SIMD features enabled. But for CPUs
that support FP/SIMD and half-precision floating-point arithmetic, the
ID_AA64PFR0_EL1.FP/SIMD are 1 (see Arm ARM DDI0487F.b, D13.2.64).
For these CPUs, xen will treat them as no FP/SIMD support, the
vfp_save/restore_state will not take effect.

From the TRM documents of Cortex-A75/A76/N1, we know these CPUs support
basic Advanced SIMD/FP and half-precision floating-point arithmetic. In
this case, on N1/A76/A75 platforms, Xen will always miss the floating
pointer registers save/restore. If different vCPUs are running on the
same pCPU, the floating pointer registers will be corrupted randomly.

This patch fixes Xen on these new cores.

Signed-off-by: Wei Chen <wei.chen@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit 968bb86d04913f52d7678a842474f2a674a8b23e)
xen/include/asm-arm/cpufeature.h