[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v5 1/2] xen/arm: Missing N1/A76/A75 FP registers in vCPU context switch


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>
  • From: Wei Chen <wei.chen@xxxxxxx>
  • Date: Fri, 28 Aug 2020 02:34:03 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LxjuW76QYQnnm39E3PPg+txyPyA7XTzDaE5mmk/F3KI=; b=MrmGYKhxBFl3RYYCfq6o191APdm3bXcH2784OagsceHIW1KRyxTDkkmqnEGvPG6qhIZpMv1SoU7itLHKyJLR6PjiAO8Dhhc19WWDSy9VQoYyb8yT98O41ocaoL/Y9axfmG36X+aKqbHsdjxXy4yWmSzTbHx6Y9EDhM4TFcmJxBljOf7NphTwD2Tq02CTOn/mjieEtkA/G3/6d4kbuziKoa/3DxICmlQ/Zd/EPVPI5wN6CH+6i6FJtarfCajQyjnv8VMl0ade4jv2xH0ZDcKF2qKHwj8H7rnmJeKZbO6Lkho+gkD9xtI5vqj+/t9aM1z54JYMMzS2sqwThKgX2VtFig==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RL5V301u6+pCoJr7dyDL1kz4o26WE/O4DUrDmXafHOz0Kz7qHgps2As5tul2pA+1hTai4CrzkcXkKyNHOPHQO3iUa/JBNAKMx3+juevBlzi5SFnBYCqbG655gzUOSLwcoF6epd/BhShBOuITJG47nC68kggZjYvgwwNzovJF7kzP5fHKGkZ3zU+1iqCgPU0Wg5m8n+j9GCgZ9NMozfqNJV6wm9+16xNaMCyO91r7gzSy4z5M3eVobPEGFpGebWcINNoYcb30T2EK6pyr92wDzmPpmCQWzJi/zall09JpitEXOJ8JCOxY/y5+ZSUx+GjtPxF6pSGzZJ587b001EpqUw==
  • Cc: <Andre.Przywara@xxxxxxx>, <Bertrand.Marquis@xxxxxxx>, <Penny.Zheng@xxxxxxx>, <Kaly.Xin@xxxxxxx>, <nd@xxxxxxx>
  • Delivery-date: Fri, 28 Aug 2020 02:34:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true

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@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/include/asm-arm/cpufeature.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeature.h
index 674beb0353..10878ead8a 100644
--- a/xen/include/asm-arm/cpufeature.h
+++ b/xen/include/asm-arm/cpufeature.h
@@ -13,8 +13,8 @@
 #define cpu_has_el2_64    (boot_cpu_feature64(el2) >= 1)
 #define cpu_has_el3_32    (boot_cpu_feature64(el3) == 2)
 #define cpu_has_el3_64    (boot_cpu_feature64(el3) >= 1)
-#define cpu_has_fp        (boot_cpu_feature64(fp) == 0)
-#define cpu_has_simd      (boot_cpu_feature64(simd) == 0)
+#define cpu_has_fp        (boot_cpu_feature64(fp) < 8)
+#define cpu_has_simd      (boot_cpu_feature64(simd) < 8)
 #define cpu_has_gicv3     (boot_cpu_feature64(gic) == 1)
 #endif
 
-- 
2.17.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.