[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] fix booting with SMP enabled


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Kip Macy <kmacy@xxxxxxxxxx>
  • Date: Sun, 1 May 2005 17:04:29 -0700 (PDT)
  • Delivery-date: Mon, 02 May 2005 12:40:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Let me know if pine has messed up the patch the way gmail does.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/04/30 16:07:55-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx 
#   Make FreeBSD work with SMP enabled again
#   Kip Macy <kmacy@xxxxxxxxxxx>
# 
# BitKeeper/etc/logging_ok
#   2005/04/30 16:07:54-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +1 -0
#   Logging to logging@xxxxxxxxxxxxxxx accepted
# 
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
#   2005/04/30 16:07:39-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +22 -12
#   Do shadow directory initialization before SMP page table setup
# 
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c
#   2005/04/30 16:07:39-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +2 -1
#   Don't try to probe apics
# 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c     2005-04-30 
17:06:42 -07:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c     2005-04-30 
17:06:42 -07:00
@@ -545,7 +545,6 @@
 static void
 apic_init(void *dummy __unused)
 {
-       struct apic_enumerator *enumerator;
        uint64_t apic_base;
        int retval, best;
 
@@ -560,6 +559,7 @@
        /* First, probe all the enumerators to find the best match. */
        best_enum = NULL;
        best = 0;
+#ifndef XEN
        SLIST_FOREACH(enumerator, &enumerators, apic_next) {
                retval = enumerator->apic_probe();
                if (retval > 0)
@@ -569,6 +569,7 @@
                        best = retval;
                }
        }
+#endif
        if (best_enum == NULL) {
                if (bootverbose)
                        printf("APIC: Could not find any APICs.\n");
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c        2005-04-30 
17:06:42 -07:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c        2005-04-30 
17:06:42 -07:00
@@ -1386,6 +1386,7 @@
 { 
     int i;
     vm_paddr_t pdir_shadow_ma, KPTphys;
+    vm_offset_t *pdir_shadow;
 #ifdef WRITABLE_PAGETABLES
     printk("using writable pagetables\n");
     HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
@@ -1424,6 +1425,27 @@
     /* allocate page for ldt */
     ldt = (union descriptor *)(KERNBASE + (tmpindex << PAGE_SHIFT));
     tmpindex++; 
+
+    /* initialize page directory shadow page */
+    pdir_shadow = (vm_offset_t *)(KERNBASE + (tmpindex << PAGE_SHIFT));
+    i686_pagezero(pdir_shadow);
+    pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT);
+    PT_SET_MA(pdir_shadow, pdir_shadow_ma | PG_V | PG_A);
+    tmpindex++;
+
+    /* setup shadow mapping first so vtomach will work */
+    xen_pt_pin((vm_paddr_t)pdir_shadow_ma);
+    xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), 
+                       pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M);
+    xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), 
+                       ((vm_paddr_t)IdlePTD) | PG_V | PG_A);
+    xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), 
+                       KPTphys | PG_V | PG_A);
+
+    xen_flush_queue();
+    /* allocate remainder of NKPT pages */
+
+
 #ifdef SMP
     /* allocate cpu0 private page */
     cpu0prvpage = (KERNBASE + (tmpindex << PAGE_SHIFT));
@@ -1458,18 +1480,6 @@
        xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0);
     xen_flush_queue();
     
-    pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT);
-    tmpindex++;
-
-    /* setup shadow mapping first so vtomach will work */
-    xen_pt_pin((vm_paddr_t)pdir_shadow_ma);
-    xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), 
-                       pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M);
-    xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), 
-                       ((vm_paddr_t)IdlePTD) | PG_V | PG_A);
-    xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), 
-                       KPTphys | PG_V | PG_A);
-
     /* allocate remainder of NKPT pages */
     for (i = 0; i < NKPT-1; i++, tmpindex++) {
        xen_queue_pt_update((vm_paddr_t)(IdlePTD + KPTDI + i + 1), 


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.