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 XENFEAT feature parsing to the domain 0 builder in X

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add XENFEAT feature parsing to the domain 0 builder in Xen.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Feb 2006 18:32:09 +0000
Delivery-date: Thu, 23 Feb 2006 18:32:46 +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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 13e4df60caf14f9c010735b3a531478dcca0cbc5
# Parent  b883ef5fad48486365537d15d20336c0bbcace83
Add XENFEAT feature parsing to the domain 0 builder in Xen.
Fail to boot if domain 0 requires features that Xen does not
understand or support (for domain 0).

Remove stale dom0_translate boot option.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r b883ef5fad48 -r 13e4df60caf1 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Thu Feb 23 14:33:08 2006
+++ b/xen/arch/x86/domain_build.c       Thu Feb 23 14:55:35 2006
@@ -17,6 +17,7 @@
 #include <xen/domain.h>
 #include <xen/compile.h>
 #include <xen/iocap.h>
+#include <xen/bitops.h>
 #include <asm/regs.h>
 #include <asm/system.h>
 #include <asm/io.h>
@@ -24,6 +25,8 @@
 #include <asm/desc.h>
 #include <asm/i387.h>
 #include <asm/shadow.h>
+
+#include <public/version.h>
 
 static long dom0_nrpages;
 
@@ -56,9 +59,6 @@
 static unsigned int opt_dom0_shadow;
 boolean_param("dom0_shadow", opt_dom0_shadow);
 
-static unsigned int opt_dom0_translate;
-boolean_param("dom0_translate", opt_dom0_translate);
-
 static char opt_dom0_ioports_disable[200] = "";
 string_param("dom0_ioports_disable", opt_dom0_ioports_disable);
 
@@ -131,6 +131,62 @@
 
         if ( ioports_deny_access(dom0, io_from, io_to) != 0 )
             BUG();
+    }
+}
+
+static const char *feature_names[XENFEAT_NR_SUBMAPS*32] = {
+    [XENFEAT_writable_page_tables]       = "writable_page_tables",
+    [XENFEAT_writable_descriptor_tables] = "writable_descriptor_tables",
+    [XENFEAT_auto_translated_physmap]    = "auto_translated_physmap",
+    [XENFEAT_supervisor_mode_kernel]     = "supervisor_mode_kernel",
+    [XENFEAT_pae_pgdir_above_4gb]        = "pae_pgdir_above_4gb"
+};
+
+static void parse_features(
+    const char *feats,
+    uint32_t supported[XENFEAT_NR_SUBMAPS],
+    uint32_t required[XENFEAT_NR_SUBMAPS])
+{
+    const char *end, *p;
+    int i, req;
+
+    if ( (end = strchr(feats, ',')) == NULL )
+        end = feats + strlen(feats);
+
+    while ( feats < end )
+    {
+        p = strchr(feats, '|');
+        if ( (p == NULL) || (p > end) )
+            p = end;
+
+        req = (*feats == '!');
+        if ( req )
+            feats++;
+
+        for ( i = 0; i < XENFEAT_NR_SUBMAPS*32; i++ )
+        {
+            if ( feature_names[i] == NULL )
+                continue;
+
+            if ( strncmp(feature_names[i], feats, p-feats) == 0 )
+            {
+                set_bit(i, supported);
+                if ( req )
+                    set_bit(i, required);
+                break;
+            }
+        }
+
+        if ( i == XENFEAT_NR_SUBMAPS*32 )
+        {
+            printk("Unknown kernel feature \"%.*s\".\n",
+                   (int)(p-feats), feats);
+            panic("Domain 0 requires an unknown hypervisor feature.\n");
+        }
+
+        feats = p;
+        if ( *feats == '|' )
+            feats++;
     }
 }
 
@@ -188,6 +244,10 @@
     /* Machine address of next candidate page-table page. */
     unsigned long mpt_alloc;
 
+    /* Features supported. */
+    uint32_t dom0_features_supported[XENFEAT_NR_SUBMAPS] = { 0 };
+    uint32_t dom0_features_required[XENFEAT_NR_SUBMAPS] = { 0 };
+
     extern void translate_l2pgtable(
         struct domain *d, l1_pgentry_t *p2m, unsigned long l2mfn);
 
