mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Add more version and capability reporting to Xen. Print the results with 'xm info'.
Signed-off-by: ian@xensource.com
This commit is contained in:
1 parent
73eac1082d
commit
45c67ab505
8 files changed
+118
-20
No files matched your search
@@ -690,6 +690,8 @@ static PyObject *pyxc_physinfo(PyObject *self,
|
||||
{
|
||||
XcObject *xc = (XcObject *)self;
|
||||
xc_physinfo_t info;
|
||||
char cpu_cap[128], *p=cpu_cap, *q=cpu_cap;
|
||||
int i;
|
||||
|
||||
if ( !PyArg_ParseTuple(args, "") )
|
||||
return NULL;
|
||||
@@ -697,14 +699,25 @@ static PyObject *pyxc_physinfo(PyObject *self,
|
||||
if ( xc_physinfo(xc->xc_handle, &info) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}",
|
||||
*q=0;
|
||||
for(i=0;i<sizeof(info.hw_cap)/4;i++)
|
||||
{
|
||||
p+=sprintf(p,"%08x:",info.hw_cap[i]);
|
||||
if(info.hw_cap[i])
|
||||
q=p;
|
||||
}
|
||||
if(q>cpu_cap)
|
||||
*(q-1)=0;
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i,s:s}",
|
||||
"threads_per_core", info.threads_per_core,
|
||||
"cores_per_socket", info.cores_per_socket,
|
||||
"sockets_per_node", info.sockets_per_node,
|
||||
"nr_nodes", info.nr_nodes,
|
||||
"total_pages", info.total_pages,
|
||||
"free_pages", info.free_pages,
|
||||
"cpu_khz", info.cpu_khz);
|
||||
"cpu_khz", info.cpu_khz,
|
||||
"hw_caps", cpu_cap);
|
||||
}
|
||||
|
||||
static PyObject *pyxc_xeninfo(PyObject *self,
|
||||
@@ -715,7 +728,10 @@ static PyObject *pyxc_xeninfo(PyObject *self,
|
||||
xen_extraversion_t xen_extra;
|
||||
xen_compile_info_t xen_cc;
|
||||
xen_changeset_info_t xen_chgset;
|
||||
xen_capabilities_info_t xen_caps;
|
||||
xen_parameters_info_t xen_parms;
|
||||
long xen_version;
|
||||
char str[128];
|
||||
|
||||
xen_version = xc_version(xc->xc_handle, XENVER_version, NULL);
|
||||
|
||||
@@ -728,10 +744,20 @@ static PyObject *pyxc_xeninfo(PyObject *self,
|
||||
if ( xc_version(xc->xc_handle, XENVER_changeset, &xen_chgset) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s}",
|
||||
if ( xc_version(xc->xc_handle, XENVER_capabilities, &xen_caps) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
if ( xc_version(xc->xc_handle, XENVER_parameters, &xen_parms) != 0 )
|
||||
return PyErr_SetFromErrno(xc_error);
|
||||
|
||||
sprintf(str,"virt_start=0x%lx",xen_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_major", xen_version >> 16,
|
||||
"xen_minor", (xen_version & 0xffff),
|
||||
"xen_extra", xen_extra,
|
||||
"xen_caps", xen_caps.caps,
|
||||
"xen_params", str,
|
||||
"xen_changeset", xen_chgset,
|
||||
"cc_compiler", xen_cc.compiler,
|
||||
"cc_compile_by", xen_cc.compile_by,
|
||||
|
||||
@@ -58,20 +58,26 @@ class XendNode:
|
||||
|
||||
def physinfo(self):
|
||||
pinfo = self.xc.physinfo()
|
||||
info = [['cores_per_socket', pinfo['cores_per_socket']],
|
||||
info = [['nr_cpus', pinfo['nr_nodes']*pinfo['sockets_per_node']*pinfo['cores_per_socket']*pinfo['threads_per_core']],
|
||||
['nr_nodes', pinfo['nr_nodes']],
|
||||
['sockets_per_node', pinfo['sockets_per_node']],
|
||||
['cores_per_socket', pinfo['cores_per_socket']],
|
||||
['threads_per_core', pinfo['threads_per_core']],
|
||||
['cpu_mhz', pinfo['cpu_khz']/1000],
|
||||
['memory', pinfo['total_pages']/256],
|
||||
['free_memory', pinfo['free_pages']/256]]
|
||||
['cpu_mhz', pinfo['cpu_khz']/1000],
|
||||
['hw_caps', pinfo['hw_caps']],
|
||||
['memory', pinfo['total_pages']/256],
|
||||
['free_memory', pinfo['free_pages']/256]]
|
||||
return info
|
||||
|
||||
def xeninfo(self):
|
||||
xinfo = self.xc.xeninfo()
|
||||
return [['xen_major', xinfo['xen_major']],
|
||||
['xen_minor', xinfo['xen_minor']],
|
||||
['xen_extra', xinfo['xen_extra']],
|
||||
['xen_changeset', xinfo['xen_changeset']],
|
||||
['cc_compiler', xinfo['cc_compiler']],
|
||||
return [['xen_major', xinfo['xen_major']],
|
||||
['xen_minor', xinfo['xen_minor']],
|
||||
['xen_extra', xinfo['xen_extra']],
|
||||
['xen_caps', xinfo['xen_caps']],
|
||||
['xen_params',xinfo['xen_params']],
|
||||
['xen_changeset', xinfo['xen_changeset']],
|
||||
['cc_compiler', xinfo['cc_compiler']],
|
||||
['cc_compile_by', xinfo['cc_compile_by']],
|
||||
['cc_compile_domain', xinfo['cc_compile_domain']],
|
||||
['cc_compile_date', xinfo['cc_compile_date']]]
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <xen/console.h>
|
||||
#include <asm/shadow.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/processor.h>
|
||||
#include <public/sched_ctl.h>
|
||||
|
||||
#include <asm/mtrr.h>
|
||||
@@ -188,9 +189,11 @@ long arch_do_dom0_op(dom0_op_t *op, dom0_op_t *u_dom0_op)
|
||||
pi->total_pages = max_page;
|
||||
pi->free_pages = avail_domheap_pages();
|
||||
pi->cpu_khz = cpu_khz;
|
||||
|
||||
copy_to_user(u_dom0_op, op, sizeof(*op));
|
||||
memset( pi->hw_cap, 0, sizeof(pi->hw_cap) );
|
||||
memcpy( pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4 );
|
||||
ret = 0;
|
||||
if( copy_to_user(u_dom0_op, op, sizeof(*op)) )
|
||||
ret = -EINVAL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include <xen/trace.h>
|
||||
#include <xen/multiboot.h>
|
||||
#include <xen/domain_page.h>
|
||||
#include <xen/compile.h>
|
||||
#include <public/version.h>
|
||||
#include <asm/bitops.h>
|
||||
#include <asm/smp.h>
|
||||
#include <asm/processor.h>
|
||||
@@ -91,6 +93,8 @@ unsigned long mmu_cr4_features = X86_CR4_PSE;
|
||||
#endif
|
||||
EXPORT_SYMBOL(mmu_cr4_features);
|
||||
|
||||
int hvm_enabled = 0; /* can we run unmodified guests */
|
||||
|
||||
struct vcpu *idle_task[NR_CPUS] = { &idle0_vcpu };
|
||||
|
||||
int acpi_disabled;
|
||||
@@ -529,6 +533,45 @@ void __init __start_xen(multiboot_info_t *mbi)
|
||||
startup_cpu_idle_loop();
|
||||
}
|
||||
|
||||
void arch_get_xen_caps(xen_capabilities_info_t *info)
|
||||
{
|
||||
char *p=info->caps;
|
||||
|
||||
*p=0;
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
|
||||
#ifndef CONFIG_X86_PAE
|
||||
p+=sprintf(p,"xen_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
|
||||
if(hvm_enabled)
|
||||
{
|
||||
p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
|
||||
}
|
||||
#else
|
||||
p+=sprintf(p,"xen_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
|
||||
if(hvm_enabled)
|
||||
{
|
||||
//p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
|
||||
//p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else /* !CONFIG_X86_32 */
|
||||
p+=sprintf(p,"xen_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION);
|
||||
if(hvm_enabled)
|
||||
{
|
||||
//p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
|
||||
//p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
|
||||
p+=sprintf(p,"hvm_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION);
|
||||
}
|
||||
#endif
|
||||
|
||||
BUG_ON((p-info->caps)>sizeof(*info));
|
||||
|
||||
if(p>info->caps) *(p-1) = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
|
||||
@@ -50,6 +50,8 @@ int vmcs_size;
|
||||
unsigned int opt_vmx_debug_level = 0;
|
||||
integer_param("vmx_debug", opt_vmx_debug_level);
|
||||
|
||||
extern int hvm_enabled;
|
||||
|
||||
#ifdef TRACE_BUFFER
|
||||
static unsigned long trace_values[NR_CPUS][4];
|
||||
#define TRACE_VMEXIT(index,value) trace_values[current->processor][index]=value
|
||||
@@ -345,6 +347,8 @@ int start_vmx(void)
|
||||
|
||||
vmx_save_init_msrs();
|
||||
|
||||
hvm_enabled = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+15
-4
@@ -113,16 +113,27 @@ long do_xen_version(int cmd, void *arg)
|
||||
|
||||
case XENVER_capabilities:
|
||||
{
|
||||
struct xen_capabilities_info info;
|
||||
xen_capabilities_info_t info;
|
||||
extern void arch_get_xen_caps(xen_capabilities_info_t * info);
|
||||
|
||||
/* FIXME */
|
||||
info.arch = 0;
|
||||
info.pae = 0;
|
||||
memset(&info, 0, sizeof(info));
|
||||
arch_get_xen_caps(&info);
|
||||
|
||||
if ( copy_to_user(arg, &info, sizeof(info)) )
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case XENVER_parameters:
|
||||
{
|
||||
xen_parameters_info_t info = { .virt_start = HYPERVISOR_VIRT_START };
|
||||
|
||||
if ( copy_to_user(arg, &info, sizeof(info)) )
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
case XENVER_changeset:
|
||||
{
|
||||
xen_changeset_info_t chgset;
|
||||
|
||||
@@ -213,6 +213,7 @@ typedef struct {
|
||||
u32 cpu_khz;
|
||||
unsigned long total_pages;
|
||||
unsigned long free_pages;
|
||||
u32 hw_cap[8];
|
||||
} dom0_physinfo_t;
|
||||
|
||||
/*
|
||||
|
||||
@@ -30,11 +30,15 @@ typedef struct xen_compile_info {
|
||||
|
||||
#define XENVER_capabilities 3
|
||||
typedef struct xen_capabilities_info {
|
||||
int pae;
|
||||
int arch;
|
||||
char caps[1024];
|
||||
} xen_capabilities_info_t;
|
||||
|
||||
#define XENVER_changeset 4
|
||||
typedef char xen_changeset_info_t[64];
|
||||
|
||||
#define XENVER_parameters 5
|
||||
typedef struct xen_paramaters_info {
|
||||
unsigned long virt_start;
|
||||
} xen_parameters_info_t;
|
||||
|
||||
#endif /* __XEN_PUBLIC_VERSION_H__ */
|
||||