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] Merged.

# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 1e7bbbdff402b35b77b34c42e3c57eeb3d4dcd93
# Parent  6a7253b1ce8ad357698219910ee6628be4a2efb9
# Parent  4ac2051ec21e275753c77ca53322f1d635a46918
Merged.

diff -r 6a7253b1ce8a -r 1e7bbbdff402 
linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c   Thu Oct 20 11:34:50 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/ioremap.c   Thu Oct 20 11:35:57 2005
@@ -123,9 +123,18 @@
        return __direct_remap_pfn_range(
                vma->vm_mm, address, mfn, size, prot, domid);
 }
-
 EXPORT_SYMBOL(direct_remap_pfn_range);
 
+int direct_kernel_remap_pfn_range(unsigned long address, 
+                                 unsigned long mfn,
+                                 unsigned long size, 
+                                 pgprot_t prot,
+                                 domid_t  domid)
+{
+       return __direct_remap_pfn_range(
+               &init_mm, address, mfn, size, prot, domid);
+}
+EXPORT_SYMBOL(direct_kernel_remap_pfn_range);
 
 /* FIXME: This is horribly broken on PAE */ 
 static int lookup_pte_fn(
diff -r 6a7253b1ce8a -r 1e7bbbdff402 
linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h   Thu Oct 20 
11:34:50 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h   Thu Oct 20 
11:35:57 2005
@@ -455,6 +455,11 @@
                             unsigned long size, 
                             pgprot_t prot,
                             domid_t  domid);
+int direct_kernel_remap_pfn_range(unsigned long address, 
+                                 unsigned long mfn,
+                                 unsigned long size, 
+                                 pgprot_t prot,
+                                 domid_t  domid);
 int create_lookup_pte_addr(struct mm_struct *mm,
                            unsigned long address,
                            unsigned long *ptep);
diff -r 6a7253b1ce8a -r 1e7bbbdff402 
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
--- a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Thu Oct 20 
11:34:50 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h Thu Oct 20 
11:35:57 2005
@@ -533,6 +533,12 @@
                             pgprot_t prot,
                             domid_t  domid);
 
+int direct_kernel_remap_pfn_range(unsigned long address, 
+                                 unsigned long mfn,
+                                 unsigned long size, 
+                                 pgprot_t prot,
+                                 domid_t  domid);
+
 int create_lookup_pte_addr(struct mm_struct *mm,
                            unsigned long address,
                            unsigned long *ptep);
diff -r 6a7253b1ce8a -r 1e7bbbdff402 tools/ioemu/hw/pckbd.c
--- a/tools/ioemu/hw/pckbd.c    Thu Oct 20 11:34:50 2005
+++ b/tools/ioemu/hw/pckbd.c    Thu Oct 20 11:35:57 2005
@@ -29,6 +29,9 @@
 /* debug PC keyboard : only mouse */
 //#define DEBUG_MOUSE
 
+/* enable synapatic touchpad device model */
+//#define SYNAPTIC
+
 /*     Keyboard Controller Commands */
 #define KBD_CCMD_READ_MODE     0x20    /* Read mode bits */
 #define KBD_CCMD_WRITE_MODE    0x60    /* Write mode bits */
@@ -117,10 +120,12 @@
     int rptr, wptr, count;
 } KBDQueue;
 
+#ifdef SYNAPTIC
 typedef struct {
     int absolute;
     int high;
 } TouchPad;
+#endif
 
 typedef struct KBDState {
     KBDQueue queue;
@@ -142,7 +147,9 @@
     int mouse_dy;
     int mouse_dz;
     uint8_t mouse_buttons;
+#ifdef SYNAPTIC
     TouchPad touchpad;
+#endif
 } KBDState;
 
 KBDState kbd_state;
@@ -399,6 +406,7 @@
     dx1 = s->mouse_dx;
     dy1 = s->mouse_dy;
     dz1 = s->mouse_dz;
