]> xenbits.xensource.com Git - xen.git/commitdiff
tools/ocaml: Add missing vmtrace_buf_kb field
authorPetr Beneš <w1benny@gmail.com>
Fri, 9 Feb 2024 07:17:24 +0000 (08:17 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 9 Feb 2024 07:17:24 +0000 (08:17 +0100)
Add the missing `vmtrace_buf_kb` field to the OCaml bindings to match the
vm.cfg configuration, correcting an oversight from its initial introduction.

Signed-off-by: Petr Beneš <w1benny@gmail.com>
Acked-by: Christian Lindig <christian.lindig@cloud.com>
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
tools/ocaml/libs/xc/xenctrl_stubs.c

index d6c6eb73db4487e631a347c9807362af750c0c2c..55923857ec0a593ebd73ff60a25b8bdf34873c94 100644 (file)
@@ -85,6 +85,7 @@ type domctl_create_config =
     max_grant_frames: int;
     max_maptrack_frames: int;
     max_grant_version: int;
+    vmtrace_buf_kb: int32;
     cpupool_id: int32;
     arch: arch_domainconfig;
   }
index 3bfc16edba9678e2cbb31d0a3b6cbb15aebae8bf..9b4b45db3a6d0d2a2ffd6f5b0f8cb26b1479a86a 100644 (file)
@@ -77,6 +77,7 @@ type domctl_create_config = {
   max_grant_frames: int;
   max_maptrack_frames: int;
   max_grant_version: int;
+  vmtrace_buf_kb: int32;
   cpupool_id: int32;
   arch: arch_domainconfig;
 }
index 3703f48c74d1d43aa14ae47f97fe65242bf1a496..2b6d3c09dfa05d0dc3e0cfc46c096a4d74d6bdce 100644 (file)
@@ -210,10 +210,17 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 #define VAL_MAX_GRANT_FRAMES    Field(config, 6)
 #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7)
 #define VAL_MAX_GRANT_VERSION   Field(config, 8)
-#define VAL_CPUPOOL_ID          Field(config, 9)
-#define VAL_ARCH                Field(config, 10)
+#define VAL_VMTRACE_BUF_KB      Field(config, 9)
+#define VAL_CPUPOOL_ID          Field(config, 10)
+#define VAL_ARCH                Field(config, 11)
 
        uint32_t domid = Int_val(wanted_domid);
+       uint64_t vmtrace_size = Int32_val(VAL_VMTRACE_BUF_KB);
+
+       vmtrace_size = ROUNDUP(vmtrace_size << 10, XC_PAGE_SHIFT);
+       if ( vmtrace_size != (uint32_t)vmtrace_size )
+               caml_invalid_argument("vmtrace_buf_kb");
+
        int result;
        struct xen_domctl_createdomain cfg = {
                .ssidref = Int32_val(VAL_SSIDREF),
@@ -223,6 +230,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
                .max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
                .grant_opts =
                    XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
+               .vmtrace_size = vmtrace_size,
                .cpupool_id = Int32_val(VAL_CPUPOOL_ID),
        };
 
@@ -279,6 +287,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 
 #undef VAL_ARCH
 #undef VAL_CPUPOOL_ID
+#undef VAL_VMTRACE_BUF_KB
 #undef VAL_MAX_GRANT_VERSION
 #undef VAL_MAX_MAPTRACK_FRAMES
 #undef VAL_MAX_GRANT_FRAMES