[3/6] tools/python: Drop cpuid helpers
diff mbox series

Message ID 20200205165056.11734-4-andrew.cooper3@citrix.com
State New, archived
Headers show
Series
  • tools: Rationalise legacy CPUID handling
Related show

Commit Message

Andrew Cooper Feb. 5, 2020, 4:50 p.m. UTC
These are believed-unused, and the underlying infrastructure is about to be
rewritten completely.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <Ian.Jackson@citrix.com>
CC: Wei Liu <wl@xen.org>
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 tools/python/xen/lowlevel/xc/xc.c | 98 ---------------------------------------
 1 file changed, 98 deletions(-)

Comments

Marek Marczykowski-Górecki Feb. 5, 2020, 7:37 p.m. UTC | #1
On Wed, Feb 05, 2020 at 04:50:53PM +0000, Andrew Cooper wrote:
> These are believed-unused, and the underlying infrastructure is about to be
> rewritten completely.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Ian Jackson Feb. 11, 2020, 5:41 p.m. UTC | #2
Andrew Cooper writes ("[PATCH 3/6] tools/python: Drop cpuid helpers"):
> These are believed-unused, and the underlying infrastructure is about to be
> rewritten completely.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Patch
diff mbox series

diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
index a751e85910..ac0e26a742 100644
--- a/tools/python/xen/lowlevel/xc/xc.c
+++ b/tools/python/xen/lowlevel/xc/xc.c
@@ -694,84 +694,6 @@  static PyObject *pyxc_get_device_group(XcObject *self,
     return Pystr;
 }
 
-#if defined(__i386__) || defined(__x86_64__)
-static void pyxc_dom_extract_cpuid(PyObject *config,
-                                  char **regs)
-{
-    const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" };
-    PyObject *obj;
-    int i;
-
-    memset(regs, 0, 4*sizeof(*regs));
-
-    if ( !PyDict_Check(config) )
-        return;
-
-    for ( i = 0; i < 4; i++ )
-        if ( (obj = PyDict_GetItemString(config, regs_extract[i])) != NULL )
-            regs[i] = PyBytes_AS_STRING(obj);
-}
-
-static PyObject *pyxc_create_cpuid_dict(char **regs)
-{
-   const char *regs_extract[4] = { "eax", "ebx", "ecx", "edx" };
-   PyObject *dict;
-   int i;
-
-   dict = PyDict_New();
-   for ( i = 0; i < 4; i++ )
-   {
-       if ( regs[i] == NULL )
-           continue;
-       PyDict_SetItemString(dict, regs_extract[i],
-                            PyBytes_FromString(regs[i]));
-       free(regs[i]);
-       regs[i] = NULL;
-   }
-   return dict;
-}
-
-static PyObject *pyxc_dom_set_policy_cpuid(XcObject *self,
-                                           PyObject *args)
-{
-    int domid;
-
-    if ( !PyArg_ParseTuple(args, "i", &domid) )
-        return NULL;
-
-    if ( xc_cpuid_apply_policy(self->xc_handle, domid, NULL, 0) )
-        return pyxc_error_to_exception(self->xc_handle);
-
-    Py_INCREF(zero);
-    return zero;
-}
-
-
-static PyObject *pyxc_dom_set_cpuid(XcObject *self,
-                                    PyObject *args)
-{
-    PyObject *sub_input, *config;
-    unsigned int domid, input[2];
-    char *regs[4], *regs_transform[4];
-
-    if ( !PyArg_ParseTuple(args, "IIOO", &domid,
-                           &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_set(self->xc_handle, domid, input, (const char **)regs,
-                      regs_transform) )
-        return pyxc_error_to_exception(self->xc_handle);
-
-    return pyxc_create_cpuid_dict(regs_transform);
-}
-#endif /* __i386__ || __x86_64__ */
-
 static PyObject *pyxc_gnttab_hvm_seed(XcObject *self,
 				      PyObject *args,
 				      PyObject *kwds)
@@ -2406,26 +2328,6 @@  static PyMethodDef pyxc_methods[] = {
       "Inject debug keys into Xen.\n"
       " keys    [str]: String of keys to inject.\n" },
 
-#if defined(__i386__) || defined(__x86_64__)
-    { "domain_set_cpuid", 
-      (PyCFunction)pyxc_dom_set_cpuid, 
-      METH_VARARGS, "\n"
-      "Set cpuid response for an input and a domain.\n"
-      " dom [int]: Identifier of domain.\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\n"
-      "Returns: [int] 0 on success; exception on error.\n" },
-
-    { "domain_set_policy_cpuid", 
-      (PyCFunction)pyxc_dom_set_policy_cpuid, 
-      METH_VARARGS, "\n"
-      "Set the default cpuid policy for a domain.\n"
-      " dom [int]: Identifier of domain.\n\n"
-      "Returns: [int] 0 on success; exception on error.\n" },
-#endif
-
     { "dom_set_memshr", 
       (PyCFunction)pyxc_dom_set_memshr,
       METH_VARARGS, "\n"