]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen: Drop DOMCTL_getmemlist and xc_get_pfn_list()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 15 Jan 2018 10:00:51 +0000 (10:00 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 26 Jan 2018 18:28:47 +0000 (18:28 +0000)
c/s 4ddf474e2 "tools/xen-mceinj: Pass in GPA when injecting through
MSR_MCI_ADDR" removed the remaining user of hypercall.

It has been listed as broken, deprecated and wont-fix since XSA-74, so take
this opportunity to remove it completely.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxc/include/xenctrl.h
tools/libxc/xc_private.c
tools/ocaml/libs/xc/xenctrl.ml
tools/ocaml/libs/xc/xenctrl.mli
tools/ocaml/libs/xc/xenctrl_stubs.c
xen/arch/x86/domctl.c
xen/include/public/domctl.h

index 6a4347e842eba3dd24b7b9b38854d20e85858ca4..235b8bb8479e9709f405deab928b431afde6ca12 100644 (file)
@@ -1514,13 +1514,6 @@ unsigned long xc_translate_foreign_address(xc_interface *xch, uint32_t dom,
                                            int vcpu, unsigned long long virt);
 
 
-/**
- * DEPRECATED.  Avoid using this, as it does not correctly account for PFNs
- * without a backing MFN.
- */
-int xc_get_pfn_list(xc_interface *xch, uint32_t domid, uint64_t *pfn_buf,
-                    unsigned long max_pfns);
-
 int xc_copy_to_domain_page(xc_interface *xch, uint32_t domid,
                            unsigned long dst_pfn, const char *src_page);
 
index 36ead5fcca0608e45df061c06ae32ea57f8d6ac4..fcda981744aedc391a39984a30f797dff424aaf5 100644 (file)
@@ -387,33 +387,6 @@ int xc_machphys_mfn_list(xc_interface *xch,
     return rc;
 }
 
-int xc_get_pfn_list(xc_interface *xch,
-                    uint32_t domid,
-                    uint64_t *pfn_buf,
-                    unsigned long max_pfns)
-{
-    DECLARE_DOMCTL;
-    DECLARE_HYPERCALL_BOUNCE(pfn_buf, max_pfns * sizeof(*pfn_buf), XC_HYPERCALL_BUFFER_BOUNCE_OUT);
-    int ret;
-
-    if ( xc_hypercall_bounce_pre(xch, pfn_buf) )
-    {
-        PERROR("xc_get_pfn_list: pfn_buf bounce failed");
-        return -1;
-    }
-
-    domctl.cmd = XEN_DOMCTL_getmemlist;
-    domctl.domain = domid;
-    domctl.u.getmemlist.max_pfns = max_pfns;
-    set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
-
-    ret = do_domctl(xch, &domctl);
-
-    xc_hypercall_bounce_post(xch, pfn_buf);
-
-    return (ret < 0) ? -1 : domctl.u.getmemlist.num_pfns;
-}
-
 long xc_get_tot_pages(xc_interface *xch, uint32_t domid)
 {
     xc_dominfo_t info;
index a3ba488d1bf3f81189c4b253fa9c9e85ab569631..1a01faa61ee07eb404b53b542e7535ce6f973179 100644 (file)
@@ -244,9 +244,6 @@ external map_foreign_range: handle -> domid -> int
                          -> nativeint -> Xenmmap.mmap_interface
        = "stub_map_foreign_range"
 
-external domain_get_pfn_list: handle -> domid -> nativeint -> nativeint array
-       = "stub_xc_domain_get_pfn_list"
-
 external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
        = "stub_xc_domain_assign_device"
 external domain_deassign_device: handle -> domid -> (int * int * int * int) -> unit
index ed021249c0f1f98878d7453bc9964b25db92e5f3..7d2e6f0fb461765f3b3a4e7104336bc790eb2f29 100644 (file)
@@ -154,9 +154,6 @@ external domain_memory_increase_reservation :
 external map_foreign_range :
   handle -> domid -> int -> nativeint -> Xenmmap.mmap_interface
   = "stub_map_foreign_range"
-external domain_get_pfn_list :
-  handle -> domid -> nativeint -> nativeint array
-  = "stub_xc_domain_get_pfn_list"
 
 external domain_assign_device: handle -> domid -> (int * int * int * int) -> unit
        = "stub_xc_domain_assign_device"
index d1801e19ce25ce219afdc1fec606b60cea6bdf23..f97070c8b040503a56cb1e9db61207a626f3645e 100644 (file)
@@ -1009,38 +1009,6 @@ CAMLprim value stub_shadow_allocation_set(value xch, value domid,
        CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_xc_domain_get_pfn_list(value xch, value domid,
-                                           value nr_pfns)
-{
-       CAMLparam3(xch, domid, nr_pfns);
-       CAMLlocal2(array, v);
-       unsigned long c_nr_pfns;
-       long ret, i;
-       uint64_t *c_array;
-
-       c_nr_pfns = Nativeint_val(nr_pfns);
-
-       c_array = malloc(sizeof(uint64_t) * c_nr_pfns);
-       if (!c_array)
-               caml_raise_out_of_memory();
-
-       ret = xc_get_pfn_list(_H(xch), _D(domid),
-                             c_array, c_nr_pfns);
-       if (ret < 0) {
-               free(c_array);
-               failwith_xc(_H(xch));
-       }
-
-       array = caml_alloc(ret, 0);
-       for (i = 0; i < ret; i++) {
-               v = caml_copy_nativeint(c_array[i]);
-               Store_field(array, i, v);
-       }
-       free(c_array);
-
-       CAMLreturn(array);
-}
-
 CAMLprim value stub_xc_domain_ioport_permission(value xch, value domid,
                                               value start_port, value nr_ports,
                                               value allow)
index d725bb48b16086f980e9a90da6af1c44c905b494..8fbbf3aeb3e62e25188846eb037cb38d3e6693f8 100644 (file)
@@ -413,62 +413,6 @@ long arch_do_domctl(
         break;
     }
 
-    case XEN_DOMCTL_getmemlist:
-    {
-        unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
-        uint64_t mfn;
-        struct page_info *page;
-
-        if ( unlikely(d->is_dying) )
-        {
-            ret = -EINVAL;
-            break;
-        }
-
-        /*
-         * XSA-74: This sub-hypercall is broken in several ways:
-         * - lock order inversion (p2m locks inside page_alloc_lock)
-         * - no preemption on huge max_pfns input
-         * - not (re-)checking d->is_dying with page_alloc_lock held
-         * - not honoring start_pfn input (which libxc also doesn't set)
-         * Additionally it is rather useless, as the result is stale by the
-         * time the caller gets to look at it.
-         * As it only has a single, non-production consumer (xen-mceinj),
-         * rather than trying to fix it we restrict it for the time being.
-         */
-        if ( /* No nested locks inside copy_to_guest_offset(). */
-             paging_mode_external(currd) ||
-             /* Arbitrary limit capping processing time. */
-             max_pfns > GB(4) / PAGE_SIZE )
-        {
-            ret = -EOPNOTSUPP;
-            break;
-        }
-
-        spin_lock(&d->page_alloc_lock);
-
-        ret = i = 0;
-        page_list_for_each(page, &d->page_list)
-        {
-            if ( i >= max_pfns )
-                break;
-            mfn = page_to_mfn(page);
-            if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
-                                      i, &mfn, 1) )
-            {
-                ret = -EFAULT;
-                break;
-            }
-                       ++i;
-               }
-
-        spin_unlock(&d->page_alloc_lock);
-
-        domctl->u.getmemlist.num_pfns = i;
-        copyback = true;
-        break;
-    }
-
     case XEN_DOMCTL_getpageframeinfo3:
     {
         unsigned int num = domctl->u.getpageframeinfo3.num;
index 30674d65dab3a52c401f0c8e22884f661c130529..fb8b9379ffcc41f872c87e654d7a7b2d97e58c09 100644 (file)
@@ -1113,7 +1113,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_pausedomain                    3
 #define XEN_DOMCTL_unpausedomain                  4
 #define XEN_DOMCTL_getdomaininfo                  5
-#define XEN_DOMCTL_getmemlist                     6
+/* #define XEN_DOMCTL_getmemlist                  6 Removed */
 /* #define XEN_DOMCTL_getpageframeinfo            7 Obsolete - use getpageframeinfo3 */
 /* #define XEN_DOMCTL_getpageframeinfo2           8 Obsolete - use getpageframeinfo3 */
 #define XEN_DOMCTL_setvcpuaffinity                9