direct-io.hg
changeset 6703:ec4a3f2d060e
Add more version and capability reporting to Xen. Print the results with 'xm info'.
Signed-off-by: ian@xensource.com
Signed-off-by: ian@xensource.com
author | iap10@freefall.cl.cam.ac.uk |
---|---|
date | Fri Sep 09 15:33:32 2005 +0000 (2005-09-09) |
parents | 3f4d14357976 |
children | 16cd990994d5 b2f4823b6ff0 |
files | linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/XendNode.py xen/arch/x86/dom0_ops.c xen/arch/x86/setup.c xen/arch/x86/vmx.c xen/common/kernel.c xen/include/public/dom0_ops.h xen/include/public/version.h |
line diff
2.1 --- a/tools/python/xen/lowlevel/xc/xc.c Fri Sep 09 13:28:23 2005 +0000 2.2 +++ b/tools/python/xen/lowlevel/xc/xc.c Fri Sep 09 15:33:32 2005 +0000 2.3 @@ -690,6 +690,8 @@ static PyObject *pyxc_physinfo(PyObject 2.4 { 2.5 XcObject *xc = (XcObject *)self; 2.6 xc_physinfo_t info; 2.7 + char cpu_cap[128], *p=cpu_cap, *q=cpu_cap; 2.8 + int i; 2.9 2.10 if ( !PyArg_ParseTuple(args, "") ) 2.11 return NULL; 2.12 @@ -697,14 +699,25 @@ static PyObject *pyxc_physinfo(PyObject 2.13 if ( xc_physinfo(xc->xc_handle, &info) != 0 ) 2.14 return PyErr_SetFromErrno(xc_error); 2.15 2.16 - return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i}", 2.17 + *q=0; 2.18 + for(i=0;i<sizeof(info.hw_cap)/4;i++) 2.19 + { 2.20 + p+=sprintf(p,"%08x:",info.hw_cap[i]); 2.21 + if(info.hw_cap[i]) 2.22 + q=p; 2.23 + } 2.24 + if(q>cpu_cap) 2.25 + *(q-1)=0; 2.26 + 2.27 + return Py_BuildValue("{s:i,s:i,s:i,s:i,s:l,s:l,s:i,s:s}", 2.28 "threads_per_core", info.threads_per_core, 2.29 "cores_per_socket", info.cores_per_socket, 2.30 "sockets_per_node", info.sockets_per_node, 2.31 "nr_nodes", info.nr_nodes, 2.32 "total_pages", info.total_pages, 2.33 "free_pages", info.free_pages, 2.34 - "cpu_khz", info.cpu_khz); 2.35 + "cpu_khz", info.cpu_khz, 2.36 + "hw_caps", cpu_cap); 2.37 } 2.38 2.39 static PyObject *pyxc_xeninfo(PyObject *self, 2.40 @@ -715,7 +728,10 @@ static PyObject *pyxc_xeninfo(PyObject * 2.41 xen_extraversion_t xen_extra; 2.42 xen_compile_info_t xen_cc; 2.43 xen_changeset_info_t xen_chgset; 2.44 + xen_capabilities_info_t xen_caps; 2.45 + xen_parameters_info_t xen_parms; 2.46 long xen_version; 2.47 + char str[128]; 2.48 2.49 xen_version = xc_version(xc->xc_handle, XENVER_version, NULL); 2.50 2.51 @@ -728,10 +744,20 @@ static PyObject *pyxc_xeninfo(PyObject * 2.52 if ( xc_version(xc->xc_handle, XENVER_changeset, &xen_chgset) != 0 ) 2.53 return PyErr_SetFromErrno(xc_error); 2.54 2.55 - return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s}", 2.56 + if ( xc_version(xc->xc_handle, XENVER_capabilities, &xen_caps) != 0 ) 2.57 + return PyErr_SetFromErrno(xc_error); 2.58 + 2.59 + if ( xc_version(xc->xc_handle, XENVER_parameters, &xen_parms) != 0 ) 2.60 + return PyErr_SetFromErrno(xc_error); 2.61 + 2.62 + sprintf(str,"virt_start=0x%lx",xen_parms.virt_start); 2.63 + 2.64 + return Py_BuildValue("{s:i,s:i,s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:s}", 2.65 "xen_major", xen_version >> 16, 2.66 "xen_minor", (xen_version & 0xffff), 2.67 "xen_extra", xen_extra, 2.68 + "xen_caps", xen_caps.caps, 2.69 + "xen_params", str, 2.70 "xen_changeset", xen_chgset, 2.71 "cc_compiler", xen_cc.compiler, 2.72 "cc_compile_by", xen_cc.compile_by,
3.1 --- a/tools/python/xen/xend/XendNode.py Fri Sep 09 13:28:23 2005 +0000 3.2 +++ b/tools/python/xen/xend/XendNode.py Fri Sep 09 15:33:32 2005 +0000 3.3 @@ -58,20 +58,26 @@ class XendNode: 3.4 3.5 def physinfo(self): 3.6 pinfo = self.xc.physinfo() 3.7 - info = [['cores_per_socket', pinfo['cores_per_socket']], 3.8 + info = [['nr_cpus', pinfo['nr_nodes']*pinfo['sockets_per_node']*pinfo['cores_per_socket']*pinfo['threads_per_core']], 3.9 + ['nr_nodes', pinfo['nr_nodes']], 3.10 + ['sockets_per_node', pinfo['sockets_per_node']], 3.11 + ['cores_per_socket', pinfo['cores_per_socket']], 3.12 ['threads_per_core', pinfo['threads_per_core']], 3.13 - ['cpu_mhz', pinfo['cpu_khz']/1000], 3.14 - ['memory', pinfo['total_pages']/256], 3.15 - ['free_memory', pinfo['free_pages']/256]] 3.16 + ['cpu_mhz', pinfo['cpu_khz']/1000], 3.17 + ['hw_caps', pinfo['hw_caps']], 3.18 + ['memory', pinfo['total_pages']/256], 3.19 + ['free_memory', pinfo['free_pages']/256]] 3.20 return info 3.21 3.22 def xeninfo(self): 3.23 xinfo = self.xc.xeninfo() 3.24 - return [['xen_major', xinfo['xen_major']], 3.25 - ['xen_minor', xinfo['xen_minor']], 3.26 - ['xen_extra', xinfo['xen_extra']], 3.27 - ['xen_changeset', xinfo['xen_changeset']], 3.28 - ['cc_compiler', xinfo['cc_compiler']], 3.29 + return [['xen_major', xinfo['xen_major']], 3.30 + ['xen_minor', xinfo['xen_minor']], 3.31 + ['xen_extra', xinfo['xen_extra']], 3.32 + ['xen_caps', xinfo['xen_caps']], 3.33 + ['xen_params',xinfo['xen_params']], 3.34 + ['xen_changeset', xinfo['xen_changeset']], 3.35 + ['cc_compiler', xinfo['cc_compiler']], 3.36 ['cc_compile_by', xinfo['cc_compile_by']], 3.37 ['cc_compile_domain', xinfo['cc_compile_domain']], 3.38 ['cc_compile_date', xinfo['cc_compile_date']]]
4.1 --- a/xen/arch/x86/dom0_ops.c Fri Sep 09 13:28:23 2005 +0000 4.2 +++ b/xen/arch/x86/dom0_ops.c Fri Sep 09 15:33:32 2005 +0000 4.3 @@ -19,6 +19,7 @@ 4.4 #include <xen/console.h> 4.5 #include <asm/shadow.h> 4.6 #include <asm/irq.h> 4.7 +#include <asm/processor.h> 4.8 #include <public/sched_ctl.h> 4.9 4.10 #include <asm/mtrr.h> 4.11 @@ -188,9 +189,11 @@ long arch_do_dom0_op(dom0_op_t *op, dom0 4.12 pi->total_pages = max_page; 4.13 pi->free_pages = avail_domheap_pages(); 4.14 pi->cpu_khz = cpu_khz; 4.15 - 4.16 - copy_to_user(u_dom0_op, op, sizeof(*op)); 4.17 + memset( pi->hw_cap, 0, sizeof(pi->hw_cap) ); 4.18 + memcpy( pi->hw_cap, boot_cpu_data.x86_capability, NCAPINTS*4 ); 4.19 ret = 0; 4.20 + if( copy_to_user(u_dom0_op, op, sizeof(*op)) ) 4.21 + ret = -EINVAL; 4.22 } 4.23 break; 4.24
5.1 --- a/xen/arch/x86/setup.c Fri Sep 09 13:28:23 2005 +0000 5.2 +++ b/xen/arch/x86/setup.c Fri Sep 09 15:33:32 2005 +0000 5.3 @@ -12,6 +12,8 @@ 5.4 #include <xen/trace.h> 5.5 #include <xen/multiboot.h> 5.6 #include <xen/domain_page.h> 5.7 +#include <xen/compile.h> 5.8 +#include <public/version.h> 5.9 #include <asm/bitops.h> 5.10 #include <asm/smp.h> 5.11 #include <asm/processor.h> 5.12 @@ -91,6 +93,8 @@ unsigned long mmu_cr4_features = X86_CR4 5.13 #endif 5.14 EXPORT_SYMBOL(mmu_cr4_features); 5.15 5.16 +int hvm_enabled = 0; /* can we run unmodified guests */ 5.17 + 5.18 struct vcpu *idle_task[NR_CPUS] = { &idle0_vcpu }; 5.19 5.20 int acpi_disabled; 5.21 @@ -529,6 +533,45 @@ void __init __start_xen(multiboot_info_t 5.22 startup_cpu_idle_loop(); 5.23 } 5.24 5.25 +void arch_get_xen_caps(xen_capabilities_info_t *info) 5.26 +{ 5.27 + char *p=info->caps; 5.28 + 5.29 + *p=0; 5.30 + 5.31 +#ifdef CONFIG_X86_32 5.32 + 5.33 +#ifndef CONFIG_X86_PAE 5.34 + p+=sprintf(p,"xen_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION); 5.35 + if(hvm_enabled) 5.36 + { 5.37 + p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION); 5.38 + } 5.39 +#else 5.40 + p+=sprintf(p,"xen_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION); 5.41 + if(hvm_enabled) 5.42 + { 5.43 + //p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION); 5.44 + //p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION); 5.45 + } 5.46 + 5.47 +#endif 5.48 + 5.49 +#else /* !CONFIG_X86_32 */ 5.50 + p+=sprintf(p,"xen_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION); 5.51 + if(hvm_enabled) 5.52 + { 5.53 + //p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION); 5.54 + //p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION); 5.55 + p+=sprintf(p,"hvm_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION); 5.56 + } 5.57 +#endif 5.58 + 5.59 + BUG_ON((p-info->caps)>sizeof(*info)); 5.60 + 5.61 + if(p>info->caps) *(p-1) = 0; 5.62 +} 5.63 + 5.64 /* 5.65 * Local variables: 5.66 * mode: C
6.1 --- a/xen/arch/x86/vmx.c Fri Sep 09 13:28:23 2005 +0000 6.2 +++ b/xen/arch/x86/vmx.c Fri Sep 09 15:33:32 2005 +0000 6.3 @@ -50,6 +50,8 @@ int vmcs_size; 6.4 unsigned int opt_vmx_debug_level = 0; 6.5 integer_param("vmx_debug", opt_vmx_debug_level); 6.6 6.7 +extern int hvm_enabled; 6.8 + 6.9 #ifdef TRACE_BUFFER 6.10 static unsigned long trace_values[NR_CPUS][4]; 6.11 #define TRACE_VMEXIT(index,value) trace_values[current->processor][index]=value 6.12 @@ -345,6 +347,8 @@ int start_vmx(void) 6.13 6.14 vmx_save_init_msrs(); 6.15 6.16 + hvm_enabled = 1; 6.17 + 6.18 return 1; 6.19 } 6.20
7.1 --- a/xen/common/kernel.c Fri Sep 09 13:28:23 2005 +0000 7.2 +++ b/xen/common/kernel.c Fri Sep 09 15:33:32 2005 +0000 7.3 @@ -113,16 +113,27 @@ long do_xen_version(int cmd, void *arg) 7.4 7.5 case XENVER_capabilities: 7.6 { 7.7 - struct xen_capabilities_info info; 7.8 + xen_capabilities_info_t info; 7.9 + extern void arch_get_xen_caps(xen_capabilities_info_t * info); 7.10 7.11 - /* FIXME */ 7.12 - info.arch = 0; 7.13 - info.pae = 0; 7.14 + memset(&info, 0, sizeof(info)); 7.15 + arch_get_xen_caps(&info); 7.16 + 7.17 if ( copy_to_user(arg, &info, sizeof(info)) ) 7.18 return -EFAULT; 7.19 return 0; 7.20 } 7.21 7.22 + case XENVER_parameters: 7.23 + { 7.24 + xen_parameters_info_t info = { .virt_start = HYPERVISOR_VIRT_START }; 7.25 + 7.26 + if ( copy_to_user(arg, &info, sizeof(info)) ) 7.27 + return -EFAULT; 7.28 + return 0; 7.29 + 7.30 + } 7.31 + 7.32 case XENVER_changeset: 7.33 { 7.34 xen_changeset_info_t chgset;
8.1 --- a/xen/include/public/dom0_ops.h Fri Sep 09 13:28:23 2005 +0000 8.2 +++ b/xen/include/public/dom0_ops.h Fri Sep 09 15:33:32 2005 +0000 8.3 @@ -213,6 +213,7 @@ typedef struct { 8.4 u32 cpu_khz; 8.5 unsigned long total_pages; 8.6 unsigned long free_pages; 8.7 + u32 hw_cap[8]; 8.8 } dom0_physinfo_t; 8.9 8.10 /*
9.1 --- a/xen/include/public/version.h Fri Sep 09 13:28:23 2005 +0000 9.2 +++ b/xen/include/public/version.h Fri Sep 09 15:33:32 2005 +0000 9.3 @@ -30,11 +30,15 @@ typedef struct xen_compile_info { 9.4 9.5 #define XENVER_capabilities 3 9.6 typedef struct xen_capabilities_info { 9.7 - int pae; 9.8 - int arch; 9.9 + char caps[1024]; 9.10 } xen_capabilities_info_t; 9.11 9.12 #define XENVER_changeset 4 9.13 typedef char xen_changeset_info_t[64]; 9.14 9.15 +#define XENVER_parameters 5 9.16 +typedef struct xen_paramaters_info { 9.17 +unsigned long virt_start; 9.18 +} xen_parameters_info_t; 9.19 + 9.20 #endif /* __XEN_PUBLIC_VERSION_H__ */