public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] x86: apic - unify init_bsp_APIC
       [not found] <20080815190517.850120473@gmail.com>
@ 2008-08-15 19:05 ` Cyrill Gorcunov
  2008-08-15 19:05 ` [patch 2/2] x86: apic - sync_Arb_IDs style fixup Cyrill Gorcunov
  1 sibling, 0 replies; 2+ messages in thread
From: Cyrill Gorcunov @ 2008-08-15 19:05 UTC (permalink / raw)
  To: mingo, macro; +Cc: linux-kernel, Cyrill Gorcunov

[-- Attachment #1: x86-unify-init_bsp_APIC --]
[-- Type: text/plain, Size: 2393 bytes --]

- remove redundant read of APIC_LVR register in 64bit mode
- APIC is always integrated for 64bit mode so
  gcc will eliminate lapic_is_integrated call

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

Index: linux-2.6.git/arch/x86/kernel/apic_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic_32.c	2008-08-15 22:14:45.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/apic_32.c	2008-08-15 22:41:52.000000000 +0400
@@ -927,7 +927,7 @@ void __init sync_Arb_IDs(void)
  */
 void __init init_bsp_APIC(void)
 {
-	unsigned long value;
+	unsigned int value;
 
 	/*
 	 * Don't do the setup now if we have a SMP BIOS as the
@@ -948,11 +948,13 @@ void __init init_bsp_APIC(void)
 	value &= ~APIC_VECTOR_MASK;
 	value |= APIC_SPIV_APIC_ENABLED;
 
+#ifdef CONFIG_X86_32
 	/* 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
+#endif
 		value |= APIC_SPIV_FOCUS_DISABLED;
 	value |= SPURIOUS_APIC_VECTOR;
 	apic_write(APIC_SPIV, value);
Index: linux-2.6.git/arch/x86/kernel/apic_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic_64.c	2008-08-15 22:14:45.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/apic_64.c	2008-08-15 22:41:53.000000000 +0400
@@ -780,8 +780,6 @@ void __init init_bsp_APIC(void)
 	if (smp_found_config || !cpu_has_apic)
 		return;
 
-	value = apic_read(APIC_LVR);
-
 	/*
 	 * Do not trust the local APIC being empty at bootup.
 	 */
@@ -793,7 +791,15 @@ void __init init_bsp_APIC(void)
 	value = apic_read(APIC_SPIV);
 	value &= ~APIC_VECTOR_MASK;
 	value |= APIC_SPIV_APIC_ENABLED;
-	value |= APIC_SPIV_FOCUS_DISABLED;
+
+#ifdef CONFIG_X86_32
+	/* 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
+#endif
+		value |= APIC_SPIV_FOCUS_DISABLED;
 	value |= SPURIOUS_APIC_VECTOR;
 	apic_write(APIC_SPIV, value);
 
@@ -802,6 +808,8 @@ void __init init_bsp_APIC(void)
 	 */
 	apic_write(APIC_LVT0, APIC_DM_EXTINT);
 	value = APIC_DM_NMI;
+	if (!lapic_is_integrated())		/* 82489DX */
+		value |= APIC_LVT_LEVEL_TRIGGER;
 	apic_write(APIC_LVT1, value);
 }
 

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [patch 2/2] x86: apic - sync_Arb_IDs style fixup
       [not found] <20080815190517.850120473@gmail.com>
  2008-08-15 19:05 ` [patch 1/2] x86: apic - unify init_bsp_APIC Cyrill Gorcunov
@ 2008-08-15 19:05 ` Cyrill Gorcunov
  1 sibling, 0 replies; 2+ messages in thread
From: Cyrill Gorcunov @ 2008-08-15 19:05 UTC (permalink / raw)
  To: mingo, macro; +Cc: linux-kernel, Cyrill Gorcunov

[-- Attachment #1: x86-apic-sync_Arb_IDs-style-fix --]
[-- Type: text/plain, Size: 1370 bytes --]

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

No cnages on binary level

Index: linux-2.6.git/arch/x86/kernel/apic_32.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic_32.c	2008-08-15 22:41:52.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/apic_32.c	2008-08-15 22:49:09.000000000 +0400
@@ -913,13 +913,15 @@ void __init sync_Arb_IDs(void)
 	 */
 	if (modern_apic() || boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
 		return;
+
 	/*
 	 * Wait for idle.
 	 */
 	apic_wait_icr_idle();
 
 	apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
-	apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT);
+	apic_write(APIC_ICR, APIC_DEST_ALLINC |
+			APIC_INT_LEVELTRIG | APIC_DM_INIT);
 }
 
 /*
Index: linux-2.6.git/arch/x86/kernel/apic_64.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic_64.c	2008-08-15 22:41:53.000000000 +0400
+++ linux-2.6.git/arch/x86/kernel/apic_64.c	2008-08-15 22:49:07.000000000 +0400
@@ -763,7 +763,8 @@ void __init sync_Arb_IDs(void)
 	apic_wait_icr_idle();
 
 	apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
-	apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG | APIC_DM_INIT);
+	apic_write(APIC_ICR, APIC_DEST_ALLINC |
+			APIC_INT_LEVELTRIG | APIC_DM_INIT);
 }
 
 /*

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-15 19:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080815190517.850120473@gmail.com>
2008-08-15 19:05 ` [patch 1/2] x86: apic - unify init_bsp_APIC Cyrill Gorcunov
2008-08-15 19:05 ` [patch 2/2] x86: apic - sync_Arb_IDs style fixup Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox