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

[Xen-changelog] [xen-unstable] Add XENVER_pagesize hypercall.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6604238412bec090ceaf08bf139ca95403a62504
# Parent  869937819ed95ead0468a6c64b4aa753a4b8ab76
Add XENVER_pagesize hypercall.
Make xen pagesize available through xm info and sysfs.
Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c   |   13 +++++++++++++
 tools/python/xen/lowlevel/xc/xc.c                   |    8 +++++++-
 tools/python/xen/xend/XendNode.py                   |    1 +
 tools/xm-test/tests/info/02_info_compiledata_pos.py |    3 ++-
 xen/common/kernel.c                                 |    5 +++++
 xen/include/public/version.h                        |    5 ++++-
 6 files changed, 32 insertions(+), 3 deletions(-)

diff -r 869937819ed9 -r 6604238412be 
linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c Tue Jun 27 10:36:51 
2006 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c Tue Jun 27 10:44:33 
2006 +0100
@@ -225,6 +225,18 @@ static ssize_t virtual_start_show(struct
 
 HYPERVISOR_ATTR_RO(virtual_start);
 
+static ssize_t pagesize_show(struct hyp_sysfs_attr *attr, char *buffer)
+{
+       int ret;
+
+       ret = HYPERVISOR_xen_version(XENVER_pagesize, NULL);
+       if (ret > 0)
+               ret = sprintf(buffer, "%lx\n", ret);
+       return ret;
+}
+
+HYPERVISOR_ATTR_RO(pagesize);
+
 /* eventually there will be several more features to export */
 static ssize_t xen_feature_show(int index, char *buffer)
 {
@@ -254,6 +266,7 @@ static struct attribute *xen_properties_
        &capabilities_attr.attr,
        &changeset_attr.attr,
        &virtual_start_attr.attr,
+       &pagesize_attr.attr,
        &writable_pt_attr.attr,
        NULL
 };
diff -r 869937819ed9 -r 6604238412be tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue Jun 27 10:36:51 2006 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Jun 27 10:44:33 2006 +0100
@@ -637,6 +637,7 @@ static PyObject *pyxc_xeninfo(XcObject *
     xen_capabilities_info_t xen_caps;
     xen_platform_parameters_t p_parms;
     long xen_version;
+    long xen_pagesize;
     char str[128];
 
     xen_version = xc_version(self->xc_handle, XENVER_version, NULL);
@@ -658,11 +659,16 @@ static PyObject *pyxc_xeninfo(XcObject *
 
     sprintf(str, "virt_start=0x%lx", p_parms.virt_start);
 
-    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:s}",
+    xen_pagesize = xc_version(self->xc_handle, XENVER_pagesize, NULL);
+    if (xen_pagesize < 0 )
+        return PyErr_SetFromErrno(xc_error);
+
+    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:i,s:s,s:s,s:s,s:s,s:s,s:s}",
                          "xen_major", xen_version >> 16,
                          "xen_minor", (xen_version & 0xffff),
                          "xen_extra", xen_extra,
                          "xen_caps",  xen_caps,
+                         "xen_pagesize", xen_pagesize,
                          "platform_params", str,
                          "xen_changeset", xen_chgset,
                          "cc_compiler", xen_cc.compiler,
diff -r 869937819ed9 -r 6604238412be tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Tue Jun 27 10:36:51 2006 +0100
+++ b/tools/python/xen/xend/XendNode.py Tue Jun 27 10:44:33 2006 +0100
@@ -86,6 +86,7 @@ class XendNode:
                       'xen_minor',
                       'xen_extra',
                       'xen_caps',
+                      'xen_pagesize',
                       'platform_params',
                       'xen_changeset',
                       'cc_compiler',
diff -r 869937819ed9 -r 6604238412be 
tools/xm-test/tests/info/02_info_compiledata_pos.py
--- a/tools/xm-test/tests/info/02_info_compiledata_pos.py       Tue Jun 27 
10:36:51 2006 +0100
+++ b/tools/xm-test/tests/info/02_info_compiledata_pos.py       Tue Jun 27 
10:44:33 2006 +0100
@@ -24,7 +24,8 @@ for line in lines:
         map[pieces[0]] = pieces[1]
 
 for field in ["cores_per_socket", "threads_per_core", "cpu_mhz",
-              "total_memory", "free_memory", "xen_major", "xen_minor"]:
+              "total_memory", "free_memory", "xen_major", "xen_minor",
+              "xen_pagesize"]:
     val = map[field]
     if not val.isdigit():
         FAIL("Numeric field %s not all-numbers: %s" % (field, val))
diff -r 869937819ed9 -r 6604238412be xen/common/kernel.c
--- a/xen/common/kernel.c       Tue Jun 27 10:36:51 2006 +0100
+++ b/xen/common/kernel.c       Tue Jun 27 10:44:33 2006 +0100
@@ -212,6 +212,11 @@ long do_xen_version(int cmd, XEN_GUEST_H
         return 0;
     }
 
+    case XENVER_pagesize:
+    {
+        return (guest_handle_is_null(arg) ? -EINVAL : PAGE_SIZE);
+    }
+
     }
 
     return -ENOSYS;
diff -r 869937819ed9 -r 6604238412be xen/include/public/version.h
--- a/xen/include/public/version.h      Tue Jun 27 10:36:51 2006 +0100
+++ b/xen/include/public/version.h      Tue Jun 27 10:44:33 2006 +0100
@@ -10,7 +10,7 @@
 #ifndef __XEN_PUBLIC_VERSION_H__
 #define __XEN_PUBLIC_VERSION_H__
 
-/* NB. All ops return zero on success, except XENVER_version. */
+/* NB. All ops return zero on success, except XENVER_{version,pagesize} */
 
 /* arg == NULL; returns major:minor (16:16). */
 #define XENVER_version      0
@@ -54,6 +54,9 @@ typedef struct xen_feature_info xen_feat
 /* Declares the features reported by XENVER_get_features. */
 #include "features.h"
 
+/* arg == NULL; returns host memory page size. */
+#define XENVER_pagesize 7
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */
 
 /*

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.