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

[Xen-devel] [PATCH RFC v1 14/74] tools/ocaml: Expose arch_config in domaininfo



From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 tools/ocaml/libs/xc/xenctrl.ml      | 29 +++++++++++++++++++++++++++++
 tools/ocaml/libs/xc/xenctrl.mli     | 28 ++++++++++++++++++++++++++++
 tools/ocaml/libs/xc/xenctrl_stubs.c | 26 ++++++++++++++++++++++++--
 3 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 70a325b0e9..d549068d60 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -28,6 +28,34 @@ type vcpuinfo =
        cpumap: int32;
 }
 
+type xen_arm_arch_domainconfig =
+{
+       gic_version: int;
+       nr_spis: int;
+       clock_frequency: int32;
+}
+
+type x86_arch_emulation_flags =
+       | X86_EMU_LAPIC
+       | X86_EMU_HPET
+       | X86_EMU_PM
+       | X86_EMU_RTC
+       | X86_EMU_IOAPIC
+       | X86_EMU_PIC
+       | X86_EMU_VGA
+       | X86_EMU_IOMMU
+       | X86_EMU_PIT
+       | X86_EMU_USE_PIRQ
+
+type xen_x86_arch_domainconfig =
+{
+       emulation_flags: x86_arch_emulation_flags list;
+}
+
+type arch_domainconfig =
+       | ARM of xen_arm_arch_domainconfig
+       | X86 of xen_x86_arch_domainconfig
+
 type domaininfo =
 {
        domid             : domid;
@@ -46,6 +74,7 @@ type domaininfo =
        max_vcpu_id       : int;
        ssidref           : int32;
        handle            : int array;
+       arch_config       : arch_domainconfig;
 }
 
 type sched_control =
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 702d8a7ab8..08f1fd26ae 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -22,6 +22,33 @@ type vcpuinfo = {
   cputime : int64;
   cpumap : int32;
 }
+
+type xen_arm_arch_domainconfig = {
+  gic_version: int;
+  nr_spis: int;
+  clock_frequency: int32;
+}
+
+type x86_arch_emulation_flags =
+  | X86_EMU_LAPIC
+  | X86_EMU_HPET
+  | X86_EMU_PM
+  | X86_EMU_RTC
+  | X86_EMU_IOAPIC
+  | X86_EMU_PIC
+  | X86_EMU_VGA
+  | X86_EMU_IOMMU
+  | X86_EMU_PIT
+  | X86_EMU_USE_PIRQ
+
+type xen_x86_arch_domainconfig = {
+  emulation_flags: x86_arch_emulation_flags list;
+}
+
+type arch_domainconfig =
+  | ARM of xen_arm_arch_domainconfig
+  | X86 of xen_x86_arch_domainconfig
+
 type domaininfo = {
   domid : domid;
   dying : bool;
@@ -39,6 +66,7 @@ type domaininfo = {
   max_vcpu_id : int;
   ssidref : int32;
   handle : int array;
+  arch_config : arch_domainconfig;
 }
 type sched_control = { weight : int; cap : int; }
 type physinfo_cap_flag = CAP_HVM | CAP_DirectIO
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c66732f67c..124aa34fe8 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -273,10 +273,10 @@ CAMLprim value stub_xc_domain_shutdown(value xch, value 
domid, value reason)
 static value alloc_domaininfo(xc_domaininfo_t * info)
 {
        CAMLparam0();
-       CAMLlocal2(result, tmp);
+       CAMLlocal5(result, tmp, arch_config, x86_arch_config, emul_list);
        int i;
 
-       result = caml_alloc_tuple(16);
+       result = caml_alloc_tuple(17);
 
        Store_field(result,  0, Val_int(info->domain));
        Store_field(result,  1, Val_bool(info->flags & XEN_DOMINF_dying));
@@ -302,6 +302,28 @@ static value alloc_domaininfo(xc_domaininfo_t * info)
 
        Store_field(result, 15, tmp);
 
+       /* emulation_flags: x86_arch_emulation_flags list; */
+       tmp = emul_list = Val_emptylist;
+       for (i = 0; i < 10; i++) {
+               if ((info->arch_config.emulation_flags >> i) & 1) {
+                       tmp = caml_alloc_small(2, Tag_cons);
+                       Field(tmp, 0) = Val_int(i);
+                       Field(tmp, 1) = emul_list;
+                       emul_list = tmp;
+               }
+       }
+
+       /* xen_x86_arch_domainconfig */
+       x86_arch_config = caml_alloc_tuple(1);
+       Store_field(x86_arch_config, 0, emul_list);
+
+       /* arch_config: arch_domainconfig */
+       arch_config = caml_alloc_small(1, 1);
+
+       Store_field(arch_config, 0, x86_arch_config);
+
+       Store_field(result, 16, arch_config);
+
        CAMLreturn(result);
 }
 
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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