ia64/xen-unstable

changeset 4728:4a4f2e086608

bitkeeper revision 1.1389.1.25 (42763030SYN-c5A47iaiRMSIUFsKbA)

[PATCH] [PATCH] fix booting with SMP enabled

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@curly.lab.netapp.com
# Make FreeBSD work with SMP enabled again
# Kip Macy <kmacy@fsmware.com>
#
# BitKeeper/etc/logging_ok
# 2005/04/30 16:07:54-07:00 kmacy@curly.lab.netapp.com +1 -0
# Logging to logging@openlogging.org accepted
#
# freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
# 2005/04/30 16:07:39-07:00 kmacy@curly.lab.netapp.com +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@curly.lab.netapp.com +2 -1
# Don't try to probe apics
#
author kmacy@netapp.com[kaf24]
date Mon May 02 13:50:40 2005 +0000 (2005-05-02)
parents 86ee0ef83cc5
children 2621a06f6d37
files freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c
line diff
     1.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c	Mon May 02 10:17:29 2005 +0000
     1.2 +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/local_apic.c	Mon May 02 13:50:40 2005 +0000
     1.3 @@ -545,7 +545,6 @@ apic_register_enumerator(struct apic_enu
     1.4  static void
     1.5  apic_init(void *dummy __unused)
     1.6  {
     1.7 -	struct apic_enumerator *enumerator;
     1.8  	uint64_t apic_base;
     1.9  	int retval, best;
    1.10  
    1.11 @@ -560,6 +559,7 @@ apic_init(void *dummy __unused)
    1.12  	/* First, probe all the enumerators to find the best match. */
    1.13  	best_enum = NULL;
    1.14  	best = 0;
    1.15 +#ifndef XEN
    1.16  	SLIST_FOREACH(enumerator, &enumerators, apic_next) {
    1.17  		retval = enumerator->apic_probe();
    1.18  		if (retval > 0)
    1.19 @@ -569,6 +569,7 @@ apic_init(void *dummy __unused)
    1.20  			best = retval;
    1.21  		}
    1.22  	}
    1.23 +#endif
    1.24  	if (best_enum == NULL) {
    1.25  		if (bootverbose)
    1.26  			printf("APIC: Could not find any APICs.\n");
     2.1 --- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c	Mon May 02 10:17:29 2005 +0000
     2.2 +++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/machdep.c	Mon May 02 13:50:40 2005 +0000
     2.3 @@ -1386,6 +1386,7 @@ initvalues(start_info_t *startinfo)
     2.4  { 
     2.5      int i;
     2.6      vm_paddr_t pdir_shadow_ma, KPTphys;
     2.7 +    vm_offset_t *pdir_shadow;
     2.8  #ifdef WRITABLE_PAGETABLES
     2.9      printk("using writable pagetables\n");
    2.10      HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
    2.11 @@ -1424,6 +1425,27 @@ initvalues(start_info_t *startinfo)
    2.12      /* allocate page for ldt */
    2.13      ldt = (union descriptor *)(KERNBASE + (tmpindex << PAGE_SHIFT));
    2.14      tmpindex++; 
    2.15 +
    2.16 +    /* initialize page directory shadow page */
    2.17 +    pdir_shadow = (vm_offset_t *)(KERNBASE + (tmpindex << PAGE_SHIFT));
    2.18 +    i686_pagezero(pdir_shadow);
    2.19 +    pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT);
    2.20 +    PT_SET_MA(pdir_shadow, pdir_shadow_ma | PG_V | PG_A);
    2.21 +    tmpindex++;
    2.22 +
    2.23 +    /* setup shadow mapping first so vtomach will work */
    2.24 +    xen_pt_pin((vm_paddr_t)pdir_shadow_ma);
    2.25 +    xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), 
    2.26 +			pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M);
    2.27 +    xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), 
    2.28 +			((vm_paddr_t)IdlePTD) | PG_V | PG_A);
    2.29 +    xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), 
    2.30 +			KPTphys | PG_V | PG_A);
    2.31 +
    2.32 +    xen_flush_queue();
    2.33 +    /* allocate remainder of NKPT pages */
    2.34 +
    2.35 +
    2.36  #ifdef SMP
    2.37      /* allocate cpu0 private page */
    2.38      cpu0prvpage = (KERNBASE + (tmpindex << PAGE_SHIFT));
    2.39 @@ -1458,18 +1480,6 @@ initvalues(start_info_t *startinfo)
    2.40  	xen_queue_pt_update(KPTphys + i*sizeof(vm_paddr_t), 0);
    2.41      xen_flush_queue();
    2.42      
    2.43 -    pdir_shadow_ma = xpmap_ptom(tmpindex << PAGE_SHIFT);
    2.44 -    tmpindex++;
    2.45 -
    2.46 -    /* setup shadow mapping first so vtomach will work */
    2.47 -    xen_pt_pin((vm_paddr_t)pdir_shadow_ma);
    2.48 -    xen_queue_pt_update((vm_paddr_t)(IdlePTD + PTDPTDI), 
    2.49 -			pdir_shadow_ma | PG_V | PG_A | PG_RW | PG_M);
    2.50 -    xen_queue_pt_update(pdir_shadow_ma + PTDPTDI*sizeof(vm_paddr_t), 
    2.51 -			((vm_paddr_t)IdlePTD) | PG_V | PG_A);
    2.52 -    xen_queue_pt_update(pdir_shadow_ma + KPTDI*sizeof(vm_paddr_t), 
    2.53 -			KPTphys | PG_V | PG_A);
    2.54 -
    2.55      /* allocate remainder of NKPT pages */
    2.56      for (i = 0; i < NKPT-1; i++, tmpindex++) {
    2.57  	xen_queue_pt_update((vm_paddr_t)(IdlePTD + KPTDI + i + 1),