[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] tools: Drop xc_cpuid_check() and bindings
commit 73771b89fd9d89a23d5c7b760056fdaf94946be9 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Mon Jul 17 13:38:03 2017 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Thu Jul 20 17:35:52 2017 +0100 tools: Drop xc_cpuid_check() and bindings There are no current users which I can locate. One piece of xend which didn't move forwards into xl/libxl is this: # Configure host CPUID consistency checks, which must be satisfied for this # VM to be allowed to run on this host's processor type: #cpuid_check=[ '1:ecx=xxxxxxxxxxxxxxxxxxxxxxxxxx1xxxxx' ] # - Host must have VMX feature flag set The implementation of xc_cpuid_check() is conceptually broken. Dom0's view of CPUID is not the approprite view to check, and will be wrong in the presence of CPUID masking/faulting, and for HVM-based toolstack domains. If it turns out that the functionality is required, it should be implemented in terms of XEN_SYSCTL_get_cpuid_policy to use the proper CPUID view. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- tools/libxc/include/xenctrl.h | 4 --- tools/libxc/xc_cpuid_x86.c | 57 ------------------------------------- tools/ocaml/libs/xc/xenctrl.ml | 2 -- tools/ocaml/libs/xc/xenctrl.mli | 3 -- tools/ocaml/libs/xc/xenctrl_stubs.c | 43 ---------------------------- tools/python/xen/lowlevel/xc/xc.c | 34 ---------------------- 6 files changed, 143 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 552a4fd..bde8313 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1793,10 +1793,6 @@ int xc_domain_debug_control(xc_interface *xch, uint32_t vcpu); #if defined(__i386__) || defined(__x86_64__) -int xc_cpuid_check(xc_interface *xch, - const unsigned int *input, - const char **config, - char **config_transformed); int xc_cpuid_set(xc_interface *xch, domid_t domid, const unsigned int *input, diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index 1bedf05..d890935 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -777,63 +777,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, domid_t domid, } /* - * Check whether a VM is allowed to launch on this host's processor type. - * - * @config format is similar to that of xc_cpuid_set(): - * '1' -> the bit must be set to 1 - * '0' -> must be 0 - * 'x' -> we don't care - * 's' -> (same) must be the same - */ -int xc_cpuid_check( - xc_interface *xch, const unsigned int *input, - const char **config, - char **config_transformed) -{ - int i, j, rc; - unsigned int regs[4]; - - memset(config_transformed, 0, 4 * sizeof(*config_transformed)); - - cpuid(input, regs); - - for ( i = 0; i < 4; i++ ) - { - if ( config[i] == NULL ) - continue; - config_transformed[i] = alloc_str(); - if ( config_transformed[i] == NULL ) - { - rc = -ENOMEM; - goto fail_rc; - } - for ( j = 0; j < 32; j++ ) - { - unsigned char val = !!((regs[i] & (1U << (31 - j)))); - if ( !strchr("10xs", config[i][j]) || - ((config[i][j] == '1') && !val) || - ((config[i][j] == '0') && val) ) - goto fail; - config_transformed[i][j] = config[i][j]; - if ( config[i][j] == 's' ) - config_transformed[i][j] = '0' + val; - } - } - - return 0; - - fail: - rc = -EPERM; - fail_rc: - for ( i = 0; i < 4; i++ ) - { - free(config_transformed[i]); - config_transformed[i] = NULL; - } - return rc; -} - -/* * Configure a single input with the informatiom from config. * * Config is an array of strings: diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 75006e7..70a325b 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -218,8 +218,6 @@ external domain_cpuid_set: handle -> domid -> (int64 * (int64 option)) = "stub_xc_domain_cpuid_set" external domain_cpuid_apply_policy: handle -> domid -> unit = "stub_xc_domain_cpuid_apply_policy" -external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array) - = "stub_xc_cpuid_check" external map_foreign_range: handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli index 720e4b2..702d8a7 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -179,6 +179,3 @@ external domain_cpuid_set: handle -> domid -> (int64 * (int64 option)) = "stub_xc_domain_cpuid_set" external domain_cpuid_apply_policy: handle -> domid -> unit = "stub_xc_domain_cpuid_apply_policy" -external cpuid_check: handle -> (int64 * (int64 option)) -> string option array -> (bool * string option array) - = "stub_xc_cpuid_check" - diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c index f1b28db..c66732f 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -805,49 +805,6 @@ CAMLprim value stub_xc_domain_cpuid_apply_policy(value xch, value domid) CAMLreturn(Val_unit); } -CAMLprim value stub_xc_cpuid_check(value xch, value input, value config) -{ - CAMLparam3(xch, input, config); - CAMLlocal3(ret, array, tmp); -#if defined(__i386__) || defined(__x86_64__) - int r; - unsigned int c_input[2]; - char *c_config[4], *out_config[4]; - - c_config[0] = string_of_option_array(config, 0); - c_config[1] = string_of_option_array(config, 1); - c_config[2] = string_of_option_array(config, 2); - c_config[3] = string_of_option_array(config, 3); - - cpuid_input_of_val(c_input[0], c_input[1], input); - - array = caml_alloc(4, 0); - for (r = 0; r < 4; r++) { - tmp = Val_none; - if (c_config[r]) { - tmp = caml_alloc_small(1, 0); - Field(tmp, 0) = caml_alloc_string(32); - } - Store_field(array, r, tmp); - } - - for (r = 0; r < 4; r++) - out_config[r] = (c_config[r]) ? String_val(Field(Field(array, r), 0)) : NULL; - - r = xc_cpuid_check(_H(xch), c_input, (const char **)c_config, out_config); - if (r < 0) - failwith_xc(_H(xch)); - - ret = caml_alloc_tuple(2); - Store_field(ret, 0, Val_bool(r)); - Store_field(ret, 1, array); - -#else - caml_failwith("xc_domain_cpuid_check: not implemented"); -#endif - CAMLreturn(ret); -} - CAMLprim value stub_xc_version_version(value xch) { CAMLparam1(xch); diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index 5d112af..aa9f8e4 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -711,29 +711,6 @@ static PyObject *pyxc_create_cpuid_dict(char **regs) return dict; } -static PyObject *pyxc_dom_check_cpuid(XcObject *self, - PyObject *args) -{ - PyObject *sub_input, *config; - unsigned int input[2]; - char *regs[4], *regs_transform[4]; - - if ( !PyArg_ParseTuple(args, "iOO", &input[0], &sub_input, &config) ) - return NULL; - - pyxc_dom_extract_cpuid(config, regs); - - input[1] = XEN_CPUID_INPUT_UNUSED; - if ( PyLong_Check(sub_input) ) - input[1] = PyLong_AsUnsignedLong(sub_input); - - if ( xc_cpuid_check(self->xc_handle, input, - (const char **)regs, regs_transform) ) - return pyxc_error_to_exception(self->xc_handle); - - return pyxc_create_cpuid_dict(regs_transform); -} - static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self, PyObject *args) { @@ -2467,17 +2444,6 @@ static PyMethodDef pyxc_methods[] = { " keys [str]: String of keys to inject.\n" }, #if defined(__i386__) || defined(__x86_64__) - { "domain_check_cpuid", - (PyCFunction)pyxc_dom_check_cpuid, - METH_VARARGS, "\n" - "Apply checks to host CPUID.\n" - " input [long]: Input for cpuid instruction (eax)\n" - " sub_input [long]: Second input (optional, may be None) for cpuid " - " instruction (ecx)\n" - " config [dict]: Dictionary of register\n" - " config [dict]: Dictionary of register, use for checking\n\n" - "Returns: [int] 0 on success; exception on error.\n" }, - { "domain_set_cpuid", (PyCFunction)pyxc_dom_set_cpuid, METH_VARARGS, "\n" -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |