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

[Xen-changelog] [xen-unstable] Merge



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1334683152 -3600
# Node ID 214ca44b931682bc4b588b690e9b494dd956dc22
# Parent  1ff80750ce31a4f628b2e6830d273fa95f1364c4
# Parent  569d6f05e1ef3146c269bca6313e2777420d616d
Merge
---


diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c    Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/io_apic.c    Tue Apr 17 18:19:12 2012 +0100
@@ -185,7 +185,7 @@ struct IO_APIC_route_entry **alloc_ioapi
         ioapic_entries[apic] =
             xmalloc_array(struct IO_APIC_route_entry,
                           nr_ioapic_entries[apic]);
-        if (!ioapic_entries[apic])
+        if (!ioapic_entries[apic] && nr_ioapic_entries[apic])
             goto nomem;
     }
 
@@ -310,6 +310,9 @@ int save_IO_APIC_setup(struct IO_APIC_ro
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -331,6 +334,9 @@ void mask_IO_APIC_setup(struct IO_APIC_r
         return;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             break;
 
@@ -358,6 +364,9 @@ int restore_IO_APIC_setup(struct IO_APIC
         return -ENOMEM;
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
+
         if (!ioapic_entries[apic])
             return -ENOMEM;
 
@@ -610,6 +619,8 @@ static int __init find_isa_irq_apic(int 
     if (i < mp_irq_entries) {
         int apic;
         for(apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
                 return apic;
         }
@@ -1080,6 +1091,8 @@ static void /*__init*/ __print_IO_APIC(v
     printk(KERN_INFO "testing the IO APIC.......................\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
        spin_lock_irqsave(&ioapic_lock, flags);
        reg_00.raw = io_apic_read(apic, 0);
@@ -1229,6 +1242,8 @@ static void __init enable_IO_APIC(void)
 
     if (directed_eoi_enabled) {
         for (apic = 0; apic < nr_ioapics; apic++) {
+            if (!nr_ioapic_entries[apic])
+                continue;
             vector_map[apic] = xzalloc(vmask_t);
             BUG_ON(!vector_map[apic]);
         }
@@ -1354,6 +1369,8 @@ static void __init setup_ioapic_ids_from
      * Set the IOAPIC ID to the value stored in the MPC table.
      */
     for (apic = 0; apic < nr_ioapics; apic++) {
+        if (!nr_ioapic_entries[apic])
+            continue;
 
         /* Read the register 0 value */
         spin_lock_irqsave(&ioapic_lock, flags);
@@ -2038,6 +2055,8 @@ void ioapic_resume(void)
 
     spin_lock_irqsave(&ioapic_lock, flags);
     for (apic = 0; apic < nr_ioapics; apic++){
+        if (!nr_ioapic_entries[apic])
+            continue;
         reg_00.raw = __io_apic_read(apic, 0);
         if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid) {
             reg_00.bits.ID = mp_ioapics[apic].mpc_apicid;
@@ -2164,8 +2183,8 @@ int io_apic_set_pci_routing (int ioapic,
     int vector;
 
     if (!IO_APIC_IRQ(irq)) {
-        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
-               ioapic);
+        printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ %d\n",
+               ioapic, irq);
         return -EINVAL;
     }
 
@@ -2225,8 +2244,12 @@ static int ioapic_physbase_to_id(unsigne
 {
     int apic;
     for ( apic = 0; apic < nr_ioapics; apic++ )
+    {
+        if ( !nr_ioapic_entries[apic] )
+            continue;
         if ( mp_ioapics[apic].mpc_apicaddr == physbase )
             return apic;
+    }
     return -EINVAL;
 }
 
@@ -2444,6 +2467,22 @@ void dump_ioapic_irq_info(void)
 static unsigned int __initdata max_gsi_irqs;
 integer_param("max_gsi_irqs", max_gsi_irqs);
 
+static __init bool_t bad_ioapic_register(unsigned int idx)
+{
+    union IO_APIC_reg_00 reg_00 = { .raw = io_apic_read(idx, 0) };
+    union IO_APIC_reg_01 reg_01 = { .raw = io_apic_read(idx, 1) };
+    union IO_APIC_reg_02 reg_02 = { .raw = io_apic_read(idx, 2) };
+
+    if ( reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1 )
+    {
+        printk(KERN_WARNING "I/O APIC %#x registers return all ones, 
skipping!\n",
+               mp_ioapics[idx].mpc_apicaddr);
+        return 1;
+    }
+
+    return 0;
+}
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2477,6 +2516,12 @@ void __init init_ioapic_mappings(void)
                     __fix_to_virt(idx), ioapic_phys);
         idx++;
 
+        if ( bad_ioapic_register(i) )
+        {
+            __set_fixmap(idx, 0, 0);
+            continue;
+        }
+
         if ( smp_found_config )
         {
             /* The number of IO-APIC IRQ registers (== #pins): */
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c    Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/mpparse.c    Tue Apr 17 18:19:12 2012 +0100
@@ -1034,6 +1034,21 @@ int mp_register_gsi (u32 gsi, int trigge
                return gsi;
 #endif
 
+       if (!nr_ioapics) {
+               unsigned int port = 0x4d0 + (gsi >> 3);
+               u8 val;
+
+               if (!platform_legacy_irq(gsi))
+                       return -EINVAL;
+               val = inb(port);
+               if (triggering)
+                       val |= 1 << (gsi & 7);
+               else
+                       val &= ~(1 << (gsi & 7));
+               outb(val, port);
+               return 0;
+       }
+
        ioapic = mp_find_ioapic(gsi);
        if (ioapic < 0) {
                printk(KERN_WARNING "No IOAPIC for GSI %u\n", gsi);
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/asm-offsets.c
--- a/xen/arch/x86/x86_64/asm-offsets.c Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/asm-offsets.c Tue Apr 17 18:19:12 2012 +0100
@@ -145,6 +145,7 @@ void __dummy__(void)
 
     OFFSET(TRAPINFO_eip, struct trap_info, address);
     OFFSET(TRAPINFO_cs, struct trap_info, cs);
+    OFFSET(TRAPINFO_flags, struct trap_info, flags);
     DEFINE(TRAPINFO_sizeof, sizeof(struct trap_info));
     BLANK();
 
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/compat/entry.S        Tue Apr 17 18:19:12 2012 +0100
@@ -213,6 +213,7 @@ 1:      call  compat_create_bounce_frame
 ENTRY(compat_post_handle_exception)
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    compat_test_all_events
+.Lcompat_bounce_exception:
         call  compat_create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   compat_test_all_events
@@ -225,20 +226,21 @@ ENTRY(compat_syscall)
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testl $~3,%esi
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  %rax,TRAPBOUNCE_eip(%rdx)
+UNLIKELY_START(z, compat_syscall_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rdi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subl  $2,UREGS_rip(%rsp)
+        movl  $0,TRAPBOUNCE_error_code(%rdx)
+        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rdi),%eax
+        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rdi),%esi
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rdi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(compat_syscall_gpf)
+        movq  %rax,TRAPBOUNCE_eip(%rdx)
         movw  %si,TRAPBOUNCE_cs(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
-        call  compat_create_bounce_frame
-        jmp   compat_test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rsi
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        subl  $2,UREGS_rip(%rsp)
-        movl  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%eax
-        movzwl TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_cs(%rsi),%esi
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $0,TRAPBOUNCE_error_code(%rdx)
-        jmp   1b
+        jmp   .Lcompat_bounce_exception
 
 ENTRY(compat_sysenter)
         movq  VCPU_trap_ctxt(%rbx),%rcx
diff -r 1ff80750ce31 -r 214ca44b9316 xen/arch/x86/x86_64/entry.S
--- a/xen/arch/x86/x86_64/entry.S       Tue Apr 17 18:18:49 2012 +0100
+++ b/xen/arch/x86/x86_64/entry.S       Tue Apr 17 18:19:12 2012 +0100
@@ -277,20 +277,22 @@ sysenter_eflags_saved:
         leaq  VCPU_trap_bounce(%rbx),%rdx
         testq %rax,%rax
         leal  (,%rcx,TBF_INTERRUPT),%ecx
-        jz    2f
-1:      movq  VCPU_domain(%rbx),%rdi
+UNLIKELY_START(z, sysenter_gpf)
+        movq  VCPU_trap_ctxt(%rbx),%rsi
+        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
+        subq  $2,UREGS_rip(%rsp)
+        movl  %eax,TRAPBOUNCE_error_code(%rdx)
+        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rsi),%rax
+        testb $4,TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_flags(%rsi)
+        setnz %cl
+        leal  TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE(,%rcx,TBF_INTERRUPT),%ecx
+UNLIKELY_END(sysenter_gpf)
+        movq  VCPU_domain(%rbx),%rdi
         movq  %rax,TRAPBOUNCE_eip(%rdx)
         movb  %cl,TRAPBOUNCE_flags(%rdx)
         testb $1,DOMAIN_is_32bit_pv(%rdi)
         jnz   compat_sysenter
-        call  create_bounce_frame
-        jmp   test_all_events
-2:      movq  VCPU_trap_ctxt(%rbx),%rcx
-        movl  %eax,TRAPBOUNCE_error_code(%rdx)
-        movq  TRAP_gp_fault * TRAPINFO_sizeof + TRAPINFO_eip(%rcx),%rax
-        movb  $(TBF_EXCEPTION|TBF_EXCEPTION_ERRCODE|TBF_INTERRUPT),%cl
-        movl  $TRAP_gp_fault,UREGS_entry_vector(%rsp)
-        jmp   1b
+        jmp   .Lbounce_exception
 
 ENTRY(int80_direct_trap)
         pushq $0
@@ -483,6 +485,7 @@ 1:      movq  %rsp,%rdi
         jnz   compat_post_handle_exception
         testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
         jz    test_all_events
+.Lbounce_exception:
         call  create_bounce_frame
         movb  $0,TRAPBOUNCE_flags(%rdx)
         jmp   test_all_events

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


 


Rackspace

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