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

[PATCH 1/4] tools/ocaml: expose the supported guest GIC versions in physinfo



Since XEN_DOMCTL_CONFIG_GIC_NATIVE was removed, the toolstack has to
choose a concrete GIC_V2 or GIC_V3 version itself when creating an ARM
domain. libxl and the Python bindings do so via XEN_SYSCTL_physinfo, but
the OCaml physinfo stub only extracts the SVE vector length on ARM, so
an OCaml toolstack has no way to select the GIC version.

Add gic_v2 and gic_v3 to arm_physinfo_caps and populate them using
arch_capabilities_arm_gic_v2/v3(), as is done for the Python bindings.

Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
Changes in v2:
- No changes
---
 tools/ocaml/libs/xc/xenctrl.ml      | 2 ++
 tools/ocaml/libs/xc/xenctrl.mli     | 2 ++
 tools/ocaml/libs/xc/xenctrl_stubs.c | 7 ++++++-
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 582897af6d..37e41879bb 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -134,6 +134,8 @@ type physinfo_cap_flag =
 type arm_physinfo_caps =
   {
     sve_vl: int;
+    gic_v2: bool;
+    gic_v3: bool;
   }
 
 type x86_physinfo_cap_flag
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 9414b87164..7a0dd7d8ba 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -119,6 +119,8 @@ type physinfo_cap_flag =
 type arm_physinfo_caps =
   {
     sve_vl: int;
+    gic_v2: bool;
+    gic_v3: bool;
   }
 
 type x86_physinfo_cap_flag
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c15a3428da..e0c435e346 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -35,6 +35,7 @@
 #define XC_WANT_COMPAT_MAP_FOREIGN_API
 #include <xenctrl.h>
 #include <xenguest.h>
+#include <xen-tools/arm-arch-capabilities.h>
 #include <xen-tools/common-macros.h>
 
 #include "mmap_stubs.h"
@@ -880,11 +881,15 @@ CAMLprim value physinfo_arch_caps(const xc_physinfo_t 
*info)
 
        tag = 0; /* tag ARM */
 
-       arch_obj = caml_alloc_tuple(1);
+       arch_obj = caml_alloc_tuple(3);
 
        Store_field(arch_obj, 0,
                    Val_int(MASK_EXTR(info->arch_capabilities,
                                      XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK) * 128));
+       Store_field(arch_obj, 1,
+                   
Val_bool(arch_capabilities_arm_gic_v2(info->arch_capabilities)));
+       Store_field(arch_obj, 2,
+                   
Val_bool(arch_capabilities_arm_gic_v3(info->arch_capabilities)));
 
 #elif defined(__i386__) || defined(__x86_64__)
 
-- 
2.53.0



--
Julian Vetter | Vates Hypervisor & Kernel Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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