]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen/physinfo: encode Arm SVE vector length in arch_capabilities
authorLuca Fancellu <luca.fancellu@arm.com>
Wed, 31 May 2023 07:24:09 +0000 (08:24 +0100)
committerJulien Grall <jgrall@amazon.com>
Wed, 7 Jun 2023 10:21:41 +0000 (11:21 +0100)
When the arm platform supports SVE, advertise the feature in the
field arch_capabilities in struct xen_sysctl_physinfo by encoding
the SVE vector length in it.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
xen/arch/arm/sysctl.c
xen/include/public/sysctl.h

index b0a78a8b10d0f19cd76ea99e7d63655e0c67609d..e9a0661146e42e26c764faac177339cfc140f780 100644 (file)
 #include <xen/lib.h>
 #include <xen/errno.h>
 #include <xen/hypercall.h>
+#include <asm/arm64/sve.h>
 #include <public/sysctl.h>
 
 void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
 {
     pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm | XEN_SYSCTL_PHYSCAP_hap;
+
+    pi->arch_capabilities |= MASK_INSR(sve_encode_vl(get_sys_vl_len()),
+                                       XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK);
 }
 
 long arch_do_sysctl(struct xen_sysctl *sysctl,
index 2b24d6bfd00ed3cec523ea970e3328612e176272..9d06e92d0f6ae098f4aea06f6d337b05de2f9aef 100644 (file)
@@ -94,6 +94,10 @@ struct xen_sysctl_tbuf_op {
 /* Max XEN_SYSCTL_PHYSCAP_* constant.  Used for ABI checking. */
 #define XEN_SYSCTL_PHYSCAP_MAX XEN_SYSCTL_PHYSCAP_gnttab_v2
 
+#if defined(__arm__) || defined(__aarch64__)
+#define XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK  (0x1FU)
+#endif
+
 struct xen_sysctl_physinfo {
     uint32_t threads_per_core;
     uint32_t cores_per_socket;