+#ifdef SYNAPTIC
     if (s->touchpad.absolute)
     {
        int dz2, dleftnright, dg, df;
@@ -444,6 +452,7 @@
        kbd_queue(s, dy1 & 0xFF, 1);
        return;
     }
+#endif
     /* XXX: increase range to 8 bits ? */
     if (dx1 > 127)
         dx1 = 127;
@@ -516,9 +525,11 @@
 
 static void kbd_write_mouse(KBDState *s, int val)
 {
+#ifdef SYNAPTIC
 /* variables needed to store synaptics command info */
 static int rr = 0, ss = 0, tt = 0, uu = 0, res_count = 0, last_com = 0;
 int spare;
+#endif
 #ifdef DEBUG_MOUSE
     printf("kbd: write mouse 0x%02x\n", val);
 #endif
@@ -536,7 +547,9 @@
                 return;
             }
         }
+#ifdef SYNAPTIC
        last_com = val;
+#endif
         switch(val) {
         case AUX_SET_SCALE11:
             s->mouse_status &= ~MOUSE_STATUS_SCALE21;
@@ -568,6 +581,7 @@
             kbd_queue(s, AUX_ACK, 1);
             break;
         case AUX_GET_SCALE:
+#ifdef SYNAPTIC
            if (res_count == 4)
            {
                    /* time for the special stuff */
@@ -681,6 +695,7 @@
                    }
            }
            else
+#endif
            {
                    /* not a special command, just do the regular stuff */
             kbd_queue(s, AUX_ACK, 1);
@@ -705,14 +720,18 @@
             s->mouse_sample_rate = 100;
             s->mouse_resolution = 2;
             s->mouse_status = 0;
+#ifdef SYNAPTIC
                    s->touchpad.absolute = 0;
+#endif
             kbd_queue(s, AUX_ACK, 1);
             break;
         case AUX_RESET:
             s->mouse_sample_rate = 100;
             s->mouse_resolution = 2;
             s->mouse_status = 0;
+#ifdef SYNAPTIC
            s->touchpad.absolute = 0;
+#endif
             kbd_queue(s, AUX_ACK, 1);
             kbd_queue(s, 0xaa, 1);
             kbd_queue(s, s->mouse_type, 1);
@@ -722,6 +741,7 @@
         }
         break;
     case AUX_SET_SAMPLE:
+#ifdef SYNAPTIC
        if (res_count == 4 && val == 0x14)
        {
                /* time for the special stuff */
@@ -729,6 +749,7 @@
                val = (rr*64) + (ss*16) + (tt*4) + uu;
                /* TODO: set the mode byte */
        } else
+#endif
         s->mouse_sample_rate = val;
 #if 0
         /* detect IMPS/2 or IMEX */
@@ -762,6 +783,7 @@
         s->mouse_write_cmd = -1;
         break;
     case AUX_SET_RES:
+#ifdef SYNAPTIC
        if (last_com != AUX_SET_RES)
        {
                /* if its not 4 in a row, its not a command */
@@ -790,6 +812,7 @@
                        uu = val;
                        break;
        }
+#endif
         s->mouse_resolution = val;
         kbd_queue(s, AUX_ACK, 1);
         s->mouse_write_cmd = -1;
@@ -871,8 +894,10 @@
     qemu_put_be32s(f, &s->mouse_dy);
     qemu_put_be32s(f, &s->mouse_dz);
     qemu_put_8s(f, &s->mouse_buttons);
+#ifdef SYNAPTIC
     qemu_put_be32s(f, &s->touchpad.absolute);
     qemu_put_be32s(f, &s->touchpad.high);
+#endif
 }
 
 static int kbd_load(QEMUFile* f, void* opaque, int version_id)
@@ -897,8 +922,10 @@
     qemu_get_be32s(f, &s->mouse_dy);
     qemu_get_be32s(f, &s->mouse_dz);
     qemu_get_8s(f, &s->mouse_buttons);
+#ifdef SYNAPTIC
     qemu_get_be32s(f, &s->touchpad.absolute);
     qemu_get_be32s(f, &s->touchpad.high);
+#endif
     return 0;
 }
 
