Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> --- CC: Ian Campbell <ian.campb...@citrix.com> CC: Ian Jackson <ian.jack...@eu.citrix.com> CC: Wei Liu <wei.l...@citrix.com> CC: David Scott <d...@recoil.org> CC: Rob Hoes <rob.h...@citrix.com> --- tools/libxc/include/xenctrl.h | 2 ++ tools/libxc/xc_misc.c | 14 ++++++++++++++ tools/ocaml/libs/xc/xenctrl.ml | 2 ++ tools/ocaml/libs/xc/xenctrl.mli | 2 ++ tools/ocaml/libs/xc/xenctrl_stubs.c | 20 ++++++++++++++++++++ 5 files changed, 40 insertions(+)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index b44aec7..401a6f8 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2843,6 +2843,8 @@ int xc_psr_cat_get_domain_data(xc_interface *xch, uint32_t domid, int xc_psr_cat_get_l3_info(xc_interface *xch, uint32_t socket, uint32_t *cos_max, uint32_t *cbm_len); +int xc_get_levelling_caps(xc_interface *xch, uint64_t *caps); + int xc_get_featureset(xc_interface *xch, uint32_t index, uint32_t *nr_features, uint32_t *featureset); #endif diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 4d7af3d..7707a70 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -745,6 +745,20 @@ int xc_get_featureset(xc_interface *xch, uint32_t index, return ret; } +int xc_get_levelling_caps(xc_interface *xch, uint64_t *caps) +{ + DECLARE_SYSCTL; + int ret; + + sysctl.cmd = XEN_SYSCTL_get_levelling_caps; + ret = do_sysctl(xch, &sysctl); + + if ( !ret ) + *caps = sysctl.u.levelling.caps; + + return ret; +} + /* * Local variables: * mode: C diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 15c7eb0..d651533 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -247,6 +247,8 @@ external version_capabilities: handle -> string = type featureset_index = Featureset_host | Featureset_pv | Featureset_hvm external get_featureset : handle -> featureset_index -> int64 array = "stub_xc_get_featureset" +external get_levelling_caps : handle -> int64 = "stub_xc_get_levelling_caps" + external watchdog : handle -> int -> int32 -> int = "stub_xc_watchdog" diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 42d6199..1342a5e 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -152,6 +152,8 @@ external version_capabilities : handle -> string type featureset_index = Featureset_host | Featureset_pv | Featureset_hvm external get_featureset : handle -> featureset_index -> int64 array = "stub_xc_get_featureset" +external get_levelling_caps : handle -> int64 = "stub_xc_get_levelling_caps" + type core_magic = Magic_hvm | Magic_pv type core_header = { xch_magic : core_magic; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index a47473b..3ae2060 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -1255,6 +1255,26 @@ CAMLprim value stub_xc_get_featureset(value xch, value idx) CAMLreturn(bitmap_val); } +CAMLprim value stub_xc_get_levelling_caps(value xch) +{ + CAMLparam1(xch); + + /* Safe, because of the global ocaml lock. */ + static uint64_t caps; + static bool have_caps; + + if (!have_caps) + { + int ret = xc_get_levelling_caps(_H(xch), &caps); + + if (ret || (caps > INT64_MAX)) + failwith_xc(_H(xch)); + have_caps = true; + } + + CAMLreturn(caml_copy_int64(caps)); +} + CAMLprim value stub_xc_watchdog(value xch, value domid, value timeout) { CAMLparam3(xch, domid, timeout); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel