WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add more version and capability reporting to Xen. Print

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add more version and capability reporting to Xen. Print the results with 'xm info'.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Sep 2005 15:36:10 +0000
Delivery-date: Fri, 09 Sep 2005 15:34:37 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User iap10@xxxxxxxxxxxxxxxxxxxxx
# Node ID ec4a3f2d060e1dcc137cca136309ca67d46fbb85
# Parent  3f4d143579763d6f280146c8f0d49922c55ae82d
Add more version and capability reporting to Xen. Print the results with 'xm 
info'.
Signed-off-by: ian@xxxxxxxxxxxxx

diff -r 3f4d14357976 -r ec4a3f2d060e tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Fri Sep  9 13:28:23 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Sep  9 15:33:32 2005
@@ -690,6 +690,8 @@
 {
     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 @@
     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 @@
     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 @@
     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,
diff -r 3f4d14357976 -r ec4a3f2d060e tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Fri Sep  9 13:28:23 2005
+++ b/tools/python/xen/xend/XendNode.py Fri Sep  9 15:33:32 2005
@@ -58,20 +58,26 @@
 
     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']]]
diff -r 3f4d14357976 -r ec4a3f2d060e xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c   Fri Sep  9 13:28:23 2005
+++ b/xen/arch/x86/dom0_ops.c   Fri Sep  9 15:33:32 2005
@@ -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 @@
         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;
     
diff -r 3f4d14357976 -r ec4a3f2d060e xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Fri Sep  9 13:28:23 2005
+++ b/xen/arch/x86/setup.c      Fri Sep  9 15:33:32 2005
@@ -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>
@@ -90,6 +92,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 };
 
@@ -529,6 +533,45 @@
     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
diff -r 3f4d14357976 -r ec4a3f2d060e xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        Fri Sep  9 13:28:23 2005
+++ b/xen/arch/x86/vmx.c        Fri Sep  9 15:33:32 2005
@@ -49,6 +49,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];
@@ -344,6 +346,8 @@
     }
 
     vmx_save_init_msrs();
+
+    hvm_enabled = 1;
 
     return 1;
 }
diff -r 3f4d14357976 -r ec4a3f2d060e xen/common/kernel.c
--- a/xen/common/kernel.c       Fri Sep  9 13:28:23 2005
+++ b/xen/common/kernel.c       Fri Sep  9 15:33:32 2005
@@ -113,14 +113,25 @@
 
     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:
diff -r 3f4d14357976 -r ec4a3f2d060e xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h     Fri Sep  9 13:28:23 2005
+++ b/xen/include/public/dom0_ops.h     Fri Sep  9 15:33:32 2005
@@ -213,6 +213,7 @@
     u32      cpu_khz;
     unsigned long total_pages;
     unsigned long free_pages;
+    u32      hw_cap[8];
 } dom0_physinfo_t;
 
 /*
diff -r 3f4d14357976 -r ec4a3f2d060e xen/include/public/version.h
--- a/xen/include/public/version.h      Fri Sep  9 13:28:23 2005
+++ b/xen/include/public/version.h      Fri Sep  9 15:33:32 2005
@@ -30,11 +30,15 @@
 
 #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__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add more version and capability reporting to Xen. Print the results with 'xm info'., Xen patchbot -unstable <=