[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools: Synchronize privcmd header constants


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Tue, 13 Nov 2012 00:55:12 +0000
  • Delivery-date: Tue, 13 Nov 2012 00:55:24 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
# Date 1352739800 0
# Node ID ff9750a630d8c742c630e7bb6c1b3fe2aeda0a37
# Parent  139f059cb0b38f54faa1b04ec5c513706ba0d6db
tools: Synchronize privcmd header constants

Since Linux's git commit ceb90fa0a8008059ecbbf9114cb89dc71a730bb6,
the privcmd.h interface between Linux and libxc specifies two new
constants, PRIVCMD_MMAPBATCH_MFN_ERROR and
PRIVCMD_MMAPBATCH_PAGED_ERROR. These constants represent the error
codes encoded in the top nibble of an mfn slot passed to the legacy
MMAPBATCH ioctl.

In particular, libxenctrl checks for the equivalent of the latter
constant when dealing with paged out frames that might be the target
of a foreign map.

Previously, the relevant constant was defined in the domctl hypervisor
interface header (XEN_DOMCTL_PFINFO_PAGEDTAB). Because this
top-nibble encoding is a contract between the dom0 kernel and libxc,
a domctl.h definition is misplaced.

- Sync the privcmd.h header to that now available in upstream Linux
- Update libxc appropriately
- Remove the unnecessary constant in domctl.h

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbelL@xxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 139f059cb0b3 -r ff9750a630d8 tools/include/xen-sys/Linux/privcmd.h
--- a/tools/include/xen-sys/Linux/privcmd.h     Mon Nov 12 17:03:19 2012 +0000
+++ b/tools/include/xen-sys/Linux/privcmd.h     Mon Nov 12 17:03:20 2012 +0000
@@ -64,6 +64,9 @@ typedef struct privcmd_mmapbatch {
        xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */
 } privcmd_mmapbatch_t; 
 
+#define PRIVCMD_MMAPBATCH_MFN_ERROR     0xf0000000U
+#define PRIVCMD_MMAPBATCH_PAGED_ERROR   0x80000000U
+
 typedef struct privcmd_mmapbatch_v2 {
        unsigned int num; /* number of pages to populate */
        domid_t dom;      /* target domain */
diff -r 139f059cb0b3 -r ff9750a630d8 tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c      Mon Nov 12 17:03:19 2012 +0000
+++ b/tools/libxc/xc_linux_osdep.c      Mon Nov 12 17:03:20 2012 +0000
@@ -129,7 +129,7 @@ static int xc_map_foreign_batch_single(i
 
     do
     {
-        *mfn ^= XEN_DOMCTL_PFINFO_PAGEDTAB;
+        *mfn ^= PRIVCMD_MMAPBATCH_PAGED_ERROR;
         usleep(100);
         rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
     }
@@ -166,8 +166,8 @@ static void *linux_privcmd_map_foreign_b
 
         for ( i = 0; i < num; i++ )
         {
-            if ( (arr[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) ==
-                 XEN_DOMCTL_PFINFO_PAGEDTAB )
+            if ( (arr[i] & PRIVCMD_MMAPBATCH_MFN_ERROR) ==
+                           PRIVCMD_MMAPBATCH_PAGED_ERROR )
             {
                 unsigned long paged_addr = (unsigned long)addr + (i << 
XC_PAGE_SHIFT);
                 rc = xc_map_foreign_batch_single(fd, dom, &arr[i],
@@ -323,12 +323,12 @@ static void *linux_privcmd_map_foreign_b
             default:
                 err[i] = -EINVAL;
                 continue;
-            case XEN_DOMCTL_PFINFO_PAGEDTAB:
+            case PRIVCMD_MMAPBATCH_PAGED_ERROR:
                 if ( rc != -ENOENT )
                 {
                     err[i] = rc ?: -EINVAL;
                     continue;
-                 }
+                }
                 rc = xc_map_foreign_batch_single(fd, dom, pfn + i,
                         (unsigned long)addr + ((unsigned 
long)i<<XC_PAGE_SHIFT));
                 if ( rc < 0 )
diff -r 139f059cb0b3 -r ff9750a630d8 xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Mon Nov 12 17:03:19 2012 +0000
+++ b/xen/include/public/domctl.h       Mon Nov 12 17:03:20 2012 +0000
@@ -136,7 +136,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getme
 #define XEN_DOMCTL_PFINFO_LPINTAB (0x1U<<31)
 #define XEN_DOMCTL_PFINFO_XTAB    (0xfU<<28) /* invalid page */
 #define XEN_DOMCTL_PFINFO_XALLOC  (0xeU<<28) /* allocate-only page */
-#define XEN_DOMCTL_PFINFO_PAGEDTAB (0x8U<<28)
 #define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
 
 struct xen_domctl_getpageframeinfo {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.