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

[Xen-changelog] Manual merge.



ChangeSet 1.1349, 2005/03/22 19:35:36+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Manual merge.



 arch/x86/domain.c   | 1180 +++++++++++++++++++++++++++-------------------------
 common/page_alloc.c |   78 +--
 common/schedule.c   |  208 +++++----
 3 files changed, 803 insertions(+), 663 deletions(-)


diff -Nru a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     2005-03-22 15:04:20 -05:00
+++ b/xen/arch/x86/domain.c     2005-03-22 15:04:21 -05:00
@@ -19,6 +19,7 @@
 #include <xen/smp.h>
 #include <xen/delay.h>
 #include <xen/softirq.h>
+#include <xen/grant_table.h>
 #include <asm/regs.h>
 #include <asm/mc146818rtc.h>
 #include <asm/system.h>
@@ -33,26 +34,17 @@
 #include <asm/shadow.h>
 #include <xen/console.h>
 #include <xen/elf.h>
+#include <asm/vmx.h>
+#include <asm/vmx_vmcs.h>
+#include <asm/msr.h>
+#include <xen/kernel.h>
+#include <public/io/ioreq.h>
 #include <xen/multicall.h>
 
 /* opt_noreboot: If true, machine will need manual reset on error. */
 static int opt_noreboot = 0;
 boolean_param("noreboot", opt_noreboot);
 
