ia64/xen-unstable

changeset 10529:6604238412be

Add XENVER_pagesize hypercall.
Make xen pagesize available through xm info and sysfs.
Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author kaf24@firebug.cl.cam.ac.uk
date Tue Jun 27 10:44:33 2006 +0100 (2006-06-27)
parents 869937819ed9
children e236794915cc
files linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendNode.py tools/xm-test/tests/info/02_info_compiledata_pos.py xen/common/kernel.c xen/include/public/version.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c	Tue Jun 27 10:36:51 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/core/xen_sysfs.c	Tue Jun 27 10:44:33 2006 +0100
     1.3 @@ -225,6 +225,18 @@ static ssize_t virtual_start_show(struct
     1.4  
     1.5  HYPERVISOR_ATTR_RO(virtual_start);
     1.6  
     1.7 +static ssize_t pagesize_show(struct hyp_sysfs_attr *attr, char *buffer)
     1.8 +{
     1.9 +	int ret;
    1.10 +
    1.11 +	ret = HYPERVISOR_xen_version(XENVER_pagesize, NULL);
    1.12 +	if (ret > 0)
    1.13 +		ret = sprintf(buffer, "%lx\n", ret);
    1.14 +	return ret;
    1.15 +}
    1.16 +
    1.17 +HYPERVISOR_ATTR_RO(pagesize);
    1.18 +
    1.19  /* eventually there will be several more features to export */
    1.20  static ssize_t xen_feature_show(int index, char *buffer)
    1.21  {
    1.22 @@ -254,6 +266,7 @@ static struct attribute *xen_properties_
    1.23  	&capabilities_attr.attr,
    1.24  	&changeset_attr.attr,
    1.25  	&virtual_start_attr.attr,
    1.26 +	&pagesize_attr.attr,
    1.27  	&writable_pt_attr.attr,
    1.28  	NULL
    1.29  };
     2.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Tue Jun 27 10:36:51 2006 +0100
     2.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue Jun 27 10:44:33 2006 +0100
     2.3 @@ -637,6 +637,7 @@ static PyObject *pyxc_xeninfo(XcObject *
     2.4      xen_capabilities_info_t xen_caps;
     2.5      xen_platform_parameters_t p_parms;
     2.6      long xen_version;
     2.7 +    long xen_pagesize;
     2.8      char str[128];
     2.9  
    2.10      xen_version = xc_version(self->xc_handle, XENVER_version, NULL);
    2.11 @@ -658,11 +659,16 @@ static PyObject *pyxc_xeninfo(XcObject *
    2.12  
    2.13      sprintf(str, "virt_start=0x%lx", p_parms.virt_start);
    2.14  
    2.15 -    return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:s}",
    2.16 +    xen_pagesize = xc_version(self->xc_handle, XENVER_pagesize, NULL);
    2.17 +    if (xen_pagesize < 0 )
    2.18 +        return PyErr_SetFromErrno(xc_error);
    2.19 +
    2.20 +    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}",
    2.21                           "xen_major", xen_version >> 16,
    2.22                           "xen_minor", (xen_version & 0xffff),
    2.23                           "xen_extra", xen_extra,
    2.24                           "xen_caps",  xen_caps,
    2.25 +                         "xen_pagesize", xen_pagesize,
    2.26                           "platform_params", str,
    2.27                           "xen_changeset", xen_chgset,
    2.28                           "cc_compiler", xen_cc.compiler,
     3.1 --- a/tools/python/xen/xend/XendNode.py	Tue Jun 27 10:36:51 2006 +0100
     3.2 +++ b/tools/python/xen/xend/XendNode.py	Tue Jun 27 10:44:33 2006 +0100
     3.3 @@ -86,6 +86,7 @@ class XendNode:
     3.4                        'xen_minor',
     3.5                        'xen_extra',
     3.6                        'xen_caps',
     3.7 +                      'xen_pagesize',
     3.8                        'platform_params',
     3.9                        'xen_changeset',
    3.10                        'cc_compiler',
     4.1 --- a/tools/xm-test/tests/info/02_info_compiledata_pos.py	Tue Jun 27 10:36:51 2006 +0100
     4.2 +++ b/tools/xm-test/tests/info/02_info_compiledata_pos.py	Tue Jun 27 10:44:33 2006 +0100
     4.3 @@ -24,7 +24,8 @@ for line in lines:
     4.4          map[pieces[0]] = pieces[1]
     4.5  
     4.6  for field in ["cores_per_socket", "threads_per_core", "cpu_mhz",
     4.7 -              "total_memory", "free_memory", "xen_major", "xen_minor"]:
     4.8 +              "total_memory", "free_memory", "xen_major", "xen_minor",
     4.9 +              "xen_pagesize"]:
    4.10      val = map[field]
    4.11      if not val.isdigit():
    4.12          FAIL("Numeric field %s not all-numbers: %s" % (field, val))
     5.1 --- a/xen/common/kernel.c	Tue Jun 27 10:36:51 2006 +0100
     5.2 +++ b/xen/common/kernel.c	Tue Jun 27 10:44:33 2006 +0100
     5.3 @@ -212,6 +212,11 @@ long do_xen_version(int cmd, XEN_GUEST_H
     5.4          return 0;
     5.5      }
     5.6  
     5.7 +    case XENVER_pagesize:
     5.8 +    {
     5.9 +        return (guest_handle_is_null(arg) ? -EINVAL : PAGE_SIZE);
    5.10 +    }
    5.11 +
    5.12      }
    5.13  
    5.14      return -ENOSYS;
     6.1 --- a/xen/include/public/version.h	Tue Jun 27 10:36:51 2006 +0100
     6.2 +++ b/xen/include/public/version.h	Tue Jun 27 10:44:33 2006 +0100
     6.3 @@ -10,7 +10,7 @@
     6.4  #ifndef __XEN_PUBLIC_VERSION_H__
     6.5  #define __XEN_PUBLIC_VERSION_H__
     6.6  
     6.7 -/* NB. All ops return zero on success, except XENVER_version. */
     6.8 +/* NB. All ops return zero on success, except XENVER_{version,pagesize} */
     6.9  
    6.10  /* arg == NULL; returns major:minor (16:16). */
    6.11  #define XENVER_version      0
    6.12 @@ -54,6 +54,9 @@ typedef struct xen_feature_info xen_feat
    6.13  /* Declares the features reported by XENVER_get_features. */
    6.14  #include "features.h"
    6.15  
    6.16 +/* arg == NULL; returns host memory page size. */
    6.17 +#define XENVER_pagesize 7
    6.18 +
    6.19  #endif /* __XEN_PUBLIC_VERSION_H__ */
    6.20  
    6.21  /*