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] Fix APIC setup on legacy systems.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix APIC setup on legacy systems.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 21 Apr 2005 15:39:08 +0000
Delivery-date: Fri, 22 Apr 2005 01:04:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1357, 2005/04/21 16:39:08+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Fix APIC setup on legacy systems.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 apic.c  |   49 ++++++++++++++++++++++++++++++++++++++++---------
 setup.c |    2 +-
 2 files changed, 41 insertions(+), 10 deletions(-)


diff -Nru a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
--- a/xen/arch/x86/apic.c       2005-04-21 21:05:03 -04:00
+++ b/xen/arch/x86/apic.c       2005-04-21 21:05:03 -04:00
@@ -229,17 +229,48 @@
 
 extern void __error_in_apic_c (void);
 
-/*
- * WAS: An initial setup of the virtual wire mode.
- * NOW: We don't bother doing anything. All we need at this point
- * is to receive timer ticks, so that 'jiffies' is incremented.
- * If we're SMP, then we can assume BIOS did setup for us.
- * If we're UP, then the APIC should be disabled (it is at reset).
- * If we're UP and APIC is enabled, then BIOS is clever and has 
- * probably done initial interrupt routing for us.
- */
 void __init init_bsp_APIC(void)
 {
+    unsigned long value, ver;
+
+    /*
+     * Don't do the setup now if we have a SMP BIOS as the through-I/O-APIC 
+     * virtual wire mode might be active.
+     */
+    if (smp_found_config || !cpu_has_apic)
+        return;
+
+    value = apic_read(APIC_LVR);
+    ver = GET_APIC_VERSION(value);
+    
+    /*
+     * Do not trust the local APIC being empty at bootup.
+     */
+    clear_local_APIC();
+    
+    /*
+     * Enable APIC.
+     */
+    value = apic_read(APIC_SPIV);
+    value &= ~APIC_VECTOR_MASK;
+    value |= APIC_SPIV_APIC_ENABLED;
+    
+    /* This bit is reserved on P4/Xeon and should be cleared */
+    if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 
== 15))
+        value &= ~APIC_SPIV_FOCUS_DISABLED;
+    else
+        value |= APIC_SPIV_FOCUS_DISABLED;
+    value |= SPURIOUS_APIC_VECTOR;
+    apic_write_around(APIC_SPIV, value);
+
+    /*
+     * Set up the virtual wire mode.
+     */
+    apic_write_around(APIC_LVT0, APIC_DM_EXTINT);
+    value = APIC_DM_NMI;
+    if (!APIC_INTEGRATED(ver))              /* 82489DX */
+        value |= APIC_LVT_LEVEL_TRIGGER;
+    apic_write_around(APIC_LVT1, value);
 }
 
 void __init setup_local_APIC (void)
diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      2005-04-21 21:05:03 -04:00
+++ b/xen/arch/x86/setup.c      2005-04-21 21:05:03 -04:00
@@ -388,11 +388,11 @@
     if ( smp_found_config ) 
         get_smp_config();
 #endif
+    init_apic_mappings(); /* make APICs addressable in our pagetables. */
     scheduler_init();  
     init_IRQ();  /* installs simple interrupt wrappers. Starts HZ clock. */
     trap_init();
     time_init(); /* installs software handler for HZ clock. */
-    init_apic_mappings(); /* make APICs addressable in our pagetables. */
 
     arch_init_memory();
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Fix APIC setup on legacy systems., BitKeeper Bot <=