@@ -245,8 +305,19 @@
         return -EINVAL;
     }
 
-    if ( strstr(dsi.xen_section_string, "SHADOW=translate") )
-        opt_dom0_translate = 1;
+    if ( (p = strstr(dsi.xen_section_string, "FEATURES=")) != NULL )
+    {
+        parse_features(
+            p + strlen("FEATURES="),
+            dom0_features_supported,
+            dom0_features_required);
+        printk("Domain 0 kernel supports features = { %08x }.\n",
+               dom0_features_supported[0]);
+        printk("Domain 0 kernel requires features = { %08x }.\n",
+               dom0_features_required[0]);
+        if ( dom0_features_required[0] )
+            panic("Domain 0 requires an unsupported hypervisor feature.\n");
+    }
 
     /* Align load address to 4MB boundary. */
     dsi.v_start &= ~((1UL<<22)-1);
@@ -650,11 +721,6 @@
     si->nr_pages = nr_pages;
 
     si->shared_info = virt_to_maddr(d->shared_info);
-    if ( opt_dom0_translate )
-    {
-        si->shared_info  = max_page << PAGE_SHIFT;
-        set_gpfn_from_mfn(virt_to_maddr(d->shared_info) >> PAGE_SHIFT, 
max_page);
-    }
 
     si->flags        = SIF_PRIVILEGED | SIF_INITDOMAIN;
     si->pt_base      = vpt_start;
@@ -669,7 +735,7 @@
         mfn = pfn + alloc_spfn;
 #ifndef NDEBUG
 #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT)
-        if ( !opt_dom0_translate && (pfn > REVERSE_START) )
+        if ( pfn > REVERSE_START )
             mfn = alloc_epfn - (pfn - REVERSE_START);
 #endif
         ((unsigned long *)vphysmap_start)[pfn] = mfn;
@@ -720,48 +786,10 @@
 
     new_thread(v, dsi.v_kernentry, vstack_end, vstartinfo_start);
 
-    if ( opt_dom0_shadow || opt_dom0_translate )
-    {
-        printk("dom0: shadow enable\n");
-        shadow_mode_enable(d, (opt_dom0_translate
-                               ? SHM_enable | SHM_refcounts | SHM_translate
-                               : SHM_enable));
-        if ( opt_dom0_translate )
-        {
-            printk("dom0: shadow translate\n");
-#if defined(__i386__) && defined(CONFIG_X86_PAE)
-            printk("FIXME: PAE code needed here: %s:%d (%s)\n",
-                   __FILE__, __LINE__, __FUNCTION__);
-            for ( ; ; )
-                __asm__ __volatile__ ( "hlt" );
-#else
-            /* Hmm, what does this?
-               Looks like isn't portable across 32/64 bit and pae/non-pae ...
-               -- kraxel */
-
-            /* mafetter: This code is mostly a hack in order to be able to
-             * test with dom0's which are running with shadow translate.
-             * I expect we'll rip this out once we have a stable set of
-             * domU clients which use the various shadow modes, but it's
-             * useful to leave this here for now...
-             */
-
-            // map this domain's p2m table into current page table,
-            // so that we can easily access it.
-            //
-            ASSERT( root_get_intpte(idle_pg_table[1]) == 0 );
-            ASSERT( pagetable_get_paddr(d->arch.phys_table) );
-            idle_pg_table[1] = root_from_paddr(
-                pagetable_get_paddr(d->arch.phys_table), __PAGE_HYPERVISOR);
-            translate_l2pgtable(d, (l1_pgentry_t *)(1u << L2_PAGETABLE_SHIFT),
-                                pagetable_get_pfn(v->arch.guest_table));
-            idle_pg_table[1] = root_empty();
-            local_flush_tlb();
-#endif
-        }
-
-        update_pagetables(v); /* XXX SMP */
-        printk("dom0: shadow setup done\n");
+    if ( opt_dom0_shadow )
+    {
+        shadow_mode_enable(d, SHM_enable);
+        update_pagetables(v);
     }
 
     rc = 0;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add XENFEAT feature parsing to the domain 0 builder in Xen., Xen patchbot -unstable <=