ACPI based I/O APIC hot-plug
PATCH 2/3 ACPI based I/O APIC hot-plug
This is an ia64 implementation of acpi_register_ioapic() and acpi_unregister_ioapic() interfaces.
---
linux-2.6.12-rc2-mm3-kanesige/arch/ia64/kernel/acpi.c | 21 +- linux-2.6.12-rc2-mm3-kanesige/arch/ia64/kernel/iosapic.c | 131 ++++++++++++--- linux-2.6.12-rc2-mm3-kanesige/include/asm-ia64/iosapic.h | 12 + 3 files changed, 132 insertions(+), 32 deletions(-)
arch/ia64/kernel/acpi.c renamed from arch/ia64/kernel/acpi.c~ioapic_hotplug_ia64 +13 -8
@@ -242,9 +242,7 @@ acpi_parse_iosapic (acpi_table_entry_heaif (BAD_MADT_ENTRY (iosapic, end))return -EINVAL ; -iosapic_init (iosapic->address, iosapic->global_irq_base); - -return 0 ; +return iosapic_init (iosapic->address, iosapic->global_irq_base); }
@@ -826,7 +824,7 @@ EXPORT_SYMBOL(acpi_unmap_lsapic);#ifdef CONFIG_ACPI_NUMA -acpi_status __init +acpi_status __devinit acpi_map_iosapic (acpi_handle handle,u32 depth,void *context,void **ret) {struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER ,NULL };
@@ -896,16 +894,23 @@ acpi_map_iosapic (acpi_handle handle, u3int acpi_register_ioapic (acpi_handle handle,u64 phys_addr,u32 gsi_base) { -/* TBD */ -return -EINVAL ; +int err; + +if ((err =iosapic_init (phys_addr, gsi_base))) +return err; + +#if CONFIG_ACPI_NUMA +acpi_map_iosapic (handle,0 ,NULL ,NULL ); +#endif /* CONFIG_ACPI_NUMA */ + +return 0 ; }EXPORT_SYMBOL (acpi_register_ioapic);int acpi_unregister_ioapic (acpi_handle handle,u32 gsi_base) { -/* TBD */ -return -EINVAL ; +return iosapic_remove (gsi_base); }EXPORT_SYMBOL (acpi_unregister_ioapic);
arch/ia64/kernel/iosapic.c renamed from arch/ia64/kernel/iosapic.c~ioapic_hotplug_ia64 +110 -21
190 lines not on this page · raw message
include/asm-ia64/iosapic.h renamed from include/asm-ia64/iosapic.h~ioapic_hotplug_ia64 +9 -3
@@ -71,8 +71,11 @@ static inline void iosapic_eoi(char __io }extern void __init iosapic_system_init (int pcat_compat); -extern void __init iosapic_init (unsigned long address, +extern int __devinit iosapic_init (unsigned long address,unsigned int gsi_base); +#ifdef CONFIG_HOTPLUG +extern int iosapic_remove (unsigned int gsi_base); +#endif /* CONFIG_HOTPLUG */ extern int gsi_to_vector (unsigned int gsi);extern int gsi_to_irq (unsigned int gsi);extern void iosapic_enable_intr (unsigned int vector);
@@ -94,11 +97,14 @@ extern unsigned int iosapic_version (chaextern void iosapic_pci_fixup (int );#ifdef CONFIG_NUMA -extern void __init map_iosapic_to_node (unsigned int ,int ); +extern void __devinit map_iosapic_to_node (unsigned int ,int );#endif #else #define iosapic_system_init (pcat_compat) do { } while (0) -#define iosapic_init (address,gsi_base) do { } while (0) +#define iosapic_init (address,gsi_base) (-EINVAL) +#ifdef CONFIG_HOTPLUG +#define iosapic_remove (gsi_base) (-ENODEV) +#endif /* CONFIG_HOTPLUG */ #define iosapic_register_intr (gsi,polarity,trigger) (gsi)#define iosapic_unregister_intr (irq) do { } while (0)#define iosapic_override_isa_irq (isa_irq,gsi,polarity,trigger) do { } while (0)
_
Quoted 2 lines
+acpi_status
__devinit
acpi_map_iosapic(acpi_handlehandle, u32 depth, void *context, void **ret)
I think "acpi_map_iosapic" is poorly named. It's really associating an iosapic with a locality domain.
And there's nothing ia64-specific in acpi_map_iosapic(). It'd be nice to figure out a way to move it into generic ACPI code.
But your patch didn't introduce either of these problems, so I don't think you have to fix them now.
arch/ia64/kernel/iosapic.c static struct iosapic { · line 132
Quoted 2 lines
arch/ia64/kernel/iosapic.c renamed from arch/ia64/kernel/iosapic.c~ioapic_hotplug_ia64 +1
-0unsigned short num_rte;/* number of RTE in this IOSAPIC */ +int count;/* # of RTEs in use on this IOSAPIC */
"count" isn't very descriptive. Maybe "rtes_inuse" or similar?
arch/ia64/kernel/iosapic.c iosapic_system_init (int system_pcat_com · line 958
Quoted 2 lines
arch/ia64/kernel/iosapic.c renamed from arch/ia64/kernel/iosapic.c~ioapic_hotplug_ia64 +1
-1-void __init +static inline int iosapic_alloc (void )
Nitpick: should be
static inline int
iosapic_alloc (void)
to match the style of the rest of the file.
Quoted 1 line
+static inline void
free_iosapic(int index)
Nitpick: follow style again.
arch/ia64/kernel/iosapic.c iosapic_system_init (int system_pcat_com · line 972
Quoted 1 line
arch/ia64/kernel/iosapic.c renamed from arch/ia64/kernel/iosapic.c~ioapic_hotplug_ia64 +1
-0+memset (&iosapic_lists[index],0 ,sizeof (struct iosapic ));
What about
memset(&iosapic_lists[index], 0, sizeof(iosapic_lists[0]));
so you can tell this is correct without looking up the declaration of iosapic_lists[]?
Quoted 1 line
+static inline int
iosapic_check(unsigned intgsi_base, unsigned int ver)
Nitpick: follow style again. And maybe a more descriptive name?