-#if !defined(CONFIG_X86_64BITMODE)
-/* No ring-3 access in initial page tables. */
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
-#else
-/* Allow ring-3 access in long mode as guest cannot use ring 1. */
-#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_USER)
-#endif
-#define L2_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L3_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-#define L4_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED|_PAGE_DIRTY|_PAGE_USER)
-
-#define round_pgup(_p)    (((_p)+(PAGE_SIZE-1))&PAGE_MASK)
-#define round_pgdown(_p)  ((_p)&PAGE_MASK)
-
 static void default_idle(void)
 {
     __cli();
@@ -80,8 +72,8 @@
 void startup_cpu_idle_loop(void)
 {
     /* Just some sanity to ensure that the scheduler is set up okay. */
-    ASSERT(current->id == IDLE_DOMAIN_ID);
-    domain_unpause_by_systemcontroller(current);
+    ASSERT(current->domain->id == IDLE_DOMAIN_ID);
+    domain_unpause_by_systemcontroller(current->domain);
     __enter_scheduler();
 
     /*
@@ -96,106 +88,79 @@
 
 static long no_idt[2];
 static int reboot_mode;
-int reboot_thru_bios = 0;
-
-#ifdef CONFIG_SMP
-int reboot_smp = 0;
-static int reboot_cpu = -1;
-/* shamelessly grabbed from lib/vsprintf.c for readability */
-#define is_digit(c)    ((c) >= '0' && (c) <= '9')
-#endif
-
 
 static inline void kb_wait(void)
 {
     int i;
 
-    for (i=0; i<0x10000; i++)
-        if ((inb_p(0x64) & 0x02) == 0)
+    for ( i = 0; i < 0x10000; i++ )
+        if ( (inb_p(0x64) & 0x02) == 0 )
             break;
 }
 
-
 void machine_restart(char * __unused)
 {
-#ifdef CONFIG_SMP
-    int cpuid;
-#endif
+    int i;
        
     if ( opt_noreboot )
     {
         printk("Reboot disabled on cmdline: require manual reset\n");
-        for ( ; ; ) __asm__ __volatile__ ("hlt");
+        for ( ; ; )
+            safe_halt();
     }
 
-#ifdef CONFIG_SMP
-    cpuid = GET_APIC_ID(apic_read(APIC_ID));
-
-    /* KAF: Need interrupts enabled for safe IPI. */
     __sti();
 
-    if (reboot_smp) {
-
-        /* check to see if reboot_cpu is valid 
-           if its not, default to the BSP */
-        if ((reboot_cpu == -1) ||  
-            (reboot_cpu > (NR_CPUS -1))  || 
-            !(phys_cpu_present_map & (1<<cpuid))) 
-            reboot_cpu = boot_cpu_physical_apicid;
-
-        reboot_smp = 0;  /* use this as a flag to only go through this once*/
-        /* re-run this function on the other CPUs
-           it will fall though this section since we have 
-           cleared reboot_smp, and do the reboot if it is the
-           correct CPU, otherwise it halts. */
-        if (reboot_cpu != cpuid)
-            smp_call_function((void *)machine_restart , NULL, 1, 0);
-    }
-
-    /* if reboot_cpu is still -1, then we want a tradional reboot, 
-       and if we are not running on the reboot_cpu,, halt */
-    if ((reboot_cpu != -1) && (cpuid != reboot_cpu)) {
-        for (;;)
-            __asm__ __volatile__ ("hlt");
+    /* Ensure we are the boot CPU. */
+    if ( GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid )
+    {
+        smp_call_function((void *)machine_restart, NULL, 1, 0);
+        for ( ; ; )
+            safe_halt();
     }
+
     /*
      * Stop all CPUs and turn off local APICs and the IO-APIC, so
      * other OSs see a clean IRQ state.
      */
     smp_send_stop();
     disable_IO_APIC();
+
+#ifdef CONFIG_VMX
+    stop_vmx();
 #endif
 
-    if(!reboot_thru_bios) {
-        /* rebooting needs to touch the page at absolute addr 0 */
-        *((unsigned short *)__va(0x472)) = reboot_mode;
-        for (;;) {
-            int i;
-            for (i=0; i<100; i++) {
-                kb_wait();
-                udelay(50);
-                outb(0xfe,0x64);         /* pulse reset low */
-                udelay(50);
-            }
-            /* That didn't work - force a triple fault.. */
-            __asm__ __volatile__("lidt %0": "=m" (no_idt));
-            __asm__ __volatile__("int3");
+    /* Rebooting needs to touch the page at absolute address 0. */
+    *((unsigned short *)__va(0x472)) = reboot_mode;
+
+    for ( ; ; )
+    {
+        /* Pulse the keyboard reset line. */
+        for ( i = 0; i < 100; i++ )
+        {
+            kb_wait();
+            udelay(50);
+            outb(0xfe,0x64); /* pulse reset low */
+            udelay(50);
         }
-    }
 
-    panic("Need to reinclude BIOS reboot code\n");
+        /* That didn't work - force a triple fault.. */
+        __asm__ __volatile__("lidt %0": "=m" (no_idt));
+        __asm__ __volatile__("int3");
+    }
 }
 
 
 void __attribute__((noreturn)) __machine_halt(void *unused)
 {
     for ( ; ; )
-        __asm__ __volatile__ ( "cli; hlt" );
+        safe_halt();
 }
 
 void machine_halt(void)
 {
-    smp_call_function(__machine_halt, NULL, 1, 1);
+    watchdog_on = 0;
+    smp_call_function(__machine_halt, NULL, 1, 0);
     __machine_halt(NULL);
 }
 
@@ -219,158 +184,364 @@
            page->u.inuse.type_info);
 }
 
-xmem_cache_t *domain_struct_cachep;
-void __init domain_startofday(void)
+struct domain *arch_alloc_domain_struct(void)
 {
-    domain_struct_cachep = xmem_cache_create(
-        "domain_cache", sizeof(struct domain),
-        0, SLAB_HWCACHE_ALIGN, NULL, NULL);
-    if ( domain_struct_cachep == NULL )
-        panic("No slab cache for domain structs.");
+    return xmalloc(struct domain);
 }
 
-struct domain *arch_alloc_domain_struct(void)
+void arch_free_domain_struct(struct domain *d)
 {
-    return xmem_cache_alloc(domain_struct_cachep);
+    xfree(d);
 }
 
-void arch_free_domain_struct(struct domain *d)
+struct exec_domain *arch_alloc_exec_domain_struct(void)
+{
+    return xmalloc(struct exec_domain);
+}
+
+void arch_free_exec_domain_struct(struct exec_domain *ed)
 {
-    xmem_cache_free(domain_struct_cachep, d);
+    xfree(ed);
 }
 
 void free_perdomain_pt(struct domain *d)
 {
-    free_xenheap_page((unsigned long)d->mm.perdomain_pt);
+    free_xenheap_page((unsigned long)d->arch.mm_perdomain_pt);
+#ifdef __x86_64__
+    free_xenheap_page((unsigned long)d->arch.mm_perdomain_l2);
+    free_xenheap_page((unsigned long)d->arch.mm_perdomain_l3);
+#endif
 }
 
-static void continue_idle_task(struct domain *d)
+static void continue_idle_task(struct exec_domain *ed)
 {
     reset_stack_and_jump(idle_loop);
 }
 
-static void continue_nonidle_task(struct domain *d)
+static void continue_nonidle_task(struct exec_domain *ed)
 {
     reset_stack_and_jump(ret_from_intr);


-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog


 


Rackspace

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