Skip to contentSkip to conversation

-rt: x86_64 ioapic register cache

PATCH New Karsten Wiese 1 participant 1 message Nov 27, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 -rt: x86_64 ioapic register cache

x86_64 ioapic register cache

new "_init setup_IO_APIC_early()" to consolidate data structs. Config selectable register cache.
Removes "int sis_apic_bug". Sensible?

arch/x86_64/Kconfig +10 -0
diff -urp rt12/arch/x86_64/Kconfig rt12-kw/arch/x86_64/Kconfig
@@ -171,6 +171,16 @@ config X86_IO_APIC
 	bool
 	default y
 
+config X86_IOAPIC_FAST
+	bool "enhanced IO-APIC support"
+	depends on X86_IO_APIC
+	default y
+	help
+	  this option will activate further optimizations in the IO-APIC
+	  code. NOTE: this is experimental code, and disabled by default.
+	  Symptoms of non-working systems are boot-time lockups, stray or
+	  screaming interrupts and other interrupt related weirdnesses.
+
 config X86_LOCAL_APIC
 	bool
 	default y
arch/x86_64/kernel/apic.c +4 -6
diff -urp rt12/arch/x86_64/kernel/apic.c rt12-kw/arch/x86_64/kernel/apic.c
@@ -628,15 +628,13 @@ void __init init_apic_mappings(void)
 		int i;
 
 		for (i = 0; i < nr_ioapics; i++) {
-			if (smp_found_config) {
-				ioapic_phys = mp_ioapics[i].mpc_apicaddr;
-			} else {
+			if (!smp_found_config) {
 				ioapic_phys = (unsigned long) alloc_bootmem_pages(PAGE_SIZE);
 				ioapic_phys = __pa(ioapic_phys);
+				set_fixmap_nocache(idx, ioapic_phys);
+				printk("faked IOAPIC to %016lx (%016lx)\n",
+				       __fix_to_virt(idx), ioapic_phys);
 			}
-			set_fixmap_nocache(idx, ioapic_phys);
-			apic_printk(APIC_VERBOSE,"mapped IOAPIC to %016lx (%016lx)\n",
-					__fix_to_virt(idx), ioapic_phys);
 			idx++;
 		}
 	}
arch/x86_64/kernel/io_apic.c +207 -75

463 lines not on this page · raw message

arch/x86_64/kernel/mpparse.c +2 -1
diff -urp rt12/arch/x86_64/kernel/mpparse.c rt12-kw/arch/x86_64/kernel/mpparse.c
@@ -207,6 +207,7 @@ static void __init MP_ioapic_info (struc
 		return;
 	}
 	mp_ioapics[nr_ioapics] = *m;
+	setup_IO_APIC_early(nr_ioapics);
 	nr_ioapics++;
 }
 
@@ -769,7 +770,7 @@ void __init mp_register_ioapic (
 	mp_ioapics[idx].mpc_flags = MPC_APIC_USABLE;
 	mp_ioapics[idx].mpc_apicaddr = address;
 
-	set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address);
+	setup_IO_APIC_early(idx);
 	mp_ioapics[idx].mpc_apicid = id;
 	mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx);
 	
include/asm-x86_64/io_apic.h +1 -23
diff -urp rt12/include/asm-x86_64/io_apic.h rt12-kw/include/asm-x86_64/io_apic.h
@@ -103,7 +103,6 @@ union IO_APIC_reg_03 {
  * # of IO-APICs and # of IRQ routing registers
  */
 extern int nr_ioapics;
-extern int nr_ioapic_registers[MAX_IO_APICS];
 
 enum ioapic_irq_destination_types {
 	dest_Fixed = 0,
@@ -160,27 +159,6 @@ extern struct mpc_config_intsrc mp_irqs[
 /* non-0 if default (table-less) MP configuration */
 extern int mpc_default_type;
 
-static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
-{
-	*IO_APIC_BASE(apic) = reg;
-	return *(IO_APIC_BASE(apic)+4);
-}
-
-static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value)
-{
-	*IO_APIC_BASE(apic) = reg;
-	*(IO_APIC_BASE(apic)+4) = value;
-}
-
-/*
- * Re-write a value: to be used for read-modify-write
- * cycles where the read already set up the index register.
- */
-static inline void io_apic_modify(unsigned int apic, unsigned int value)
-{
-	*(IO_APIC_BASE(apic)+4) = value;
-}
-
 /*
  * Synchronize the IO-APIC and the CPU by doing
  * a dummy read from the IO-APIC
@@ -205,7 +183,7 @@ extern int io_apic_get_redir_entries (in
 extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int, int);
 #endif
 
-extern int sis_apic_bug; /* dummy */ 
+extern void setup_IO_APIC_early(int ioapic);
 
 #else  /* !CONFIG_X86_IO_APIC */
 #define io_apic_assign_pci_irqs 0
drivers/pci/quirks.c +2 -0
diff -urp rt12/drivers/pci/quirks.c rt12-kw/drivers/pci/quirks.c
@@ -543,12 +543,14 @@ static void __devinit quirk_amd_ioapic(s
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD,	PCI_DEVICE_ID_AMD_VIPER_7410,	quirk_amd_ioapic );
 
+#if !defined(CONFIG_X86_64)
 static void __init quirk_ioapic_rmw(struct pci_dev *dev)
 {
 	if (dev->devfn == 0 && dev->bus->number == 0)
 		sis_apic_bug = 1;
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SI,	PCI_ANY_ID,			quirk_ioapic_rmw );
+#endif
 
 int pci_msi_quirk;
 
kernel/irq/spurious.c +7 -5
diff -urp rt12/kernel/irq/spurious.c rt12-kw/kernel/irq/spurious.c
@@ -164,11 +164,13 @@ void note_interrupt(unsigned int irq, ir
 		 * The interrupt is stuck
 		 */
 		__report_bad_irq(irq, desc, action_ret);
-#ifdef CONFIG_X86_IO_APIC
-		if (!sis_apic_bug) {
-			sis_apic_bug = 1;
-			printk(KERN_ERR "turning off IO-APIC fast mode.\n");
-		}
+#ifndef CONFIG_X86_64
+# ifdef CONFIG_X86_IO_APIC
+ 		if (!sis_apic_bug) {
+ 			sis_apic_bug = 1;
+ 			printk(KERN_ERR "turning off IO-APIC fast mode.\n");
+ 		}
+# endif
 #else
 		/*
 		 * Now kill the IRQ