diff -r 6a7253b1ce8a -r 1e7bbbdff402 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu Oct 20 11:34:50 2005
+++ b/xen/arch/x86/domain.c     Thu Oct 20 11:35:57 2005
@@ -226,11 +226,9 @@
 
     if ( (v->vcpu_id = vcpu_id) != 0 )
     {
-        v->arch.schedule_tail = d->vcpu[0]->arch.schedule_tail;
+        v->arch.schedule_tail  = d->vcpu[0]->arch.schedule_tail;
         v->arch.perdomain_ptes =
             d->arch.mm_perdomain_pt + (vcpu_id << PDPT_VCPU_SHIFT);
-        v->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] =
-            l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
     }
 
     return v;
@@ -256,6 +254,7 @@
 void arch_do_createdomain(struct vcpu *v)
 {
     struct domain *d = v->domain;
+    int vcpuid;
 
     if ( is_idle_task(d) )
         return;
@@ -275,8 +274,20 @@
     set_pfn_from_mfn(virt_to_phys(d->arch.mm_perdomain_pt) >> PAGE_SHIFT,
             INVALID_M2P_ENTRY);
     v->arch.perdomain_ptes = d->arch.mm_perdomain_pt;
-    v->arch.perdomain_ptes[FIRST_RESERVED_GDT_PAGE] =
-        l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
+
+    /*
+     * Map Xen segments into every VCPU's GDT, irrespective of whether every
+     * VCPU will actually be used. This avoids an NMI race during context
+     * switch: if we take an interrupt after switching CR3 but before switching
+     * GDT, and the old VCPU# is invalid in the new domain, we would otherwise
+     * try to load CS from an invalid table.
+     */
+    for ( vcpuid = 0; vcpuid < MAX_VIRT_CPUS; vcpuid++ )
+    {
+        d->arch.mm_perdomain_pt[
+            (vcpuid << PDPT_VCPU_SHIFT) + FIRST_RESERVED_GDT_PAGE] =
+            l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
+    }
 
     v->arch.guest_vtable  = __linear_l2_table;
     v->arch.shadow_vtable = __shadow_linear_l2_table;
diff -r 6a7253b1ce8a -r 1e7bbbdff402 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Thu Oct 20 11:34:50 2005
+++ b/xen/arch/x86/setup.c      Thu Oct 20 11:35:57 2005
@@ -141,6 +141,7 @@
 static void __init start_of_day(void)
 {
     int i;
+    unsigned long vgdt;
 
     early_cpu_init();
 
@@ -158,10 +159,17 @@
 
     arch_do_createdomain(current);
     
-    /* Map default GDT into their final position in the idle page table. */
-    map_pages_to_xen(
-        GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE,
-        virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR);
+    /*
+     * Map default GDT into its final positions in the idle page table. As
+     * noted in arch_do_createdomain(), we must map for every possible VCPU#.
+     */
+    vgdt = GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE;
+    for ( i = 0; i < MAX_VIRT_CPUS; i++ )
+    {
+        map_pages_to_xen(
+            vgdt, virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR);
+        vgdt += 1 << PDPT_VCPU_VA_SHIFT;
+    }
 
     find_smp_config();
 
diff -r 6a7253b1ce8a -r 1e7bbbdff402 xen/include/xen/smp.h
--- a/xen/include/xen/smp.h     Thu Oct 20 11:34:50 2005
+++ b/xen/include/xen/smp.h     Thu Oct 20 11:35:57 2005
@@ -90,7 +90,7 @@
 #define smp_processor_id()                     0
 #endif
 #define hard_smp_processor_id()                        0
-#define smp_call_function(func,info,retry,wait)        0
+#define smp_call_function(func,info,retry,wait)        ({ do {} while (0); 0; 
})
 #define on_each_cpu(func,info,retry,wait)      ({ func(info); 0; })
 #define num_booting_cpus()                     1
 #define smp_prepare_boot_cpu()                 do {} while (0)

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

<Prev in Thread] Current Thread [Next in Thread>