From: kaf24@firebug.cl.cam.ac.uk Date: Tue, 27 Jun 2006 09:44:33 +0000 (+0100) Subject: Add XENVER_pagesize hypercall. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15913^2~29 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3d8026009baf3bbf0ee8a7a7cf7f2d42628d8a01;p=xen.git Add XENVER_pagesize hypercall. Make xen pagesize available through xm info and sysfs. Signed-off-by: Tristan Gingold --- diff --git a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c index abe52d5a8b..ca4d4ea70d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c +++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c @@ -225,6 +225,18 @@ static ssize_t virtual_start_show(struct hyp_sysfs_attr *attr, char *buffer) 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_attrs[] = { &capabilities_attr.attr, &changeset_attr.attr, &virtual_start_attr.attr, + &pagesize_attr.attr, &writable_pt_attr.attr, NULL }; diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c index db42ab058a..a39e7d5739 100644 --- a/tools/python/xen/lowlevel/xc/xc.c +++ b/tools/python/xen/lowlevel/xc/xc.c @@ -637,6 +637,7 @@ static PyObject *pyxc_xeninfo(XcObject *self) 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 *self) 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 --git a/tools/python/xen/xend/XendNode.py b/tools/python/xen/xend/XendNode.py index 02899bec27..4142f752a5 100644 --- a/tools/python/xen/xend/XendNode.py +++ b/tools/python/xen/xend/XendNode.py @@ -86,6 +86,7 @@ class XendNode: 'xen_minor', 'xen_extra', 'xen_caps', + 'xen_pagesize', 'platform_params', 'xen_changeset', 'cc_compiler', diff --git a/tools/xm-test/tests/info/02_info_compiledata_pos.py b/tools/xm-test/tests/info/02_info_compiledata_pos.py index 3224e13b5e..189fce17cb 100644 --- a/tools/xm-test/tests/info/02_info_compiledata_pos.py +++ b/tools/xm-test/tests/info/02_info_compiledata_pos.py @@ -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 --git a/xen/common/kernel.c b/xen/common/kernel.c index 41505c54d0..db82859d0f 100644 --- a/xen/common/kernel.c +++ b/xen/common/kernel.c @@ -212,6 +212,11 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE(void) arg) return 0; } + case XENVER_pagesize: + { + return (guest_handle_is_null(arg) ? -EINVAL : PAGE_SIZE); + } + } return -ENOSYS; diff --git a/xen/include/public/version.h b/xen/include/public/version.h index 52d42aa8fd..8976130c59 100644 --- a/xen/include/public/version.h +++ b/xen/include/public/version.h @@ -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_feature_info_t; /* 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__ */ /*