Skip to contentSkip to conversation

x86: early_res and irq_desc

PATCH NAK Yinghai Lu 12 participants 77 messages Mar 21, 2010 – Mar 24, 2010

Subsystems (58)
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

cover x86: early_res and irq_desc

01 - 06: early_res related
07 - 15: irq_desc releated
19 - 20: pci related

Thanks

Yinghai

author
#1 lore raw

PATCH 1/20 x86: add find_e820_area_node

David Miller pointed out that early_res have problem to find node data on correct node when we have
node0: [0, 2g), [4g, 6g), [10g, 14g)
node1: [6g, 10g), [14g, 18g)
the cross node case

the problem is there for x86 bits even before we are using early_res for bootmem replacement. after early_res for bootmem replacement, alloc_bootmem_node still can get range on correct node

this patch is fixing problem before bootmem or early_res replacement for bootmem.

now only user is for x86 64bit numa to find node data.

the point is use early_node_map with find_e820_area_node()

---
 arch/x86/include/asm/e820.h |    1 +
 arch/x86/kernel/e820.c      |   15 +++++++++++++++
 arch/x86/mm/numa_64.c       |    4 ++--
 include/linux/mm.h          |    2 ++
 mm/page_alloc.c             |   37 +++++++++++++++++++++++--------------
 5 files changed, 43 insertions(+), 16 deletions(-)
arch/x86/include/asm/e820.h +1 -0
index 0e22296..b48f371 100644
@@ -111,6 +111,7 @@ extern unsigned long end_user_pfn;
 
 extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
 extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
+u64 find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
 extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
 #include <linux/early_res.h>
 
arch/x86/kernel/e820.c +15 -0
index 740b440..05ee724 100644
@@ -787,6 +787,21 @@ u64 __init find_e820_area_size(u64 start, u64 *sizep, u64 align)
 	return -1ULL;
 }
 
+u64 __init find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align)
+{
+	u64 addr;
+	/*
+	 * need to call this function after e820_register_active_regions
+	 * so early_node_map[] is set
+	 */
+	addr = find_memory_core_early(nid, size, align, start, end);
+	if (addr != -1ULL)
+		return addr;
+
+	/* fallback, should already have start end in the node range */
+	return find_e820_area(start, end, size, align);
+}
+
 /*
  * pre allocated 4k and reserved it in e820
  */
arch/x86/mm/numa_64.c +2 -2
index 8948f47..ffc5ad5 100644
@@ -174,7 +174,7 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
 	if (start < (MAX_DMA32_PFN<<PAGE_SHIFT) &&
 	    end > (MAX_DMA32_PFN<<PAGE_SHIFT))
 		start = MAX_DMA32_PFN<<PAGE_SHIFT;
-	mem = find_e820_area(start, end, size, align);
+	mem = find_e820_area_node(nodeid, start, end, size, align);
 	if (mem != -1L)
 		return __va(mem);
 
@@ -184,7 +184,7 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
 		start = MAX_DMA32_PFN<<PAGE_SHIFT;
 	else
 		start = MAX_DMA_PFN<<PAGE_SHIFT;
-	mem = find_e820_area(start, end, size, align);
+	mem = find_e820_area_node(nodeid, start, end, size, align);
 	if (mem != -1L)
 		return __va(mem);
 
include/linux/mm.h +2 -0
index e70f21b..5c2d17e 100644
@@ -1160,6 +1160,8 @@ extern void free_bootmem_with_active_regions(int nid,
 						unsigned long max_low_pfn);
 int add_from_early_node_map(struct range *range, int az,
 				   int nr_range, int nid);
+u64 __init find_memory_core_early(int nid, u64 size, u64 align,
+					u64 goal, u64 limit);
 void *__alloc_memory_core_early(int nodeid, u64 size, u64 align,
 				 u64 goal, u64 limit);
 typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
mm/page_alloc.c +23 -14
index d03c946..eef3757 100644
@@ -3408,12 +3408,11 @@ int __init add_from_early_node_map(struct range *range, int az,
 	return nr_range;
 }
 
-#ifdef CONFIG_NO_BOOTMEM
-void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
+#ifdef CONFIG_HAVE_EARLY_RES
+u64 __init find_memory_core_early(int nid, u64 size, u64 align,
 					u64 goal, u64 limit)
 {
 	int i;
-	void *ptr;
 
 	/* need to go over early_node_map to find out good range for node */
 	for_each_active_range_index_in_nid(i, nid) {
@@ -3430,20 +3429,30 @@ void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
 		if (addr == -1ULL)
 			continue;
 
-#if 0
-		printk(KERN_DEBUG "alloc (nid=%d %llx - %llx) (%llx - %llx) %llx %llx => %llx\n",
-				nid,
-				ei_start, ei_last, goal, limit, size,
-				align, addr);
+		return addr;
+	}
+
+	return -1ULL;
+}
 #endif
 
-		ptr = phys_to_virt(addr);
-		memset(ptr, 0, size);
-		reserve_early_without_check(addr, addr + size, "BOOTMEM");
-		return ptr;
-	}
+#ifdef CONFIG_NO_BOOTMEM
+void * __init __alloc_memory_core_early(int nid, u64 size, u64 align,
+					u64 goal, u64 limit)
+{
+	void *ptr;
 
-	return NULL;
+	u64 addr;
+
+	addr = find_memory_core_early(nid, size, align, goal, limit);
+
+	if (addr == -1ULL)
+		return NULL;
+
+	ptr = phys_to_virt(addr);
+	memset(ptr, 0, size);
+	reserve_early_without_check(addr, addr + size, "BOOTMEM");
+	return ptr;
 }
 #endif
 
Signature · 1 line
1.6.4.2
author
#2 lore raw

PATCH 2/20 x86: add get_centaur_ram_top

In reply to Yinghai Lu

so we can avoid to access e820.map[] directly.

later we could move e820 to static and _initdata

---
 arch/x86/include/asm/e820.h   |    9 ++++++
 arch/x86/kernel/cpu/centaur.c |   53 +------------------------------------
 arch/x86/kernel/e820.c        |   57 +++++++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/setup.c       |    2 +
 4 files changed, 70 insertions(+), 51 deletions(-)
arch/x86/include/asm/e820.h +9 -0
index b48f371..38828c7 100644
@@ -72,6 +72,15 @@ struct e820map {
 extern struct e820map e820;
 extern struct e820map e820_saved;
 
+#ifdef CONFIG_X86_OOSTORE
+extern int centaur_ram_top;
+void get_centaur_ram_top(void);
+#else
+static inline void get_centaur_ram_top(void)
+{
+}
+#endif
+
 extern unsigned long pci_mem_start;
 extern int e820_any_mapped(u64 start, u64 end, unsigned type);
 extern int e820_all_mapped(u64 start, u64 end, unsigned type);
arch/x86/kernel/cpu/centaur.c +2 -51

65 lines not on this page · raw message

arch/x86/kernel/e820.c +57 -0

60 lines not on this page · raw message

arch/x86/kernel/setup.c +2 -0
index 5d7ba1a..c5ea524 100644
@@ -875,6 +875,8 @@ void __init setup_arch(char **cmdline_p)
 	if (mtrr_trim_uncached_memory(max_pfn))
 		max_pfn = e820_end_of_ram_pfn();
 
+	get_centaur_ram_top();
+
 #ifdef CONFIG_X86_32
 	/* max_low_pfn get updated here */
 	find_low_pfn_range();
Signature · 1 line
1.6.4.2
author
#3 lore raw

PATCH 3/20 x86: make e820 to be static

In reply to Yinghai Lu

make sanitize_e820_map() not take e820.map directly.

and could change e820_saved to initdata

---
 arch/x86/include/asm/e820.h |    7 ++-----
 arch/x86/kernel/e820.c      |   28 +++++++++++++++++++---------
 arch/x86/kernel/efi.c       |    2 +-
 arch/x86/kernel/setup.c     |   10 +++++-----
 arch/x86/xen/setup.c        |    4 +---
 5 files changed, 28 insertions(+), 23 deletions(-)
arch/x86/include/asm/e820.h +2 -5
index 38828c7..71c0348 100644
@@ -68,9 +68,6 @@ struct e820map {
 #define BIOS_END		0x00100000
 
 #ifdef __KERNEL__
-/* see comment in arch/x86/kernel/e820.c */
-extern struct e820map e820;
-extern struct e820map e820_saved;
 
 #ifdef CONFIG_X86_OOSTORE
 extern int centaur_ram_top;
@@ -86,8 +83,8 @@ extern int e820_any_mapped(u64 start, u64 end, unsigned type);
 extern int e820_all_mapped(u64 start, u64 end, unsigned type);
 extern void e820_add_region(u64 start, u64 size, int type);
 extern void e820_print_map(char *who);
-extern int
-sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, u32 *pnr_map);
+int sanitize_e820_map(void);
+void save_e820_map(void);
 extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
 			       unsigned new_type);
 extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
arch/x86/kernel/e820.c +19 -9
index 119c0e1..40c04cf 100644
@@ -34,8 +34,8 @@
  * user can e.g. boot the original kernel with mem=1G while still booting the
  * next kernel with full memory.
  */
-struct e820map e820;
-struct e820map e820_saved;
+static struct e820map e820;
+static struct e820map __initdata e820_saved;
 
 /* For PCI or other memory-mapped resources */
 unsigned long pci_mem_start = 0xaeedbabe;
@@ -224,7 +224,7 @@ void __init e820_print_map(char *who)
  *	   ______________________4_
  */
 
-int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
+static int __init __sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
 			     u32 *pnr_map)
 {
 	struct change_member {
@@ -383,6 +383,11 @@ int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
 	return 0;
 }
 
+int __init sanitize_e820_map(void)
+{
+	return __sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+}
+
 static int __init __append_e820_map(struct e820entry *biosmap, int nr_map)
 {
 	while (nr_map) {
@@ -555,7 +560,7 @@ void __init update_e820(void)
 	u32 nr_map;
 
 	nr_map = e820.nr_map;
-	if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map))
+	if (__sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map))
 		return;
 	e820.nr_map = nr_map;
 	printk(KERN_INFO "modified physical RAM map:\n");
@@ -566,7 +571,7 @@ static void __init update_e820_saved(void)
 	u32 nr_map;
 
 	nr_map = e820_saved.nr_map;
-	if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map))
+	if (__sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map))
 		return;
 	e820_saved.nr_map = nr_map;
 }
@@ -661,7 +666,7 @@ void __init parse_e820_ext(struct setup_data *sdata, unsigned long pa_data)
 		sdata = early_ioremap(pa_data, map_len);
 	extmap = (struct e820entry *)(sdata->data);
 	__append_e820_map(extmap, entries);
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	sanitize_e820_map();
 	if (map_len > PAGE_SIZE)
 		early_iounmap(sdata, map_len);
 	printk(KERN_INFO "extended physical RAM map:\n");
@@ -1043,7 +1048,7 @@ void __init finish_e820_parsing(void)
 	if (userdef) {
 		u32 nr = e820.nr_map;
 
-		if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0)
+		if (__sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0)
 			early_panic("Invalid user supplied memory map");
 		e820.nr_map = nr;
 
@@ -1173,7 +1178,7 @@ char *__init default_machine_specific_memory_setup(void)
 	 * the next section from 1mb->appropriate_mem_k
 	 */
 	new_nr = boot_params.e820_entries;
-	sanitize_e820_map(boot_params.e820_map,
+	__sanitize_e820_map(boot_params.e820_map,
 			ARRAY_SIZE(boot_params.e820_map),
 			&new_nr);
 	boot_params.e820_entries = new_nr;
@@ -1200,12 +1205,17 @@ char *__init default_machine_specific_memory_setup(void)
 	return who;
 }
 
+void __init save_e820_map(void)
+{
+	memcpy(&e820_saved, &e820, sizeof(struct e820map));
+}
+
 void __init setup_memory_map(void)
 {
 	char *who;
 
 	who = x86_init.resources.memory_setup();
-	memcpy(&e820_saved, &e820, sizeof(struct e820map));
+	save_e820_map();
 	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
 	e820_print_map(who);
 }
arch/x86/kernel/efi.c +1 -1
index c2fa9b8..299f03f 100644
@@ -272,7 +272,7 @@ static void __init do_add_efi_memmap(void)
 		}
 		e820_add_region(start, size, e820_type);
 	}
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	sanitize_e820_map();
 }
 
 void __init efi_reserve_early(void)
arch/x86/kernel/setup.c +5 -5
index c5ea524..82533cf 100644
@@ -461,8 +461,8 @@ static void __init e820_reserve_setup_data(void)
 	if (!found)
 		return;
 
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
-	memcpy(&e820_saved, &e820, sizeof(struct e820map));
+	sanitize_e820_map();
+	save_e820_map();
 	printk(KERN_INFO "extended physical RAM map:\n");
 	e820_print_map("reserve setup_data");
 }
@@ -614,7 +614,7 @@ static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
 		d->ident);
 
 	e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	sanitize_e820_map();
 
 	return 0;
 }
@@ -683,7 +683,7 @@ static void __init trim_bios_range(void)
 	 * take them out.
 	 */
 	e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	sanitize_e820_map();
 }
 
 /*
@@ -854,7 +854,7 @@ void __init setup_arch(char **cmdline_p)
 	if (ppro_with_ram_bug()) {
 		e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
 				  E820_RESERVED);
-		sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+		sanitize_e820_map();
 		printk(KERN_INFO "fixed physical RAM map:\n");
 		e820_print_map("bad_ppro");
 	}
arch/x86/xen/setup.c +1 -3
index ad0047f..3f2c411 100644
@@ -43,8 +43,6 @@ char * __init xen_memory_setup(void)
 
 	max_pfn = min(MAX_DOMAIN_PAGES, max_pfn);
 
-	e820.nr_map = 0;
-
 	e820_add_region(0, PFN_PHYS((u64)max_pfn), E820_RAM);
 
 	/*
@@ -65,7 +63,7 @@ char * __init xen_memory_setup(void)
 		      __pa(xen_start_info->pt_base),
 			"XEN START INFO");
 
-	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+	sanitize_e820_map();
 
 	return "Xen";
 }
Signature · 1 line
1.6.4.2
author
#4 lore raw

PATCH 4/20 x86: use wake_system_ram_range instead of e820_any_mapped in agp path

In reply to Yinghai Lu

put apterture_valid back to .c
and early path still use e820_any_mapped()

---
 arch/x86/include/asm/gart.h   |   22 ----------------------
 arch/x86/kernel/aperture_64.c |   22 ++++++++++++++++++++++
 drivers/char/agp/amd64-agp.c  |   39 ++++++++++++++++++++++++++++++++++++++-
 3 files changed, 60 insertions(+), 23 deletions(-)
arch/x86/include/asm/gart.h +0 -22
index 4ac5b0f..2b63a91 100644
@@ -74,26 +74,4 @@ static inline void enable_gart_translation(struct pci_dev *dev, u64 addr)
         pci_write_config_dword(dev, AMD64_GARTAPERTURECTL, ctl);
 }
 
-static inline int aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
-{
-	if (!aper_base)
-		return 0;
-
-	if (aper_base + aper_size > 0x100000000ULL) {
-		printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
-		return 0;
-	}
-	if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
-		printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
-		return 0;
-	}
-	if (aper_size < min_size) {
-		printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n",
-				 aper_size>>20, min_size>>20);
-		return 0;
-	}
-
-	return 1;
-}
-
 #endif /* _ASM_X86_GART_H */
arch/x86/kernel/aperture_64.c +22 -0
index 3704997..f6e6270 100644
@@ -145,6 +145,28 @@ static u32 __init find_cap(int bus, int slot, int func, int cap)
 	return 0;
 }
 
+static int __init aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
+{
+	if (!aper_base)
+		return 0;
+
+	if (aper_base + aper_size > 0x100000000ULL) {
+		printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
+		return 0;
+	}
+	if (e820_any_mapped(aper_base, aper_base + aper_size, E820_RAM)) {
+		printk(KERN_INFO "Aperture pointing to e820 RAM. Ignoring.\n");
+		return 0;
+	}
+	if (aper_size < min_size) {
+		printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n",
+				 aper_size>>20, min_size>>20);
+		return 0;
+	}
+
+	return 1;
+}
+
 /* Read a standard AGPv3 bridge header */
 static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order)
 {
drivers/char/agp/amd64-agp.c +38 -1
index fd50ead..85cabd0 100644
@@ -14,7 +14,6 @@
 #include <linux/agp_backend.h>
 #include <linux/mmzone.h>
 #include <asm/page.h>		/* PAGE_SIZE */
-#include <asm/e820.h>
 #include <asm/k8.h>
 #include <asm/gart.h>
 #include "agp.h"
@@ -231,6 +230,44 @@ static const struct agp_bridge_driver amd_8151_driver = {
 	.agp_type_to_mask_type  = agp_generic_type_to_mask_type,
 };
 
+static int __devinit
+__is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+	return 1;
+}
+
+static int __devinit any_ram_in_range(u64 base, u64 size)
+{
+	unsigned long pfn, nr_pages;
+
+	pfn = base >> PAGE_SHIFT;
+	nr_pages = size >> PAGE_SHIFT;
+
+	return walk_system_ram_range(pfn, nr_pages, NULL, __is_ram) == 1;
+}
+
+static int __devinit aperture_valid(u64 aper_base, u32 aper_size, u32 min_size)
+{
+	if (!aper_base)
+		return 0;
+
+	if (aper_base + aper_size > 0x100000000ULL) {
+		printk(KERN_INFO "Aperture beyond 4GB. Ignoring.\n");
+		return 0;
+	}
+	if (any_ram_in_range(aper_base, aper_size)) {
+		printk(KERN_INFO "Aperture pointing to E820 RAM. Ignoring.\n");
+		return 0;
+	}
+	if (aper_size < min_size) {
+		printk(KERN_INFO "Aperture too small (%d MB) than (%d MB)\n",
+				 aper_size>>20, min_size>>20);
+		return 0;
+	}
+
+	return 1;
+}
+
 /* Some basic sanity checks for the aperture. */
 static int __devinit agp_aperture_valid(u64 aper, u32 size)
 {
Signature · 1 line
1.6.4.2
author
#5 lore raw

PATCH 5/20 x86: make e820 to be initdata

In reply to Yinghai Lu

and we don't need to expose e820_any_mapped anymore

---
 arch/x86/kernel/e820.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/e820.c +4 -4
index 40c04cf..a558609 100644
@@ -34,7 +34,7 @@
  * user can e.g. boot the original kernel with mem=1G while still booting the
  * next kernel with full memory.
  */
-static struct e820map e820;
+static struct e820map __initdata e820;
 static struct e820map __initdata e820_saved;
 
 /* For PCI or other memory-mapped resources */
@@ -46,9 +46,10 @@ EXPORT_SYMBOL(pci_mem_start);
 /*
  * This function checks if any part of the range <start,end> is mapped
  * with type.
+ * phys_pud_init() is using it and is _meminit, but we have !after_bootmem
+ * so could use refok here
  */
-int
-e820_any_mapped(u64 start, u64 end, unsigned type)
+int __init_refok e820_any_mapped(u64 start, u64 end, unsigned type)
 {
 	int i;
 
@@ -63,7 +64,6 @@ e820_any_mapped(u64 start, u64 end, unsigned type)
 	}
 	return 0;
 }
-EXPORT_SYMBOL_GPL(e820_any_mapped);
 
 /*
  * This function checks if the entire range <start,end> is mapped with type.
Signature · 1 line
1.6.4.2
author
#6 lore raw

PATCH 6/20 early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Yinghai Lu

move it to kernel/fw_memmap.c from arch/x86/kernel/e820.c

-v2: add fw_memmap wrapper to some func...
move some functions back to e820.c

---
 arch/x86/include/asm/e820.h  |  176 ++++++-------
 arch/x86/kernel/e820.c       |  638 ++----------------------------------------
 include/linux/bootmem.h      |    2 +-
 include/linux/early_res.h    |    1 +
 include/linux/fw_memmap.h    |   40 +++
 kernel/Makefile              |    2 +-
 kernel/fw_memmap.c           |  625 +++++++++++++++++++++++++++++++++++++++++
 kernel/fw_memmap_internals.h |   49 ++++
 8 files changed, 822 insertions(+), 711 deletions(-)
 create mode 100644 include/linux/fw_memmap.h
 create mode 100644 kernel/fw_memmap.c
 create mode 100644 kernel/fw_memmap_internals.h
arch/x86/include/asm/e820.h +80 -96
index 71c0348..c038616 100644
@@ -1,65 +1,10 @@
 #ifndef _ASM_X86_E820_H
 #define _ASM_X86_E820_H
-#define E820MAP	0x2d0		/* our map */
-#define E820MAX	128		/* number of entries in E820MAP */
-
-/*
- * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the
- * constrained space in the zeropage.  If we have more nodes than
- * that, and if we've booted off EFI firmware, then the EFI tables
- * passed us from the EFI firmware can list more nodes.  Size our
- * internal memory map tables to have room for these additional
- * nodes, based on up to three entries per node for which the
- * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT),
- * plus E820MAX, allowing space for the possible duplicate E820
- * entries that might need room in the same arrays, prior to the
- * call to sanitize_e820_map() to remove duplicates.  The allowance
- * of three memory map entries per node is "enough" entries for
- * the initial hardware platform motivating this mechanism to make
- * use of additional EFI map entries.  Future platforms may want
- * to allow more than three entries per node or otherwise refine
- * this size.
- */
-
-/*
- * Odd: 'make headers_check' complains about numa.h if I try
- * to collapse the next two #ifdef lines to a single line:
- *	#if defined(__KERNEL__) && defined(CONFIG_EFI)
- */
-#ifdef __KERNEL__
-#ifdef CONFIG_EFI
-#include <linux/numa.h>
-#define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)
-#else	/* ! CONFIG_EFI */
-#define E820_X_MAX E820MAX
-#endif
-#else	/* ! __KERNEL__ */
-#define E820_X_MAX E820MAX
-#endif
-
-#define E820NR	0x1e8		/* # entries in E820MAP */
-
-#define E820_RAM	1
-#define E820_RESERVED	2
-#define E820_ACPI	3
-#define E820_NVS	4
-#define E820_UNUSABLE	5
 
 /* reserved RAM used by kernel itself */
 #define E820_RESERVED_KERN        128
 
 #ifndef __ASSEMBLY__
-#include <linux/types.h>
-struct e820entry {
-	__u64 addr;	/* start of memory segment */
-	__u64 size;	/* size of memory segment */
-	__u32 type;	/* type of memory segment */
-} __attribute__((packed));
-
-struct e820map {
-	__u32 nr_map;
-	struct e820entry map[E820_X_MAX];
-};
 
 #define ISA_START_ADDRESS	0xa0000
 #define ISA_END_ADDRESS		0x100000
@@ -69,32 +14,18 @@ struct e820map {
 
 #ifdef __KERNEL__
 
-#ifdef CONFIG_X86_OOSTORE
-extern int centaur_ram_top;
-void get_centaur_ram_top(void);
+#include <linux/fw_memmap.h>
+
+#ifdef CONFIG_MEMTEST
+extern void early_memtest(unsigned long start, unsigned long end);
 #else
-static inline void get_centaur_ram_top(void)
+static inline void early_memtest(unsigned long start, unsigned long end)
 {
 }
 #endif
 
 extern unsigned long pci_mem_start;
-extern int e820_any_mapped(u64 start, u64 end, unsigned type);
-extern int e820_all_mapped(u64 start, u64 end, unsigned type);
-extern void e820_add_region(u64 start, u64 size, int type);
-extern void e820_print_map(char *who);
-int sanitize_e820_map(void);
-void save_e820_map(void);
-extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
-			       unsigned new_type);
-extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
-			     int checktype);
-extern void update_e820(void);
 extern void e820_setup_gap(void);
-extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
-			unsigned long start_addr, unsigned long long end_addr);
-struct setup_data;
-extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);
 
 #if defined(CONFIG_X86_64) || \
 	(defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
@@ -105,37 +36,80 @@ static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
 }
 #endif
 
-#ifdef CONFIG_MEMTEST
-extern void early_memtest(unsigned long start, unsigned long end);
-#else
-static inline void early_memtest(unsigned long start, unsigned long end)
+static inline void e820_add_region(u64 start, u64 size, int type)
 {
+	fw_memmap_add_region(start, size, type);
+}
+
+static inline void e820_print_map(char *who)
+{
+	fw_memmap_print_map(who);
+}
+
+static inline int sanitize_e820_map(void)
+{
+	return sanitize_fw_memmap();
+}
+
+static inline void finish_e820_parsing(void)
+{
+	finish_fw_memmap_parsing();
+}
+
+static inline void e820_register_active_regions(int nid,
+						unsigned long start_pfn,
+						unsigned long end_pfn)
+{
+	fw_memmap_register_active_regions(nid, start_pfn, end_pfn);
+}
+
+static inline u64 e820_hole_size(u64 start, u64 end)
+{
+	return fw_memmap_hole_size(start, end);
+}
+
+static inline u64 find_e820_area(u64 start, u64 end, u64 size, u64 align)
+{
+	return find_fw_memmap_area(start, end, size, align);
+}
+
+static inline u64 find_e820_area_node(int nid, u64 start, u64 end,
+					 u64 size, u64 align)
+{
+	return find_fw_memmap_area_node(nid, start, end, size, align);
 }
-#endif
 
-extern unsigned long end_user_pfn;
+static inline unsigned long e820_end_of_ram_pfn(void)
+{
+	return fw_memmap_end_of_ram_pfn();
+}
+
+void clear_e820_map(void);
+
+extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
+				int checktype);
+struct e820entry;
+int __sanitize_e820_map(struct e820entry *biosmap, int max_nr, u32 *pnr_map);
+extern unsigned long e820_end_of_low_ram_pfn(void);
+
+extern int e820_any_mapped(u64 start, u64 end, unsigned type);
+extern int e820_all_mapped(u64 start, u64 end, unsigned type);
+extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
+			       unsigned new_type);
+
+extern void update_e820(void);
+void save_e820_map(void);
+struct setup_data;
+extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);
+extern char *default_machine_specific_memory_setup(void);
+extern void setup_memory_map(void);
 
-extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
 extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
-u64 find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
+
 extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
-#include <linux/early_res.h>
 
-extern unsigned long e820_end_of_ram_pfn(void);
-extern unsigned long e820_end_of_low_ram_pfn(void);
-extern int e820_find_active_region(const struct e820entry *ei,
-				  unsigned long start_pfn,
-				  unsigned long last_pfn,
-				  unsigned long *ei_startpfn,
-				  unsigned long *ei_endpfn);
-extern void e820_register_active_regions(int nid, unsigned long start_pfn,
-					 unsigned long end_pfn);
-extern u64 e820_hole_size(u64 start, u64 end);
-extern void finish_e820_parsing(void);
 extern void e820_reserve_resources(void);
 extern void e820_reserve_resources_late(void);
-extern void setup_memory_map(void);
-extern char *default_machine_specific_memory_setup(void);
 
 /*
  * Returns true iff the specified range [s,e) is completely contained inside
@@ -146,7 +120,17 @@ static inline bool is_ISA_range(u64 s, u64 e)
 	return s >= ISA_START_ADDRESS && e <= ISA_END_ADDRESS;
 }
 
+#ifdef CONFIG_X86_OOSTORE
+extern int centaur_ram_top;
+void get_centaur_ram_top(void);
+#else
+static inline void get_centaur_ram_top(void)
+{
+}
+#endif
+
 #endif /* __KERNEL__ */
+
 #endif /* __ASSEMBLY__ */
 
 #ifdef __KERNEL__
arch/x86/kernel/e820.c +25 -613

756 lines not on this page · raw message

include/linux/bootmem.h +1 -1
index 266ab92..c341c18 100644
@@ -6,7 +6,7 @@
 
 #include <linux/mmzone.h>
 #include <asm/dma.h>
-
+#include <linux/early_res.h>
 /*
  *  simple boot-time physical memory area allocator.
  */
include/linux/early_res.h +1 -0
index 29c09f5..0f4590f 100644
@@ -14,6 +14,7 @@ u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
 u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
 			 u64 *sizep, u64 align);
 u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_fw_memmap_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);
include/linux/fw_memmap.h new file +40 -0
new file mode 100644
index 0000000..e0fcc1b
@@ -0,0 +1,40 @@
+#ifndef _LINUX_FW_MEMMAP_H
+#define _LINUX_FW_MEMMAP_H
+#define E820MAX	128		/* number of entries in E820MAP */
+
+#define FW_MEMMAP_RAM	1
+#define FW_MEMMAP_RESERVED	2
+
+#define E820_RAM	FW_MEMMAP_RAM
+#define E820_RESERVED	FW_MEMMAP_RESERVED
+
+#define E820_ACPI	3
+#define E820_NVS	4
+#define E820_UNUSABLE	5
+
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+struct e820entry {
+	__u64 addr;	/* start of memory segment */
+	__u64 size;	/* size of memory segment */
+	__u32 type;	/* type of memory segment */
+} __attribute__((packed));
+
+#ifdef __KERNEL__
+
+void fw_memmap_add_region(u64 start, u64 size, int type);
+void fw_memmap_print_map(char *who);
+int sanitize_fw_memmap(void);
+void finish_fw_memmap_parsing(void);
+
+#include <linux/early_res.h>
+
+unsigned long fw_memmap_end_of_ram_pfn(void);
+void fw_memmap_register_active_regions(int nid, unsigned long start_pfn,
+					 unsigned long end_pfn);
+u64 fw_memmap_hole_size(u64 start, u64 end);
+
+#endif /* __KERNEL__ */
+#endif /* __ASSEMBLY__ */
+
+#endif /* _LINUX_FW_MEMMAP_H */
kernel/Makefile +1 -1
index d5c3006..b0afaa5 100644
@@ -11,7 +11,7 @@ obj-y     = sched.o fork.o exec_domain.o panic.o printk.o \
 	    hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
 	    notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \
 	    async.o range.o
-obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o
+obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o fw_memmap.o
 obj-y += groups.o
 
 ifdef CONFIG_FUNCTION_TRACER
kernel/fw_memmap.c new file +625 -0

625 lines not on this page · raw message

kernel/fw_memmap_internals.h new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.6.4.2
#7 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 4 lines · Yinghai Lu

move it to kernel/fw_memmap.c from arch/x86/kernel/e820.c

-v2: add fw_memmap wrapper to some func...
move some functions back to e820.c

NAK

This is even worse than before. You are now moving that entire pile of x86 gunk into "generic" code, but even keep it names e820 there !

What happened to the discussion we had earlier, which iirc concluded that a better approach would be to adapt x86 to use LMB ?

Cheers,
Ben.

Quoted 1,789 lines
---
 arch/x86/include/asm/e820.h  |  176 ++++++-------
 arch/x86/kernel/e820.c       |  638 ++----------------------------------------
 include/linux/bootmem.h      |    2 +-
 include/linux/early_res.h    |    1 +
 include/linux/fw_memmap.h    |   40 +++
 kernel/Makefile              |    2 +-
 kernel/fw_memmap.c           |  625 +++++++++++++++++++++++++++++++++++++++++
 kernel/fw_memmap_internals.h |   49 ++++
 8 files changed, 822 insertions(+), 711 deletions(-)
 create mode 100644 include/linux/fw_memmap.h
 create mode 100644 kernel/fw_memmap.c
 create mode 100644 kernel/fw_memmap_internals.h
arch/x86/include/asm/e820.h +80 -96
index 71c0348..c038616 100644
@@ -1,65 +1,10 @@
 #ifndef _ASM_X86_E820_H
 #define _ASM_X86_E820_H
-#define E820MAP	0x2d0		/* our map */
-#define E820MAX	128		/* number of entries in E820MAP */
-
-/*
- * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the
- * constrained space in the zeropage.  If we have more nodes than
- * that, and if we've booted off EFI firmware, then the EFI tables
- * passed us from the EFI firmware can list more nodes.  Size our
- * internal memory map tables to have room for these additional
- * nodes, based on up to three entries per node for which the
- * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT),
- * plus E820MAX, allowing space for the possible duplicate E820
- * entries that might need room in the same arrays, prior to the
- * call to sanitize_e820_map() to remove duplicates.  The allowance
- * of three memory map entries per node is "enough" entries for
- * the initial hardware platform motivating this mechanism to make
- * use of additional EFI map entries.  Future platforms may want
- * to allow more than three entries per node or otherwise refine
- * this size.
- */
-
-/*
- * Odd: 'make headers_check' complains about numa.h if I try
- * to collapse the next two #ifdef lines to a single line:
- *	#if defined(__KERNEL__) && defined(CONFIG_EFI)
- */
-#ifdef __KERNEL__
-#ifdef CONFIG_EFI
-#include <linux/numa.h>
-#define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)
-#else	/* ! CONFIG_EFI */
-#define E820_X_MAX E820MAX
-#endif
-#else	/* ! __KERNEL__ */
-#define E820_X_MAX E820MAX
-#endif
-
-#define E820NR	0x1e8		/* # entries in E820MAP */
-
-#define E820_RAM	1
-#define E820_RESERVED	2
-#define E820_ACPI	3
-#define E820_NVS	4
-#define E820_UNUSABLE	5
 
 /* reserved RAM used by kernel itself */
 #define E820_RESERVED_KERN        128
 
 #ifndef __ASSEMBLY__
-#include <linux/types.h>
-struct e820entry {
-	__u64 addr;	/* start of memory segment */
-	__u64 size;	/* size of memory segment */
-	__u32 type;	/* type of memory segment */
-} __attribute__((packed));
-
-struct e820map {
-	__u32 nr_map;
-	struct e820entry map[E820_X_MAX];
-};
 
 #define ISA_START_ADDRESS	0xa0000
 #define ISA_END_ADDRESS		0x100000
@@ -69,32 +14,18 @@ struct e820map {
 
 #ifdef __KERNEL__
 
-#ifdef CONFIG_X86_OOSTORE
-extern int centaur_ram_top;
-void get_centaur_ram_top(void);
+#include <linux/fw_memmap.h>
+
+#ifdef CONFIG_MEMTEST
+extern void early_memtest(unsigned long start, unsigned long end);
 #else
-static inline void get_centaur_ram_top(void)
+static inline void early_memtest(unsigned long start, unsigned long end)
 {
 }
 #endif
 
 extern unsigned long pci_mem_start;
-extern int e820_any_mapped(u64 start, u64 end, unsigned type);
-extern int e820_all_mapped(u64 start, u64 end, unsigned type);
-extern void e820_add_region(u64 start, u64 size, int type);
-extern void e820_print_map(char *who);
-int sanitize_e820_map(void);
-void save_e820_map(void);
-extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
-			       unsigned new_type);
-extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
-			     int checktype);
-extern void update_e820(void);
 extern void e820_setup_gap(void);
-extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
-			unsigned long start_addr, unsigned long long end_addr);
-struct setup_data;
-extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);
 
 #if defined(CONFIG_X86_64) || \
 	(defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
@@ -105,37 +36,80 @@ static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
 }
 #endif
 
-#ifdef CONFIG_MEMTEST
-extern void early_memtest(unsigned long start, unsigned long end);
-#else
-static inline void early_memtest(unsigned long start, unsigned long end)
+static inline void e820_add_region(u64 start, u64 size, int type)
 {
+	fw_memmap_add_region(start, size, type);
+}
+
+static inline void e820_print_map(char *who)
+{
+	fw_memmap_print_map(who);
+}
+
+static inline int sanitize_e820_map(void)
+{
+	return sanitize_fw_memmap();
+}
+
+static inline void finish_e820_parsing(void)
+{
+	finish_fw_memmap_parsing();
+}
+
+static inline void e820_register_active_regions(int nid,
+						unsigned long start_pfn,
+						unsigned long end_pfn)
+{
+	fw_memmap_register_active_regions(nid, start_pfn, end_pfn);
+}
+
+static inline u64 e820_hole_size(u64 start, u64 end)
+{
+	return fw_memmap_hole_size(start, end);
+}
+
+static inline u64 find_e820_area(u64 start, u64 end, u64 size, u64 align)
+{
+	return find_fw_memmap_area(start, end, size, align);
+}
+
+static inline u64 find_e820_area_node(int nid, u64 start, u64 end,
+					 u64 size, u64 align)
+{
+	return find_fw_memmap_area_node(nid, start, end, size, align);
 }
-#endif
 
-extern unsigned long end_user_pfn;
+static inline unsigned long e820_end_of_ram_pfn(void)
+{
+	return fw_memmap_end_of_ram_pfn();
+}
+
+void clear_e820_map(void);
+
+extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
+				int checktype);
+struct e820entry;
+int __sanitize_e820_map(struct e820entry *biosmap, int max_nr, u32 *pnr_map);
+extern unsigned long e820_end_of_low_ram_pfn(void);
+
+extern int e820_any_mapped(u64 start, u64 end, unsigned type);
+extern int e820_all_mapped(u64 start, u64 end, unsigned type);
+extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
+			       unsigned new_type);
+
+extern void update_e820(void);
+void save_e820_map(void);
+struct setup_data;
+extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data);
+extern char *default_machine_specific_memory_setup(void);
+extern void setup_memory_map(void);
 
-extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
 extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
-u64 find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
+
 extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
-#include <linux/early_res.h>
 
-extern unsigned long e820_end_of_ram_pfn(void);
-extern unsigned long e820_end_of_low_ram_pfn(void);
-extern int e820_find_active_region(const struct e820entry *ei,
-				  unsigned long start_pfn,
-				  unsigned long last_pfn,
-				  unsigned long *ei_startpfn,
-				  unsigned long *ei_endpfn);
-extern void e820_register_active_regions(int nid, unsigned long start_pfn,
-					 unsigned long end_pfn);
-extern u64 e820_hole_size(u64 start, u64 end);
-extern void finish_e820_parsing(void);
 extern void e820_reserve_resources(void);
 extern void e820_reserve_resources_late(void);
-extern void setup_memory_map(void);
-extern char *default_machine_specific_memory_setup(void);
 
 /*
  * Returns true iff the specified range [s,e) is completely contained inside
@@ -146,7 +120,17 @@ static inline bool is_ISA_range(u64 s, u64 e)
 	return s >= ISA_START_ADDRESS && e <= ISA_END_ADDRESS;
 }
 
+#ifdef CONFIG_X86_OOSTORE
+extern int centaur_ram_top;
+void get_centaur_ram_top(void);
+#else
+static inline void get_centaur_ram_top(void)
+{
+}
+#endif
+
 #endif /* __KERNEL__ */
+
 #endif /* __ASSEMBLY__ */
 
 #ifdef __KERNEL__
arch/x86/kernel/e820.c +25 -613
index a558609..9f125ca 100644
@@ -12,18 +12,15 @@
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
-#include <linux/pfn.h>
 #include <linux/suspend.h>
 #include <linux/firmware-map.h>
 
 #include <asm/e820.h>
-#include <asm/proto.h>
 #include <asm/setup.h>
 
+#include "../../../kernel/fw_memmap_internals.h"
+
 /*
- * The e820 map is the map that gets modified e.g. with command line parameters
- * and that is also registered with modifications in the kernel resource tree
- * with the iomem_resource as parent.
  *
  * The e820_saved is directly saved after the BIOS-provided memory map is
  * copied. It doesn't get modified afterwards. It's registered for the
@@ -34,7 +31,6 @@
  * user can e.g. boot the original kernel with mem=1G while still booting the
  * next kernel with full memory.
  */
-static struct e820map __initdata e820;
 static struct e820map __initdata e820_saved;
 
 /* For PCI or other memory-mapped resources */
@@ -99,295 +95,6 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
 	return 0;
 }
 
-/*
- * Add a memory region to the kernel e820 map.
- */
-static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size,
-					 int type)
-{
-	int x = e820x->nr_map;
-
-	if (x >= ARRAY_SIZE(e820x->map)) {
-		printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
-		return;
-	}
-
-	e820x->map[x].addr = start;
-	e820x->map[x].size = size;
-	e820x->map[x].type = type;
-	e820x->nr_map++;
-}
-
-void __init e820_add_region(u64 start, u64 size, int type)
-{
-	__e820_add_region(&e820, start, size, type);
-}
-
-static void __init e820_print_type(u32 type)
-{
-	switch (type) {
-	case E820_RAM:
-	case E820_RESERVED_KERN:
-		printk(KERN_CONT "(usable)");
-		break;
-	case E820_RESERVED:
-		printk(KERN_CONT "(reserved)");
-		break;
-	case E820_ACPI:
-		printk(KERN_CONT "(ACPI data)");
-		break;
-	case E820_NVS:
-		printk(KERN_CONT "(ACPI NVS)");
-		break;
-	case E820_UNUSABLE:
-		printk(KERN_CONT "(unusable)");
-		break;
-	default:
-		printk(KERN_CONT "type %u", type);
-		break;
-	}
-}
-
-void __init e820_print_map(char *who)
-{
-	int i;
-
-	for (i = 0; i < e820.nr_map; i++) {
-		printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
-		       (unsigned long long) e820.map[i].addr,
-		       (unsigned long long)
-		       (e820.map[i].addr + e820.map[i].size));
-		e820_print_type(e820.map[i].type);
-		printk(KERN_CONT "\n");
-	}
-}
-
-/*
- * Sanitize the BIOS e820 map.
- *
- * Some e820 responses include overlapping entries. The following
- * replaces the original e820 map with a new one, removing overlaps,
- * and resolving conflicting memory types in favor of highest
- * numbered type.
- *
- * The input parameter biosmap points to an array of 'struct
- * e820entry' which on entry has elements in the range [0, *pnr_map)
- * valid, and which has space for up to max_nr_map entries.
- * On return, the resulting sanitized e820 map entries will be in
- * overwritten in the same location, starting at biosmap.
- *
- * The integer pointed to by pnr_map must be valid on entry (the
- * current number of valid entries located at biosmap) and will
- * be updated on return, with the new number of valid entries
- * (something no more than max_nr_map.)
- *
- * The return value from sanitize_e820_map() is zero if it
- * successfully 'sanitized' the map entries passed in, and is -1
- * if it did nothing, which can happen if either of (1) it was
- * only passed one map entry, or (2) any of the input map entries
- * were invalid (start + size < start, meaning that the size was
- * so big the described memory range wrapped around through zero.)
- *
- *	Visually we're performing the following
- *	(1,2,3,4 = memory types)...
- *
- *	Sample memory map (w/overlaps):
- *	   ____22__________________
- *	   ______________________4_
- *	   ____1111________________
- *	   _44_____________________
- *	   11111111________________
- *	   ____________________33__
- *	   ___________44___________
- *	   __________33333_________
- *	   ______________22________
- *	   ___________________2222_
- *	   _________111111111______
- *	   _____________________11_
- *	   _________________4______
- *
- *	Sanitized equivalent (no overlap):
- *	   1_______________________
- *	   _44_____________________
- *	   ___1____________________
- *	   ____22__________________
- *	   ______11________________
- *	   _________1______________
- *	   __________3_____________
- *	   ___________44___________
- *	   _____________33_________
- *	   _______________2________
- *	   ________________1_______
- *	   _________________4______
- *	   ___________________2____
- *	   ____________________33__
- *	   ______________________4_
- */
-
-static int __init __sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
-			     u32 *pnr_map)
-{
-	struct change_member {
-		struct e820entry *pbios; /* pointer to original bios entry */
-		unsigned long long addr; /* address for this change point */
-	};
-	static struct change_member change_point_list[2*E820_X_MAX] __initdata;
-	static struct change_member *change_point[2*E820_X_MAX] __initdata;
-	static struct e820entry *overlap_list[E820_X_MAX] __initdata;
-	static struct e820entry new_bios[E820_X_MAX] __initdata;
-	struct change_member *change_tmp;
-	unsigned long current_type, last_type;
-	unsigned long long last_addr;
-	int chgidx, still_changing;
-	int overlap_entries;
-	int new_bios_entry;
-	int old_nr, new_nr, chg_nr;
-	int i;
-
-	/* if there's only one memory region, don't bother */
-	if (*pnr_map < 2)
-		return -1;
-
-	old_nr = *pnr_map;
-	BUG_ON(old_nr > max_nr_map);
-
-	/* bail out if we find any unreasonable addresses in bios map */
-	for (i = 0; i < old_nr; i++)
-		if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr)
-			return -1;
-
-	/* create pointers for initial change-point information (for sorting) */
-	for (i = 0; i < 2 * old_nr; i++)
-		change_point[i] = &change_point_list[i];
-
-	/* record all known change-points (starting and ending addresses),
-	   omitting those that are for empty memory regions */
-	chgidx = 0;
-	for (i = 0; i < old_nr; i++)	{
-		if (biosmap[i].size != 0) {
-			change_point[chgidx]->addr = biosmap[i].addr;
-			change_point[chgidx++]->pbios = &biosmap[i];
-			change_point[chgidx]->addr = biosmap[i].addr +
-				biosmap[i].size;
-			change_point[chgidx++]->pbios = &biosmap[i];
-		}
-	}
-	chg_nr = chgidx;
-
-	/* sort change-point list by memory addresses (low -> high) */
-	still_changing = 1;
-	while (still_changing)	{
-		still_changing = 0;
-		for (i = 1; i < chg_nr; i++)  {
-			unsigned long long curaddr, lastaddr;
-			unsigned long long curpbaddr, lastpbaddr;
-
-			curaddr = change_point[i]->addr;
-			lastaddr = change_point[i - 1]->addr;
-			curpbaddr = change_point[i]->pbios->addr;
-			lastpbaddr = change_point[i - 1]->pbios->addr;
-
-			/*
-			 * swap entries, when:
-			 *
-			 * curaddr > lastaddr or
-			 * curaddr == lastaddr and curaddr == curpbaddr and
-			 * lastaddr != lastpbaddr
-			 */
-			if (curaddr < lastaddr ||
-			    (curaddr == lastaddr && curaddr == curpbaddr &&
-			     lastaddr != lastpbaddr)) {
-				change_tmp = change_point[i];
-				change_point[i] = change_point[i-1];
-				change_point[i-1] = change_tmp;
-				still_changing = 1;
-			}
-		}
-	}
-
-	/* create a new bios memory map, removing overlaps */
-	overlap_entries = 0;	 /* number of entries in the overlap table */
-	new_bios_entry = 0;	 /* index for creating new bios map entries */
-	last_type = 0;		 /* start with undefined memory type */
-	last_addr = 0;		 /* start with 0 as last starting address */
-
-	/* loop through change-points, determining affect on the new bios map */
-	for (chgidx = 0; chgidx < chg_nr; chgidx++) {
-		/* keep track of all overlapping bios entries */
-		if (change_point[chgidx]->addr ==
-		    change_point[chgidx]->pbios->addr) {
-			/*
-			 * add map entry to overlap list (> 1 entry
-			 * implies an overlap)
-			 */
-			overlap_list[overlap_entries++] =
-				change_point[chgidx]->pbios;
-		} else {
-			/*
-			 * remove entry from list (order independent,
-			 * so swap with last)
-			 */
-			for (i = 0; i < overlap_entries; i++) {
-				if (overlap_list[i] ==
-				    change_point[chgidx]->pbios)
-					overlap_list[i] =
-						overlap_list[overlap_entries-1];
-			}
-			overlap_entries--;
-		}
-		/*
-		 * if there are overlapping entries, decide which
-		 * "type" to use (larger value takes precedence --
-		 * 1=usable, 2,3,4,4+=unusable)
-		 */
-		current_type = 0;
-		for (i = 0; i < overlap_entries; i++)
-			if (overlap_list[i]->type > current_type)
-				current_type = overlap_list[i]->type;
-		/*
-		 * continue building up new bios map based on this
-		 * information
-		 */
-		if (current_type != last_type)	{
-			if (last_type != 0)	 {
-				new_bios[new_bios_entry].size =
-					change_point[chgidx]->addr - last_addr;
-				/*
-				 * move forward only if the new size
-				 * was non-zero
-				 */
-				if (new_bios[new_bios_entry].size != 0)
-					/*
-					 * no more space left for new
-					 * bios entries ?
-					 */
-					if (++new_bios_entry >= max_nr_map)
-						break;
-			}
-			if (current_type != 0)	{
-				new_bios[new_bios_entry].addr =
-					change_point[chgidx]->addr;
-				new_bios[new_bios_entry].type = current_type;
-				last_addr = change_point[chgidx]->addr;
-			}
-			last_type = current_type;
-		}
-	}
-	/* retain count for new bios entries */
-	new_nr = new_bios_entry;
-
-	/* copy new bios mapping into original location */
-	memcpy(biosmap, new_bios, new_nr * sizeof(struct e820entry));
-	*pnr_map = new_nr;
-
-	return 0;
-}
-
-int __init sanitize_e820_map(void)
-{
-	return __sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
-}
-
 static int __init __append_e820_map(struct e820entry *biosmap, int nr_map)
 {
 	while (nr_map) {
@@ -509,52 +216,6 @@ static u64 __init e820_update_range_saved(u64 start, u64 size,
 				     new_type);
 }
 
-/* make e820 not cover the range */
-u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
-			     int checktype)
-{
-	int i;
-	u64 end;
-	u64 real_removed_size = 0;
-
-	if (size > (ULLONG_MAX - start))
-		size = ULLONG_MAX - start;
-
-	end = start + size;
-	printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ",
-		       (unsigned long long) start,
-		       (unsigned long long) end);
-	e820_print_type(old_type);
-	printk(KERN_CONT "\n");
-
-	for (i = 0; i < e820.nr_map; i++) {
-		struct e820entry *ei = &e820.map[i];
-		u64 final_start, final_end;
-
-		if (checktype && ei->type != old_type)
-			continue;
-		/* totally covered? */
-		if (ei->addr >= start &&
-		    (ei->addr + ei->size) <= (start + size)) {
-			real_removed_size += ei->size;
-			memset(ei, 0, sizeof(struct e820entry));
-			continue;
-		}
-		/* partially covered */
-		final_start = max(start, ei->addr);
-		final_end = min(start + size, ei->addr + ei->size);
-		if (final_start >= final_end)
-			continue;
-		real_removed_size += final_end - final_start;
-
-		ei->size -= final_end - final_start;
-		if (ei->addr < final_start)
-			continue;
-		ei->addr = final_end;
-	}
-	return real_removed_size;
-}
-
 void __init update_e820(void)
 {
 	u32 nr_map;
@@ -566,20 +227,24 @@ void __init update_e820(void)
 	printk(KERN_INFO "modified physical RAM map:\n");
 	e820_print_map("modified");
 }
+
 static void __init update_e820_saved(void)
 {
 	u32 nr_map;
+	int max_nr_map = ARRAY_SIZE(e820_saved.map);
 
 	nr_map = e820_saved.nr_map;
-	if (__sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map))
+	if (__sanitize_e820_map(e820_saved.map, max_nr_map, &nr_map))
 		return;
 	e820_saved.nr_map = nr_map;
 }
+
 #define MAX_GAP_END 0x100000000ull
 /*
  * Search for a gap in the e820 memory space from start_addr to end_addr.
  */
-__init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
+static int __init
+e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
 		unsigned long start_addr, unsigned long long end_addr)
 {
 	unsigned long long last;
@@ -726,37 +391,6 @@ static int __init e820_mark_nvs_memory(void)
 core_initcall(e820_mark_nvs_memory);
 #endif
 
-/*
- * Find a free area with specified alignment in a specific range.
- */
-u64 __init find_e820_area(u64 start, u64 end, u64 size, u64 align)
-{
-	int i;
-
-	for (i = 0; i < e820.nr_map; i++) {
-		struct e820entry *ei = &e820.map[i];
-		u64 addr;
-		u64 ei_start, ei_last;
-
-		if (ei->type != E820_RAM)
-			continue;
-
-		ei_last = ei->addr + ei->size;
-		ei_start = ei->addr;
-		addr = find_early_area(ei_start, ei_last, start, end,
-					 size, align);
-
-		if (addr != -1ULL)
-			return addr;
-	}
-	return -1ULL;
-}
-
-u64 __init find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align)
-{
-	return find_e820_area(start, end, size, align);
-}
-
 u64 __init get_max_mapped(void)
 {
 	u64 end = max_pfn_mapped;
@@ -765,6 +399,7 @@ u64 __init get_max_mapped(void)
 
 	return end;
 }
+
 /*
  * Find next free range after *start
  */
@@ -792,21 +427,6 @@ u64 __init find_e820_area_size(u64 start, u64 *sizep, u64 align)
 	return -1ULL;
 }
 
-u64 __init find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align)
-{
-	u64 addr;
-	/*
-	 * need to call this function after e820_register_active_regions
-	 * so early_node_map[] is set
-	 */
-	addr = find_memory_core_early(nid, size, align, start, end);
-	if (addr != -1ULL)
-		return addr;
-
-	/* fallback, should already have start end in the node range */
-	return find_e820_area(start, end, size, align);
-}
-
 /*
  * pre allocated 4k and reserved it in e820
  */
@@ -843,220 +463,6 @@ u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align)
 	return addr;
 }
 
-#ifdef CONFIG_X86_32
-# ifdef CONFIG_X86_PAE
-#  define MAX_ARCH_PFN		(1ULL<<(36-PAGE_SHIFT))
-# else
-#  define MAX_ARCH_PFN		(1ULL<<(32-PAGE_SHIFT))
-# endif
-#else /* CONFIG_X86_32 */
-# define MAX_ARCH_PFN MAXMEM>>PAGE_SHIFT
-#endif
-
-/*
- * Find the highest page frame number we have available
- */
-static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
-{
-	int i;
-	unsigned long last_pfn = 0;
-	unsigned long max_arch_pfn = MAX_ARCH_PFN;
-
-	for (i = 0; i < e820.nr_map; i++) {
-		struct e820entry *ei = &e820.map[i];
-		unsigned long start_pfn;
-		unsigned long end_pfn;
-
-		if (ei->type != type)
-			continue;
-
-		start_pfn = ei->addr >> PAGE_SHIFT;
-		end_pfn = (ei->addr + ei->size) >> PAGE_SHIFT;
-
-		if (start_pfn >= limit_pfn)
-			continue;
-		if (end_pfn > limit_pfn) {
-			last_pfn = limit_pfn;
-			break;
-		}
-		if (end_pfn > last_pfn)
-			last_pfn = end_pfn;
-	}
-
-	if (last_pfn > max_arch_pfn)
-		last_pfn = max_arch_pfn;
-
-	printk(KERN_INFO "last_pfn = %#lx max_arch_pfn = %#lx\n",
-			 last_pfn, max_arch_pfn);
-	return last_pfn;
-}
-unsigned long __init e820_end_of_ram_pfn(void)
-{
-	return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
-}
-
-unsigned long __init e820_end_of_low_ram_pfn(void)
-{
-	return e820_end_pfn(1UL<<(32 - PAGE_SHIFT), E820_RAM);
-}
-/*
- * Finds an active region in the address range from start_pfn to last_pfn and
- * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
- */
-int __init e820_find_active_region(const struct e820entry *ei,
-				  unsigned long start_pfn,
-				  unsigned long last_pfn,
-				  unsigned long *ei_startpfn,
-				  unsigned long *ei_endpfn)
-{
-	u64 align = PAGE_SIZE;
-
-	*ei_startpfn = round_up(ei->addr, align) >> PAGE_SHIFT;
-	*ei_endpfn = round_down(ei->addr + ei->size, align) >> PAGE_SHIFT;
-
-	/* Skip map entries smaller than a page */
-	if (*ei_startpfn >= *ei_endpfn)
-		return 0;
-
-	/* Skip if map is outside the node */
-	if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
-				    *ei_startpfn >= last_pfn)
-		return 0;
-
-	/* Check for overlaps */
-	if (*ei_startpfn < start_pfn)
-		*ei_startpfn = start_pfn;
-	if (*ei_endpfn > last_pfn)
-		*ei_endpfn = last_pfn;
-
-	return 1;
-}
-
-/* Walk the e820 map and register active regions within a node */
-void __init e820_register_active_regions(int nid, unsigned long start_pfn,
-					 unsigned long last_pfn)
-{
-	unsigned long ei_startpfn;
-	unsigned long ei_endpfn;
-	int i;
-
-	for (i = 0; i < e820.nr_map; i++)
-		if (e820_find_active_region(&e820.map[i],
-					    start_pfn, last_pfn,
-					    &ei_startpfn, &ei_endpfn))
-			add_active_range(nid, ei_startpfn, ei_endpfn);
-}
-
-/*
- * Find the hole size (in bytes) in the memory range.
- * @start: starting address of the memory range to scan
- * @end: ending address of the memory range to scan
- */
-u64 __init e820_hole_size(u64 start, u64 end)
-{
-	unsigned long start_pfn = start >> PAGE_SHIFT;
-	unsigned long last_pfn = end >> PAGE_SHIFT;
-	unsigned long ei_startpfn, ei_endpfn, ram = 0;
-	int i;
-
-	for (i = 0; i < e820.nr_map; i++) {
-		if (e820_find_active_region(&e820.map[i],
-					    start_pfn, last_pfn,
-					    &ei_startpfn, &ei_endpfn))
-			ram += ei_endpfn - ei_startpfn;
-	}
-	return end - start - ((u64)ram << PAGE_SHIFT);
-}
-
-static void early_panic(char *msg)
-{
-	early_printk(msg);
-	panic(msg);
-}
-
-static int userdef __initdata;
-
-/* "mem=nopentium" disables the 4MB page tables. */
-static int __init parse_memopt(char *p)
-{
-	u64 mem_size;
-
-	if (!p)
-		return -EINVAL;
-
-#ifdef CONFIG_X86_32
-	if (!strcmp(p, "nopentium")) {
-		setup_clear_cpu_cap(X86_FEATURE_PSE);
-		return 0;
-	}
-#endif
-
-	userdef = 1;
-	mem_size = memparse(p, &p);
-	e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
-
-	return 0;
-}
-early_param("mem", parse_memopt);
-
-static int __init parse_memmap_opt(char *p)
-{
-	char *oldp;
-	u64 start_at, mem_size;
-
-	if (!p)
-		return -EINVAL;
-
-	if (!strncmp(p, "exactmap", 8)) {
-#ifdef CONFIG_CRASH_DUMP
-		/*
-		 * If we are doing a crash dump, we still need to know
-		 * the real mem size before original memory map is
-		 * reset.
-		 */
-		saved_max_pfn = e820_end_of_ram_pfn();
-#endif
-		e820.nr_map = 0;
-		userdef = 1;
-		return 0;
-	}
-
-	oldp = p;
-	mem_size = memparse(p, &p);
-	if (p == oldp)
-		return -EINVAL;
-
-	userdef = 1;
-	if (*p == '@') {
-		start_at = memparse(p+1, &p);
-		e820_add_region(start_at, mem_size, E820_RAM);
-	} else if (*p == '#') {
-		start_at = memparse(p+1, &p);
-		e820_add_region(start_at, mem_size, E820_ACPI);
-	} else if (*p == '$') {
-		start_at = memparse(p+1, &p);
-		e820_add_region(start_at, mem_size, E820_RESERVED);
-	} else
-		e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
-
-	return *p == '\0' ? 0 : -EINVAL;
-}
-early_param("memmap", parse_memmap_opt);
-
-void __init finish_e820_parsing(void)
-{
-	if (userdef) {
-		u32 nr = e820.nr_map;
-
-		if (__sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0)
-			early_panic("Invalid user supplied memory map");
-		e820.nr_map = nr;
-
-		printk(KERN_INFO "user-defined physical RAM map:\n");
-		e820_print_map("user");
-	}
-}
-
 static inline const char *e820_type_to_string(int e820_type)
 {
 	switch (e820_type) {
@@ -1098,7 +504,8 @@ void __init e820_reserve_resources(void)
 		 * pci device BAR resource and insert them later in
 		 * pcibios_resource_survey()
 		 */
-		if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20)) {
+		if (e820.map[i].type != E820_RESERVED ||
+		    res->start < (1ULL<<20)) {
 			res->flags |= IORESOURCE_BUSY;
 			insert_resource(&iomem_resource, res);
 		}
@@ -1114,7 +521,7 @@ void __init e820_reserve_resources(void)
 }
 
 /* How much should we pad RAM ending depending on where it is? */
-static unsigned long ram_alignment(resource_size_t pos)
+static unsigned long __init ram_alignment(resource_size_t pos)
 {
 	unsigned long mb = pos >> 20;
 
@@ -1196,7 +603,7 @@ char *__init default_machine_specific_memory_setup(void)
 			who = "BIOS-e801";
 		}
 
-		e820.nr_map = 0;
+		clear_e820_map();
 		e820_add_region(0, LOWMEMSIZE(), E820_RAM);
 		e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
 	}
@@ -1204,7 +611,6 @@ char *__init default_machine_specific_memory_setup(void)
 	/* In case someone cares... */
 	return who;
 }
-
 void __init save_e820_map(void)
 {
 	memcpy(&e820_saved, &e820, sizeof(struct e820map));
@@ -1221,20 +627,18 @@ void __init setup_memory_map(void)
 }
 
 #ifdef CONFIG_X86_OOSTORE
+
 /*
  * Figure what we can cover with MCR's
  *
  * Shortcut: We know you can't put 4Gig of RAM on a winchip
  */
-void __init get_centaur_ram_top(void)
+static void __init __get_special_low_ram_top(void)
 {
 	u32 clip = 0xFFFFFFFFUL;
 	u32 top = 0;
 	int i;
 
-	if (boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR)
-		return;
-
 	for (i = 0; i < e820.nr_map; i++) {
 		unsigned long start, end;
 
@@ -1272,7 +676,15 @@ void __init get_centaur_ram_top(void)
 	if (top > clip)
 		top = clip;
 
-	centaur_ram_top = top;
+	return top;
 }
-#endif
 
+int centaur_ram_top;
+void __init get_centaur_ram_top(void)
+{
+	if (boot_cpu_data.x86_vendor != X86_VENDOR_CENTAUR)
+		return;
+
+	centaur_ram_top = __get_special_low_ram_top();
+}
+#endif
include/linux/bootmem.h +1 -1
index 266ab92..c341c18 100644
@@ -6,7 +6,7 @@
 
 #include <linux/mmzone.h>
 #include <asm/dma.h>
-
+#include <linux/early_res.h>
 /*
  *  simple boot-time physical memory area allocator.
  */
include/linux/early_res.h +1 -0
index 29c09f5..0f4590f 100644
@@ -14,6 +14,7 @@ u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
 u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
 			 u64 *sizep, u64 align);
 u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_fw_memmap_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);
include/linux/fw_memmap.h new file +40 -0
new file mode 100644
index 0000000..e0fcc1b
@@ -0,0 +1,40 @@
+#ifndef _LINUX_FW_MEMMAP_H
+#define _LINUX_FW_MEMMAP_H
+#define E820MAX	128		/* number of entries in E820MAP */
+
+#define FW_MEMMAP_RAM	1
+#define FW_MEMMAP_RESERVED	2
+
+#define E820_RAM	FW_MEMMAP_RAM
+#define E820_RESERVED	FW_MEMMAP_RESERVED
+
+#define E820_ACPI	3
+#define E820_NVS	4
+#define E820_UNUSABLE	5
+
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+struct e820entry {
+	__u64 addr;	/* start of memory segment */
+	__u64 size;	/* size of memory segment */
+	__u32 type;	/* type of memory segment */
+} __attribute__((packed));
+
+#ifdef __KERNEL__
+
+void fw_memmap_add_region(u64 start, u64 size, int type);
+void fw_memmap_print_map(char *who);
+int sanitize_fw_memmap(void);
+void finish_fw_memmap_parsing(void);
+
+#include <linux/early_res.h>
+
+unsigned long fw_memmap_end_of_ram_pfn(void);
+void fw_memmap_register_active_regions(int nid, unsigned long start_pfn,
+					 unsigned long end_pfn);
+u64 fw_memmap_hole_size(u64 start, u64 end);
+
+#endif /* __KERNEL__ */
+#endif /* __ASSEMBLY__ */
+
+#endif /* _LINUX_FW_MEMMAP_H */
kernel/Makefile +1 -1
index d5c3006..b0afaa5 100644
@@ -11,7 +11,7 @@ obj-y     = sched.o fork.o exec_domain.o panic.o printk.o \
 	    hrtimer.o rwsem.o nsproxy.o srcu.o semaphore.o \
 	    notifier.o ksysfs.o pm_qos_params.o sched_clock.o cred.o \
 	    async.o range.o
-obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o
+obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o fw_memmap.o
 obj-y += groups.o
 
 ifdef CONFIG_FUNCTION_TRACER
kernel/fw_memmap.c new file +625 -0
new file mode 100644
index 0000000..11067f3
@@ -0,0 +1,625 @@
+/*
+ * Handle the memory map.
+ * The functions here do the job until bootmem takes over.
+ *
+ *  Getting sanitize_e820_map() in sync with i386 version by applying change:
+ *  -  Provisions for empty E820 memory regions (reported by certain BIOSes).
+ *     Alex Achenbach <[email protected]>, December 2002.
+ *  Venkatesh Pallipadi <[email protected]>
+ *
+ */
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/init.h>
+#include <linux/bootmem.h>
+#include <linux/suspend.h>
+#include <linux/ioport.h>
+
+#include <linux/fw_memmap.h>
+#include "fw_memmap_internals.h"
+
+/*
+ * The e820 map is the map that gets modified e.g. with command line parameters
+ * and that is also registered with modifications in the kernel resource tree
+ * with the iomem_resource as parent.
+ */
+struct e820map __initdata e820;
+
+/*
+ * Add a memory region to the kernel e820 map.
+ */
+void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size,
+					 int type)
+{
+	int x = e820x->nr_map;
+
+	if (x >= ARRAY_SIZE(e820x->map)) {
+		printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
+		return;
+	}
+
+	e820x->map[x].addr = start;
+	e820x->map[x].size = size;
+	e820x->map[x].type = type;
+	e820x->nr_map++;
+}
+
+void __init fw_memmap_add_region(u64 start, u64 size, int type)
+{
+	__e820_add_region(&e820, start, size, type);
+}
+
+/* make e820 not cover the range */
+u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
+			     int checktype)
+{
+	int i;
+	u64 end;
+	u64 real_removed_size = 0;
+
+	if (size > (ULLONG_MAX - start))
+		size = ULLONG_MAX - start;
+
+	end = start + size;
+	printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ",
+		       (unsigned long long) start,
+		       (unsigned long long) end);
+	e820_print_type(old_type);
+	printk(KERN_CONT "\n");
+
+	for (i = 0; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+		u64 final_start, final_end;
+
+		if (checktype && ei->type != old_type)
+			continue;
+		/* totally covered? */
+		if (ei->addr >= start &&
+		    (ei->addr + ei->size) <= (start + size)) {
+			real_removed_size += ei->size;
+			memset(ei, 0, sizeof(struct e820entry));
+			continue;
+		}
+		/* partially covered */
+		final_start = max(start, ei->addr);
+		final_end = min(start + size, ei->addr + ei->size);
+		if (final_start >= final_end)
+			continue;
+		real_removed_size += final_end - final_start;
+
+		ei->size -= final_end - final_start;
+		if (ei->addr < final_start)
+			continue;
+		ei->addr = final_end;
+	}
+	return real_removed_size;
+}
+
+void __init e820_print_type(u32 type)
+{
+	switch (type) {
+	case E820_RAM:
+	case E820_RESERVED_KERN:
+		printk(KERN_CONT "(usable)");
+		break;
+	case E820_RESERVED:
+		printk(KERN_CONT "(reserved)");
+		break;
+	case E820_ACPI:
+		printk(KERN_CONT "(ACPI data)");
+		break;
+	case E820_NVS:
+		printk(KERN_CONT "(ACPI NVS)");
+		break;
+	case E820_UNUSABLE:
+		printk(KERN_CONT "(unusable)");
+		break;
+	default:
+		printk(KERN_CONT "type %u", type);
+		break;
+	}
+}
+
+void __init fw_memmap_print_map(char *who)
+{
+	int i;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		printk(KERN_INFO " %s: %016Lx - %016Lx ", who,
+		       (unsigned long long) e820.map[i].addr,
+		       (unsigned long long)
+		       (e820.map[i].addr + e820.map[i].size));
+		e820_print_type(e820.map[i].type);
+		printk(KERN_CONT "\n");
+	}
+}
+
+/*
+ * Sanitize the BIOS e820 map.
+ *
+ * Some e820 responses include overlapping entries. The following
+ * replaces the original e820 map with a new one, removing overlaps,
+ * and resolving conflicting memory types in favor of highest
+ * numbered type.
+ *
+ * The input parameter biosmap points to an array of 'struct
+ * e820entry' which on entry has elements in the range [0, *pnr_map)
+ * valid, and which has space for up to max_nr_map entries.
+ * On return, the resulting sanitized e820 map entries will be in
+ * overwritten in the same location, starting at biosmap.
+ *
+ * The integer pointed to by pnr_map must be valid on entry (the
+ * current number of valid entries located at biosmap) and will
+ * be updated on return, with the new number of valid entries
+ * (something no more than max_nr_map.)
+ *
+ * The return value from sanitize_e820_map() is zero if it
+ * successfully 'sanitized' the map entries passed in, and is -1
+ * if it did nothing, which can happen if either of (1) it was
+ * only passed one map entry, or (2) any of the input map entries
+ * were invalid (start + size < start, meaning that the size was
+ * so big the described memory range wrapped around through zero.)
+ *
+ *	Visually we're performing the following
+ *	(1,2,3,4 = memory types)...
+ *
+ *	Sample memory map (w/overlaps):
+ *	   ____22__________________
+ *	   ______________________4_
+ *	   ____1111________________
+ *	   _44_____________________
+ *	   11111111________________
+ *	   ____________________33__
+ *	   ___________44___________
+ *	   __________33333_________
+ *	   ______________22________
+ *	   ___________________2222_
+ *	   _________111111111______
+ *	   _____________________11_
+ *	   _________________4______
+ *
+ *	Sanitized equivalent (no overlap):
+ *	   1_______________________
+ *	   _44_____________________
+ *	   ___1____________________
+ *	   ____22__________________
+ *	   ______11________________
+ *	   _________1______________
+ *	   __________3_____________
+ *	   ___________44___________
+ *	   _____________33_________
+ *	   _______________2________
+ *	   ________________1_______
+ *	   _________________4______
+ *	   ___________________2____
+ *	   ____________________33__
+ *	   ______________________4_
+ */
+
+int __init __sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
+			     u32 *pnr_map)
+{
+	struct change_member {
+		struct e820entry *pbios; /* pointer to original bios entry */
+		unsigned long long addr; /* address for this change point */
+	};
+	static struct change_member change_point_list[2*E820_X_MAX] __initdata;
+	static struct change_member *change_point[2*E820_X_MAX] __initdata;
+	static struct e820entry *overlap_list[E820_X_MAX] __initdata;
+	static struct e820entry new_bios[E820_X_MAX] __initdata;
+	struct change_member *change_tmp;
+	unsigned long current_type, last_type;
+	unsigned long long last_addr;
+	int chgidx, still_changing;
+	int overlap_entries;
+	int new_bios_entry;
+	int old_nr, new_nr, chg_nr;
+	int i;
+
+	/* if there's only one memory region, don't bother */
+	if (*pnr_map < 2)
+		return -1;
+
+	old_nr = *pnr_map;
+	BUG_ON(old_nr > max_nr_map);
+
+	/* bail out if we find any unreasonable addresses in bios map */
+	for (i = 0; i < old_nr; i++)
+		if (biosmap[i].addr + biosmap[i].size < biosmap[i].addr)
+			return -1;
+
+	/* create pointers for initial change-point information (for sorting) */
+	for (i = 0; i < 2 * old_nr; i++)
+		change_point[i] = &change_point_list[i];
+
+	/* record all known change-points (starting and ending addresses),
+	   omitting those that are for empty memory regions */
+	chgidx = 0;
+	for (i = 0; i < old_nr; i++)	{
+		if (biosmap[i].size != 0) {
+			change_point[chgidx]->addr = biosmap[i].addr;
+			change_point[chgidx++]->pbios = &biosmap[i];
+			change_point[chgidx]->addr = biosmap[i].addr +
+				biosmap[i].size;
+			change_point[chgidx++]->pbios = &biosmap[i];
+		}
+	}
+	chg_nr = chgidx;
+
+	/* sort change-point list by memory addresses (low -> high) */
+	still_changing = 1;
+	while (still_changing)	{
+		still_changing = 0;
+		for (i = 1; i < chg_nr; i++)  {
+			unsigned long long curaddr, lastaddr;
+			unsigned long long curpbaddr, lastpbaddr;
+
+			curaddr = change_point[i]->addr;
+			lastaddr = change_point[i - 1]->addr;
+			curpbaddr = change_point[i]->pbios->addr;
+			lastpbaddr = change_point[i - 1]->pbios->addr;
+
+			/*
+			 * swap entries, when:
+			 *
+			 * curaddr > lastaddr or
+			 * curaddr == lastaddr and curaddr == curpbaddr and
+			 * lastaddr != lastpbaddr
+			 */
+			if (curaddr < lastaddr ||
+			    (curaddr == lastaddr && curaddr == curpbaddr &&
+			     lastaddr != lastpbaddr)) {
+				change_tmp = change_point[i];
+				change_point[i] = change_point[i-1];
+				change_point[i-1] = change_tmp;
+				still_changing = 1;
+			}
+		}
+	}
+
+	/* create a new bios memory map, removing overlaps */
+	overlap_entries = 0;	 /* number of entries in the overlap table */
+	new_bios_entry = 0;	 /* index for creating new bios map entries */
+	last_type = 0;		 /* start with undefined memory type */
+	last_addr = 0;		 /* start with 0 as last starting address */
+
+	/* loop through change-points, determining affect on the new bios map */
+	for (chgidx = 0; chgidx < chg_nr; chgidx++) {
+		/* keep track of all overlapping bios entries */
+		if (change_point[chgidx]->addr ==
+		    change_point[chgidx]->pbios->addr) {
+			/*
+			 * add map entry to overlap list (> 1 entry
+			 * implies an overlap)
+			 */
+			overlap_list[overlap_entries++] =
+				change_point[chgidx]->pbios;
+		} else {
+			/*
+			 * remove entry from list (order independent,
+			 * so swap with last)
+			 */
+			for (i = 0; i < overlap_entries; i++) {
+				if (overlap_list[i] ==
+				    change_point[chgidx]->pbios)
+					overlap_list[i] =
+						overlap_list[overlap_entries-1];
+			}
+			overlap_entries--;
+		}
+		/*
+		 * if there are overlapping entries, decide which
+		 * "type" to use (larger value takes precedence --
+		 * 1=usable, 2,3,4,4+=unusable)
+		 */
+		current_type = 0;
+		for (i = 0; i < overlap_entries; i++)
+			if (overlap_list[i]->type > current_type)
+				current_type = overlap_list[i]->type;
+		/*
+		 * continue building up new bios map based on this
+		 * information
+		 */
+		if (current_type != last_type)	{
+			if (last_type != 0)	 {
+				new_bios[new_bios_entry].size =
+					change_point[chgidx]->addr - last_addr;
+				/*
+				 * move forward only if the new size
+				 * was non-zero
+				 */
+				if (new_bios[new_bios_entry].size != 0)
+					/*
+					 * no more space left for new
+					 * bios entries ?
+					 */
+					if (++new_bios_entry >= max_nr_map)
+						break;
+			}
+			if (current_type != 0)	{
+				new_bios[new_bios_entry].addr =
+					change_point[chgidx]->addr;
+				new_bios[new_bios_entry].type = current_type;
+				last_addr = change_point[chgidx]->addr;
+			}
+			last_type = current_type;
+		}
+	}
+	/* retain count for new bios entries */
+	new_nr = new_bios_entry;
+
+	/* copy new bios mapping into original location */
+	memcpy(biosmap, new_bios, new_nr * sizeof(struct e820entry));
+	*pnr_map = new_nr;
+
+	return 0;
+}
+
+int __init sanitize_fw_memmap(void)
+{
+	int max_nr_map = ARRAY_SIZE(e820.map);
+
+	return __sanitize_e820_map(e820.map, max_nr_map, &e820.nr_map);
+}
+
+void __init clear_e820_map(void)
+{
+	e820.nr_map = 0;
+}
+
+static int userdef __initdata;
+
+/* "mem=nopentium" disables the 4MB page tables. */
+static int __init parse_memopt(char *p)
+{
+	u64 mem_size;
+
+	if (!p)
+		return -EINVAL;
+
+#ifdef CONFIG_X86_32
+	if (!strcmp(p, "nopentium")) {
+		setup_clear_cpu_cap(X86_FEATURE_PSE);
+		return 0;
+	}
+#endif
+
+	userdef = 1;
+	mem_size = memparse(p, &p);
+	e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
+
+	return 0;
+}
+early_param("mem", parse_memopt);
+
+static int __init parse_memmap_opt(char *p)
+{
+	char *oldp;
+	u64 start_at, mem_size;
+
+	if (!p)
+		return -EINVAL;
+
+	if (!strncmp(p, "exactmap", 8)) {
+#ifdef CONFIG_CRASH_DUMP
+		/*
+		 * If we are doing a crash dump, we still need to know
+		 * the real mem size before original memory map is
+		 * reset.
+		 */
+		saved_max_pfn = fw_memmap_end_of_ram_pfn();
+#endif
+		e820.nr_map = 0;
+		userdef = 1;
+		return 0;
+	}
+
+	oldp = p;
+	mem_size = memparse(p, &p);
+	if (p == oldp)
+		return -EINVAL;
+
+	userdef = 1;
+	if (*p == '@') {
+		start_at = memparse(p+1, &p);
+		e820_add_region(start_at, mem_size, E820_RAM);
+	} else if (*p == '#') {
+		start_at = memparse(p+1, &p);
+		e820_add_region(start_at, mem_size, E820_ACPI);
+	} else if (*p == '$') {
+		start_at = memparse(p+1, &p);
+		e820_add_region(start_at, mem_size, E820_RESERVED);
+	} else
+		e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
+
+	return *p == '\0' ? 0 : -EINVAL;
+}
+early_param("memmap", parse_memmap_opt);
+
+static void early_panic(char *msg)
+{
+	early_printk(msg);
+	panic(msg);
+}
+
+void __init finish_fw_memmap_parsing(void)
+{
+	if (userdef) {
+		u32 nr = e820.nr_map;
+		int max_nr_map = ARRAY_SIZE(e820.map);
+
+		if (__sanitize_e820_map(e820.map, max_nr_map, &nr) < 0)
+			early_panic("Invalid user supplied memory map");
+		e820.nr_map = nr;
+
+		printk(KERN_INFO "user-defined physical RAM map:\n");
+		e820_print_map("user");
+	}
+}
+
+/*
+ * Find a free area with specified alignment in a specific range.
+ */
+u64 __init find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align)
+{
+	int i;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+		u64 addr;
+		u64 ei_start, ei_last;
+
+		if (ei->type != E820_RAM)
+			continue;
+
+		ei_last = ei->addr + ei->size;
+		ei_start = ei->addr;
+		addr = find_early_area(ei_start, ei_last, start, end,
+					 size, align);
+
+		if (addr != -1ULL)
+			return addr;
+	}
+	return -1ULL;
+}
+
+u64 __init
+find_fw_memmap_area_node(int nid, u64 start, u64 end, u64 size, u64 align)
+{
+	u64 addr;
+	/*
+	 * need to call this function after e820_register_active_regions
+	 * so early_node_map[] is set
+	 */
+	addr = find_memory_core_early(nid, size, align, start, end);
+	if (addr != -1ULL)
+		return addr;
+
+	/* fallback, should already have start end in the node range */
+	return find_fw_memmap_area(start, end, size, align);
+}
+
+#ifdef CONFIG_X86_32
+# ifdef CONFIG_X86_PAE
+#  define MAX_ARCH_PFN	(1ULL<<(36-PAGE_SHIFT))
+# else
+#  define MAX_ARCH_PFN	(1ULL<<(32-PAGE_SHIFT))
+# endif
+#else /* CONFIG_X86_32 */
+# define MAX_ARCH_PFN	(MAXMEM>>PAGE_SHIFT)
+#endif
+
+/*
+ * Find the highest page frame number we have available
+ */
+static unsigned long __init e820_end_pfn(unsigned long limit_pfn, unsigned type)
+{
+	int i;
+	unsigned long last_pfn = 0;
+	unsigned long max_arch_pfn = MAX_ARCH_PFN;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		struct e820entry *ei = &e820.map[i];
+		unsigned long start_pfn;
+		unsigned long end_pfn;
+
+		if (ei->type != type)
+			continue;
+
+		start_pfn = ei->addr >> PAGE_SHIFT;
+		end_pfn = (ei->addr + ei->size) >> PAGE_SHIFT;
+
+		if (start_pfn >= limit_pfn)
+			continue;
+		if (end_pfn > limit_pfn) {
+			last_pfn = limit_pfn;
+			break;
+		}
+		if (end_pfn > last_pfn)
+			last_pfn = end_pfn;
+	}
+
+	if (last_pfn > max_arch_pfn)
+		last_pfn = max_arch_pfn;
+
+	printk(KERN_INFO "last_pfn = %#lx max_arch_pfn = %#lx\n",
+			 last_pfn, max_arch_pfn);
+	return last_pfn;
+}
+unsigned long __init fw_memmap_end_of_ram_pfn(void)
+{
+	return e820_end_pfn(MAX_ARCH_PFN, E820_RAM);
+}
+
+unsigned long __init e820_end_of_low_ram_pfn(void)
+{
+	return e820_end_pfn(1UL<<(32 - PAGE_SHIFT), E820_RAM);
+}
+/*
+ * Finds an active region in the address range from start_pfn to last_pfn and
+ * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
+ */
+static int __init e820_find_active_region(const struct e820entry *ei,
+				  unsigned long start_pfn,
+				  unsigned long last_pfn,
+				  unsigned long *ei_startpfn,
+				  unsigned long *ei_endpfn)
+{
+	u64 align = PAGE_SIZE;
+
+	*ei_startpfn = round_up(ei->addr, align) >> PAGE_SHIFT;
+	*ei_endpfn = round_down(ei->addr + ei->size, align) >> PAGE_SHIFT;
+
+	/* Skip map entries smaller than a page */
+	if (*ei_startpfn >= *ei_endpfn)
+		return 0;
+
+	/* Skip if map is outside the node */
+	if (ei->type != E820_RAM || *ei_endpfn <= start_pfn ||
+				    *ei_startpfn >= last_pfn)
+		return 0;
+
+	/* Check for overlaps */
+	if (*ei_startpfn < start_pfn)
+		*ei_startpfn = start_pfn;
+	if (*ei_endpfn > last_pfn)
+		*ei_endpfn = last_pfn;
+
+	return 1;
+}
+
+/* Walk the e820 map and register active regions within a node */
+void __init fw_memmap_register_active_regions(int nid, unsigned long start_pfn,
+					 unsigned long last_pfn)
+{
+	unsigned long ei_startpfn;
+	unsigned long ei_endpfn;
+	int i;
+
+	for (i = 0; i < e820.nr_map; i++)
+		if (e820_find_active_region(&e820.map[i],
+					    start_pfn, last_pfn,
+					    &ei_startpfn, &ei_endpfn))
+			add_active_range(nid, ei_startpfn, ei_endpfn);
+}
+
+/*
+ * Find the hole size (in bytes) in the memory range.
+ * @start: starting address of the memory range to scan
+ * @end: ending address of the memory range to scan
+ */
+u64 __init fw_memmap_hole_size(u64 start, u64 end)
+{
+	unsigned long start_pfn = start >> PAGE_SHIFT;
+	unsigned long last_pfn = end >> PAGE_SHIFT;
+	unsigned long ei_startpfn, ei_endpfn, ram = 0;
+	int i;
+
+	for (i = 0; i < e820.nr_map; i++) {
+		if (e820_find_active_region(&e820.map[i],
+					    start_pfn, last_pfn,
+					    &ei_startpfn, &ei_endpfn))
+			ram += ei_endpfn - ei_startpfn;
+	}
+	return end - start - ((u64)ram << PAGE_SHIFT);
+}
kernel/fw_memmap_internals.h new file +49 -0
new file mode 100644
index 0000000..f217602
@@ -0,0 +1,49 @@
+#ifndef __KERNEL_FW_MEMMAP_INTERNALS_H
+#define __KERNEL_FW_MEMMAP_INTERNALS_H
+
+/*
+ * Legacy E820 BIOS limits us to 128 (E820MAX) nodes due to the
+ * constrained space in the zeropage.  If we have more nodes than
+ * that, and if we've booted off EFI firmware, then the EFI tables
+ * passed us from the EFI firmware can list more nodes.  Size our
+ * internal memory map tables to have room for these additional
+ * nodes, based on up to three entries per node for which the
+ * kernel was built: MAX_NUMNODES == (1 << CONFIG_NODES_SHIFT),
+ * plus E820MAX, allowing space for the possible duplicate E820
+ * entries that might need room in the same arrays, prior to the
+ * call to sanitize_e820_map() to remove duplicates.  The allowance
+ * of three memory map entries per node is "enough" entries for
+ * the initial hardware platform motivating this mechanism to make
+ * use of additional EFI map entries.  Future platforms may want
+ * to allow more than three entries per node or otherwise refine
+ * this size.
+ */
+
+/*
+ * Odd: 'make headers_check' complains about numa.h if I try
+ * to collapse the next two #ifdef lines to a single line:
+ *	#if defined(__KERNEL__) && defined(CONFIG_EFI)
+ */
+#ifdef __KERNEL__
+#ifdef CONFIG_EFI
+#include <linux/numa.h>
+#define E820_X_MAX (E820MAX + 3 * MAX_NUMNODES)
+#else	/* ! CONFIG_EFI */
+#define E820_X_MAX E820MAX
+#endif
+#else	/* ! __KERNEL__ */
+#define E820_X_MAX E820MAX
+#endif
+
+#ifndef __ASSEMBLY__
+struct e820map {
+	__u32 nr_map;
+	struct e820entry map[E820_X_MAX];
+};
+#endif
+
+extern struct e820map __initdata e820;
+void e820_print_type(u32 type);
+void __e820_add_region(struct e820map *e820x, u64 start, u64 size, int type);
+
+#endif
#8 lore raw

Questions about SMP bootup control

Hi All:

I want to do some modification on the SMP architecture.

Purpose:
Only the first CPU is running the linux OS, while others do some private services processing.

My solution:
In the end of the start_secondary() function, I try to schedu the slave cpu to call my private endless loop instead of cpu_idle();

Result:
The system can NOT up, there is no interactive cli.

Question:
Is there some wrong with my modification or I go to the wrong way?

Thank you very much.

#9 lore raw

Re: Questions about SMP bootup control

Quoted 12 lines · Yijun (NSN - CN/Beijing)

Hi All:

I want to do some modification on the SMP architecture.

Purpose:
Only the first CPU is running the linux OS, while others do some private services processing.

My solution:
In the end of the start_secondary() function, I try to schedu the slave cpu to call my private endless loop instead of cpu_idle();

Quoted 5 lines

Result:
The system can NOT up, there is no interactive cli.

Question:
Is there some wrong with my modification or I go to the wrong way?

Presumably you're doing this to own that CPU exclusively.

Hooking at cpu_idle is not very useful then because interrupts will be already enabled and the system participate in IPIs etc, so you can't simply disable them, the others will miss them.

You would rather need to prevent them from being started in the first place, e.g. by exluding them with maxcpus=..

A better alternative might be to use isolcpus=... and schedule a standard program.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#10 lore raw

RE: Questions about SMP bootup control

-----Original Message-----
From: ext Andi Kleen [mailto:[email protected]]
Sent: Monday, March 22, 2010 11:29 AM
To: Zhu, Yijun (NSN - CN/Beijing)
Cc: [email protected]; [email protected]
Subject: Re: Questions about SMP bootup control

Quoted 6 lines · Yijun (NSN - CN/Beijing)

Hi All:

I want to do some modification on the SMP architecture.

Purpose:
Only the first CPU is running the linux OS, while others do some

private

Quoted 4 lines

services processing.

My solution:
In the end of the start_secondary() function, I try to schedu the

slave

Quoted 15 lines

cpu to call my private endless loop instead of cpu_idle();

Result:
The system can NOT up, there is no interactive cli.

Question:
Is there some wrong with my modification or I go to the wrong way?

Presumably you're doing this to own that CPU exclusively.

Hooking at cpu_idle is not very useful then because interrupts will be already enabled and the system participate in IPIs etc, so you can't simply disable them, the others will miss them.

Quoted 9 lines

You would rather need to prevent them from being started in the first place, e.g. by exluding them with maxcpus=..

A better alternative might be to use isolcpus=... and schedule a standard program.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.

Thank you very much. But when I try to apply with the isolcpus opinion, It seems it still can NOT work.
All other CPUs are isolated, only the first one is left. Then I found all others are still initialized by the start_secondary() even I use the isolated opinion, in the end,
I add an endless loop instead of cpu_idle(), The system still can NOT up.

So is there any mistake in what I did, could someone be kindness to give me more suggestions.

Thanks in advance.

author
#11 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Benjamin Herrenschmidt
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 4 lines · Yinghai Lu

move it to kernel/fw_memmap.c from arch/x86/kernel/e820.c

-v2: add fw_memmap wrapper to some func...
move some functions back to e820.c

NAK

at this point, kernel/early_res.c and kernel/fw_memmap.c is protected with HAVE_EARLY_RES

obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o fw_memmap.o

so it will not increase size that doesn't support early_res/bootmem yet.

Quoted 3 lines

This is even worse than before. You are now moving that entire pile of x86 gunk into "generic" code, but even keep it names e820 there !

not all of the e820 code. arch/x86/kernel/e820.c are still there.

linux-2.6> wc -l arch/x86/kernel/e820.c
690 arch/x86/kernel/e820.c
linux-2.6> wc -l kernel/fw_memmap.c
625 kernel/fw_memmap.c

and interface header file

yhlu@linux-siqj:~/xx/xx/kernel/tip/linux-2.6> cat include/linux/fw_memmap.h #ifndef _LINUX_FW_MEMMAP_H
#define _LINUX_FW_MEMMAP_H
#define E820MAX 128 /* number of entries in E820MAP */

#define FW_MEMMAP_RAM 1
#define FW_MEMMAP_RESERVED 2

#define E820_RAM FW_MEMMAP_RAM
#define E820_RESERVED FW_MEMMAP_RESERVED

#define E820_ACPI 3
#define E820_NVS 4
#define E820_UNUSABLE 5

#ifndef __ASSEMBLY__
#include <linux/types.h>
struct e820entry {
__u64 addr; /* start of memory segment */
__u64 size; /* size of memory segment */
__u32 type; /* type of memory segment */
} __attribute__((packed));

#ifdef __KERNEL__

void fw_memmap_add_region(u64 start, u64 size, int type); void fw_memmap_print_map(char *who);
int sanitize_fw_memmap(void);
void finish_fw_memmap_parsing(void);

#include <linux/early_res.h>

unsigned long fw_memmap_end_of_ram_pfn(void);
void fw_memmap_register_active_regions(int nid, unsigned long start_pfn,

					 unsigned long end_pfn);

u64 fw_memmap_hole_size(u64 start, u64 end);

#endif /* __KERNEL__ */
#endif /* __ASSEMBLY__ */

#endif /* _LINUX_FW_MEMMAP_H */

and new arch that support early_res/bootmem, will normally only need to call those six functions like

+void __init setup_memory_map(void)
+{

+       int i;
+       unsigned long phys_base;
+       /* Find available physical memory...
+        *
+        * Read it twice in order to work around a bug in openfirmware.
+        * The call to grab this table itself can cause openfirmware to
+        * allocate memory, which in turn can take away some space from
+        * the list of available memory.  Reading it twice makes sure
+        * we really do get the final value.
+        */
+       read_obp_translations();
+       read_obp_memory("reg", &pall[0], &pall_ents);
+       read_obp_memory("available", &pavail[0], &pavail_ents);
+       read_obp_memory("available", &pavail[0], &pavail_ents);

+
+ phys_base = 0xffffffffffffffffUL;
+ for (i = 0; i < pavail_ents; i++) {
+ phys_base = min(phys_base, pavail[i].phys_addr);
+ fw_memmap_add_region(pavail[i].phys_addr, pavail[i].reg_size,
+ FW_MEMMAP_RAM);
+ }
+
+ sanitize_fw_memmap();
+
+ fw_memmap_print_map("obp memmap:");

Quoted 3 lines

What happened to the discussion we had earlier, which iirc concluded that a better approach would be to adapt x86 to use LMB ?

e820/early_res is more complicated than lmb. to make x86, we still need to keep e820 related code. and early_res already can be used to replace bootmem code.

maybe we should find other user other than previous lmb users at first.

attached is the one for sparc64/lmb converting...- i have no chance to debug it. qemu seems doesn't support sparc64 well yet.

Yinghai

[RFC PATCH -v2 6/6] sparc64: use early_res and nobootmem
From: Yinghai Lu <[email protected]>

use early_res/fw_memmap to replace lmb, so could use early_res replace bootmem

-v2: remve e820 reference...

---
 arch/sparc/Kconfig                   |   17 ++
 arch/sparc/configs/sparc64_defconfig |    1 
 arch/sparc/include/asm/lmb.h         |   10 -
 arch/sparc/include/asm/pgtable_64.h  |    2 
 arch/sparc/kernel/mdesc.c            |   18 +-
 arch/sparc/kernel/prom_64.c          |    7 
 arch/sparc/kernel/setup_64.c         |   21 --
 arch/sparc/mm/init_64.c              |  252 +++++++++++++++++------------------
 8 files changed, 162 insertions(+), 166 deletions(-)
arch/sparc/Kconfig +16 -1
Index: linux-2.6/arch/sparc/Kconfig
===================================================================
@@ -39,7 +39,6 @@ config SPARC64
 	select HAVE_FUNCTION_TRACER
 	select HAVE_KRETPROBES
 	select HAVE_KPROBES
-	select HAVE_LMB
 	select HAVE_SYSCALL_WRAPPERS
 	select HAVE_DYNAMIC_FTRACE
 	select HAVE_FTRACE_MCOUNT_RECORD
@@ -90,6 +89,10 @@ config STACKTRACE_SUPPORT
 	bool
 	default y if SPARC64
 
+config HAVE_EARLY_RES
+	bool
+	default y if SPARC64
+
 config LOCKDEP_SUPPORT
 	bool
 	default y if SPARC64
@@ -287,6 +290,18 @@ config GENERIC_HARDIRQS
 source "kernel/time/Kconfig"
 
 if SPARC64
+
+config NO_BOOTMEM
+	default y
+	bool "Disable Bootmem code"
+	---help---
+	  Use early_res directly instead of bootmem before slab is ready.
+		- allocator (buddy) [generic]
+		- early allocator (bootmem) [generic]
+		- very early allocator (reserve_early*()) [generic]
+	  So reduce one layer between early allocator to final allocator
+
+
 source "drivers/cpufreq/Kconfig"
 
 config US3_FREQ
arch/sparc/include/asm/pgtable_64.h +2 -0
Index: linux-2.6/arch/sparc/include/asm/pgtable_64.h
===================================================================
@@ -752,6 +752,8 @@ extern int io_remap_pfn_range(struct vm_
 #define GET_IOSPACE(pfn)		(pfn >> (BITS_PER_LONG - 4))
 #define GET_PFN(pfn)			(pfn & 0x0fffffffffffffffUL)
 
+#define MAXMEM		_AC(__AC(1,UL)<<60, UL)
+
 #include <asm-generic/pgtable.h>
 
 /* We provide our own get_unmapped_area to cope with VA holes and
arch/sparc/kernel/mdesc.c +10 -8
Index: linux-2.6/arch/sparc/kernel/mdesc.c
===================================================================
@@ -4,7 +4,8 @@
  */
 #include <linux/kernel.h>
 #include <linux/types.h>
-#include <linux/lmb.h>
+#include <linux/fw_memmap.h>
+#include <linux/early_res.h>
 #include <linux/log2.h>
 #include <linux/list.h>
 #include <linux/slab.h>
@@ -86,7 +87,7 @@ static void mdesc_handle_init(struct mde
 	hp->handle_size = handle_size;
 }
 
-static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
+static struct mdesc_handle * __init mdesc_early_alloc(unsigned int mdesc_size)
 {
 	unsigned int handle_size, alloc_size;
 	struct mdesc_handle *hp;
@@ -97,17 +98,18 @@ static struct mdesc_handle * __init mdes
 		       mdesc_size);
 	alloc_size = PAGE_ALIGN(handle_size);
 
-	paddr = lmb_alloc(alloc_size, PAGE_SIZE);
+	paddr = find_fw_memmap_area(0, -1UL, alloc_size, PAGE_SIZE);
 
 	hp = NULL;
 	if (paddr) {
+		reserve_early(paddr, paddr + alloc_size, "mdesc");
 		hp = __va(paddr);
 		mdesc_handle_init(hp, handle_size, hp);
 	}
 	return hp;
 }
 
-static void mdesc_lmb_free(struct mdesc_handle *hp)
+static void mdesc_early_free(struct mdesc_handle *hp)
 {
 	unsigned int alloc_size;
 	unsigned long start;
@@ -120,9 +122,9 @@ static void mdesc_lmb_free(struct mdesc_
 	free_bootmem_late(start, alloc_size);
 }
 
-static struct mdesc_mem_ops lmb_mdesc_ops = {
-	.alloc = mdesc_lmb_alloc,
-	.free  = mdesc_lmb_free,
+static struct mdesc_mem_ops early_mdesc_ops = {
+	.alloc = mdesc_early_alloc,
+	.free  = mdesc_early_free,
 };
 
 static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
@@ -914,7 +916,7 @@ void __init sun4v_mdesc_init(void)
 
 	printk("MDESC: Size is %lu bytes.\n", len);
 
-	hp = mdesc_alloc(len, &lmb_mdesc_ops);
+	hp = mdesc_alloc(len, &early_mdesc_ops);
 	if (hp == NULL) {
 		prom_printf("MDESC: alloc of %lu bytes failed.\n", len);
 		prom_halt();
arch/sparc/kernel/prom_64.c +4 -3
Index: linux-2.6/arch/sparc/kernel/prom_64.c
===================================================================
@@ -20,7 +20,8 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/module.h>
-#include <linux/lmb.h>
+#include <linux/fw_memmap.h>
+#include <linux/early_res.h>
 #include <linux/of_device.h>
 
 #include <asm/prom.h>
@@ -34,14 +35,14 @@
 
 void * __init prom_early_alloc(unsigned long size)
 {
-	unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES);
+	unsigned long paddr = find_fw_memmap_area(0, -1UL, size, SMP_CACHE_BYTES);
 	void *ret;
 
 	if (!paddr) {
 		prom_printf("prom_early_alloc(%lu) failed\n");
 		prom_halt();
 	}
-
+	reserve_early(paddr, paddr + size, "prom_alloc");
 	ret = __va(paddr);
 	memset(ret, 0, size);
 	prom_early_allocated += size;
arch/sparc/kernel/setup_64.c +6 -15
Index: linux-2.6/arch/sparc/kernel/setup_64.c
===================================================================
@@ -30,6 +30,7 @@
 #include <linux/interrupt.h>
 #include <linux/cpu.h>
 #include <linux/initrd.h>
+#include <linux/fw_memmap.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -139,21 +140,7 @@ static void __init boot_flags_init(char
 				process_switch(*commands++);
 			continue;
 		}
-		if (!strncmp(commands, "mem=", 4)) {
-			/*
-			 * "mem=XXX[kKmM]" overrides the PROM-reported
-			 * memory size.
-			 */
-			cmdline_memory_size = simple_strtoul(commands + 4,
-							     &commands, 0);
-			if (*commands == 'K' || *commands == 'k') {
-				cmdline_memory_size <<= 10;
-				commands++;
-			} else if (*commands=='M' || *commands=='m') {
-				cmdline_memory_size <<= 20;
-				commands++;
-			}
-		}
+
 		while (*commands && *commands != ' ')
 			commands++;
 	}
@@ -279,11 +266,14 @@ void __init boot_cpu_id_too_large(int cp
 }
 #endif
 
+void __init setup_memory_map(void);
+
 void __init setup_arch(char **cmdline_p)
 {
 	/* Initialize PROM console and command line. */
 	*cmdline_p = prom_getbootargs();
 	strcpy(boot_command_line, *cmdline_p);
+	setup_memory_map();
 	parse_early_param();
 
 	boot_flags_init(*cmdline_p);
@@ -300,6 +290,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
+	finish_fw_memmap_parsing();
 
 	idprom_init();
 
arch/sparc/mm/init_64.c +124 -128

413 lines not on this page · raw message

arch/sparc/configs/sparc64_defconfig +0 -1
Index: linux-2.6/arch/sparc/configs/sparc64_defconfig
===================================================================
@@ -1916,5 +1916,4 @@ CONFIG_DECOMPRESS_LZO=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
 CONFIG_HAS_DMA=y
-CONFIG_HAVE_LMB=y
 CONFIG_NLATTR=y
arch/sparc/include/asm/lmb.h deleted +0 -10
Index: linux-2.6/arch/sparc/include/asm/lmb.h
===================================================================
@@ -1,10 +0,0 @@
-#ifndef _SPARC64_LMB_H
-#define _SPARC64_LMB_H
-
-#include <asm/oplib.h>
-
-#define LMB_DBG(fmt...) prom_printf(fmt)
-
-#define LMB_REAL_LIMIT	0
-
-#endif /* !(_SPARC64_LMB_H) */
maintainer
#12 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

You really aren't listening to us at all.

We told you a thousand times to investigate using LMB for all of this.

Instead you are posting the sparc64 conversion to the e820 stuff again.

That action means you absolutely don't value our feedback at all.

You seem to really not care what a mess you are (unnecessarily) making.

author
#13 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 2 lines

That action means you absolutely don't value our feedback at all.

[PATCH 01/20] x86: add find_e820_area_node
is addressing your concern that early_res didn't handle memory cross the nodes problem.

YH

maintainer
#14 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

From: Yinghai Lu <[email protected]>
Date: Sun, 21 Mar 2010 21:28:38 -0700

Quoted 5 lines
Quoted 2 lines

That action means you absolutely don't value our feedback at all.

[PATCH 01/20] x86: add find_e820_area_node
is addressing your concern that early_res didn't handle memory cross the nodes problem.

Now I know that you _REALLY_ aren't listening to us.

We said to use LMB because 1) it already exists 2) many platforms have been using it for years and 3) it doesn't lack the features you're now having to add to e820.

Instead of trying to use LMB, you're just addding feature after feature to e820 in order to bring it up to having parity with LMB.

You're wasting a lot of time, and you're completely ignoring an existing facility that has been working on and used for many years.

And you've never ever convinced any of us familiar with LMB why you keep doing this, and why LMB can't be used for what you need this generic e820 crap for.

I'm absolutely flabbergasted at this point, you really have no value for the feedback you've been given.

None at all.

#15 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

( Cc:-ed Andrew and Linus as this is a general design/policy matter wrt.
memory management. )

Quoted 10 lines · David Miller

From: Yinghai Lu <[email protected]>
Date: Sun, 21 Mar 2010 21:28:38 -0700

Quoted 5 lines
Quoted 2 lines

That action means you absolutely don't value our feedback at all.

[PATCH 01/20] x86: add find_e820_area_node
is addressing your concern that early_res didn't handle memory cross the nodes problem.

Now I know that you _REALLY_ aren't listening to us.

[ He has done a bit more than just to simply listen: he seems to have written
a patch which he thinks is addressing the concerns you pointed out. It might not be the response you wished for (and it might be inadequate) for but it sure gives me the impression of him listening to you - unless by 'listening' you mean 'follow my exact opinion without argument'. ]

Quoted 3 lines

We said to use LMB because 1) it already exists 2) many platforms have been using it for years and 3) it doesn't lack the features you're now having to add to e820.

The thing is, lib/lmb.c was librarized two years ago by you (much after early_res has been written for x86), but was not properly integrated into the core kernel nor into x86. It was first suggested by you in the early_res context about ten days ago, when Yinghai started posting Sparc64 patches.

Which is about half a year after the whole very difficult early_res/bootmem work was started by Yinghai :-(

I dont mind LMB per se, logically it seems quite similar to the early_res bits Yinghai has generalized (to a certain degree), and is quite a bit cleaner as you are writing very clean code.

Note the other side of the coin: LMB appears to be deployed on only 4 non-x86 architectures that muster ~1% of the Linux boxes while early_res is deployed on more than 95%.

So there's a very real hardship of testing and conversion here that we cannot ignore and an even better path may be to gradually transform the more tested and more deployed early_res code to meet the interface details of LMB.

Please also realize the difficulties Yinghai has gone through already:
converting and generalizing _all_ of the x86 early allocation code to a more generic core kernel approach, with essentially zero interest from _any_ non-x86 person ...

Those early_res patches were posted all over on lkml, it was literally hundreds of difficult patches, and now, months down the line, after we've tested and upstreamed it (with many nasty regressions fixed on x86 during the development of it) you come with a rigid "do it some other way, convert all of x86 over again or else" position.

I really wish non-x86 architectures apprecitated (and helped) the core kernel work x86 is doing, because it is subsidizing non-x86 architectures all the time.

For example when LMB was plopped into lib/lmb.c in 2008 why was it not ported to x86, our most popular architecture? Did you consider posting LMB patches for x86 instead of expecting Yinghai to post Sparc64, PowerPC, SH and Microblaze patches?

Anyway, i'm sure we can work out an approach, and yes, LMB looks pretty good and could be picked up if it can be done gradually - given some mutual willingness to work on this as equals.

Thanks,

Ingo

#16 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 2 lines · Ingo Molnar

( Cc:-ed Andrew and Linus as this is a general design/policy matter wrt.
memory management. )

[snip]

Quoted 4 lines

Please also realize the difficulties Yinghai has gone through already:
converting and generalizing _all_ of the x86 early allocation code to a more generic core kernel approach, with essentially zero interest from _any_ non-x86 person ...

It still seemed to have a lot that was x86-specific - in particular it seemed to have a lot of code to cope with various mistakes that firmware might have made in the memory map. That adds code which is basically just bloat on architectures where those problems don't arise.

The fw_memmap.c code also still seemed to be tied to the x86 e820 data structures and layouts.

Quoted 5 lines

Those early_res patches were posted all over on lkml, it was literally hundreds of difficult patches, and now, months down the line, after we've tested and upstreamed it (with many nasty regressions fixed on x86 during the development of it) you come with a rigid "do it some other way, convert all of x86 over again or else" position.

Well I personally don't mind if x86 uses early_res or whatever other code in arch/x86 to handle the problems that arise from deficient firmware. I just don't see any value in converting powerpc or sparc64 over to using ~2000 lines of early_res/fw_memmap code where the existing ~500 lines of lmb code is working just fine.

And I don't see the point of moving the x86 e820 stuff into the kernel directory. Does any other platform use e820 tables?

Quoted 3 lines

I really wish non-x86 architectures apprecitated (and helped) the core kernel work x86 is doing, because it is subsidizing non-x86 architectures all the time.

We do help with core kernel work. Coping with deficient x86 firmware doesn't really feel like core kernel work to me though.

Paul.

#17 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 2 lines · Paul Mackerras

And I don't see the point of moving the x86 e820 stuff into the kernel directory. [...]

I dont see the point of that either - that is a mistake. e820 is an x86 bios call and we shouldnt name a generic mechanism after that. e820 is absolutely messy and has no place anywhere beyond x86.

The main technical argument i see is 'early_res versus LMB'. Even there i'd prefer LMB from a technical quality POV.

Quoted 5 lines

Well I personally don't mind if x86 uses early_res or whatever other code in arch/x86 to handle the problems that arise from deficient firmware. I just don't see any value in converting powerpc or sparc64 over to using ~2000 lines of early_res/fw_memmap code where the existing ~500 lines of lmb code is working just fine.

Lets put it this way then: do you see any point in PowerPC making use of a 10+ million lines of code kernel that is being mainly (80%+) financed, developed, tested and deployed by people who care about x86 mostly?

If yes then it seems like a pretty damn good deal to me for PowerPC to go beyond its narrow short-term self-interest and work towards generalizations more actively, and even consider touching its 500 lines of lmb code ...

I dont know how many times we've accomodated for non-x86 architectures in various pieces of kernel code.

Obviously if there's bloat affecting PowerPC then that can be addressed via technical measures. But we really shouldnt leave the slightly incompatible early allocators in place. (we shouldnt have let them get created in the first place, but that is water down the bridge.)

Thanks,

Ingo

#18 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 11 lines · Ingo Molnar
Quoted 2 lines · Paul Mackerras

And I don't see the point of moving the x86 e820 stuff into the kernel directory. [...]

I dont see the point of that either - that is a mistake. e820 is an x86 bios call and we shouldnt name a generic mechanism after that. e820 is absolutely messy and has no place anywhere beyond x86.

The main technical argument i see is 'early_res versus LMB'. Even there i'd prefer LMB from a technical quality POV.

Then we have no argument. The point is, we object to that fw_memmap/e820 stuff taking over for non-x86 architectures. We aren't saying that x86 -must- move to LMB, but if the wish is to have a common implementation in generic code accross all archs, -then- we object to it being e820.

Ben.

#19 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 10 lines · Benjamin Herrenschmidt
Quoted 9 lines · Ingo Molnar
Quoted 2 lines · Paul Mackerras

And I don't see the point of moving the x86 e820 stuff into the kernel directory. [...]

I dont see the point of that either - that is a mistake. e820 is an x86 bios call and we shouldnt name a generic mechanism after that. e820 is absolutely messy and has no place anywhere beyond x86.

Quoted 7 lines
Quoted 2 lines

The main technical argument i see is 'early_res versus LMB'. Even there i'd prefer LMB from a technical quality POV.

Then we have no argument. The point is, we object to that fw_memmap/e820 stuff taking over for non-x86 architectures. We aren't saying that x86 -must- move to LMB, but if the wish is to have a common implementation in generic code accross all archs, -then- we object to it being e820.

Ok, just in case i wasnt clear enough in my first reply (and i guess your mail means i wasnt): that whole-sale move of e820 into kernel/fw_memmap.c is a total non-starter as far as i'm concerned.

And i kind of like the 'logical memory block' name - it is more intuitive than 'early_res' (which was always a misnomer IMO, just couldnt find a better name for it and it stuck with us).

So no arguments from me at all about the code quality aspects - i just wanted to highlight the huge amount of non-trivial work Yinghai has invested into this already, with little external help, and that if possible it would be nice to minimize the upsetting of related x86 code if possible. Please help him out with more specific suggestions about how the two memory allocation spaces could be unified best, to serve the needs of all these architectures - if you have some spare time.

Thanks,

Ingo

#20 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 8 lines · Ingo Molnar

So no arguments from me at all about the code quality aspects - i just wanted to highlight the huge amount of non-trivial work Yinghai has invested into this already, with little external help, and that if possible it would be nice to minimize the upsetting of related x86 code if possible. Please help him out with more specific suggestions about how the two memory allocation spaces could be unified best, to serve the needs of all these architectures - if you have some spare time.

Why not start by unifying the APIs to it, while keeping the implementation in the arch for now ? That would be a good first step and would give us a good idea of what kind of requirements all the archs have since to some extent those requirements need to be represented in this API.

Cheers,
Ben.

author
#21 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 10 lines · Benjamin Herrenschmidt
Quoted 8 lines · Ingo Molnar

So no arguments from me at all about the code quality aspects - i just wanted to highlight the huge amount of non-trivial work Yinghai has invested into this already, with little external help, and that if possible it would be nice to minimize the upsetting of related x86 code if possible. Please help him out with more specific suggestions about how the two memory allocation spaces could be unified best, to serve the needs of all these architectures - if you have some spare time.

Quoted 5 lines

Why not start by unifying the APIs to it, while keeping the implementation in the arch for now ? That would be a good first step and would give us a good idea of what kind of requirements all the archs have since to some extent those requirements need to be represented in this API.

current early_res has

reserve/free/find

and don't have alloc, because it is equal to find + reserve. all the find related will subtract reserved area already.
and it use start/end (goal/limit) and it will honor goal.

extern void reserve_early(u64 start, u64 end, char *name); extern void reserve_early_overlap_ok(u64 start, u64 end, char *name); extern void free_early(u64 start, u64 end);
void free_early_partial(u64 start, u64 end);
extern void early_res_to_bootmem(u64 start, u64 end);

void reserve_early_without_check(u64 start, u64 end, char *name); u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,

                         u64 size, u64 align);
u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
                         u64 *sizep, u64 align);

u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align); u64 get_max_mapped(void);
int get_free_all_memory_range(struct range **rangep, int nodeid);

lmd has:
reserve/free/alloc
and it does have lmb_find, but that doesn't subtract reserved area.

also lmb_alloc doesn't take goal. and only have limit there.

YH

#22 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

In reply to Ingo Molnar

Ingo,

Quoted 15 lines · Ingo Molnar

( Cc:-ed Andrew and Linus as this is a general design/policy matter wrt.
memory management. )

Quoted 9 lines · David Miller

From: Yinghai Lu <[email protected]>
Date: Sun, 21 Mar 2010 21:28:38 -0700

Quoted 5 lines
Quoted 2 lines

That action means you absolutely don't value our feedback at all.

[PATCH 01/20] x86: add find_e820_area_node
is addressing your concern that early_res didn't handle memory cross the nodes problem.

Quoted 8 lines
Quoted 1 line

Now I know that you _REALLY_ aren't listening to us.

[ He has done a bit more than just to simply listen: he seems to have written a patch which he thinks is addressing the concerns you pointed out. It might not be the response you wished for (and it might be inadequate) for but it sure gives me the impression of him listening to you - unless by 'listening' you mean 'follow my exact opinion without argument'. ]

I tend to disagree. Fixing the bug pointed out by Dave is not really a good argument about listening.

The main point is that there is still no answer why lmb cannot be used and the reposted patch still is a full move of the x86 e820 functions into kernel/fw_memmap.c.

That's not a generalization, that's simply a relocation of x86 code to kernel/. And I agree with Dave and Ben that this is an useless exercise.

Quoted 4 lines
Quoted 3 lines

We said to use LMB because 1) it already exists 2) many platforms have been using it for years and 3) it doesn't lack the features you're now having to add to e820.

Quoted 8 lines

The thing is, lib/lmb.c was librarized two years ago by you (much after early_res has been written for x86), but was not properly integrated into the core kernel nor into x86. It was first suggested by you in the early_res context about ten days ago, when Yinghai started posting Sparc64 patches.

Which is about half a year after the whole very difficult early_res/bootmem work was started by Yinghai :-(

Well, the early_res split out from x86 was mostly an x86 related effort and there is no point on enforcing that to archs which are happily using lmb for quite a while.

You have to admit, that we did not notice either that lmb could be reused for that purpose as well, so blaming Dave now for not paying attention to the x86 early_res bits is unfair at least.

Quoted 7 lines

I dont mind LMB per se, logically it seems quite similar to the early_res bits Yinghai has generalized (to a certain degree), and is quite a bit cleaner as you are writing very clean code.

Note the other side of the coin: LMB appears to be deployed on only 4 non-x86 architectures that muster ~1% of the Linux boxes while early_res is deployed on more than 95%.

Come on, that's a stupid argument. The lmb code looks well structured and understandable which I can't say about early_res.c. And it definitly got a fair amount of testing and shakeout.

Quoted 4 lines

So there's a very real hardship of testing and conversion here that we cannot ignore and an even better path may be to gradually transform the more tested and more deployed early_res code to meet the interface details of LMB.

I'd rather see moving that code to the cleaner code base of lmb.

Quoted 9 lines

Please also realize the difficulties Yinghai has gone through
already: converting and generalizing _all_ of the x86 early allocation code to a more generic core kernel approach, with essentially zero interest from _any_ non-x86 person ... Those early_res patches were posted all over on lkml, it was literally hundreds of difficult patches, and now, months down the line, after we've tested and upstreamed it (with many nasty regressions fixed on x86 during the development of it) you come with a rigid "do it some other way, convert all of x86 over again or else" position.

That's not what Dave and Ben said. They just opposed that we push the e820 horror into kernel/ and enforce it on everybody else.

Quoted 3 lines

I really wish non-x86 architectures apprecitated (and helped) the core kernel work x86 is doing, because it is subsidizing non-x86 architectures all the time.

Can we just stop that "x86 is the center of the universe" chant?

Most of the core kernel work is done by core kernel developers. Just because you and I ended up being x86 maintainers does not change that at all.

In some areas the core code actually suffers from x86. Just look at timers. At least 50% of the code in kernel/time/clock* and tick-* is just there to cope with x86 specific hardware wreckage.

I don't see a point in doing the same thing with the e820 horror. That code drop in kernel/fw_memmap.c is _NOT_ what I consider core kernel work in the sense of providing generalized non arch specific infrastructure.

Also I consider lmb core infrastructure. It does not have to be placed in kernel/ to be accounted for it. It's pretty generic and easy to extend.

Quoted 2 lines

For example when LMB was plopped into lib/lmb.c in 2008 why was it not ported to x86, our most popular architecture? Did you consider

Why did _we_ not look at LMB? The early res code of x86 was (and still is to some degree) a tangled mess and I wouldn't have expected that some non x86 person would touch that with a ten foot pole.

We made a mistake and it got pointed out, so we better sit down and make our homework instead of insisting that early_res/fw_memmap is something set in stone.

Quoted 2 lines

posting LMB patches for x86 instead of expecting Yinghai to post Sparc64, PowerPC, SH and Microblaze patches?

Well, it's pretty easy to move those archs over, but I cannot see any reason why they should move to something which they consider inferior.

Quoted 3 lines

Anyway, i'm sure we can work out an approach, and yes, LMB looks pretty good and could be picked up if it can be done gradually - given some mutual willingness to work on this as equals.

I think it was made entirely clear, that nobody is opposing to extend lmb if the need arises.

So before going any further on this early_res stuff, it needs to be analysed what has to be done (if at all) to make lmb usable for x86. From that we can figure out on a technical argument how to proceed, not by reposting e820 -> kernel patches over and over.

Thanks,

tglx

#23 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 30 lines · Thomas Gleixner

Ingo,

Quoted 15 lines · Ingo Molnar

( Cc:-ed Andrew and Linus as this is a general design/policy matter wrt.
memory management. )

Quoted 9 lines · David Miller

From: Yinghai Lu <[email protected]>
Date: Sun, 21 Mar 2010 21:28:38 -0700

Quoted 5 lines
Quoted 2 lines

That action means you absolutely don't value our feedback at all.

[PATCH 01/20] x86: add find_e820_area_node
is addressing your concern that early_res didn't handle memory cross the nodes problem.

Quoted 8 lines
Quoted 1 line

Now I know that you _REALLY_ aren't listening to us.

[ He has done a bit more than just to simply listen: he seems to have written a patch which he thinks is addressing the concerns you pointed out. It might not be the response you wished for (and it might be inadequate) for but it sure gives me the impression of him listening to you - unless by 'listening' you mean 'follow my exact opinion without argument'. ]

I tend to disagree. Fixing the bug pointed out by Dave is not really a good argument about listening.

Quoted 6 lines

The main point is that there is still no answer why lmb cannot be used and the reposted patch still is a full move of the x86 e820 functions into kernel/fw_memmap.c.

That's not a generalization, that's simply a relocation of x86 code to kernel/. And I agree with Dave and Ben that this is an useless exercise.

ok - i think you are right. Yinghai, mind having a look at using lib/lmb.c for all this?

Ingo

author
#24 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 37 lines · Ingo Molnar
Quoted 34 lines · Thomas Gleixner

Ingo,

Quoted 15 lines · Ingo Molnar

( Cc:-ed Andrew and Linus as this is a general design/policy matter wrt.
memory management. )

Quoted 9 lines · David Miller

From: Yinghai Lu <[email protected]>
Date: Sun, 21 Mar 2010 21:28:38 -0700

Quoted 5 lines
Quoted 2 lines

That action means you absolutely don't value our feedback at all.

[PATCH 01/20] x86: add find_e820_area_node
is addressing your concern that early_res didn't handle memory cross the nodes problem.

Quoted 8 lines
Quoted 1 line

Now I know that you _REALLY_ aren't listening to us.

[ He has done a bit more than just to simply listen: he seems to have written a patch which he thinks is addressing the concerns you pointed out. It might not be the response you wished for (and it might be inadequate) for but it sure gives me the impression of him listening to you - unless by 'listening' you mean 'follow my exact opinion without argument'. ]

I tend to disagree. Fixing the bug pointed out by Dave is not really a good argument about listening.

The main point is that there is still no answer why lmb cannot be used and the reposted patch still is a full move of the x86 e820 functions into kernel/fw_memmap.c.

Quoted 5 lines
Quoted 2 lines

That's not a generalization, that's simply a relocation of x86 code to kernel/. And I agree with Dave and Ben that this is an useless exercise.

ok - i think you are right. Yinghai, mind having a look at using lib/lmb.c for all this?

1. need to keep e820
2. use e820 range with RAM to fill lmb.memory when finizing_e820
3. use lmb.reserved to replace early_res.

current lmb is merging the region, we can not use name tag any more.

may need to dump early_memtest, and use early_res for bootmem at first.

YH

#25 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 5 lines · Yinghai Lu

1. need to keep e820
2. use e820 range with RAM to fill lmb.memory when finizing_e820
3. use lmb.reserved to replace early_res.

current lmb is merging the region, we can not use name tag any more.

Feel free to extend LMB as long as it's reasonable. For example, I wouldn't object to have flags or similar things to LMB regions, one of them being used to prevent merge for example.

Quoted 2 lines

may need to dump early_memtest, and use early_res for bootmem at first.

Cheers,
Ben.

#26 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

In reply to Yinghai Lu

Yinghai,

Quoted 7 lines · Yinghai Lu
Quoted 6 lines · Ingo Molnar
Quoted 4 lines · Thomas Gleixner

The main point is that there is still no answer why lmb cannot be used and the reposted patch still is a full move of the x86 e820 functions into kernel/fw_memmap.c.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That's not a generalization, that's simply a relocation of x86 code to kernel/. And I agree with Dave and Ben that this is an useless exercise.

ok - i think you are right. Yinghai, mind having a look at using lib/lmb.c for all this?

1. need to keep e820

That's neither an argument for using lmb nor an argument not to use lmb. e820 is x86 specific BIOS wreckage and it's whole purpose is just to feed information into a (hopefully) generic early resource management facility.

e820 _CANNOT_ be generalized. Period.

Quoted 1 line

2. use e820 range with RAM to fill lmb.memory when finizing_e820

What's finizing_e820 ???

Quoted 1 line

3. use lmb.reserved to replace early_res.

What's the implication of doing that ?

Quoted 1 line

current lmb is merging the region, we can not use name tag any more.

What's wrong with merging of regions ? Are you arguing about a specific region ("the region") ?

Which name tag ? And why is that name tag important ?

Quoted 2 lines

may need to dump early_memtest, and use early_res for bootmem at first.

Why exactly might early_memtest not longer be possible ?

What means "early_res for bootmem" ?

Please take some time to explain in detail. Throwing one liners and buzzwords w/o context into such a discussion is more than counter productive.

Thanks,

tglx

author
#27 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 23 lines · Thomas Gleixner

Yinghai,

Quoted 7 lines · Yinghai Lu
Quoted 6 lines · Ingo Molnar
Quoted 4 lines · Thomas Gleixner

The main point is that there is still no answer why lmb cannot be used and the reposted patch still is a full move of the x86 e820 functions into kernel/fw_memmap.c.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

That's not a generalization, that's simply a relocation of x86 code to kernel/. And I agree with Dave and Ben that this is an useless exercise.

ok - i think you are right. Yinghai, mind having a look at using lib/lmb.c for all this?

1. need to keep e820

That's neither an argument for using lmb nor an argument not to use lmb. e820 is x86 specific BIOS wreckage and it's whole purpose is just to feed information into a (hopefully) generic early resource management facility.

Quoted 5 lines

e820 _CANNOT_ be generalized. Period.

Quoted 1 line

2. use e820 range with RAM to fill lmb.memory when finizing_e820

What's finizing_e820 ???

finish_e820_parsing();

Quoted 4 lines
Quoted 2 lines

3. use lmb.reserved to replace early_res.

What's the implication of doing that ?

early_res array is only corresponding to lmb.reserved, aka reserved region from kernel.

Quoted 8 lines
Quoted 2 lines

current lmb is merging the region, we can not use name tag any more.

What's wrong with merging of regions ? Are you arguing about a specific region ("the region") ?

Which name tag ? And why is that name tag important ?

struct early_res {
        u64 start, end;
        char name[15];
        char overlap_ok;
};
Quoted 5 lines
Quoted 3 lines

may need to dump early_memtest, and use early_res for bootmem at first.

Why exactly might early_memtest not longer be possible ?

early_memtest need to call find_e820_area_size current lmb doesn't have that kind of find util. the one memory subtract reserved memory by kernel.

Quoted 2 lines

What means "early_res for bootmem" ?

use early_res to replace bootmem, the CONFIG_NO_BOOTMEM. that need early_res can be double or increase the slots automatically.

Yinghai

#28 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 4 lines · Yinghai Lu
Quoted 2 lines · Thomas Gleixner
Quoted 1 line · Yinghai Lu

On 03/22/2010 12:37 PM, Ingo Molnar wrote:

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

1. need to keep e820

That's neither an argument for using lmb nor an argument not to use lmb. e820 is x86 specific BIOS wreckage and it's whole purpose is just to feed information into a (hopefully) generic early resource management facility.

e820 _CANNOT_ be generalized. Period.

I still want to know, what "need to keep e820" means for you.

Quoted 4 lines
Quoted 3 lines
Quoted 1 line

2. use e820 range with RAM to fill lmb.memory when finizing_e820

What's finizing_e820 ???

finish_e820_parsing();

Yinghai, come on. Are you really expecting that everyone involved in this discussion goes to look up what the heck finish_e820_parsing() is doing ?

You want to explain why your solution is better or why lmb is not sufficient, so you better go and explain what finish_e820_parsing() is, why finish_e820_parsing() is important and why lmb cannot cope with it.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

3. use lmb.reserved to replace early_res.

What's the implication of doing that ?

early_res array is only corresponding to lmb.reserved, aka reserved region from kernel.

Is it only corresponding (somehow) or is it a full equivivalent ?

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

current lmb is merging the region, we can not use name tag any more.

What's wrong with merging of regions ? Are you arguing about a specific region ("the region") ?

Care to answer my question ?

Quoted 8 lines
Quoted 2 lines

Which name tag ? And why is that name tag important ?

struct early_res {
        u64 start, end;
        char name[15];
        char overlap_ok;
};

I'm starting to get annoyed, really. What is that name field for and why is that "name" field important ?

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

may need to dump early_memtest, and use early_res for bootmem at first.

Why exactly might early_memtest not longer be possible ?

early_memtest need to call find_e820_area_size current lmb doesn't have that kind of find util. the one memory subtract reserved memory by kernel.

What subtracts what ? And why is it that hard to fix that ?

Quoted 5 lines
Quoted 2 lines

What means "early_res for bootmem" ?

use early_res to replace bootmem, the CONFIG_NO_BOOTMEM. that need early_res can be double or increase the slots automatically.

-ENOPARSE

Yinghai, I asked you to take your time and explain things in detail instead of shooting unparseable answers within a minute.

Everyone else in this discussion tries to be as explanatory as possible, just you expect that everyone else is going to dig out the crystal ball to understand the deeper meanings of your patches.

Again, please take your time to explain what needs to be done or what is impossible to solve in your opinion, so we can get that resolved in a way which is satisfactory and useful for all parties involved.

Thanks,

tglx

author
#29 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 7 lines · Thomas Gleixner
Quoted 6 lines · Yinghai Lu
Quoted 5 lines · Thomas Gleixner
Quoted 3 lines · Yinghai Lu

On 03/22/2010 12:37 PM, Ingo Molnar wrote:

1. need to keep e820

Quoted 8 lines
Quoted 6 lines
Quoted 6 lines

That's neither an argument for using lmb nor an argument not to use lmb. e820 is x86 specific BIOS wreckage and it's whole purpose is just to feed information into a (hopefully) generic early resource management facility.

e820 _CANNOT_ be generalized. Period.

I still want to know, what "need to keep e820" means for you.

keep the most arch/x86/kernel/e820.c, and later when finish_e820_parsing() is called, fill lmb.memory according to e820 entries with E820_RAM type.

Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

2. use e820 range with RAM to fill lmb.memory when finizing_e820

What's finizing_e820 ???

finish_e820_parsing();

Quoted 8 lines

Yinghai, come on. Are you really expecting that everyone involved in this discussion goes to look up what the heck finish_e820_parsing() is doing ?

You want to explain why your solution is better or why lmb is not sufficient, so you better go and explain what finish_e820_parsing() is, why finish_e820_parsing() is important and why lmb cannot cope with it.

current x86:
a. setup e820 array.
b. early_parm mem= and memmap= related code will adjust the e820.

we don't need to call lmb_enforce_memory_limit().

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

3. use lmb.reserved to replace early_res.

What's the implication of doing that ?

early_res array is only corresponding to lmb.reserved, aka reserved region from kernel.

Is it only corresponding (somehow) or is it a full equivivalent ?

early_res is not sorted and merged.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

current lmb is merging the region, we can not use name tag any more.

What's wrong with merging of regions ? Are you arguing about a specific region ("the region") ?

Care to answer my question ?

if range get merged, you can not use name with them.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

Which name tag ? And why is that name tag important ?

Quoted 8 lines
Quoted 5 lines
struct early_res {
        u64 start, end;
        char name[15];
        char overlap_ok;
};

I'm starting to get annoyed, really. What is that name field for and why is that "name" field important ?

at least later when some code free a wrong range, we can figure who cause the problem.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

may need to dump early_memtest, and use early_res for bootmem at first.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Why exactly might early_memtest not longer be possible ?

early_memtest need to call find_e820_area_size current lmb doesn't have that kind of find util. the one memory subtract reserved memory by kernel.

What subtracts what ? And why is it that hard to fix that ?

lmb.memory - lmb.reserved

or e820 E820_RAM entries - early_res

move some code from early_res to lmb.c?

Quoted 12 lines
Quoted 6 lines
Quoted 3 lines

What means "early_res for bootmem" ?

use early_res to replace bootmem, the CONFIG_NO_BOOTMEM. that need early_res can be double or increase the slots automatically.

-ENOPARSE

Yinghai, I asked you to take your time and explain things in detail instead of shooting unparseable answers within a minute.

Quoted 7 lines

Everyone else in this discussion tries to be as explanatory as possible, just you expect that everyone else is going to dig out the crystal ball to understand the deeper meanings of your patches.

Again, please take your time to explain what needs to be done or what is impossible to solve in your opinion, so we can get that resolved in a way which is satisfactory and useful for all parties involved.

to make x86 to use lmb, we need to extend lmb to have find_early_area.

static int __init find_overlapped_early(u64 start, u64 end)

{
        int i;
        struct lmb_properties *r;

        for (i = 0; i < lmb.reserved_cnt && lmb.reserved.region[i].size; i++) {
                r = &lmb.reserved.region[i];
                if (end > r->base && start < (r->base + r->size))
                        break;
        }

        return i;
}

/* Check for already reserved areas */
static inline int __init bad_addr(u64 *addrp, u64 size, u64 align)

{
        int i;
        u64 addr = *addrp;
        int changed = 0;
        struct lmb_properties *r;
again:
        i = find_overlapped_early(addr, addr + size);
        r = &lmb.reserved.region[i];
        if (i < lmb.reserved.cnt && r->size) {
                *addrp = addr = round_up(r->base + r->size, align);
                changed = 1;
                goto again;
        }
        return changed;
}

u64 __init find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,

                         u64 size, u64 align)
{
        u64 addr, last;

        addr = round_up(ei_start, align);
        if (addr < start)
                addr = round_up(start, align);
        if (addr >= ei_last)
                goto out;
        while (bad_addr(&addr, size, align) && addr+size <= ei_last)
                ;
        last = addr + size;
        if (last > ei_last)
                goto out;
        if (last > end)
                goto out;

        return addr;

out:

        return -1ULL;
}

find_early_area_size()...

and use them we can have find_lmb_free_area

/*
* Find a free area with specified alignment in a specific range. */
u64 __init find_lmb_area(u64 start, u64 end, u64 size, u64 align)

{
        int i;

        for (i = 0; i < lmb.memory.cnt; i++) {
                u64 ei_start = lmb.memory.region[i].base;
                u64 ei_end = ei_start + lmb.memory.region[i].size;

                addr = find_early_area(ei_start, ei_last, start, end,
                                         size, align);

                if (addr != -1ULL)
                        return addr;
        }
        return -1ULL;
}

also later we can use with active_range for bootmem replacement.

u64 __init find_memory_core_early(int nid, u64 size, u64 align,

                                        u64 goal, u64 limit)
{
        int i;

        /* need to go over early_node_map to find out good range for node */
        for_each_active_range_index_in_nid(i, nid) {
                u64 addr;
                u64 ei_start, ei_last;

                ei_last = early_node_map[i].end_pfn;
                ei_last <<= PAGE_SHIFT;
                ei_start = early_node_map[i].start_pfn;
                ei_start <<= PAGE_SHIFT;
                addr = find_early_area(ei_start, ei_last,
                                         goal, limit, size, align);

                if (addr == -1ULL)
                        continue;

                return addr;
        }

        return -1ULL;
}

Yinghai

#30 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

B1;2005;0cYinghai,

Quoted 13 lines · Yinghai Lu
Quoted 12 lines · Thomas Gleixner
Quoted 11 lines · Yinghai Lu
Quoted 10 lines · Thomas Gleixner
Quoted 3 lines · Yinghai Lu

On 03/22/2010 12:37 PM, Ingo Molnar wrote:

1. need to keep e820

That's neither an argument for using lmb nor an argument not to use lmb. e820 is x86 specific BIOS wreckage and it's whole purpose is just to feed information into a (hopefully) generic early resource management facility.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line

e820 _CANNOT_ be generalized. Period.

I still want to know, what "need to keep e820" means for you.

keep the most arch/x86/kernel/e820.c, and later when finish_e820_parsing() is called, fill lmb.memory according to e820 entries with E820_RAM type.

Right, and we never get rid of e820.c at all. Simply because e820 is a x86 specific clusterfuck. No way to find anything which is remotely insane like that in any other architecture.

I really do not understand why you ever thought that moving that code to a generic place is something useful and acceptable.

The point is, that some of the algorithms which e820 needs to sanitize the maps might be of general use, but definitely not the whole e820 crappola. And if you look close, lmb has most of them already.

Quoted 10 lines
Quoted 10 lines
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines

2. use e820 range with RAM to fill lmb.memory when finizing_e820

What's finizing_e820 ???

finish_e820_parsing();

Yinghai, come on. Are you really expecting that everyone involved in this discussion goes to look up what the heck finish_e820_parsing() is doing ?

Quoted 8 lines
Quoted 4 lines

You want to explain why your solution is better or why lmb is not sufficient, so you better go and explain what finish_e820_parsing() is, why finish_e820_parsing() is important and why lmb cannot cope with it.

current x86:
a. setup e820 array.
b. early_parm mem= and memmap= related code will adjust the e820.

Dammit. I asked for an explanation not for some headword listing. These bullet points do _NOT_ explain at all why e820 is superior.

Quoted 1 line

we don't need to call lmb_enforce_memory_limit().

Of course you do not need to call lmb_enforce_memory_limit() simply because it is not relevant to the existing e820 code at all.

What's the point ?

Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

3. use lmb.reserved to replace early_res.

What's the implication of doing that ?

early_res array is only corresponding to lmb.reserved, aka reserved region from kernel.

Is it only corresponding (somehow) or is it a full equivivalent ?

early_res is not sorted and merged.

So what's the implication for x86 vs. the early_res stuff ? Any down sides, up sides other than not sorted and merged?

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 1 line

current lmb is merging the region, we can not use name tag any more.

What's wrong with merging of regions ? Are you arguing about a specific region ("the region") ?

Care to answer my question ?

if range get merged, you can not use name with them.

Why does that matter ?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 2 lines

Which name tag ? And why is that name tag important ?

struct early_res {
        u64 start, end;
        char name[15];
        char overlap_ok;
};
Quoted 4 lines
Quoted 2 lines

I'm starting to get annoyed, really. What is that name field for and why is that "name" field important ?

at least later when some code free a wrong range, we can figure who cause the problem.

That does not explain the value of the name field at all. If some code frees a wrong range a backtrace is always more helpful than some arbitrary name field. Am I missing something ?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

may need to dump early_memtest, and use early_res for bootmem at first.

Why exactly might early_memtest not longer be possible ?

early_memtest need to call find_e820_area_size current lmb doesn't have that kind of find util. the one memory subtract reserved memory by kernel.

Quoted 7 lines
Quoted 1 line

What subtracts what ? And why is it that hard to fix that ?

lmb.memory - lmb.reserved

or e820 E820_RAM entries - early_res

move some code from early_res to lmb.c?

Care to explain in clear wording what you need to solve ? "move some code from early_res to lmb.c?" is definitely not an useful explanation.

Quoted 15 lines
Quoted 15 lines
Quoted 5 lines
Quoted 2 lines

What means "early_res for bootmem" ?

use early_res to replace bootmem, the CONFIG_NO_BOOTMEM. that need early_res can be double or increase the slots automatically.

-ENOPARSE

Yinghai, I asked you to take your time and explain things in detail instead of shooting unparseable answers within a minute.

Everyone else in this discussion tries to be as explanatory as possible, just you expect that everyone else is going to dig out the crystal ball to understand the deeper meanings of your patches.

Quoted 5 lines
Quoted 3 lines

Again, please take your time to explain what needs to be done or what is impossible to solve in your opinion, so we can get that resolved in a way which is satisfactory and useful for all parties involved.

to make x86 to use lmb, we need to extend lmb to have find_early_area.

Why ?

Quoted 2 lines

static int __init find_overlapped_early(u64 start, u64 end) {

No, posting arbitrary code snippets which you think are necessary to solve it is not the way to go.

There is _ZERO_ explanation _WHY_ you think that this is a prerequisite.

Those largely uncommented commented code snippets (uncommented as the corresponding code in x86) are _NOT_ an explanation at all.

You just state that you need that whole bunch just w/o telling _WHY_.

The more I look into this I doubt that there is an actual reason for this complexity. It just looks like it has grown that way by fixing corner cases all over the place and not out of a real design requirement.

Either that or it's just the lack of understanding how to map lmb functionality to the problem at hand as certainly LMB does not map 1:1 to the current x86 way of solving that problem.

Please give a proper explanation for this, really !

Thanks,

tglx

author
#31 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 5 lines · Thomas Gleixner

B1;2005;0cYinghai,

Quoted 2 lines

to make x86 to use lmb, we need to extend lmb to have find_early_area.

Why ?

unless you want to dump two users of find_e820_area_size()

YH

#32 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Yinghai,

Quoted 8 lines · Yinghai Lu
Quoted 5 lines · Thomas Gleixner

B1;2005;0cYinghai,

Quoted 2 lines

to make x86 to use lmb, we need to extend lmb to have find_early_area.

Why ?

unless you want to dump two users of find_e820_area_size()

I don't care about the two users of find_e820_area_size() as long as you are not willing to spend more than a split second to explain things.

I'm really fed up to pull answers from your nose bit by bit. Me and others wrote lengthy explanations and asked precise questions.

All we get are some meager bones thrown our way.

If that's your understanding of community work, fine. It's just not our way of working together. After spending valuable time on that I completely agree with Dave on:

"Now I know that you _REALLY_ aren't listening to us."

It's not only that you are not listening, you are simply ignoring our concerns. Go ahead with that, but do not wonder about us ignoring you as well.

Thanks,

tglx

author
#33 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

please check

[PATCH 01/20] x86: add find_e820_area_node

[RFC PATCH] x86: use lmb to replace early_res

still keep kernel/early_res.c for the extension.

should move those file to lib/lmb.c later?

---
 arch/x86/Kconfig               |    1 
 arch/x86/include/asm/e820.h    |   38 +-
 arch/x86/include/asm/lmb.h     |    8 
 arch/x86/kernel/e820.c         |  163 +----------
 arch/x86/kernel/head.c         |    2 
 arch/x86/kernel/head32.c       |    4 
 arch/x86/kernel/head64.c       |    2 
 arch/x86/kernel/setup.c        |    2 
 arch/x86/kernel/setup_percpu.c |    6 
 include/linux/early_res.h      |    9 
 include/linux/lmb.h            |    5 
 kernel/early_res.c             |  594 ++++++++++++++++-------------------------
 lib/lmb.c                      |    9 
 mm/page_alloc.c                |    2 
 mm/sparse-vmemmap.c            |    4 
 15 files changed, 321 insertions(+), 528 deletions(-)
arch/x86/Kconfig +1 -0
Index: linux-2.6/arch/x86/Kconfig
===================================================================
@@ -27,6 +27,7 @@ config X86
 	select HAVE_PERF_EVENTS if (!M386 && !M486)
 	select HAVE_IOREMAP_PROT
 	select HAVE_KPROBES
+	select HAVE_LMB
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select ARCH_WANT_FRAME_POINTERS
 	select HAVE_DMA_ATTRS
arch/x86/include/asm/e820.h +26 -12
Index: linux-2.6/arch/x86/include/asm/e820.h
===================================================================
@@ -113,22 +113,36 @@ static inline void early_memtest(unsigne
 
 extern unsigned long end_user_pfn;
 
-extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
-extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
-u64 find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
-extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
 #include <linux/early_res.h>
+static inline u64 find_e820_area(u64 start, u64 end, u64 size, u64 align)
+{
+	return find_lmb_area(start, end, size, align);
+}
+static inline u64 find_e820_area_size(u64 start, u64 *sizep, u64 align)
+{
+	return find_lmb_area_size(start, sizep, align);
+}
+static inline u64
+find_e820_area_node(int nid, u64 start, u64 end, u64 size, u64 align)
+{
+	return find_lmb_area_node(nid, start, end, size, align);
+}
+extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
 
 extern unsigned long e820_end_of_ram_pfn(void);
 extern unsigned long e820_end_of_low_ram_pfn(void);
-extern int e820_find_active_region(const struct e820entry *ei,
-				  unsigned long start_pfn,
-				  unsigned long last_pfn,
-				  unsigned long *ei_startpfn,
-				  unsigned long *ei_endpfn);
-extern void e820_register_active_regions(int nid, unsigned long start_pfn,
-					 unsigned long end_pfn);
-extern u64 e820_hole_size(u64 start, u64 end);
+static inline void e820_register_active_regions(int nid,
+					 unsigned long start_pfn,
+					 unsigned long end_pfn)
+{
+	lmb_register_active_regions(nid, start_pfn, end_pfn);
+}
+static inline u64 e820_hole_size(u64 start, u64 end)
+{
+	return lmb_hole_size(start, end);
+}
+void init_lmb_memory(void);
+void fill_lmb_memory(void);
 extern void finish_e820_parsing(void);
 extern void e820_reserve_resources(void);
 extern void e820_reserve_resources_late(void);
arch/x86/kernel/e820.c +23 -140

193 lines not on this page · raw message

arch/x86/kernel/head.c +1 -1
Index: linux-2.6/arch/x86/kernel/head.c
===================================================================
@@ -51,5 +51,5 @@ void __init reserve_ebda_region(void)
 		lowmem = 0x9f000;
 
 	/* reserve all memory between lowmem and the 1MB mark */
-	reserve_early_overlap_ok(lowmem, 0x100000, "BIOS reserved");
+	reserve_early(lowmem, 0x100000, "BIOS reserved");
 }
arch/x86/kernel/head32.c +3 -1
Index: linux-2.6/arch/x86/kernel/head32.c
===================================================================
@@ -29,13 +29,15 @@ static void __init i386_default_early_se
 
 void __init i386_start_kernel(void)
 {
+
+	init_lmb_memory();
 #ifdef CONFIG_X86_TRAMPOLINE
 	/*
 	 * But first pinch a few for the stack/trampoline stuff
 	 * FIXME: Don't need the extra page at 4K, but need to fix
 	 * trampoline before removing it. (see the GDT stuff)
 	 */
-	reserve_early_overlap_ok(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE,
+	reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE,
 					 "EX TRAMPOLINE");
 #endif
 
arch/x86/kernel/head64.c +2 -0
Index: linux-2.6/arch/x86/kernel/head64.c
===================================================================
@@ -96,6 +96,8 @@ void __init x86_64_start_kernel(char * r
 
 void __init x86_64_start_reservations(char *real_mode_data)
 {
+	init_lmb_memory();
+
 	copy_bootdata(__va(real_mode_data));
 
 	reserve_early(__pa_symbol(&_text), __pa_symbol(&__bss_stop), "TEXT DATA BSS");
arch/x86/kernel/setup.c +2 -0
Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
@@ -892,6 +892,8 @@ void __init setup_arch(char **cmdline_p)
 	max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT;
 #endif
 
+	fill_lmb_memory();
+
 #ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
 	setup_bios_corruption_check();
 #endif
arch/x86/kernel/setup_percpu.c +0 -6
Index: linux-2.6/arch/x86/kernel/setup_percpu.c
===================================================================
@@ -137,13 +137,7 @@ static void * __init pcpu_fc_alloc(unsig
 
 static void __init pcpu_fc_free(void *ptr, size_t size)
 {
-#ifdef CONFIG_NO_BOOTMEM
-	u64 start = __pa(ptr);
-	u64 end = start + size;
-	free_early_partial(start, end);
-#else
 	free_bootmem(__pa(ptr), size);
-#endif
 }
 
 static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)
include/linux/early_res.h +6 -3
Index: linux-2.6/include/linux/early_res.h
===================================================================
@@ -5,15 +5,18 @@
 extern void reserve_early(u64 start, u64 end, char *name);
 extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
 extern void free_early(u64 start, u64 end);
-void free_early_partial(u64 start, u64 end);
 extern void early_res_to_bootmem(u64 start, u64 end);
 
-void reserve_early_without_check(u64 start, u64 end, char *name);
 u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
 			 u64 size, u64 align);
 u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
 			 u64 *sizep, u64 align);
-u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
+u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
+void lmb_register_active_regions(int nid, unsigned long start_pfn,
+					 unsigned long last_pfn);
+u64 lmb_hole_size(u64 start, u64 end);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);
include/linux/lmb.h +4 -1
Index: linux-2.6/include/linux/lmb.h
===================================================================
@@ -26,7 +26,8 @@ struct lmb_property {
 struct lmb_region {
 	unsigned long cnt;
 	u64 size;
-	struct lmb_property region[MAX_LMB_REGIONS+1];
+	struct lmb_property *region;
+	unsigned long region_array_size;
 };
 
 struct lmb {
@@ -37,6 +38,8 @@ struct lmb {
 };
 
 extern struct lmb lmb;
+extern struct lmb_property lmb_memory_region[MAX_LMB_REGIONS + 1];
+extern struct lmb_property lmb_reserved_region[MAX_LMB_REGIONS + 1];
 
 extern void __init lmb_init(void);
 extern void __init lmb_analyze(void);
kernel/early_res.c +233 -361

740 lines not on this page · raw message

lib/lmb.c +9 -0
Index: linux-2.6/lib/lmb.c
===================================================================
@@ -18,6 +18,8 @@
 #define LMB_ALLOC_ANYWHERE	0
 
 struct lmb lmb;
+struct lmb_property lmb_memory_region[MAX_LMB_REGIONS + 1];
+struct lmb_property lmb_reserved_region[MAX_LMB_REGIONS + 1];
 
 static int lmb_debug;
 
@@ -106,6 +108,11 @@ static void lmb_coalesce_regions(struct
 
 void __init lmb_init(void)
 {
+	lmb.memory.region   = lmb_memory_region;
+	lmb.memory.region_array_size   = ARRAY_SIZE(lmb_memory_region);
+	lmb.reserved.region = lmb_reserved_region;
+	lmb.reserved.region_array_size = ARRAY_SIZE(lmb_reserved_region);
+
 	/* Create a dummy zero size LMB which will get coalesced away later.
 	 * This simplifies the lmb_add() code below...
 	 */
@@ -539,3 +546,5 @@ int lmb_find(struct lmb_property *res)
 	}
 	return -1;
 }
+
+
mm/page_alloc.c +1 -1
Index: linux-2.6/mm/page_alloc.c
===================================================================
@@ -3457,7 +3457,7 @@ void * __init __alloc_memory_core_early(
 
 	ptr = phys_to_virt(addr);
 	memset(ptr, 0, size);
-	reserve_early_without_check(addr, addr + size, "BOOTMEM");
+	reserve_early(addr, addr + size, "BOOTMEM");
 	return ptr;
 }
 #endif
mm/sparse-vmemmap.c +2 -2
Index: linux-2.6/mm/sparse-vmemmap.c
===================================================================
@@ -229,8 +229,8 @@ void __init sparse_mem_maps_populate_nod
 			char name[15];
 
 			snprintf(name, sizeof(name), "MEMMAP %d", nodeid);
-			reserve_early_without_check(__pa(vmemmap_buf_start),
-						    __pa(vmemmap_buf), name);
+			reserve_early(__pa(vmemmap_buf_start),
+					 __pa(vmemmap_buf), name);
 		}
 #else
 		free_bootmem(__pa(vmemmap_buf), vmemmap_buf_end - vmemmap_buf);
arch/x86/include/asm/lmb.h new file +8 -0
Index: linux-2.6/arch/x86/include/asm/lmb.h
===================================================================
@@ -0,0 +1,8 @@
+#ifndef _X86_LMB_H
+#define _X86_LMB_H
+
+#define LMB_DBG(fmt...) printk(fmt)
+
+#define LMB_REAL_LIMIT	0
+
+#endif
#34 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 22 lines · Yinghai Lu

please check

[PATCH 01/20] x86: add find_e820_area_node

[RFC PATCH] x86: use lmb to replace early_res

still keep kernel/early_res.c for the extension.

should move those file to lib/lmb.c later?

---
 arch/x86/Kconfig               |    1 
 arch/x86/include/asm/e820.h    |   38 +-
 arch/x86/include/asm/lmb.h     |    8 
 arch/x86/kernel/e820.c         |  163 +----------
 arch/x86/kernel/head.c         |    2 
 arch/x86/kernel/head32.c       |    4 
 arch/x86/kernel/head64.c       |    2 
 arch/x86/kernel/setup.c        |    2 
Quoted 8 lines
 arch/x86/kernel/setup_percpu.c |    6 
 include/linux/early_res.h      |    9 
 include/linux/lmb.h            |    5 
 kernel/early_res.c             |  594 ++++++++++++++++-------------------------
 lib/lmb.c                      |    9 
 mm/page_alloc.c                |    2 
 mm/sparse-vmemmap.c            |    4 
 15 files changed, 321 insertions(+), 528 deletions(-)

That looks like a very promising direction!

There's several things to do to make the approach fully clean:

1)

I think we want to shape this as a series of simpler (and bisectable) patches.

2)

I think we also need to concentrate the changes back into LMB:

Quoted 16 lines

Index: linux-2.6/include/linux/early_res.h
===================================================================

include/linux/early_res.h +0 -2
@@ -5,15 +5,18 @@
 extern void reserve_early(u64 start, u64 end, char *name);
 extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
 extern void free_early(u64 start, u64 end);
-void free_early_partial(u64 start, u64 end);
 extern void early_res_to_bootmem(u64 start, u64 end);
 
-void reserve_early_without_check(u64 start, u64 end, char *name);
 u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
 			 u64 size, u64 align);
 u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
 			 u64 *sizep, u64 align);

include/linux/early_res.h line 22

Quoted 10 lines
include/linux/early_res.h +6 -1
-u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
+u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
+void lmb_register_active_regions(int nid, unsigned long start_pfn,
+					 unsigned long last_pfn);
+u64 lmb_hole_size(u64 start, u64 end);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);

those new lmb_*() APIs should go into lmb.h.

3)

Furthermore, i think all of early_res.c should move into lmb.c as well and we should eliminate kernel/early_res.c.

early_res.h will go away as well and all the new APIs will be in lmb.h.

4)

Also, we should move lib/lmb.c to mm/lmb.c, as now it's not just some optional library but _the_ main early-reserve memory subsystem used by the biggest Linux architectures.

5)

Could we perhaps also try to eliminate e820_*() method uses in arch/x86/, and replace them by lmb_*() API uses? (that too should be a step by step method, for bisectability)

include/linux/early_res.h struct lmb_property { · line 31

Quoted 9 lines

+++ linux-2.6/include/linux/lmb.h

include/linux/early_res.h +2 -1
@@ -26,7 +26,8 @@ struct lmb_property {
 struct lmb_region {
 	unsigned long cnt;
 	u64 size;
-	struct lmb_property region[MAX_LMB_REGIONS+1];
+	struct lmb_property *region;
+	unsigned long region_array_size;
 };

I suspect this should keep current LMB architectures still working, right?

Ingo

author
#35 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 34 lines · Ingo Molnar
Quoted 22 lines · Yinghai Lu

please check

[PATCH 01/20] x86: add find_e820_area_node

[RFC PATCH] x86: use lmb to replace early_res

still keep kernel/early_res.c for the extension.

should move those file to lib/lmb.c later?

---
 arch/x86/Kconfig               |    1 
 arch/x86/include/asm/e820.h    |   38 +-
 arch/x86/include/asm/lmb.h     |    8 
 arch/x86/kernel/e820.c         |  163 +----------
 arch/x86/kernel/head.c         |    2 
 arch/x86/kernel/head32.c       |    4 
 arch/x86/kernel/head64.c       |    2 
 arch/x86/kernel/setup.c        |    2 
Quoted 8 lines
 arch/x86/kernel/setup_percpu.c |    6 
 include/linux/early_res.h      |    9 
 include/linux/lmb.h            |    5 
 kernel/early_res.c             |  594 ++++++++++++++++-------------------------
 lib/lmb.c                      |    9 
 mm/page_alloc.c                |    2 
 mm/sparse-vmemmap.c            |    4 
 15 files changed, 321 insertions(+), 528 deletions(-)
Quoted 7 lines

That looks like a very promising direction!

There's several things to do to make the approach fully clean:

1)

I think we want to shape this as a series of simpler (and bisectable) patches.

will check it.

at least change include/linux/lmb.h and lib/lmb.c change could be sperated.

other looks a little bit hard.

Quoted 4 lines

2)

I think we also need to concentrate the changes back into LMB:

yes. put them in kernel/early_res.c and move them to lmb.c if lmb gugs are happy with the change.

Quoted 21 lines
Quoted 21 lines

Index: linux-2.6/include/linux/early_res.h
===================================================================

include/linux/early_res.h +3 -3
@@ -5,15 +5,18 @@
 extern void reserve_early(u64 start, u64 end, char *name);
 extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
 extern void free_early(u64 start, u64 end);
-void free_early_partial(u64 start, u64 end);
 extern void early_res_to_bootmem(u64 start, u64 end);
 
-void reserve_early_without_check(u64 start, u64 end, char *name);
 u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
 			 u64 size, u64 align);
 u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
 			 u64 *sizep, u64 align);
-u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
+u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64 align);
Quoted 8 lines

include/linux/early_res.h line 22

Quoted 6 lines
include/linux/early_res.h +3 -0
+void lmb_register_active_regions(int nid, unsigned long start_pfn,
+					 unsigned long last_pfn);
+u64 lmb_hole_size(u64 start, u64 end);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);

those new lmb_*() APIs should go into lmb.h.

next version

Quoted 7 lines

3)

Furthermore, i think all of early_res.c should move into lmb.c as well and we should eliminate kernel/early_res.c.

early_res.h will go away as well and all the new APIs will be in lmb.h.

current have three levels
a. old lmb users
b. x86 with bootmem
c. x86 with no-bootmem

some functions later could be moved to new bootmem.c

Quoted 6 lines

4)

Also, we should move lib/lmb.c to mm/lmb.c, as now it's not just some optional library but _the_ main early-reserve memory subsystem used by the biggest Linux architectures.

yes

Quoted 6 lines

5)

Could we perhaps also try to eliminate e820_*() method uses in arch/x86/, and replace them by lmb_*() API uses? (that too should be a step by step method, for bisectability)

yes.

except e820_any_mapped(,,E820_RESERVED)

others should not be used after fill_lmb_memory()

Quoted 12 lines

include/linux/early_res.h struct lmb_property { · line 31

Quoted 10 lines

+++ linux-2.6/include/linux/lmb.h

include/linux/early_res.h +2 -1
@@ -26,7 +26,8 @@ struct lmb_property {
 struct lmb_region {
 	unsigned long cnt;
 	u64 size;
-	struct lmb_property region[MAX_LMB_REGIONS+1];
+	struct lmb_property *region;
+	unsigned long region_array_size;
 };

I suspect this should keep current LMB architectures still working, right?

they are still working. lmb_init will connect the pointers.

lib/lmb.c +8 -1
Index: linux-2.6/lib/lmb.c
===================================================================
@@ -18,6 +18,8 @@
 #define LMB_ALLOC_ANYWHERE     0
 
 struct lmb lmb;
+struct lmb_property lmb_memory_region[MAX_LMB_REGIONS + 1];
+struct lmb_property lmb_reserved_region[MAX_LMB_REGIONS + 1];
 
 static int lmb_debug;
 
@@ -106,6 +108,11 @@ static void lmb_coalesce_regions(struct
 
 void __init lmb_init(void)
 {
+       lmb.memory.region   = lmb_memory_region;
+       lmb.memory.region_array_size   = ARRAY_SIZE(lmb_memory_region);
+       lmb.reserved.region = lmb_reserved_region;
+       lmb.reserved.region_array_size = ARRAY_SIZE(lmb_reserved_region);
+
        /* Create a dummy zero size LMB which will get coalesced away later.
         * This simplifies the lmb_add() code below...
         */
@@ -169,7 +176,7 @@ static long lmb_add_region(struct lmb_re
 
        if (coalesced)
                return coalesced;
-       if (rgn->cnt >= MAX_LMB_REGIONS)
+       if (rgn->cnt >= (rgn->region_array_size - 1))
                return -1;
 

Thanks

Yinghai

#36 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 6 lines · Yinghai Lu
Quoted 3 lines

2)

I think we also need to concentrate the changes back into LMB:

yes. put them in kernel/early_res.c and move them to lmb.c if lmb gugs are happy with the change.

Yes, they seemed OK with changing it to accomodate x86, as long as current behavior stays compatible and as long as the changes are squeaky-clean.

Both of which are highly reasonable expectations ;-)

Quoted 8 lines
Quoted 1 line

early_res.h will go away as well and all the new APIs will be in lmb.h.

current have three levels
a. old lmb users
b. x86 with bootmem
c. x86 with no-bootmem

some functions later could be moved to new bootmem.c

I think we want to work towards the end result where we dont have bootmem.c anymore. I.e. a modern LMB architecture should generally not make use of bootmem at all.

We could do that switch on x86 straight away, and make CONFIG_NO_BOOTMEM a default-y option, hm? We could also hide the interactivity behind CONFIG_DEBUG_VM or so - and eliminate it altogether later on.

We should also switch around the flag and turn it into CONFIG_BOOTMEM.

Hm?

Ingo

#37 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 10 lines · Ingo Molnar
Quoted 1 line

yes. put them in kernel/early_res.c and move them to lmb.c if lmb

gugs are

Quoted 1 line

happy with the change.

Yes, they seemed OK with changing it to accomodate x86, as long as current
behavior stays compatible and as long as the changes are squeaky-clean.

Both of which are highly reasonable expectations ;-)

Yup. As I said, tho, I'd also like a little better level of explanation and documentation (and I know the existing LMB interfaces are -not- documented, but let's not add more shall we ? :-)

Quoted 3 lines

I think we want to work towards the end result where we dont have bootmem.c anymore. I.e. a modern LMB architecture should generally not make use of bootmem at all.

bootmem has one advantage over LMB, I think, in that LMB has this annoying static array of regions, which is prone to being either too big (wasted space) or too small.

We might want to consider a slightly smarter approach there if we are going to replace bootmem.

I though one possibility would be to have LMB regions become more lists than arrays, so that the static storage only needs to cover as much as is needed during really early boot (and we could probably still move the BSS top point on some archs to dynamically make more ... actually we could be smart arses and use LMB to allocate more LMB list heads if we are reaching the table limit :-)

Quoted 6 lines

We could do that switch on x86 straight away, and make CONFIG_NO_BOOTMEM a
default-y option, hm? We could also hide the interactivity behind CONFIG_DEBUG_VM or so - and eliminate it altogether later on.

We should also switch around the flag and turn it into CONFIG_BOOTMEM.

Cheers,
Ben.

Quoted 5 lines

Hm?

Ingo

#38 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 7 lines

I though one possibility would be to have LMB regions become more lists than arrays, so that the static storage only needs to cover as much as is needed during really early boot (and we could probably still move the BSS top point on some archs to dynamically make more ... actually we could be smart arses and use LMB to allocate more LMB list heads if we are reaching the table limit :-)

Actually what about that:

LMB entries are linked-listed. The array is just storage for those entry "heads".

The initial static array only needs to be big enough for very very early platform specific kernel bits and pieces, so it could even be sized by a Kconfig option. Or it could just use a klimit moving trick to pick up a page right after the BSS but that may need to be arch specific.

lmb_init() queues all the entries from the initial array in a freelist

lmb_alloc() and lmb_reserve() just pop entries from that freelist to populate the two main linked lists (memory and reserved).

When something tries to dequeue up the last freelist entry, then under the hood, LMB uses it instead to allocate a new block of LMB entries that gets added to the freelist.

We never free blocks of LMB entries.

That way, we can fine tine the static array to be as small as we can realistically make it be, and we have no boundary limitations on the amount of entries in either the memory list or the reserved list.

I'm a bit too flat out right now to write code, but if there's no objection, I might give that a go either later this week or next week, see if I can replace bootmem on powerpc.

Cheers,
Ben.

author
#39 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 29 lines · Benjamin Herrenschmidt
Quoted 7 lines

I though one possibility would be to have LMB regions become more lists than arrays, so that the static storage only needs to cover as much as is needed during really early boot (and we could probably still move the BSS top point on some archs to dynamically make more ... actually we could be smart arses and use LMB to allocate more LMB list heads if we are reaching the table limit :-)

Actually what about that:

LMB entries are linked-listed. The array is just storage for those entry "heads".

The initial static array only needs to be big enough for very very early platform specific kernel bits and pieces, so it could even be sized by a Kconfig option. Or it could just use a klimit moving trick to pick up a page right after the BSS but that may need to be arch specific.

lmb_init() queues all the entries from the initial array in a freelist

lmb_alloc() and lmb_reserve() just pop entries from that freelist to populate the two main linked lists (memory and reserved).

When something tries to dequeue up the last freelist entry, then under the hood, LMB uses it instead to allocate a new block of LMB entries that gets added to the freelist.

We never free blocks of LMB entries.

Quoted 8 lines

That way, we can fine tine the static array to be as small as we can realistically make it be, and we have no boundary limitations on the amount of entries in either the memory list or the reserved list.

I'm a bit too flat out right now to write code, but if there's no objection, I might give that a go either later this week or next week, see if I can replace bootmem on powerpc.

if the array can be doubled and have old one copied to new one. then we don't change lmb.c too much.

new early_res.c exend lmb. and another half already works with x86 to replace bootmem.

will check if i can produce one patch to make powerpc to reuse early_res/nobootmem

Thanks

Yinghai

#40 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 8 lines · Yinghai Lu

if the array can be doubled and have old one copied to new one. then we don't change lmb.c too much.

new early_res.c exend lmb. and another half already works with x86 to replace bootmem.

will check if i can produce one patch to make powerpc to reuse early_res/nobootmem

While at it, can you rename early_res to something that doesn't suck ? :-)

Cheers,
Ben.

author
#41 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Yinghai Lu

if the array can be doubled and have old one copied to new one. then we don't change lmb.c too much.

Quoted 9 lines
Quoted 5 lines

new early_res.c exend lmb. and another half already works with x86 to replace bootmem.

will check if i can produce one patch to make powerpc to reuse early_res/nobootmem

While at it, can you rename early_res to something that doesn't suck ? :-)

ok,

please check following renaming is ok to you.

the api from linux/early_res.h

#ifndef _LINUX_EARLY_RES_H
#define _LINUX_EARLY_RES_H
#ifdef __KERNEL__

extern void reserve_early(u64 start, u64 end, char *name); extern void free_early(u64 start, u64 end);
void lmb_reserved_to_bootmem(u64 start, u64 end);

u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,

                         u64 size, u64 align);

void add_lmb_memory(u64 start, u64 end);

u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align); u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64 align); void lmb_register_active_regions(int nid, unsigned long start_pfn,

                                         unsigned long last_pfn);

u64 lmb_hole_size(u64 start, u64 end);
u64 get_max_mapped(void);
struct range;
int get_free_all_memory_range(struct range **rangep, int nodeid);

#endif /* __KERNEL__ */

#endif /* _LINUX_EARLY_RES_H */

====>

extern void reserve_lmb(u64 start, u64 end, char *name); extern void free_lmb(u64 start, u64 end);
void lmb_reserved_to_bootmem(u64 start, u64 end);

u64 __find_lmb_area(u64 ei_start, u64 ei_last, u64 start, u64 end,

                         u64 size, u64 align);

void add_lmb_memory(u64 start, u64 end);

u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align); u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64 align); void lmb_register_active_regions(int nid, unsigned long start_pfn,

                                         unsigned long last_pfn);

u64 lmb_hole_size(u64 start, u64 end);
u64 get_max_mapped(void);
struct range;
int get_free_all_memory_range(struct range **rangep, int nodeid);

Thanks

Yinghai

#42 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

In reply to Benjamin Herrenschmidt
Quoted 29 lines · Benjamin Herrenschmidt
Quoted 7 lines

I though one possibility would be to have LMB regions become more lists than arrays, so that the static storage only needs to cover as much as is needed during really early boot (and we could probably still move the BSS top point on some archs to dynamically make more ... actually we could be smart arses and use LMB to allocate more LMB list heads if we are reaching the table limit :-)

Actually what about that:

LMB entries are linked-listed. The array is just storage for those entry "heads".

The initial static array only needs to be big enough for very very early platform specific kernel bits and pieces, so it could even be sized by a Kconfig option. Or it could just use a klimit moving trick to pick up a page right after the BSS but that may need to be arch specific.

lmb_init() queues all the entries from the initial array in a freelist

lmb_alloc() and lmb_reserve() just pop entries from that freelist to populate the two main linked lists (memory and reserved).

When something tries to dequeue up the last freelist entry, then under the hood, LMB uses it instead to allocate a new block of LMB entries that gets added to the freelist.

We never free blocks of LMB entries.

Quoted 7 lines

That way, we can fine tine the static array to be as small as we can realistically make it be, and we have no boundary limitations on the amount of entries in either the memory list or the reserved list.

I'm a bit too flat out right now to write code, but if there's no objection, I might give that a go either later this week or next week, see if I can replace bootmem on powerpc.

That would be fantastic! PowerPC and x86 both doing it would give it enough of a critical mass to make the removal of bootmem realistic.

Thanks,

Ingo

#43 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 6 lines · Ingo Molnar
Quoted 3 lines

I'm a bit too flat out right now to write code, but if there's no objection, I might give that a go either later this week or next week, see if I can replace bootmem on powerpc.

That would be fantastic! PowerPC and x86 both doing it would give it enough of a critical mass to make the removal of bootmem realistic.

From the look of it, I wont' have any bandwidth this week tho ... but let's keep that as a plan for moving forward and who gets to do it first wins a free beer at the next conference :-)

Cheers,
Ben.

#44 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

include/linux/early_res.h

Quoted 4 lines
include/linux/early_res.h +3 -1
-u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
+u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64

align);

Quoted 8 lines

include/linux/early_res.h line 22

Quoted 6 lines
include/linux/early_res.h +3 -0
+void lmb_register_active_regions(int nid, unsigned long start_pfn,
+                                      unsigned long last_pfn);
+u64 lmb_hole_size(u64 start, u64 end);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);

those new lmb_*() APIs should go into lmb.h.

And while at it properly documented :-) I wouldn't mind also a reasonably clear explanation in the changeset comment as to why they are necessary for x86.

To be honest, that's my #1 grief so far with this entire patch set, it Yinghai apparent inability to write anything ressembling remotely like an explanation. All we get is key words, bullet points and half sentences, and I admit have a very very hard time extracting a meaning out of anything he's been writing so far.

Cheers,
Ben.

author
#45 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.cy

Quoted 15 lines · Benjamin Herrenschmidt
Quoted 5 lines · Ingo Molnar

include/linux/early_res.h

Quoted 4 lines
include/linux/early_res.h +3 -1
-u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area(u64 start, u64 end, u64 size, u64 align);
+u64 find_lmb_area_size(u64 start, u64 *sizep, u64 align);
+u64 find_lmb_area_node(int nid, u64 start, u64 end, u64 size, u64

align);

Quoted 8 lines

include/linux/early_res.h line 22

Quoted 6 lines
include/linux/early_res.h +3 -0
+void lmb_register_active_regions(int nid, unsigned long start_pfn,
+                                      unsigned long last_pfn);
+u64 lmb_hole_size(u64 start, u64 end);
 u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);

those new lmb_*() APIs should go into lmb.h.

Quoted 3 lines

And while at it properly documented :-) I wouldn't mind also a reasonably clear explanation in the changeset comment as to why they are necessary for x86.

new early_res.c will have
find_lmb_area
reserve_early
free_early
also have get_free_all_memory_range to support bootmem replacement.

find_lmb_area: will take goal/limit, so we can find free region with more control.

when we try to check if there is enough slots for new reserve entry. we need to make sure the new array will not overlap with range below to entry that going to be reserved.
so we need to goal for find.
otherwise you have to keep trying with lmb_alloc until get one for new array that will not overlap with new entry.

Quoted 6 lines

To be honest, that's my #1 grief so far with this entire patch set, it Yinghai apparent inability to write anything ressembling remotely like an explanation. All we get is key words, bullet points and half sentences, and I admit have a very very hard time extracting a meaning out of anything he's been writing so far.

will spend more time to write more sentences...

thought you guys like to read code instead.

Thanks for you patience.

Yinghai Lu

#46 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

Note the other side of the coin: LMB appears to be deployed on only 4 non-x86
architectures that muster ~1% of the Linux boxes while early_res is deployed
on more than 95%.

You use that arguemnt ONE MORE FUCKING TIME and you'll end up in my killfile with a auto-NACK reply of anything that looks like a patch from you.

Ben.

#47 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 8 lines · Benjamin Herrenschmidt
Quoted 3 lines · Ingo Molnar

Note the other side of the coin: LMB appears to be deployed on only 4 non-x86 architectures that muster ~1% of the Linux boxes while early_res is deployed on more than 95%.

You use that arguemnt ONE MORE FUCKING TIME and you'll end up in my killfile with a auto-NACK reply of anything that looks like a patch from you.

Does this mean you disagree with that? (I think it's pretty factual, last i checked the usage stats of devel kernels was somewhere around 99.7%.)

In any case, i dont dispute that LMB is a bit cleaner than kernel/early_res.c
- and both are much cleaner than the new e820 kernel/fw_memmap.c code posted here by Yinghai.

If you dont disagree then please spare me the insults. (or move me into your killfile)

Thanks,

Ingo

#48 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 6 lines · Ingo Molnar
Quoted 3 lines

You use that arguemnt ONE MORE FUCKING TIME and you'll end up in my killfile with a auto-NACK reply of anything that looks like a patch from you.

Does this mean you disagree with that? (I think it's pretty factual, last i checked the usage stats of devel kernels was somewhere around 99.7%.)

I disagree with that being a relevant argument in the technical discussion on the relative merits of two implementations of a given facility. I also disagree with your numbers, if you talk about deployement, I would be very very surprised if ARM wasn't close to on-par with x86.

Quoted 6 lines

In any case, i dont dispute that LMB is a bit cleaner than kernel/early_res.c
- and both are much cleaner than the new e820 kernel/fw_memmap.c code posted here by Yinghai.

If you dont disagree then please spare me the insults. (or move me into your killfile)

Well, I find some of your arguments quite insulting too, but let's move on.

Cheers,
Ben.

#49 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Ingo Molnar
Quoted 2 lines

You use that arguemnt ONE MORE FUCKING TIME and you'll end up in my killfile with a auto-NACK reply of anything that looks like a patch from you.

Quoted 8 lines
Quoted 2 lines

Does this mean you disagree with that? (I think it's pretty factual, last i checked the usage stats of devel kernels was somewhere around 99.7%.)

I disagree with that being a relevant argument in the technical discussion on the relative merits of two implementations of a given facility. I also disagree with your numbers, if you talk about deployement, I would be very very surprised if ARM wasn't close to on-par with x86.

FWIW, several years ago a MontaVista representative said there were more Linux units that did have their RT extensions than there were Linux units that did not have them...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#50 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Benjamin Herrenschmidt
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 4 lines · Ingo Molnar
Quoted 3 lines

You use that arguemnt ONE MORE FUCKING TIME and you'll end up in my killfile with a auto-NACK reply of anything that looks like a patch from you.

Quoted 7 lines
Quoted 2 lines

Does this mean you disagree with that? (I think it's pretty factual, last i checked the usage stats of devel kernels was somewhere around 99.7%.)

I disagree with that being a relevant argument in the technical discussion on the relative merits of two implementations of a given facility. I also disagree with your numbers, if you talk about deployement, I would be very very surprised if ARM wasn't close to on-par with x86.

As an upstream maintainer i mainly care about upstream kernel contributions. These contributions have three main forms:

- patches i get against latest upstream

- on-lkml review/analysis that is done on those patches

- test/bug/regression reports i get against latest upstream (either directly on lkml or via kerneloops.org or bugzilla.kernel.org)

So i weigh the architectures based on that input.

Since you mentioned ARM - here's the Git contribution stats. In the last 5 years since we have kernel Git history, there's been 1080 commits to kernel/sched.c. Amongst those 1080 commits i could find only a _single commit_ (a minor fix) being related to or contributed by anyone doing ARM development!

To be on the safe side lets assume that i missed many commits, lets up that count to ten times of that count: 10 commits. I.e. the 'weight of ARM', when it comes to kernel/sched.c, is still less than 1%.

'millions of ARM units' alone means little to me, if it does not translate into actual upstream kernel contributions. Many of those 'millions of units' are walled off from kernel contributions: the users dont even know they are running Linux. They are not linked to kerneloops.org and dont produce bugzilla bugreports. They do finance Linux developers by proxy - but as far as the upstream kernel is concerned they only exist to the extent they finance kernel developers to care about it.

Lets look at a counter example: Sparc64. There's literally just a handful of Sparc64 'units' that run Linux, still the weight of the arch is much higher - due to the well-known highly productive kernel contributor who is using that architecture. I have seen about 10 times more scheduler contributions [~15 commits] from that single unit Sparc64 angle than from the millions of ARM units! (and davem isnt even doing scheduler development per se - he's mostly doing drive-by fixes and improvements with no particular focus on the scheduler.)

Or lets look at an architecture that during its development had a physical unit count of _zero_: SGI UV. It was only running in simulators for a year but it sure resulted in dozens and dozens of useful patches that extended Linux's scalability reach. So did SGI UV matter, despite having had a zero unit count? Heck it did ...

I singled out kernel/sched.c but there's a very similar picture and contribution weights when it comes to other areas i co-maintain: lockdep, perf, tracing, etc.

So if you want your architecture to matter to me the rule is very simple:
contribute, contribute, contribute, and stop whining. If you dont contribute, frankly you dont really exist to me. On the other hand if you are actively contributing while your architecture only exists on paper, it already starts mattering to me.

I'm really that simple.

Thanks,

Ingo

#51 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 8 lines · Ingo Molnar

So if you want your architecture to matter to me the rule is very simple:
contribute, contribute, contribute, and stop whining. If you dont contribute, frankly you dont really exist to me. On the other hand if you are actively contributing while your architecture only exists on paper, it already starts mattering to me.

I'm really that simple.

So basically, what you are saying is that, totally regardless of how much an architecture is actually used in the field, if the architecture maintainer for it doesn't also do your work and contribute to every single of your pet projects, or if everybody is like you, every single other subsystem in the kernel, then that architecture is irrelevant for technical considerations and choices regarding any design decision made to the core kernel ?

Sorry Ingo, but that's just arrogant bullshit. So stop trying to win this useless argument, all you manage to do is anger people and make us even less willing to actually work with you.

Cheers,
Ben.

#52 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Ingo Molnar
Quoted 16 lines · Ingo Molnar
Quoted 4 lines · Benjamin Herrenschmidt

I disagree with that being a relevant argument in the technical discussion on the relative merits of two implementations of a given facility. I also disagree with your numbers, if you talk about deployement, I would be very very surprised if ARM wasn't close to on-par with x86.

As an upstream maintainer i mainly care about upstream kernel contributions. These contributions have three main forms:

 - patches i get against latest upstream

 - on-lkml review/analysis that is done on those patches

 - test/bug/regression reports i get against latest upstream (either directly on lkml or via kerneloops.org or bugzilla.kernel.org)

Quoted 6 lines

So i weigh the architectures based on that input.

Since you mentioned ARM - here's the Git contribution stats. In the last 5 years since we have kernel Git history, there's been 1080 commits to kernel/sched.c. Amongst those 1080 commits i could find only a _single commit_ (a minor fix) being related to or contributed by anyone doing ARM development!

Ingo,

I'd like to assume that you _accidentally_ picked the *worst* possible example file in the entire repository (with the exception of anything in arch/x86...). You should keep in mind that basically nobody doing ARM development cares one hoot about the scheduler as long as it "basically works"... most such systems could get away with just SCHED_FIFO and static priorities. When you're porting the kernel to a platform with a 250MHz in-order CPU that's going to have a load average of zero for 99.5% of the time and a load average of 1.0 for the other 0.5% of the time that's pretty much the *LAST* thing you care about.

In fact, I would guess that all the excellent work that has been done with regards to optimized SMP and UP scheduling on much busier systems with pathological loads has meant that the scheduler is probably one of the most reliable pieces of code for the ARM developers. If you want some excellent examples that go the other way, I suggest looking at gpiolib for some great examples of code that don't matter for beans on 99.95% of X86 boxes yet are essential for any kind of real embedded development.

So while it's possible that you could make a reasonable point about developer time by looking at GIT commit logs... You should refrain from making such insulting and sweeping over-generalizations by looking at single files, particularly ones which are largely irrelevant or immaterial for the specific subset of developers.

Cheers,
Kyle Moffett

#53 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Ingo Molnar
Quoted 2 lines · Ingo Molnar

Does this mean you disagree with that? (I think it's pretty factual, last i checked the usage stats of devel kernels was somewhere around 99.7%.)

Is that number obtained from Fedora downloads or something? I wouldn't be surprised if desktop usage of bleeding-edge kernels is near 100%, since basically all desktop machines are x86 these days. I think that number would be biased against server and embedded machines, but without knowing exactly what you're counting it's hard to say.

In any case, I don't think the number of machines is particularly relevant. Linux runs on maybe 1% of all desktop machines in the world, according to numbers I've seen, but that doesn't make it irrelevant or not worth working on.

Paul.

#54 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Benjamin Herrenschmidt
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 1 line · Ingo Molnar

Note the other side of the coin: LMB appears to be deployed on only

4

Quoted 4 lines

non-x86
architectures that muster ~1% of the Linux boxes while early_res is deployed
on more than 95%.

You use that arguemnt ONE MORE FUCKING TIME and you'll end up in my killfile with a auto-NACK reply of anything that looks like a patch from you.

Allright, I've calmed down now, so my appologies for going over the top here, I shouldn't reply to emails before breakfast ... but it looks like Thomas made the point a lot more clearly than me or Dave did so it's all good. Let's move on.

Cheers,
Ben.

#55 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Ingo Molnar
Quoted 5 lines · Ingo Molnar

Those early_res patches were posted all over on lkml, it was literally hundreds of difficult patches, and now, months down the line, after we've tested and upstreamed it (with many nasty regressions fixed on x86 during the development of it) you come with a rigid "do it some other way, convert all of x86 over again or else" position.

There's an easy solution here. Leave that gunk in arch/x86 where it belongs and if you want to unify things a bit, then do it at the -API- level only, and leave the implementation where it is.

Quoted 3 lines

I really wish non-x86 architectures apprecitated (and helped) the core kernel work x86 is doing, because it is subsidizing non-x86 architectures all the time.

I'm not even going to bother replying to that one

Ben.

#56 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

In reply to Yinghai Lu
Quoted 7 lines · Yinghai Lu
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 4 lines · Yinghai Lu

move it to kernel/fw_memmap.c from arch/x86/kernel/e820.c

-v2: add fw_memmap wrapper to some func...
move some functions back to e820.c

Quoted 6 lines
Quoted 1 line

NAK

at this point, kernel/early_res.c and kernel/fw_memmap.c is protected with HAVE_EARLY_RES

obj-$(CONFIG_HAVE_EARLY_RES) += early_res.o fw_memmap.o

so it will not increase size that doesn't support early_res/bootmem yet.

I'm still not at all happy with it. It's not only about increasing the size of the kernel. It's about moving some x86 specific stuff and more or less arbitrarily deciding that everybody has to convert to that model now, despite the fact that more suited alternatives have existed for years, rather than thinking about doing the logical thing, which is to convert x86 over to lmb, eventually adding the missing functionalities in lmb if need be.

Also, there's something just plain gross about the choice of names.

fw_memmap is something I wouldn't wish my enemies to have to type on a keyboard, it looks ugly, and it lends to way too long function names. In addition to the fact that your "generic" facility is still all cluttered with the e820 names and other very x86 centric definitions.

It -may- well be that adapting x86 to lmb isn't a practical approach, but if that was the case, then please justify why with precise technical reasons, which we can discuss then in details and make a decision based on that.

Cheers,
Ben.

author
#57 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 4 lines · Benjamin Herrenschmidt

It -may- well be that adapting x86 to lmb isn't a practical approach, but if that was the case, then please justify why with precise technical reasons, which we can discuss then in details and make a decision based on that.

1. lmb is merging region when you add one new reserved region.
early_res doesn't do that merge. so later it could figure wrong freeing.
<recently add free_early_partial, for per cpu setup only>
2. mem type in e820 map has more than RAM, it include RAM, reserved, ACPI, acpi nvs, and type 9?, and KERN_RESERVED...
3. early res, every range has one name tag.
4. early_res is array based, and it could auto double the array size and copy the old one to new one. and first entry in new array is for array itself.

if want x86 to use lmb, the e820 map and the lmb.memory are duplicated.
also need to have lmb.memory to support more type, otherwise still need to go back to check e820 about e820 reserved etc.

Thanks

Yinghai

#58 lore raw

Re: [PATCH 06/20] early_res: seperate common memmap func from e820.c to fw_memmap.c

Quoted 11 lines · Yinghai Lu
Quoted 4 lines · Benjamin Herrenschmidt

It -may- well be that adapting x86 to lmb isn't a practical approach, but if that was the case, then please justify why with precise technical reasons, which we can discuss then in details and make a decision based on that.

1. lmb is merging region when you add one new reserved region. early_res doesn't do that merge. so later it could figure wrong freeing. <recently add free_early_partial, for per cpu setup only>

2. mem type in e820 map has more than RAM, it include RAM, reserved, ACPI, acpi nvs, and type 9?, and KERN_RESERVED...

lmb has a reserved type as well.

Beyond that does anything except /proc/iomem and acpi care?

Quoted 5 lines

3. early res, every range has one name tag.
4. early_res is array based, and it could auto double the array size and copy the old one to new one. and first entry in new array is for array itself.

if want x86 to use lmb, the e820 map and the lmb.memory are duplicated.
also need to have lmb.memory to support more type, otherwise still need to go back to check e820 about e820 reserved etc.

lmb clearly supports reserved regions, as well as ram regions.

Eric

author
#59 lore raw

PATCH 7/20 irq: move some interrupt arch_* functions into struct irq_chip.

In reply to Yinghai Lu

From: Ian Campbell <[email protected]>

Move arch_init_copy_chip_data and arch_free_chip_data into function pointers in struct irq_chip since they operate on irq_desc->chip_data.

arch_init_chip_data cannot be moved into struct irq_chip because irq_desc->chip is not known at the time the irq_desc is setup. Instead rename arch_init_chip_data to arch_init_irq_desc for PowerPC, the only other user, whose usage better matches the new name.

To replace the x86 arch_init_chip_data functionality irq_to_desc_alloc_node now takes a pointer to a function to allocate the chip data. This is necessary to ensure the allocation happens under the correct locking at the core level. On PowerPC and SH architectures (the other users of irq_to_desc_alloc_node) pass in NULL which retains existing chip_data behaviour.

I've retained the chip_data behaviour for uv_irq although it isn't clear to me if these interrupt types support migration or how closely related to the APIC modes they really are. If it weren't for this the x86_{init,copy,free}_chip_data functions could be static to io_apic.c.

I've tested by booting on an 64 bit x86 system with sparse IRQ enabled and 32 bit without, but it's not clear to me what actions I need to take to actually exercise some of these code paths.

-v4: yinghai add irq_to_desc_alloc_node_x...
so could leave default path not changed...

---
 arch/powerpc/kernel/irq.c      |    2 +-
 arch/x86/include/asm/hw_irq.h  |    7 +++++-
 arch/x86/kernel/apic/io_apic.c |   49 ++++++++++++++++++++++++++++++++++++---
 arch/x86/kernel/uv_irq.c       |    3 ++
 drivers/xen/events.c           |    7 +++++-
 include/linux/interrupt.h      |    1 -
 include/linux/irq.h            |   21 +++++++++++++----
 kernel/irq/chip.c              |    7 +++++
 kernel/irq/handle.c            |   13 ++++++----
 kernel/irq/numa_migrate.c      |   12 ++++++++-
 kernel/softirq.c               |    5 ----
 11 files changed, 102 insertions(+), 25 deletions(-)
arch/powerpc/kernel/irq.c +1 -1
index 64f6f20..cafd378 100644
@@ -1088,7 +1088,7 @@ int arch_early_irq_init(void)
 	return 0;
 }
 
-int arch_init_chip_data(struct irq_desc *desc, int node)
+int arch_init_irq_desc(struct irq_desc *desc, int node, init_chip_data_fn fn)
 {
 	desc->status |= IRQ_NOREQUEST;
 	return 0;
arch/x86/include/asm/hw_irq.h +6 -1
index 46c0fe0..767d3f8 100644
@@ -20,9 +20,9 @@
 #include <linux/percpu.h>
 #include <linux/profile.h>
 #include <linux/smp.h>
+#include <linux/irq.h>
 
 #include <asm/atomic.h>
-#include <asm/irq.h>
 #include <asm/sections.h>
 
 /* Interrupt handlers registered during init_IRQ */
@@ -61,6 +61,11 @@ extern void init_VISWS_APIC_irqs(void);
 extern void setup_IO_APIC(void);
 extern void disable_IO_APIC(void);
 
+extern void x86_copy_chip_data(struct irq_desc *old_desc,
+				  struct irq_desc *desc, int node);
+extern void x86_free_chip_data(struct irq_desc *old_desc,
+				  struct irq_desc *desc);
+
 struct io_apic_irq_attr {
 	int ioapic;
 	int ioapic_pin;
arch/x86/kernel/apic/io_apic.c +45 -4

127 lines not on this page · raw message

arch/x86/kernel/uv_irq.c +3 -0
index ece73d8..4c61f1b 100644
@@ -55,6 +55,9 @@ struct irq_chip uv_irq_chip = {
 	.eoi		= uv_ack_apic,
 	.end		= uv_noop,
 	.set_affinity	= uv_set_irq_affinity,
+
+	.copy_chip_data = x86_copy_chip_data,
+	.free_chip_data = x86_free_chip_data,
 };
 
 /*
drivers/xen/events.c +6 -1
index 2f84137..64cbbe4 100644
@@ -329,6 +329,11 @@ static void unmask_evtchn(int port)
 	put_cpu();
 }
 
+static int xen_init_chip_data(struct irq_desc *desc, int node)
+{
+	return 0;
+}
+
 static int find_unbound_irq(void)
 {
 	int irq;
@@ -341,7 +346,7 @@ static int find_unbound_irq(void)
 	if (irq == nr_irqs)
 		panic("No available IRQ to bind to: increase nr_irqs!\n");
 
-	desc = irq_to_desc_alloc_node(irq, 0);
+	desc = irq_to_desc_alloc_node_x(irq, 0, xen_init_chip_data);
 	if (WARN_ON(desc == NULL))
 		return -1;
 
include/linux/interrupt.h +0 -1
index 75f3f00..0b0d679 100644
@@ -611,6 +611,5 @@ struct irq_desc;
 extern int early_irq_init(void);
 extern int arch_probe_nr_irqs(void);
 extern int arch_early_irq_init(void);
-extern int arch_init_chip_data(struct irq_desc *desc, int node);
 
 #endif
include/linux/irq.h +16 -5
index 707ab12..60f3368 100644
@@ -140,6 +140,13 @@ struct irq_chip {
 	 * Will disappear.
 	 */
 	const char	*typename;
+
+	/* for move_irq_desc */
+	void		(*copy_chip_data)(struct irq_desc *old_desc,
+					  struct irq_desc *desc, int node);
+	void		(*free_chip_data)(struct irq_desc *old_desc,
+					  struct irq_desc *desc);
+
 };
 
 struct timer_rand_state;
@@ -208,10 +215,6 @@ struct irq_desc {
 	const char		*name;
 } ____cacheline_internodealigned_in_smp;
 
-extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
-					struct irq_desc *desc, int node);
-extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
-
 #ifndef CONFIG_SPARSE_IRQ
 extern struct irq_desc irq_desc[NR_IRQS];
 #endif
@@ -225,7 +228,15 @@ static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
 }
 #endif
 
-extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
+typedef int (*init_chip_data_fn)(struct irq_desc *, int node);
+int arch_init_irq_desc(struct irq_desc *desc, int node, init_chip_data_fn fn);
+struct irq_desc *irq_to_desc_alloc_node_x(unsigned int irq, int node,
+					       init_chip_data_fn fn);
+static inline struct irq_desc *irq_to_desc_alloc_node(unsigned int irq,
+							 int node)
+{
+	return irq_to_desc_alloc_node_x(irq, node, NULL);
+}
 
 /*
  * Pick up the arch-dependent methods:
kernel/irq/chip.c +7 -0
index bbba585..3dcdd2f 100644
@@ -758,3 +758,10 @@ void __init set_irq_probe(unsigned int irq)
 	desc->status &= ~IRQ_NOPROBE;
 	raw_spin_unlock_irqrestore(&desc->lock, flags);
 }
+
+int __weak arch_init_irq_desc(struct irq_desc *desc, int node,
+				 init_chip_data_fn init_chip_data)
+{
+	return 0;
+}
+
kernel/irq/handle.c +8 -5
index 76d5a67..f30c9c7 100644
@@ -100,7 +100,8 @@ void __ref init_kstat_irqs(struct irq_desc *desc, int node, int nr)
 	}
 }
 
-static void init_one_irq_desc(int irq, struct irq_desc *desc, int node)
+static void init_one_irq_desc(int irq, struct irq_desc *desc, int node,
+			      init_chip_data_fn init_chip_data)
 {
 	memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
 
@@ -120,7 +121,7 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int node)
 		BUG_ON(1);
 	}
 	init_desc_masks(desc);
-	arch_init_chip_data(desc, node);
+	arch_init_irq_desc(desc, node, init_chip_data);
 }
 
 /*
@@ -198,7 +199,8 @@ int __init early_irq_init(void)
 	return arch_early_irq_init();
 }
 
-struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
+struct irq_desc * __ref irq_to_desc_alloc_node_x(unsigned int irq, int node,
+					       init_chip_data_fn init_chip_data)
 {
 	struct irq_desc *desc;
 	unsigned long flags;
@@ -227,7 +229,7 @@ struct irq_desc * __ref irq_to_desc_alloc_node(unsigned int irq, int node)
 		printk(KERN_ERR "can not alloc irq_desc\n");
 		BUG_ON(1);
 	}
-	init_one_irq_desc(irq, desc, node);
+	init_one_irq_desc(irq, desc, node, init_chip_data);
 
 	set_irq_desc(irq, desc);
 
@@ -277,7 +279,8 @@ struct irq_desc *irq_to_desc(unsigned int irq)
 	return (irq < NR_IRQS) ? irq_desc + irq : NULL;
 }
 
-struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node)
+struct irq_desc *irq_to_desc_alloc_node_x(unsigned int irq, int node,
+					init_chip_data_fn init_chip_data)
 {
 	return irq_to_desc(irq);
 }
kernel/irq/numa_migrate.c +10 -2
index 963559d..9ea09c9 100644
@@ -47,7 +47,8 @@ static bool init_copy_one_irq_desc(int irq, struct irq_desc *old_desc,
 	lockdep_set_class(&desc->lock, &irq_desc_lock_class);
 	init_copy_kstat_irqs(old_desc, desc, node, nr_cpu_ids);
 	init_copy_desc_masks(old_desc, desc);
-	arch_init_copy_chip_data(old_desc, desc, node);
+	if (desc->chip->copy_chip_data)
+		desc->chip->copy_chip_data(old_desc, desc, node);
 	return true;
 }
 
@@ -55,7 +56,8 @@ static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc)
 {
 	free_kstat_irqs(old_desc, desc);
 	free_desc_masks(old_desc, desc);
-	arch_free_chip_data(old_desc, desc);
+	if (desc->chip->free_chip_data)
+		desc->chip->free_chip_data(old_desc, desc);
 }
 
 static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
@@ -107,9 +109,15 @@ out_unlock:
 
 struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
 {
+
 	/* those static or target node is -1, do not move them */
 	if (desc->irq < NR_IRQS_LEGACY || node == -1)
 		return desc;
+	/* IRQ chip does not support movement */
+	if (desc->chip_data &&
+	    (desc->chip->copy_chip_data == NULL ||
+	     desc->chip->free_chip_data == NULL))
+		return desc;
 
 	if (desc->node != node)
 		desc = __real_move_irq_desc(desc, node);
kernel/softirq.c +0 -5
index 7c1a67e..7df0209 100644
@@ -895,8 +895,3 @@ int __init __weak arch_early_irq_init(void)
 {
 	return 0;
 }
-
-int __weak arch_init_chip_data(struct irq_desc *desc, int node)
-{
-	return 0;
-}
Signature · 1 line
1.6.4.2
author
#60 lore raw

PATCH 8/20 x86: fix out of order of gsi - full

In reply to Yinghai Lu

Iranna D Ankad reported that IBM x3950 systems have boot problems after this commit:

 |
 | commit b9c61b70075c87a8612624736faf4a2de5b1ed30
 |
 |    x86/pci: update pirq_enable_irq() to setup io apic routing
 |

ACPI: IOAPIC (id[0x10] address[0xfecff000] gsi_base[0]) IOAPIC[0]: apic_id 16, version 0, address 0xfecff000, GSI 0-2
ACPI: IOAPIC (id[0x0f] address[0xfec00000] gsi_base[3]) IOAPIC[1]: apic_id 15, version 0, address 0xfec00000, GSI 3-38
ACPI: IOAPIC (id[0x0e] address[0xfec01000] gsi_base[39]) IOAPIC[2]: apic_id 14, version 0, address 0xfec01000, GSI 39-74

As explained in the previous patch ("x86: Fix out of order gsi)

need to remap those gsis

This patch adds boot_ioapic_idx and gsi_to_irq/irq_to_gsi So we could make sure for those kind of system will have
irq: 0 - 15 for legacy irq
irq: 16 after will be gsi + 16

-v13: move gsi_to_irq/irq_to_gsi to acpi/boot.c

---
 arch/x86/include/asm/io_apic.h |    2 +-
 arch/x86/include/asm/mpspec.h  |   14 ++++++++
 arch/x86/kernel/acpi/boot.c    |   64 +++++++++++++++++++++++++++++------
 arch/x86/kernel/apic/io_apic.c |   72 +++++++++++++++++++++++++++++----------
 drivers/pnp/pnpacpi/rsparser.c |    4 ++
 5 files changed, 125 insertions(+), 31 deletions(-)
arch/x86/include/asm/io_apic.h +1 -1
index 35832a0..c4683b9 100644
@@ -158,7 +158,7 @@ extern int io_apic_get_redir_entries(int ioapic);
 struct io_apic_irq_attr;
 extern int io_apic_set_pci_routing(struct device *dev, int irq,
 		 struct io_apic_irq_attr *irq_attr);
-void setup_IO_APIC_irq_extra(u32 gsi);
+void setup_IO_APIC_irq_extra(u32 gsi, unsigned int *irq);
 extern int (*ioapic_renumber_irq)(int ioapic, int irq);
 extern void ioapic_init_mappings(void);
 extern void ioapic_insert_resources(void);
arch/x86/include/asm/mpspec.h +14 -0
index d8bf23a..1a221e0 100644
@@ -109,6 +109,9 @@ extern int acpi_probe_gsi(void);
 #ifdef CONFIG_X86_IO_APIC
 extern int mp_find_ioapic(int gsi);
 extern int mp_find_ioapic_pin(int ioapic, int gsi);
+extern int gsi_delta;
+int gsi_to_irq(unsigned int gsi);
+unsigned int irq_to_gsi(int irq);
 #endif
 #else /* !CONFIG_ACPI: */
 static inline int acpi_probe_gsi(void)
@@ -117,6 +120,17 @@ static inline int acpi_probe_gsi(void)
 }
 #endif /* CONFIG_ACPI */
 
+#if !defined(CONFIG_ACPI) || !defined(CONFIG_X86_IO_APIC)
+static inline int gsi_to_irq(unsigned int gsi)
+{
+	return gsi;
+}
+static inline unsigned int irq_to_gsi(int irq)
+{
+	return irq;
+}
+#endif
+
 #define PHYSID_ARRAY_SIZE	BITS_TO_LONGS(MAX_APICS)
 
 struct physid_mask {
arch/x86/kernel/acpi/boot.c +53 -11

138 lines not on this page · raw message

arch/x86/kernel/apic/io_apic.c +53 -19

150 lines not on this page · raw message

drivers/pnp/pnpacpi/rsparser.c +4 -0
index 54514aa..1dcf64d 100644
@@ -123,6 +123,10 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev,
 	}
 
 	flags = irq_flags(triggering, polarity, shareable);
+#ifdef CONFIG_X86
+	/* bus_irq or gsi ? */
+	gsi = irq_to_gsi(gsi);
+#endif
 	irq = acpi_register_gsi(&dev->dev, gsi, triggering, polarity);
 	if (irq >= 0)
 		pcibios_penalize_isa_irq(irq, 1);
Signature · 1 line
1.6.4.2
author
#61 lore raw

PATCH 9/20 x86: set nr_irqs_gsi only in probe_nr_irqs_gsi

In reply to Yinghai Lu

don't clear that in arch_early_irq_init

probe_nr_irqs_gsi is always called when ioapic is selected in config.

so even for mrst, print out from probe_nr_irqs_gsi is report correct nr_irqs_gsi

-v2: remove io_apic_irqs assignement, setup_IO_APIC will do that.

---
 arch/x86/kernel/apic/io_apic.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
arch/x86/kernel/apic/io_apic.c +2 -5
index 61b59ef..ba469f8 100644
@@ -153,11 +153,6 @@ int __init arch_early_irq_init(void)
 	int node;
 	int i;
 
-	if (!legacy_pic->nr_legacy_irqs) {
-		nr_irqs_gsi = 0;
-		io_apic_irqs = ~0UL;
-	}
-
 	cfg = irq_cfgx;
 	count = ARRAY_SIZE(irq_cfgx);
 	node= cpu_to_node(boot_cpu_id);
@@ -3938,6 +3933,8 @@ void __init probe_nr_irqs_gsi(void)
 {
 	int nr = 0;
 
+	nr_irqs_gsi = legacy_pic->nr_legacy_irqs;
+
 	nr = acpi_probe_gsi();
 	if (nr > nr_irqs_gsi) {
 		nr_irqs_gsi = nr;
Signature · 1 line
1.6.4.2
author
#62 lore raw

PATCH 10/20 x86: kill smpboot_hooks.h

In reply to Yinghai Lu

only one user, move it back to smpboot.c

remove smpboot_clear_io_apic, and only keep smpboot_clear_io_apic_irqs.

and check nr_legacy_irqs before clear it.

---
 arch/x86/include/asm/smpboot_hooks.h |   61 ----------------------------------
 arch/x86/kernel/smpboot.c            |   57 ++++++++++++++++++++++++++++++--
 2 files changed, 54 insertions(+), 64 deletions(-)
 delete mode 100644 arch/x86/include/asm/smpboot_hooks.h
arch/x86/include/asm/smpboot_hooks.h deleted +0 -61
deleted file mode 100644
index 1def601..0000000
@@ -1,61 +0,0 @@
-/* two abstractions specific to kernel/smpboot.c, mainly to cater to visws
- * which needs to alter them. */
-
-static inline void smpboot_clear_io_apic_irqs(void)
-{
-#ifdef CONFIG_X86_IO_APIC
-	io_apic_irqs = 0;
-#endif
-}
-
-static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
-{
-	CMOS_WRITE(0xa, 0xf);
-	local_flush_tlb();
-	pr_debug("1.\n");
-	*((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) =
-								 start_eip >> 4;
-	pr_debug("2.\n");
-	*((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_low)) =
-							 start_eip & 0xf;
-	pr_debug("3.\n");
-}
-
-static inline void smpboot_restore_warm_reset_vector(void)
-{
-	/*
-	 * Install writable page 0 entry to set BIOS data area.
-	 */
-	local_flush_tlb();
-
-	/*
-	 * Paranoid:  Set warm reset code and vector here back
-	 * to default values.
-	 */
-	CMOS_WRITE(0, 0xf);
-
-	*((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0;
-}
-
-static inline void __init smpboot_setup_io_apic(void)
-{
-#ifdef CONFIG_X86_IO_APIC
-	/*
-	 * Here we can be sure that there is an IO-APIC in the system. Let's
-	 * go and set it up:
-	 */
-	if (!skip_ioapic_setup && nr_ioapics)
-		setup_IO_APIC();
-	else {
-		nr_ioapics = 0;
-		localise_nmi_watchdog();
-	}
-#endif
-}
-
-static inline void smpboot_clear_io_apic(void)
-{
-#ifdef CONFIG_X86_IO_APIC
-	nr_ioapics = 0;
-#endif
-}
arch/x86/kernel/smpboot.c +54 -3

93 lines not on this page · raw message

Signature · 1 line
1.6.4.2
author
#63 lore raw

PATCH 11/20 x86: use vector_desc instead of vector_irq

In reply to Yinghai Lu

Eric pointed out that radix tree version of irq_to_desc will magnify delay on the path of handle_irq.

use vector_desc to reduce the calling of irq_to_desc.

next step: need to change all ack, mask, umask, eoi for all irq_chip to take irq_desc

-v2: irq should be unsigned in 32bit handle_irq according to Eric
also reset vector_desc for lguest in setup_irq
-v3: keep irq in x+execute_on_irq_stack() ...
-v4: update after legacy_pic

---
 arch/x86/include/asm/desc.h    |    2 +-
 arch/x86/include/asm/hw_irq.h  |   13 ++++---
 arch/x86/include/asm/irq.h     |    3 +-
 arch/x86/kernel/apic/io_apic.c |   77 +++++++++++++++++++++-------------------
 arch/x86/kernel/irq.c          |   15 ++++----
 arch/x86/kernel/irq_32.c       |   13 ++++---
 arch/x86/kernel/irq_64.c       |    7 +---
 arch/x86/kernel/irqinit.c      |   14 +++----
 arch/x86/kernel/smpboot.c      |    2 +-
 arch/x86/kernel/uv_irq.c       |    2 +-
 arch/x86/kernel/vmiclock_32.c  |    2 +-
 arch/x86/lguest/boot.c         |    7 +++-
 12 files changed, 82 insertions(+), 75 deletions(-)
arch/x86/include/asm/desc.h +1 -1
index 617bd56..25c5635 100644
@@ -334,7 +334,7 @@ static inline void set_intr_gate(unsigned int n, void *addr)
 }
 
 extern int first_system_vector;
-/* used_vectors is BITMAP for irq is not managed by percpu vector_irq */
+/* used_vectors is BITMAP for irq is not managed by percpu vector_desc */
 extern unsigned long used_vectors[];
 
 static inline void alloc_system_vector(int vector)
arch/x86/include/asm/hw_irq.h +7 -6
index 767d3f8..d23cf94 100644
@@ -97,7 +97,8 @@ struct irq_cfg {
 };
 
 extern struct irq_cfg *irq_cfg(unsigned int);
-extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
+int assign_irq_vector(struct irq_desc *, struct irq_cfg *,
+			 const struct cpumask *);
 extern void send_cleanup_vector(struct irq_cfg *);
 
 struct irq_desc;
@@ -136,18 +137,18 @@ extern asmlinkage void smp_invalidate_interrupt(struct pt_regs *);
 
 extern void (*__initconst interrupt[NR_VECTORS-FIRST_EXTERNAL_VECTOR])(void);
 
-typedef int vector_irq_t[NR_VECTORS];
-DECLARE_PER_CPU(vector_irq_t, vector_irq);
-extern void setup_vector_irq(int cpu);
+typedef struct irq_desc *vector_desc_t[NR_VECTORS];
+DECLARE_PER_CPU(vector_desc_t, vector_desc);
+extern void setup_vector_desc(int cpu);
 
 #ifdef CONFIG_X86_IO_APIC
 extern void lock_vector_lock(void);
 extern void unlock_vector_lock(void);
-extern void __setup_vector_irq(int cpu);
+extern void __setup_vector_desc(int cpu);
 #else
 static inline void lock_vector_lock(void) {}
 static inline void unlock_vector_lock(void) {}
-static inline void __setup_vector_irq(int cpu) {}
+static inline void __setup_vector_desc(int cpu) {}
 #endif
 
 #endif /* !ASSEMBLY_ */
arch/x86/include/asm/irq.h +2 -1
index 5458380..64c5f6f 100644
@@ -39,7 +39,8 @@ extern void irq_force_complete_move(int);
 
 extern void (*x86_platform_ipi_callback)(void);
 extern void native_init_IRQ(void);
-extern bool handle_irq(unsigned irq, struct pt_regs *regs);
+struct irq_desc;
+extern bool handle_irq(struct irq_desc *desc, struct pt_regs *regs);
 
 extern unsigned int do_IRQ(struct pt_regs *regs);
 
arch/x86/kernel/apic/io_apic.c +40 -37

237 lines not on this page · raw message

arch/x86/kernel/irq.c +7 -8
index 91fd0c7..f71625c 100644
@@ -229,19 +229,19 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
 
 	/* high bit used in ret_from_ code  */
 	unsigned vector = ~regs->orig_ax;
-	unsigned irq;
+	struct irq_desc *desc;
 
 	exit_idle();
 	irq_enter();
 
-	irq = __get_cpu_var(vector_irq)[vector];
+	desc = __get_cpu_var(vector_desc)[vector];
 
-	if (!handle_irq(irq, regs)) {
+	if (!handle_irq(desc, regs)) {
 		ack_APIC_irq();
 
 		if (printk_ratelimit())
-			pr_emerg("%s: %d.%d No irq handler for vector (irq %d)\n",
-				__func__, smp_processor_id(), vector, irq);
+			pr_emerg("%s: %d.%d No irq handler for vector\n",
+				__func__, smp_processor_id(), vector);
 	}
 
 	irq_exit();
@@ -348,14 +348,13 @@ void fixup_irqs(void)
 	for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; vector++) {
 		unsigned int irr;
 
-		if (__get_cpu_var(vector_irq)[vector] < 0)
+		if (__get_cpu_var(vector_desc)[vector] == NULL)
 			continue;
 
 		irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
 		if (irr  & (1 << (vector % 32))) {
-			irq = __get_cpu_var(vector_irq)[vector];
+			desc = __get_cpu_var(vector_desc)[vector];
 
-			desc = irq_to_desc(irq);
 			raw_spin_lock(&desc->lock);
 			if (desc->chip->retrigger)
 				desc->chip->retrigger(irq);
arch/x86/kernel/irq_32.c +8 -5
index 10709f2..f5daa3d 100644
@@ -76,7 +76,7 @@ static void call_on_stack(void *func, void *stack)
 }
 
 static inline int
-execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
+execute_on_irq_stack(int overflow, struct irq_desc *desc, unsigned int irq)
 {
 	union irq_ctx *curctx, *irqctx;
 	u32 *isp, arg1, arg2;
@@ -189,20 +189,23 @@ asmlinkage void do_softirq(void)
 
 #else
 static inline int
-execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq) { return 0; }
+execute_on_irq_stack(int overflow, struct irq_desc *desc, unsigned int irq)
+{
+	 return 0;
+}
 #endif
 
-bool handle_irq(unsigned irq, struct pt_regs *regs)
+bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
 {
-	struct irq_desc *desc;
 	int overflow;
+	unsigned int irq;
 
 	overflow = check_stack_overflow();
 
-	desc = irq_to_desc(irq);
 	if (unlikely(!desc))
 		return false;
 
+	irq = desc->irq;
 	if (!execute_on_irq_stack(overflow, desc, irq)) {
 		if (unlikely(overflow))
 			print_stack_overflow();
arch/x86/kernel/irq_64.c +2 -5
index acf8fbf..5e6e493 100644
@@ -48,17 +48,14 @@ static inline void stack_overflow_check(struct pt_regs *regs)
 #endif
 }
 
-bool handle_irq(unsigned irq, struct pt_regs *regs)
+bool handle_irq(struct irq_desc *desc, struct pt_regs *regs)
 {
-	struct irq_desc *desc;
-
 	stack_overflow_check(regs);
 
-	desc = irq_to_desc(irq);
 	if (unlikely(!desc))
 		return false;
 
-	generic_handle_irq_desc(irq, desc);
+	generic_handle_irq_desc(desc->irq, desc);
 	return true;
 }
 
arch/x86/kernel/irqinit.c +6 -8
index f01d390..7b77458 100644
@@ -83,16 +83,14 @@ static struct irqaction irq2 = {
 	.name = "cascade",
 };
 
-DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
-	[0 ... NR_VECTORS - 1] = -1,
-};
+DEFINE_PER_CPU(vector_desc_t, vector_desc);
 
 int vector_used_by_percpu_irq(unsigned int vector)
 {
 	int cpu;
 
 	for_each_online_cpu(cpu) {
-		if (per_cpu(vector_irq, cpu)[vector] != -1)
+		if (per_cpu(vector_desc, cpu)[vector] != NULL)
 			return 1;
 	}
 
@@ -136,7 +134,7 @@ void __init init_IRQ(void)
 	 * irq's migrate etc.
 	 */
 	for (i = 0; i < legacy_pic->nr_legacy_irqs; i++)
-		per_cpu(vector_irq, 0)[IRQ0_VECTOR + i] = i;
+		per_cpu(vector_desc, 0)[IRQ0_VECTOR + i] = irq_to_desc(i);
 
 	x86_init.irqs.intr_init();
 }
@@ -144,7 +142,7 @@ void __init init_IRQ(void)
 /*
  * Setup the vector to irq mappings.
  */
-void setup_vector_irq(int cpu)
+void setup_vector_desc(int cpu)
 {
 #ifndef CONFIG_X86_IO_APIC
 	int irq;
@@ -157,10 +155,10 @@ void setup_vector_irq(int cpu)
 	 * legacy vector to irq mapping:
 	 */
 	for (irq = 0; irq < legacy_pic->nr_legacy_irqs; irq++)
-		per_cpu(vector_irq, cpu)[IRQ0_VECTOR + irq] = irq;
+		per_cpu(vector_desc, cpu)[IRQ0_VECTOR + irq] = irq_to_desc(irq);
 #endif
 
-	__setup_vector_irq(cpu);
+	__setup_vector_desc(cpu);
 }
 
 static void __init smp_intr_init(void)
arch/x86/kernel/smpboot.c +1 -1
index ba43b3b..a1483ac 100644
@@ -246,7 +246,7 @@ static void __cpuinit smp_callin(void)
 	/*
 	 * Need to setup vector mappings before we enable interrupts.
 	 */
-	setup_vector_irq(smp_processor_id());
+	setup_vector_desc(smp_processor_id());
 	/*
 	 * Get our bogomips.
 	 *
arch/x86/kernel/uv_irq.c +1 -1
index 4c61f1b..44c430d 100644
@@ -158,7 +158,7 @@ arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
 
 	cfg = irq_cfg(irq);
 
-	err = assign_irq_vector(irq, cfg, eligible_cpu);
+	err = assign_irq_vector(desc, cfg, eligible_cpu);
 	if (err != 0)
 		return err;
 
arch/x86/kernel/vmiclock_32.c +1 -1
index 5e1ff66..fb65235 100644
@@ -236,7 +236,7 @@ void __init vmi_time_init(void)
 	vmi_time_init_clockevent();
 	setup_irq(0, &vmi_clock_action);
 	for_each_possible_cpu(cpu)
-		per_cpu(vector_irq, cpu)[vmi_get_timer_vector()] = 0;
+		per_cpu(vector_desc, cpu)[vmi_get_timer_vector()] = irq_to_desc(0);
 }
 
 #ifdef CONFIG_X86_LOCAL_APIC
arch/x86/lguest/boot.c +6 -1
index 8eb9eed..e0f6b26 100644
@@ -819,7 +819,7 @@ static void __init lguest_init_IRQ(void)
 
 	for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) {
 		/* Some systems map "vectors" to interrupts weirdly.  Not us! */
-		__get_cpu_var(vector_irq)[i] = i - FIRST_EXTERNAL_VECTOR;
+		__get_cpu_var(vector_desc)[i] = irq_to_desc(i - FIRST_EXTERNAL_VECTOR);
 		if (i != SYSCALL_VECTOR)
 			set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
 	}
@@ -842,6 +842,11 @@ static void __init lguest_init_IRQ(void)
 void lguest_setup_irq(unsigned int irq)
 {
 	irq_to_desc_alloc_node(irq, 0);
+	/*
+	 *  for sparseirq, we could get new desc other than legacy irq,
+	 *  so set vector_desc again for that irq
+	 */
+	__get_cpu_var(vector_desc)[irq + FIRST_EXTERNAL_VECTOR] = irq_to_desc(irq);
 	set_irq_chip_and_handler_name(irq, &lguest_irq_controller,
 				      handle_level_irq, "level");
 }
Signature · 1 line
1.6.4.2
author
#64 lore raw

PATCH 12/20 genericirq: change ack/mask in irq_chip to take irq_desc instead of irq -- x86 and core

In reply to Yinghai Lu

will have

void            (*ack)(struct irq_desc *desc);
void            (*mask)(struct irq_desc *desc);
void            (*mask_ack)(struct irq_desc *desc);
void            (*unmask)(struct irq_desc *desc);
void            (*eoi)(struct irq_desc *desc);

so for sparseirq with raidix tree, we don't call extra irq_to_desc, and could use desc directly

-v2: change all member of irq_chip to use desc only. -v2.1: update after legacy_pic
-v2.2: update to irq one short fix

---
 arch/alpha/include/asm/hardirq.h            |    3 +-
 arch/alpha/kernel/irq.c                     |    4 +-
 arch/arm/include/asm/hw_irq.h               |    3 +-
 arch/arm/kernel/irq.c                       |    2 +-
 arch/blackfin/include/asm/hardirq.h         |    3 +-
 arch/blackfin/kernel/irqchip.c              |    4 +-
 arch/frv/include/asm/hardirq.h              |    3 +-
 arch/ia64/hp/sim/hpsim_irq.c                |    6 +-
 arch/ia64/include/asm/hardirq.h             |    2 +-
 arch/ia64/kernel/iosapic.c                  |   41 ++++----
 arch/ia64/kernel/irq.c                      |   10 +-
 arch/ia64/kernel/irq_lsapic.c               |    8 +-
 arch/ia64/kernel/msi_ia64.c                 |   21 +++--
 arch/ia64/kernel/smpboot.c                  |    6 +-
 arch/ia64/sn/kernel/irq.c                   |   25 +++--
 arch/ia64/sn/kernel/msi_sn.c                |   12 ++-
 arch/mips/include/asm/hardirq.h             |    3 +-
 arch/mips/kernel/irq.c                      |    3 +-
 arch/mn10300/include/asm/hardirq.h          |    2 +-
 arch/mn10300/kernel/irq.c                   |    4 +-
 arch/powerpc/include/asm/hardirq.h          |    4 +-
 arch/sh/include/asm/hardirq.h               |    3 +-
 arch/sh/kernel/irq.c                        |    4 +-
 arch/sparc/include/asm/hardirq_64.h         |    3 +-
 arch/sparc/kernel/irq_64.c                  |    3 +-
 arch/um/kernel/irq.c                        |    2 +-
 arch/x86/include/asm/hardirq.h              |    2 +-
 arch/x86/include/asm/hpet.h                 |    8 +-
 arch/x86/include/asm/hw_irq.h               |    1 -
 arch/x86/include/asm/i8259.h                |    2 +-
 arch/x86/kernel/apic/io_apic.c              |  143 ++++++++++-----------------
 arch/x86/kernel/hpet.c                      |   16 ++--
 arch/x86/kernel/i8259.c                     |   31 ++++---
 arch/x86/kernel/irq.c                       |   12 +-
 arch/x86/kernel/uv_irq.c                    |   14 ++--
 arch/x86/kernel/visws_quirks.c              |   29 +++---
 arch/x86/kernel/vmiclock_32.c               |    8 +-
 arch/x86/lguest/boot.c                      |    8 +-
 arch/xtensa/include/asm/hardirq.h           |    3 +-
 arch/xtensa/kernel/irq.c                    |    4 +-
 drivers/dma/ipu/ipu_irq.c                   |   18 ++--
 drivers/gpio/langwell_gpio.c                |   11 +-
 drivers/gpio/pca953x.c                      |   23 +++--
 drivers/gpio/pl061.c                        |   19 ++--
 drivers/gpio/timbgpio.c                     |   17 ++--
 drivers/gpio/vr41xx_giu.c                   |   32 +++---
 drivers/infiniband/hw/ipath/ipath_iba6110.c |    2 +-
 drivers/mfd/asic3.c                         |   27 +++--
 drivers/mfd/ezx-pcap.c                      |   12 ++-
 drivers/mfd/htc-egpio.c                     |   12 ++-
 drivers/mfd/t7l66xb.c                       |    8 +-
 drivers/mfd/tc6393xb.c                      |   14 ++-
 drivers/mfd/twl4030-irq.c                   |   16 ++--
 drivers/mfd/wm831x-irq.c                    |   18 ++--
 drivers/misc/sgi-gru/grufile.c              |    2 +-
 drivers/parisc/dino.c                       |   12 +-
 drivers/parisc/eisa.c                       |   10 +-
 drivers/parisc/gsc.c                        |   12 +-
 drivers/parisc/iosapic.c                    |   16 ++-
 drivers/parisc/superio.c                    |   10 +-
 drivers/pci/dmar.c                          |   16 ++--
 drivers/pci/htirq.c                         |   22 ++--
 drivers/pci/msi.c                           |   13 ++-
 drivers/vlynq/vlynq.c                       |   23 +++--
 drivers/xen/events.c                        |   22 ++--
 include/asm-generic/hardirq.h               |    4 +-
 include/linux/dmar.h                        |    8 +-
 include/linux/htirq.h                       |   11 +-
 include/linux/irq.h                         |   49 +++++-----
 include/linux/msi.h                         |    4 +-
 kernel/irq/autoprobe.c                      |   12 +-
 kernel/irq/chip.c                           |   68 ++++++-------
 kernel/irq/handle.c                         |   24 ++---
 kernel/irq/internals.h                      |   16 ++--
 kernel/irq/manage.c                         |   67 ++++++-------
 kernel/irq/migration.c                      |   16 +--
 kernel/irq/pm.c                             |    4 +-
 kernel/irq/resend.c                         |    8 +-
 kernel/irq/spurious.c                       |    4 +-
 79 files changed, 585 insertions(+), 562 deletions(-)
arch/alpha/include/asm/hardirq.h +2 -1
index 242c09b..80f79f4 100644
@@ -1,7 +1,8 @@
 #ifndef _ALPHA_HARDIRQ_H
 #define _ALPHA_HARDIRQ_H
 
-void ack_bad_irq(unsigned int irq);
+struct irq_desc;
+void ack_bad_irq(struct irq_desc *desc);
 #define ack_bad_irq ack_bad_irq
 
 #include <asm-generic/hardirq.h>
arch/alpha/kernel/irq.c +2 -2
index 5f2cf23..08a6384 100644
@@ -33,10 +33,10 @@
 
 volatile unsigned long irq_err_count;
 
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
 	irq_err_count++;
-	printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", irq);
+	printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", desc->irq);
 }
 
 #ifdef CONFIG_SMP 
arch/arm/include/asm/hw_irq.h +2 -1
index 90831f6..43a8c03 100644
@@ -4,7 +4,8 @@
 #ifndef _ARCH_ARM_HW_IRQ_H
 #define _ARCH_ARM_HW_IRQ_H
 
-static inline void ack_bad_irq(int irq)
+struct irq_desc;
+static inline void ack_bad_irq(struct irq_desc *desc)
 {
 	extern unsigned long irq_err_count;
 	irq_err_count++;
arch/arm/kernel/irq.c +1 -1
index b7cb45b..265e78c 100644
@@ -116,7 +116,7 @@ asmlinkage void __exception asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
 	if (unlikely(irq >= NR_IRQS)) {
 		if (printk_ratelimit())
 			printk(KERN_WARNING "Bad IRQ%u\n", irq);
-		ack_bad_irq(irq);
+		ack_bad_irq(irq_to_desc(irq));
 	} else {
 		generic_handle_irq(irq);
 	}
arch/blackfin/include/asm/hardirq.h +2 -1
index c078dd7..e5ed5d5 100644
@@ -9,7 +9,8 @@
 
 #define __ARCH_IRQ_EXIT_IRQS_DISABLED	1
 
-extern void ack_bad_irq(unsigned int irq);
+struct irq_desc;
+extern void ack_bad_irq(struct irq_desc *desc);
 #define ack_bad_irq ack_bad_irq
 
 /* Define until common code gets sane defaults */
arch/blackfin/kernel/irqchip.c +2 -2
index 64cff54..707a93b 100644
@@ -15,10 +15,10 @@
 #include <asm/pda.h>
 
 static atomic_t irq_err_count;
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
 	atomic_inc(&irq_err_count);
-	printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
+	printk(KERN_ERR "IRQ: spurious interrupt %d\n", desc->irq);
 }
 
 static struct irq_desc bad_irq_desc = {
arch/frv/include/asm/hardirq.h +2 -1
index 5fc8b6f..2c49141 100644
@@ -14,8 +14,9 @@
 
 #include <asm/atomic.h>
 
+struct irq_desc;
 extern atomic_t irq_err_count;
-static inline void ack_bad_irq(int irq)
+static inline void ack_bad_irq(struct irq_desc *desc)
 {
 	atomic_inc(&irq_err_count);
 }
arch/ia64/hp/sim/hpsim_irq.c +3 -3
index b272261..de7c5d1 100644
@@ -11,18 +11,18 @@
 #include <linux/irq.h>
 
 static unsigned int
-hpsim_irq_startup (unsigned int irq)
+hpsim_irq_startup(struct irq_desc *desc)
 {
 	return 0;
 }
 
 static void
-hpsim_irq_noop (unsigned int irq)
+hpsim_irq_noop(struct irq_desc *desc)
 {
 }
 
 static int
-hpsim_set_affinity_noop(unsigned int a, const struct cpumask *b)
+hpsim_set_affinity_noop(struct irq_desc *desc, const struct cpumask *b)
 {
 	return 0;
 }
arch/ia64/include/asm/hardirq.h +1 -1
index d514cd9..cc9950b 100644
@@ -22,6 +22,6 @@
 
 extern void __iomem *ipi_base_addr;
 
-void ack_bad_irq(unsigned int irq);
+void ack_bad_irq(struct irq_desc *desc);
 
 #endif /* _ASM_IA64_HARDIRQ_H */
arch/ia64/kernel/iosapic.c +22 -19

116 lines not on this page · raw message

arch/ia64/kernel/irq.c +5 -5
index 94ee9d0..d4fe756 100644
@@ -27,9 +27,9 @@
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
  */
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
-	printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", irq, smp_processor_id());
+	printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", desc->irq, smp_processor_id());
 }
 
 #ifdef CONFIG_IA64_GENERIC
@@ -162,10 +162,10 @@ static void migrate_irqs(void)
 			 */
 			if (desc->chip && desc->chip->disable &&
 				desc->chip->enable && desc->chip->set_affinity) {
-				desc->chip->disable(irq);
-				desc->chip->set_affinity(irq,
+				desc->chip->disable(desc);
+				desc->chip->set_affinity(desc,
 							 cpumask_of(new_cpu));
-				desc->chip->enable(irq);
+				desc->chip->enable(desc);
 			} else {
 				WARN_ON((!(desc->chip) || !(desc->chip->disable) ||
 						!(desc->chip->enable) ||
arch/ia64/kernel/irq_lsapic.c +5 -3
index fc1549d..438641a 100644
@@ -15,19 +15,21 @@
 #include <linux/irq.h>
 
 static unsigned int
-lsapic_noop_startup (unsigned int irq)
+lsapic_noop_startup(struct irq_desc *desc)
 {
 	return 0;
 }
 
 static void
-lsapic_noop (unsigned int irq)
+lsapic_noop(struct irq_desc *desc)
 {
 	/* nothing to do... */
 }
 
-static int lsapic_retrigger(unsigned int irq)
+static int lsapic_retrigger(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	ia64_resend_irq(irq);
 
 	return 1;
arch/ia64/kernel/msi_ia64.c +13 -8
index 6c89228..d33f88c 100644
@@ -12,9 +12,10 @@
 static struct irq_chip	ia64_msi_chip;
 
 #ifdef CONFIG_SMP
-static int ia64_set_msi_irq_affinity(unsigned int irq,
+static int ia64_set_msi_irq_affinity(struct irq_desc *desc,
 				      const cpumask_t *cpu_mask)
 {
+	unsigned int irq = desc->irq;
 	struct msi_msg msg;
 	u32 addr, data;
 	int cpu = first_cpu(*cpu_mask);
@@ -38,7 +39,7 @@ static int ia64_set_msi_irq_affinity(unsigned int irq,
 	msg.data = data;
 
 	write_msi_msg(irq, &msg);
-	cpumask_copy(irq_desc[irq].affinity, cpumask_of(cpu));
+	cpumask_copy(desc->affinity, cpumask_of(cpu));
 
 	return 0;
 }
@@ -84,15 +85,17 @@ void ia64_teardown_msi_irq(unsigned int irq)
 	destroy_irq(irq);
 }
 
-static void ia64_ack_msi_irq(unsigned int irq)
+static void ia64_ack_msi_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq_complete_move(irq);
-	move_native_irq(irq);
+	move_native_irq(desc);
 	ia64_eoi();
 }
 
-static int ia64_msi_retrigger_irq(unsigned int irq)
+static int ia64_msi_retrigger_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int vector = irq_to_vector(irq);
 	ia64_resend_irq(vector);
 
@@ -132,8 +135,9 @@ void arch_teardown_msi_irq(unsigned int irq)
 
 #ifdef CONFIG_DMAR
 #ifdef CONFIG_SMP
-static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
+static int dmar_msi_set_affinity(struct irq_desc *desc, const struct cpumask *mask)
 {
+	unsigned int irq = desc->irq;
 	struct irq_cfg *cfg = irq_cfg + irq;
 	struct msi_msg msg;
 	int cpu = cpumask_first(mask);
@@ -152,7 +156,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
 	msg.address_lo |= MSI_ADDR_DEST_ID_CPU(cpu_physical_id(cpu));
 
 	dmar_msi_write(irq, &msg);
-	cpumask_copy(irq_desc[irq].affinity, mask);
+	cpumask_copy(desc->affinity, mask);
 
 	return 0;
 }
@@ -198,11 +202,12 @@ int arch_setup_dmar_msi(unsigned int irq)
 {
 	int ret;
 	struct msi_msg msg;
+	struct irq_desc *desc = irq_to_desc(irq);
 
 	ret = msi_compose_msg(NULL, irq, &msg);
 	if (ret < 0)
 		return ret;
-	dmar_msi_write(irq, &msg);
+	dmar_msi_write(desc, &msg);
 	set_irq_chip_and_handler_name(irq, &dmar_msi_type, handle_edge_irq,
 		"edge");
 	return 0;
arch/ia64/kernel/smpboot.c +3 -3
index e5230b2..7241118 100644
@@ -696,9 +696,9 @@ int migrate_platform_irqs(unsigned int cpu)
 			 * polling before making changes.
 			 */
 			if (desc) {
-				desc->chip->disable(ia64_cpe_irq);
-				desc->chip->set_affinity(ia64_cpe_irq, mask);
-				desc->chip->enable(ia64_cpe_irq);
+				desc->chip->disable(desc);
+				desc->chip->set_affinity(desc, mask);
+				desc->chip->enable(desc);
 				printk ("Re-targetting CPEI to cpu %d\n", new_cpei_cpu);
 			}
 		}
arch/ia64/sn/kernel/irq.c +15 -10
index 40d6eed..78bf9c3 100644
@@ -77,31 +77,34 @@ u64 sn_intr_redirect(nasid_t local_nasid, int local_widget,
 	return ret_stuff.status;
 }
 
-static unsigned int sn_startup_irq(unsigned int irq)
+static unsigned int sn_startup_irq(struct irq_desc *desc)
 {
 	return 0;
 }
 
-static void sn_shutdown_irq(unsigned int irq)
+static void sn_shutdown_irq(struct irq_desc *desc)
 {
 }
 
 extern void ia64_mca_register_cpev(int);
 
-static void sn_disable_irq(unsigned int irq)
+static void sn_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	if (irq == local_vector_to_irq(IA64_CPE_VECTOR))
 		ia64_mca_register_cpev(0);
 }
 
-static void sn_enable_irq(unsigned int irq)
+static void sn_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	if (irq == local_vector_to_irq(IA64_CPE_VECTOR))
 		ia64_mca_register_cpev(irq);
 }
 
-static void sn_ack_irq(unsigned int irq)
+static void sn_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u64 event_occurred, mask;
 
 	irq = irq & 0xff;
@@ -110,11 +113,12 @@ static void sn_ack_irq(unsigned int irq)
 	HUB_S((u64*)LOCAL_MMR_ADDR(SH_EVENT_OCCURRED_ALIAS), mask);
 	__set_bit(irq, (volatile void *)pda->sn_in_service_ivecs);
 
-	move_native_irq(irq);
+	move_native_irq(desc);
 }
 
-static void sn_end_irq(unsigned int irq)
+static void sn_end_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int ivec;
 	u64 event_occurred;
 
@@ -227,8 +231,9 @@ finish_up:
 	return new_irq_info;
 }
 
-static int sn_set_affinity_irq(unsigned int irq, const struct cpumask *mask)
+static int sn_set_affinity_irq(struct irq_desc *desc, const struct cpumask *mask)
 {
+	unsigned int irq = desc->irq;
 	struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;
 	nasid_t nasid;
 	int slice;
@@ -258,12 +263,12 @@ void sn_set_err_irq_affinity(unsigned int irq) { }
 #endif
 
 static void
-sn_mask_irq(unsigned int irq)
+sn_mask_irq(struct irq_desc *desc)
 {
 }
 
 static void
-sn_unmask_irq(unsigned int irq)
+sn_unmask_irq(struct irq_desc *desc)
 {
 }
 
arch/ia64/sn/kernel/msi_sn.c +7 -5
index fbbfb97..df63df0 100644
@@ -151,9 +151,10 @@ int sn_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *entry)
 }
 
 #ifdef CONFIG_SMP
-static int sn_set_msi_irq_affinity(unsigned int irq,
+static int sn_set_msi_irq_affinity(struct irq_desc *desc,
 				    const struct cpumask *cpu_mask)
 {
+	unsigned int irq = desc->irq;
 	struct msi_msg msg;
 	int slice;
 	nasid_t nasid;
@@ -205,20 +206,21 @@ static int sn_set_msi_irq_affinity(unsigned int irq,
 	msg.address_lo = (u32)(bus_addr & 0x00000000ffffffff);
 
 	write_msi_msg(irq, &msg);
-	cpumask_copy(irq_desc[irq].affinity, cpu_mask);
+	cpumask_copy(desc->affinity, cpu_mask);
 
 	return 0;
 }
 #endif /* CONFIG_SMP */
 
-static void sn_ack_msi_irq(unsigned int irq)
+static void sn_ack_msi_irq(struct irq_desc *desc)
 {
-	move_native_irq(irq);
+	move_native_irq(desc);
 	ia64_eoi();
 }
 
-static int sn_msi_retrigger_irq(unsigned int irq)
+static int sn_msi_retrigger_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int vector = irq;
 	ia64_resend_irq(vector);
 
arch/mips/include/asm/hardirq.h +2 -1
index c977a86..a230b5e 100644
@@ -10,7 +10,8 @@
 #ifndef _ASM_HARDIRQ_H
 #define _ASM_HARDIRQ_H
 
-extern void ack_bad_irq(unsigned int irq);
+struct irq_desc;
+extern void ack_bad_irq(struct irq_desc *desc);
 #define ack_bad_irq ack_bad_irq
 
 #include <asm-generic/hardirq.h>
arch/mips/kernel/irq.c +2 -1
index 981f86c..619db4a 100644
@@ -74,8 +74,9 @@ void free_irqno(unsigned int irq)
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
  */
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	smtc_im_ack_irq(irq);
 	printk("unexpected IRQ # %d\n", irq);
 }
arch/mn10300/include/asm/hardirq.h +1 -1
index 54d9501..725a812 100644
@@ -26,7 +26,7 @@ typedef struct {
 
 #include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */
 
-extern void ack_bad_irq(int irq);
+extern void ack_bad_irq(struct irq_desc *desc);
 
 /*
  * manipulate stubs in the MN10300 CPU Trap/Interrupt Vector table
arch/mn10300/kernel/irq.c +2 -2
index e2d5ed8..bc98665 100644
@@ -100,9 +100,9 @@ static struct irq_chip mn10300_cpu_pic_edge = {
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
  */
-void ack_bad_irq(int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
-	printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", irq);
+	printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", desc->irq);
 }
 
 /*
arch/powerpc/include/asm/hardirq.h +2 -2
index 3147a29..945c7d2 100644
@@ -18,9 +18,9 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 
 #define local_softirq_pending()	__get_cpu_var(irq_stat).__softirq_pending
 
-static inline void ack_bad_irq(unsigned int irq)
+static inline void ack_bad_irq(struct irq_desc *desc)
 {
-	printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
+	printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", desc->irq);
 }
 
 extern u64 arch_irq_stat_cpu(unsigned int cpu);
arch/sh/include/asm/hardirq.h +2 -1
index 48b1913..c5c08c8 100644
@@ -11,6 +11,7 @@ typedef struct {
 
 #include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */
 
-extern void ack_bad_irq(unsigned int irq);
+struct irq_desc;
+extern void ack_bad_irq(struct irq_desc *desc);
 
 #endif /* __ASM_SH_HARDIRQ_H */
arch/sh/kernel/irq.c +2 -2
index d2d41d0..556e3d3 100644
@@ -25,10 +25,10 @@ atomic_t irq_err_count;
  * each architecture has to answer this themselves, it doesn't deserve
  * a generic callback i think.
  */
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
 	atomic_inc(&irq_err_count);
-	printk("unexpected IRQ trap at vector %02x\n", irq);
+	printk("unexpected IRQ trap at vector %02x\n", desc->irq);
 }
 
 #if defined(CONFIG_PROC_FS)
arch/sparc/include/asm/hardirq_64.h +2 -1
index 7c29fd1..6601974 100644
@@ -12,7 +12,8 @@
 #define local_softirq_pending() \
 	(local_cpu_data().__softirq_pending)
 
-void ack_bad_irq(unsigned int irq);
+struct irq_desc;
+void ack_bad_irq(struct irq_desc *desc);
 
 #define HARDIRQ_BITS	8
 
arch/sparc/kernel/irq_64.c +2 -1
index e1cbdb9..4e7419c 100644
@@ -689,8 +689,9 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
 	return virt_irq;
 }
 
-void ack_bad_irq(unsigned int virt_irq)
+void ack_bad_irq(struct irq_desc_desc *desc)
 {
+	unsigned int virt_irq = desc->irq;
 	unsigned int ino = virt_irq_table[virt_irq].dev_ino;
 
 	if (!ino)
arch/um/kernel/irq.c +1 -1
index 89474ba..2c21218 100644
@@ -362,7 +362,7 @@ EXPORT_SYMBOL(reactivate_fd);
  * irq_chip must define (startup || enable) &&
  * (shutdown || disable) && end
  */
-static void dummy(unsigned int irq)
+static void dummy(struct irq_desc *desc)
 {
 }
 
arch/x86/include/asm/hardirq.h +1 -1
index 0f85764..9b4b8f3 100644
@@ -44,7 +44,7 @@ DECLARE_PER_CPU_SHARED_ALIGNED(irq_cpustat_t, irq_stat);
 #define set_softirq_pending(x)	percpu_write(irq_stat.__softirq_pending, (x))
 #define or_softirq_pending(x)	percpu_or(irq_stat.__softirq_pending, (x))
 
-extern void ack_bad_irq(unsigned int irq);
+extern void ack_bad_irq(struct irq_desc *desc);
 
 extern u64 arch_irq_stat_cpu(unsigned int cpu);
 #define arch_irq_stat_cpu	arch_irq_stat_cpu
arch/x86/include/asm/hpet.h +4 -4
index 1d5c08a..16c2257 100644
@@ -74,10 +74,10 @@ extern void hpet_disable(void);
 extern unsigned int hpet_readl(unsigned int a);
 extern void force_hpet_resume(void);
 
-extern void hpet_msi_unmask(unsigned int irq);
-extern void hpet_msi_mask(unsigned int irq);
-extern void hpet_msi_write(unsigned int irq, struct msi_msg *msg);
-extern void hpet_msi_read(unsigned int irq, struct msi_msg *msg);
+extern void hpet_msi_unmask(struct irq_desc *);
+extern void hpet_msi_mask(struct irq_desc *);
+extern void hpet_msi_write(struct irq_desc *desc, struct msi_msg *msg);
+extern void hpet_msi_read(struct irq_desc *desc, struct msi_msg *msg);
 
 #ifdef CONFIG_PCI_MSI
 extern int arch_setup_hpet_msi(unsigned int irq, unsigned int id);
arch/x86/include/asm/hw_irq.h +0 -1
index d23cf94..2417e29 100644
@@ -96,7 +96,6 @@ struct irq_cfg {
 	u8			move_in_progress : 1;
 };
 
-extern struct irq_cfg *irq_cfg(unsigned int);
 int assign_irq_vector(struct irq_desc *, struct irq_cfg *,
 			 const struct cpumask *);
 extern void send_cleanup_vector(struct irq_cfg *);
arch/x86/include/asm/i8259.h +1 -1
index 1655147..0b2ad6f 100644
@@ -58,7 +58,7 @@ struct legacy_pic {
 	void (*mask_all)(void);
 	void (*restore_mask)(void);
 	void (*init)(int auto_eoi);
-	int (*irq_pending)(unsigned int irq);
+	int (*irq_pending)(struct irq_desc *desc);
 	void (*make_irq)(unsigned int irq);
 };
 
arch/x86/kernel/apic/io_apic.c +54 -89

430 lines not on this page · raw message

arch/x86/kernel/hpet.c +8 -8
index ee4fa1b..3355b99 100644
@@ -426,9 +426,9 @@ static int hpet_legacy_next_event(unsigned long delta,
 static DEFINE_PER_CPU(struct hpet_dev *, cpu_hpet_dev);
 static struct hpet_dev	*hpet_devs;
 
-void hpet_msi_unmask(unsigned int irq)
+void hpet_msi_unmask(struct irq_desc *desc)
 {
-	struct hpet_dev *hdev = get_irq_data(irq);
+	struct hpet_dev *hdev = get_irq_desc_data(desc);
 	unsigned int cfg;
 
 	/* unmask it */
@@ -437,10 +437,10 @@ void hpet_msi_unmask(unsigned int irq)
 	hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
 }
 
-void hpet_msi_mask(unsigned int irq)
+void hpet_msi_mask(struct irq_desc *desc)
 {
 	unsigned int cfg;
-	struct hpet_dev *hdev = get_irq_data(irq);
+	struct hpet_dev *hdev = get_irq_desc_data(desc);
 
 	/* mask it */
 	cfg = hpet_readl(HPET_Tn_CFG(hdev->num));
@@ -448,17 +448,17 @@ void hpet_msi_mask(unsigned int irq)
 	hpet_writel(cfg, HPET_Tn_CFG(hdev->num));
 }
 
-void hpet_msi_write(unsigned int irq, struct msi_msg *msg)
+void hpet_msi_write(struct irq_desc *desc, struct msi_msg *msg)
 {
-	struct hpet_dev *hdev = get_irq_data(irq);
+	struct hpet_dev *hdev = get_irq_desc_data(desc);
 
 	hpet_writel(msg->data, HPET_Tn_ROUTE(hdev->num));
 	hpet_writel(msg->address_lo, HPET_Tn_ROUTE(hdev->num) + 4);
 }
 
-void hpet_msi_read(unsigned int irq, struct msi_msg *msg)
+void hpet_msi_read(struct irq_desc *desc, struct msi_msg *msg)
 {
-	struct hpet_dev *hdev = get_irq_data(irq);
+	struct hpet_dev *hdev = get_irq_desc_data(desc);
 
 	msg->data = hpet_readl(HPET_Tn_ROUTE(hdev->num));
 	msg->address_lo = hpet_readl(HPET_Tn_ROUTE(hdev->num) + 4);
arch/x86/kernel/i8259.c +18 -13
index fb725ee..b248555 100644
@@ -33,13 +33,13 @@
 
 static int i8259A_auto_eoi;
 DEFINE_RAW_SPINLOCK(i8259A_lock);
-static void mask_and_ack_8259A(unsigned int);
+static void mask_and_ack_8259A(struct irq_desc *desc);
 static void mask_8259A(void);
 static void unmask_8259A(void);
-static void disable_8259A_irq(unsigned int irq);
-static void enable_8259A_irq(unsigned int irq);
+static void disable_8259A_irq(struct irq_desc *desc);
+static void enable_8259A_irq(struct irq_desc *desc);
 static void init_8259A(int auto_eoi);
-static int i8259A_irq_pending(unsigned int irq);
+static int i8259A_irq_pending(struct irq_desc *desc);
 
 struct irq_chip i8259A_chip = {
 	.name		= "XT-PIC",
@@ -69,8 +69,9 @@ unsigned int cached_irq_mask = 0xffff;
  */
 unsigned long io_apic_irqs;
 
-static void disable_8259A_irq(unsigned int irq)
+static void disable_8259A_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << irq;
 	unsigned long flags;
 
@@ -83,8 +84,9 @@ static void disable_8259A_irq(unsigned int irq)
 	raw_spin_unlock_irqrestore(&i8259A_lock, flags);
 }
 
-static void enable_8259A_irq(unsigned int irq)
+static void enable_8259A_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = ~(1 << irq);
 	unsigned long flags;
 
@@ -97,8 +99,9 @@ static void enable_8259A_irq(unsigned int irq)
 	raw_spin_unlock_irqrestore(&i8259A_lock, flags);
 }
 
-static int i8259A_irq_pending(unsigned int irq)
+static int i8259A_irq_pending(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1<<irq;
 	unsigned long flags;
 	int ret;
@@ -151,8 +154,9 @@ static inline int i8259A_irq_real(unsigned int irq)
  * first, _then_ send the EOI, and the order of EOI
  * to the two 8259s is important!
  */
-static void mask_and_ack_8259A(unsigned int irq)
+static void mask_and_ack_8259A(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int irqmask = 1 << irq;
 	unsigned long flags;
 
@@ -372,17 +376,18 @@ static void init_8259A(int auto_eoi)
  */
 
 static void legacy_pic_noop(void) { };
+static void legacy_pic_desc_noop(struct irq_desc *desc) { };
 static void legacy_pic_uint_noop(unsigned int unused) { };
 static void legacy_pic_int_noop(int unused) { };
 
 static struct irq_chip dummy_pic_chip  = {
 	.name = "dummy pic",
-	.mask = legacy_pic_uint_noop,
-	.unmask = legacy_pic_uint_noop,
-	.disable = legacy_pic_uint_noop,
-	.mask_ack = legacy_pic_uint_noop,
+	.mask = legacy_pic_desc_noop,
+	.unmask = legacy_pic_desc_noop,
+	.disable = legacy_pic_desc_noop,
+	.mask_ack = legacy_pic_desc_noop,
 };
-static int legacy_pic_irq_pending_noop(unsigned int irq)
+static int legacy_pic_irq_pending_noop(struct irq_desc *desc)
 {
 	return 0;
 }
arch/x86/kernel/irq.c +6 -6
index f71625c..ae70844 100644
@@ -24,10 +24,10 @@ void (*x86_platform_ipi_callback)(void) = NULL;
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
  */
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
 	if (printk_ratelimit())
-		pr_err("unexpected IRQ trap at vector %02x\n", irq);
+		pr_err("unexpected IRQ trap at irq %02x\n", desc->irq);
 
 	/*
 	 * Currently unexpected vectors happen only on SMP and APIC.
@@ -316,15 +316,15 @@ void fixup_irqs(void)
 		}
 
 		if (!(desc->status & IRQ_MOVE_PCNTXT) && desc->chip->mask)
-			desc->chip->mask(irq);
+			desc->chip->mask(desc);
 
 		if (desc->chip->set_affinity)
-			desc->chip->set_affinity(irq, affinity);
+			desc->chip->set_affinity(desc, affinity);
 		else if (!(warned++))
 			set_affinity = 0;
 
 		if (!(desc->status & IRQ_MOVE_PCNTXT) && desc->chip->unmask)
-			desc->chip->unmask(irq);
+			desc->chip->unmask(desc);
 
 		raw_spin_unlock(&desc->lock);
 
@@ -357,7 +357,7 @@ void fixup_irqs(void)
 
 			raw_spin_lock(&desc->lock);
 			if (desc->chip->retrigger)
-				desc->chip->retrigger(irq);
+				desc->chip->retrigger(desc);
 			raw_spin_unlock(&desc->lock);
 		}
 	}
arch/x86/kernel/uv_irq.c +7 -7
index 44c430d..2b601d3 100644
@@ -27,18 +27,18 @@ struct uv_irq_2_mmr_pnode{
 static spinlock_t		uv_irq_lock;
 static struct rb_root		uv_irq_root;
 
-static int uv_set_irq_affinity(unsigned int, const struct cpumask *);
+static int uv_set_irq_affinity(struct irq_desc *desc, const struct cpumask *);
 
-static void uv_noop(unsigned int irq)
+static void uv_noop(struct irq_desc *desc)
 {
 }
 
-static unsigned int uv_noop_ret(unsigned int irq)
+static unsigned int uv_noop_ret(struct irq_desc *desc)
 {
 	return 0;
 }
 
-static void uv_ack_apic(unsigned int irq)
+static void uv_ack_apic(struct irq_desc *desc)
 {
 	ack_APIC_irq();
 }
@@ -156,7 +156,7 @@ arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
 	BUILD_BUG_ON(sizeof(struct uv_IO_APIC_route_entry) !=
 			sizeof(unsigned long));
 
-	cfg = irq_cfg(irq);
+	cfg = desc->chip_data;
 
 	err = assign_irq_vector(desc, cfg, eligible_cpu);
 	if (err != 0)
@@ -208,9 +208,9 @@ static void arch_disable_uv_irq(int mmr_pnode, unsigned long mmr_offset)
 	uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value);
 }
 
-static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask)
+static int uv_set_irq_affinity(struct irq_desc *desc, const struct cpumask *mask)
 {
-	struct irq_desc *desc = irq_to_desc(irq);
+	unsigned int irq = desc->irq;
 	struct irq_cfg *cfg = desc->chip_data;
 	unsigned int dest;
 	unsigned long mmr_value;
arch/x86/kernel/visws_quirks.c +14 -15
index e680ea5..8bd5075 100644
@@ -430,14 +430,15 @@ static int is_co_apic(unsigned int irq)
  * This is the SGI Cobalt (IO-)APIC:
  */
 
-static void enable_cobalt_irq(unsigned int irq)
+static void enable_cobalt_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	co_apic_set(is_co_apic(irq), irq);
 }
 
-static void disable_cobalt_irq(unsigned int irq)
+static void disable_cobalt_irq(struct irq_desc *desc)
 {
-	int entry = is_co_apic(irq);
+	int entry = is_co_apic(desc->irq);
 
 	co_apic_write(CO_APIC_LO(entry), CO_APIC_MASK);
 	co_apic_read(CO_APIC_LO(entry));
@@ -448,37 +449,35 @@ static void disable_cobalt_irq(unsigned int irq)
  * map this to the Cobalt APIC entry where it's physically wired.
  * This is called via request_irq -> setup_irq -> irq_desc->startup()
  */
-static unsigned int startup_cobalt_irq(unsigned int irq)
+static unsigned int startup_cobalt_irq(struct irq_desc *desc)
 {
 	unsigned long flags;
-	struct irq_desc *desc = irq_to_desc(irq);
 
 	spin_lock_irqsave(&cobalt_lock, flags);
 	if ((desc->status & (IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING)))
 		desc->status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_WAITING);
-	enable_cobalt_irq(irq);
+	enable_cobalt_irq(desc);
 	spin_unlock_irqrestore(&cobalt_lock, flags);
 	return 0;
 }
 
-static void ack_cobalt_irq(unsigned int irq)
+static void ack_cobalt_irq(struct irq_desc *desc)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(&cobalt_lock, flags);
-	disable_cobalt_irq(irq);
+	disable_cobalt_irq(desc);
 	apic_write(APIC_EOI, APIC_EIO_ACK);
 	spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
-static void end_cobalt_irq(unsigned int irq)
+static void end_cobalt_irq(struct irq_desc *desc)
 {
 	unsigned long flags;
-	struct irq_desc *desc = irq_to_desc(irq);
 
 	spin_lock_irqsave(&cobalt_lock, flags);
 	if (!(desc->status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-		enable_cobalt_irq(irq);
+		enable_cobalt_irq(desc);
 	spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
@@ -503,19 +502,19 @@ static struct irq_chip cobalt_irq_type = {
  * interrupt controller type, and through a special virtual interrupt-
  * controller. Device drivers only see the virtual interrupt sources.
  */
-static unsigned int startup_piix4_master_irq(unsigned int irq)
+static unsigned int startup_piix4_master_irq(struct irq_desc *desc)
 {
 	legacy_pic->init(0);
 
-	return startup_cobalt_irq(irq);
+	return startup_cobalt_irq(desc);
 }
 
-static void end_piix4_master_irq(unsigned int irq)
+static void end_piix4_master_irq(struct irq_desc *desc)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(&cobalt_lock, flags);
-	enable_cobalt_irq(irq);
+	enable_cobalt_irq(desc);
 	spin_unlock_irqrestore(&cobalt_lock, flags);
 }
 
arch/x86/kernel/vmiclock_32.c +4 -4
index fb65235..41257f6 100644
@@ -84,7 +84,7 @@ static inline unsigned int vmi_get_timer_vector(void)
 
 /** vmi clockchip */
 #ifdef CONFIG_X86_LOCAL_APIC
-static unsigned int startup_timer_irq(unsigned int irq)
+static unsigned int startup_timer_irq(struct irq_desc *desc)
 {
 	unsigned long val = apic_read(APIC_LVTT);
 	apic_write(APIC_LVTT, vmi_get_timer_vector());
@@ -92,19 +92,19 @@ static unsigned int startup_timer_irq(unsigned int irq)
 	return (val & APIC_SEND_PENDING);
 }
 
-static void mask_timer_irq(unsigned int irq)
+static void mask_timer_irq(struct irq_desc *desc)
 {
 	unsigned long val = apic_read(APIC_LVTT);
 	apic_write(APIC_LVTT, val | APIC_LVT_MASKED);
 }
 
-static void unmask_timer_irq(unsigned int irq)
+static void unmask_timer_irq(struct irq_desc *desc)
 {
 	unsigned long val = apic_read(APIC_LVTT);
 	apic_write(APIC_LVTT, val & ~APIC_LVT_MASKED);
 }
 
-static void ack_timer_irq(unsigned int irq)
+static void ack_timer_irq(struct irq_desc *desc)
 {
 	ack_APIC_irq();
 }
arch/x86/lguest/boot.c +4 -4
index e0f6b26..be7a653 100644
@@ -789,14 +789,14 @@ static void lguest_flush_tlb_kernel(void)
  * simple as setting a bit.  We don't actually "ack" interrupts as such, we
  * just mask and unmask them.  I wonder if we should be cleverer?
  */
-static void disable_lguest_irq(unsigned int irq)
+static void disable_lguest_irq(struct irq_desc *desc)
 {
-	set_bit(irq, lguest_data.blocked_interrupts);
+	set_bit(desc->irq, lguest_data.blocked_interrupts);
 }
 
-static void enable_lguest_irq(unsigned int irq)
+static void enable_lguest_irq(struct irq_desc *desc)
 {
-	clear_bit(irq, lguest_data.blocked_interrupts);
+	clear_bit(desc->irq, lguest_data.blocked_interrupts);
 }
 
 /* This structure describes the lguest IRQ controller. */
arch/xtensa/include/asm/hardirq.h +2 -1
index 87cb19d..f0230ff 100644
@@ -22,7 +22,8 @@ typedef struct {
 	unsigned int __nmi_count;	       /* arch dependent */
 } ____cacheline_aligned irq_cpustat_t;
 
-void ack_bad_irq(unsigned int irq);
+struct irq_desc;
+void ack_bad_irq(struct irq_desc *desc);
 #include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */
 
 #endif	/* _XTENSA_HARDIRQ_H */
arch/xtensa/kernel/irq.c +2 -2
index 8cd3848..f86cf05 100644
@@ -30,9 +30,9 @@ atomic_t irq_err_count;
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves.
  */
-void ack_bad_irq(unsigned int irq)
+void ack_bad_irq(struct irq_desc *desc)
 {
-          printk("unexpected IRQ trap at vector %02x\n", irq);
+          printk("unexpected IRQ trap at vector %02x\n", desc->irq);
 }
 
 /*
drivers/dma/ipu/ipu_irq.c +9 -9
index dd8ebc7..62f4307 100644
@@ -94,9 +94,9 @@ static struct ipu_irq_map *src2map(unsigned int src)
 	return NULL;
 }
 
-static void ipu_irq_unmask(unsigned int irq)
+static void ipu_irq_unmask(struct irq_desc *desc)
 {
-	struct ipu_irq_map *map = get_irq_chip_data(irq);
+	struct ipu_irq_map *map = get_irq_desc_chip_data(desc);
 	struct ipu_irq_bank *bank;
 	uint32_t reg;
 	unsigned long lock_flags;
@@ -106,7 +106,7 @@ static void ipu_irq_unmask(unsigned int irq)
 	bank = map->bank;
 	if (!bank) {
 		spin_unlock_irqrestore(&bank_lock, lock_flags);
-		pr_err("IPU: %s(%u) - unmapped!\n", __func__, irq);
+		pr_err("IPU: %s(%u) - unmapped!\n", __func__, desc->irq);
 		return;
 	}
 
@@ -117,9 +117,9 @@ static void ipu_irq_unmask(unsigned int irq)
 	spin_unlock_irqrestore(&bank_lock, lock_flags);
 }
 
-static void ipu_irq_mask(unsigned int irq)
+static void ipu_irq_mask(struct irq_desc *desc)
 {
-	struct ipu_irq_map *map = get_irq_chip_data(irq);
+	struct ipu_irq_map *map = get_irq_desc_chip_data(desc);
 	struct ipu_irq_bank *bank;
 	uint32_t reg;
 	unsigned long lock_flags;
@@ -129,7 +129,7 @@ static void ipu_irq_mask(unsigned int irq)
 	bank = map->bank;
 	if (!bank) {
 		spin_unlock_irqrestore(&bank_lock, lock_flags);
-		pr_err("IPU: %s(%u) - unmapped!\n", __func__, irq);
+		pr_err("IPU: %s(%u) - unmapped!\n", __func__, desc->irq);
 		return;
 	}
 
@@ -140,9 +140,9 @@ static void ipu_irq_mask(unsigned int irq)
 	spin_unlock_irqrestore(&bank_lock, lock_flags);
 }
 
-static void ipu_irq_ack(unsigned int irq)
+static void ipu_irq_ack(struct irq_desc *desc)
 {
-	struct ipu_irq_map *map = get_irq_chip_data(irq);
+	struct ipu_irq_map *map = get_irq_desc_chip_data(desc);
 	struct ipu_irq_bank *bank;
 	unsigned long lock_flags;
 
@@ -151,7 +151,7 @@ static void ipu_irq_ack(unsigned int irq)
 	bank = map->bank;
 	if (!bank) {
 		spin_unlock_irqrestore(&bank_lock, lock_flags);
-		pr_err("IPU: %s(%u) - unmapped!\n", __func__, irq);
+		pr_err("IPU: %s(%u) - unmapped!\n", __func__, desc->irq);
 		return;
 	}
 
drivers/gpio/langwell_gpio.c +6 -5
index 6c0ebbd..0eb44e7 100644
@@ -113,9 +113,10 @@ static int lnw_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 	return lnw->irq_base + offset;
 }
 
-static int lnw_irq_type(unsigned irq, unsigned type)
+static int lnw_irq_type(struct irq_desc *desc, unsigned type)
 {
-	struct lnw_gpio *lnw = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct lnw_gpio *lnw = get_irq_desc_chip_data(desc);
 	u32 gpio = irq - lnw->irq_base;
 	u8 reg = gpio / 32;
 	unsigned long flags;
@@ -142,11 +143,11 @@ static int lnw_irq_type(unsigned irq, unsigned type)
 	return 0;
 };
 
-static void lnw_irq_unmask(unsigned irq)
+static void lnw_irq_unmask(struct irq_desc *desc)
 {
 };
 
-static void lnw_irq_mask(unsigned irq)
+static void lnw_irq_mask(struct irq_desc *desc)
 {
 };
 
@@ -184,7 +185,7 @@ static void lnw_irq_handler(unsigned irq, struct irq_desc *desc)
 		/* clear the edge detect status bit */
 		writel(gedr_v, gedr);
 	}
-	desc->chip->eoi(irq);
+	desc->chip->eoi(desc);
 }
 
 static int __devinit lnw_gpio_probe(struct pci_dev *pdev,
drivers/gpio/pca953x.c +13 -10
index ab5daab..9fb1ba3 100644
@@ -227,37 +227,40 @@ static int pca953x_gpio_to_irq(struct gpio_chip *gc, unsigned off)
 	return chip->irq_base + off;
 }
 
-static void pca953x_irq_mask(unsigned int irq)
+static void pca953x_irq_mask(struct irq_desc *desc)
 {
-	struct pca953x_chip *chip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pca953x_chip *chip = get_irq_desc_chip_data(desc);
 
 	chip->irq_mask &= ~(1 << (irq - chip->irq_base));
 }
 
-static void pca953x_irq_unmask(unsigned int irq)
+static void pca953x_irq_unmask(struct irq_desc *desc)
 {
-	struct pca953x_chip *chip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pca953x_chip *chip = get_irq_desc_chip_data(desc);
 
 	chip->irq_mask |= 1 << (irq - chip->irq_base);
 }
 
-static void pca953x_irq_bus_lock(unsigned int irq)
+static void pca953x_irq_bus_lock(struct irq_desc *desc)
 {
-	struct pca953x_chip *chip = get_irq_chip_data(irq);
+	struct pca953x_chip *chip = get_irq_desc_chip_data(desc);
 
 	mutex_lock(&chip->irq_lock);
 }
 
-static void pca953x_irq_bus_sync_unlock(unsigned int irq)
+static void pca953x_irq_bus_sync_unlock(struct irq_desc *desc)
 {
-	struct pca953x_chip *chip = get_irq_chip_data(irq);
+	struct pca953x_chip *chip = get_irq_desc_chip_data(desc);
 
 	mutex_unlock(&chip->irq_lock);
 }
 
-static int pca953x_irq_set_type(unsigned int irq, unsigned int type)
+static int pca953x_irq_set_type(struct irq_desc *desc, unsigned int type)
 {
-	struct pca953x_chip *chip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pca953x_chip *chip = get_irq_desc_chip_data(desc);
 	uint16_t level = irq - chip->irq_base;
 	uint16_t mask = 1 << level;
 
drivers/gpio/pl061.c +11 -8
index 3ad1eeb..9dddd6e 100644
@@ -122,9 +122,10 @@ static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
 /*
  * PL061 GPIO IRQ
  */
-static void pl061_irq_disable(unsigned irq)
+static void pl061_irq_disable(struct irq_desc *desc)
 {
-	struct pl061_gpio *chip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pl061_gpio *chip = get_irq_desc_chip_data(desc);
 	int offset = irq - chip->irq_base;
 	unsigned long flags;
 	u8 gpioie;
@@ -136,9 +137,10 @@ static void pl061_irq_disable(unsigned irq)
 	spin_unlock_irqrestore(&chip->irq_lock, flags);
 }
 
-static void pl061_irq_enable(unsigned irq)
+static void pl061_irq_enable(struct irq_desc *desc)
 {
-	struct pl061_gpio *chip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pl061_gpio *chip = get_irq_desc_chip_data(desc);
 	int offset = irq - chip->irq_base;
 	unsigned long flags;
 	u8 gpioie;
@@ -150,9 +152,10 @@ static void pl061_irq_enable(unsigned irq)
 	spin_unlock_irqrestore(&chip->irq_lock, flags);
 }
 
-static int pl061_irq_type(unsigned irq, unsigned trigger)
+static int pl061_irq_type(struct irq_desc *desc, unsigned trigger)
 {
-	struct pl061_gpio *chip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pl061_gpio *chip = get_irq_desc_chip_data(desc);
 	int offset = irq - chip->irq_base;
 	unsigned long flags;
 	u8 gpiois, gpioibe, gpioiev;
@@ -207,7 +210,7 @@ static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
 	struct list_head *ptr;
 	struct pl061_gpio *chip;
 
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 	list_for_each(ptr, chip_list) {
 		unsigned long pending;
 		int offset;
@@ -222,7 +225,7 @@ static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
 		for_each_set_bit(offset, &pending, PL061_GPIO_NR)
 			generic_handle_irq(pl061_to_irq(&chip->gc, offset));
 	}
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
 static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
drivers/gpio/timbgpio.c +10 -7
index d4295fa..55c51f5 100644
@@ -107,25 +107,28 @@ static int timbgpio_to_irq(struct gpio_chip *gpio, unsigned offset)
 /*
  * GPIO IRQ
  */
-static void timbgpio_irq_disable(unsigned irq)
+static void timbgpio_irq_disable(struct irq_desc *desc)
 {
-	struct timbgpio *tgpio = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct timbgpio *tgpio = get_irq_desc_chip_data(desc);
 	int offset = irq - tgpio->irq_base;
 
 	timbgpio_update_bit(&tgpio->gpio, offset, TGPIO_IER, 0);
 }
 
-static void timbgpio_irq_enable(unsigned irq)
+static void timbgpio_irq_enable(struct irq_desc *desc)
 {
-	struct timbgpio *tgpio = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct timbgpio *tgpio = get_irq_desc_chip_data(desc);
 	int offset = irq - tgpio->irq_base;
 
 	timbgpio_update_bit(&tgpio->gpio, offset, TGPIO_IER, 1);
 }
 
-static int timbgpio_irq_type(unsigned irq, unsigned trigger)
+static int timbgpio_irq_type(struct irq_desc *desc, unsigned trigger)
 {
-	struct timbgpio *tgpio = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct timbgpio *tgpio = get_irq_desc_chip_data(desc);
 	int offset = irq - tgpio->irq_base;
 	unsigned long flags;
 	u32 lvr, flr, bflr = 0;
@@ -185,7 +188,7 @@ static void timbgpio_irq(unsigned int irq, struct irq_desc *desc)
 	unsigned long ipr;
 	int offset;
 
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 	ipr = ioread32(tgpio->membase + TGPIO_IPR);
 	iowrite32(ipr, tgpio->membase + TGPIO_ICR);
 
drivers/gpio/vr41xx_giu.c +16 -16
index b16c9a8..ea2e00f 100644
@@ -111,28 +111,28 @@ static inline u16 giu_clear(u16 offset, u16 clear)
 	return data;
 }
 
-static void ack_giuint_low(unsigned int irq)
+static void ack_giuint_low(struct irq_desc *desc)
 {
-	giu_write(GIUINTSTATL, 1 << GPIO_PIN_OF_IRQ(irq));
+	giu_write(GIUINTSTATL, 1 << GPIO_PIN_OF_IRQ(desc->irq));
 }
 
-static void mask_giuint_low(unsigned int irq)
+static void mask_giuint_low(struct irq_desc *desc)
 {
-	giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
+	giu_clear(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(desc->irq));
 }
 
-static void mask_ack_giuint_low(unsigned int irq)
+static void mask_ack_giuint_low(struct irq_desc *desc)
 {
 	unsigned int pin;
 
-	pin = GPIO_PIN_OF_IRQ(irq);
+	pin = GPIO_PIN_OF_IRQ(desc->irq);
 	giu_clear(GIUINTENL, 1 << pin);
 	giu_write(GIUINTSTATL, 1 << pin);
 }
 
-static void unmask_giuint_low(unsigned int irq)
+static void unmask_giuint_low(struct irq_desc *desc)
 {
-	giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(irq));
+	giu_set(GIUINTENL, 1 << GPIO_PIN_OF_IRQ(desc->irq));
 }
 
 static struct irq_chip giuint_low_irq_chip = {
@@ -143,29 +143,29 @@ static struct irq_chip giuint_low_irq_chip = {
 	.unmask		= unmask_giuint_low,
 };
 
-static void ack_giuint_high(unsigned int irq)
+static void ack_giuint_high(struct irq_desc *desc)
 {
 	giu_write(GIUINTSTATH,
-		  1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
+		  1 << (GPIO_PIN_OF_IRQ(desc->irq) - GIUINT_HIGH_OFFSET));
 }
 
-static void mask_giuint_high(unsigned int irq)
+static void mask_giuint_high(struct irq_desc *desc)
 {
-	giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
+	giu_clear(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(desc->irq) - GIUINT_HIGH_OFFSET));
 }
 
-static void mask_ack_giuint_high(unsigned int irq)
+static void mask_ack_giuint_high(struct irq_desc *desc)
 {
 	unsigned int pin;
 
-	pin = GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET;
+	pin = GPIO_PIN_OF_IRQ(desc->irq) - GIUINT_HIGH_OFFSET;
 	giu_clear(GIUINTENH, 1 << pin);
 	giu_write(GIUINTSTATH, 1 << pin);
 }
 
-static void unmask_giuint_high(unsigned int irq)
+static void unmask_giuint_high(struct irq_desc *desc)
 {
-	giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(irq) - GIUINT_HIGH_OFFSET));
+	giu_set(GIUINTENH, 1 << (GPIO_PIN_OF_IRQ(desc->irq) - GIUINT_HIGH_OFFSET));
 }
 
 static struct irq_chip giuint_high_irq_chip = {
drivers/infiniband/hw/ipath/ipath_iba6110.c +1 -1
index 37d12e5..4cbae45 100644
@@ -986,7 +986,7 @@ static int ipath_ht_intconfig(struct ipath_devdata *dd)
 	return ret;
 }
 
-static void ipath_ht_irq_update(struct pci_dev *dev, int irq,
+static void ipath_ht_irq_update(struct pci_dev *dev, struct irq_desc *desc,
 				struct ht_irq_msg *msg)
 {
 	struct ipath_devdata *dd = pci_get_drvdata(dev);
drivers/mfd/asic3.c +16 -11
index 95c1e6b..609da5b 100644
@@ -142,7 +142,7 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc)
 	unsigned long flags;
 	struct asic3 *asic;
 
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 
 	asic = desc->handler_data;
 
@@ -225,9 +225,10 @@ static inline int asic3_irq_to_index(struct asic3 *asic, int irq)
 	return (irq - asic->irq_base) & 0xf;
 }
 
-static void asic3_mask_gpio_irq(unsigned int irq)
+static void asic3_mask_gpio_irq(struct irq_desc *desc)
 {
-	struct asic3 *asic = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct asic3 *asic = get_irq_desc_chip_data(desc);
 	u32 val, bank, index;
 	unsigned long flags;
 
@@ -241,9 +242,10 @@ static void asic3_mask_gpio_irq(unsigned int irq)
 	spin_unlock_irqrestore(&asic->lock, flags);
 }
 
-static void asic3_mask_irq(unsigned int irq)
+static void asic3_mask_irq(struct irq_desc *desc)
 {
-	struct asic3 *asic = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct asic3 *asic = get_irq_desc_chip_data(desc);
 	int regval;
 	unsigned long flags;
 
@@ -262,9 +264,10 @@ static void asic3_mask_irq(unsigned int irq)
 	spin_unlock_irqrestore(&asic->lock, flags);
 }
 
-static void asic3_unmask_gpio_irq(unsigned int irq)
+static void asic3_unmask_gpio_irq(struct irq_desc *desc)
 {
-	struct asic3 *asic = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct asic3 *asic = get_irq_desc_chip_data(desc);
 	u32 val, bank, index;
 	unsigned long flags;
 
@@ -278,9 +281,10 @@ static void asic3_unmask_gpio_irq(unsigned int irq)
 	spin_unlock_irqrestore(&asic->lock, flags);
 }
 
-static void asic3_unmask_irq(unsigned int irq)
+static void asic3_unmask_irq(struct irq_desc *desc)
 {
-	struct asic3 *asic = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct asic3 *asic = get_irq_desc_chip_data(desc);
 	int regval;
 	unsigned long flags;
 
@@ -299,9 +303,10 @@ static void asic3_unmask_irq(unsigned int irq)
 	spin_unlock_irqrestore(&asic->lock, flags);
 }
 
-static int asic3_gpio_irq_type(unsigned int irq, unsigned int type)
+static int asic3_gpio_irq_type(struct irq_desc *desc, unsigned int type)
 {
-	struct asic3 *asic = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct asic3 *asic = get_irq_desc_chip_data(desc);
 	u32 bank, index;
 	u16 trigger, level, edge, bit;
 	unsigned long flags;
drivers/mfd/ezx-pcap.c +7 -5
index df405af..26d6f9b 100644
@@ -143,17 +143,19 @@ int pcap_to_irq(struct pcap_chip *pcap, int irq)
 }
 EXPORT_SYMBOL_GPL(pcap_to_irq);
 
-static void pcap_mask_irq(unsigned int irq)
+static void pcap_mask_irq(struct irq_desc *desc)
 {
-	struct pcap_chip *pcap = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pcap_chip *pcap = get_irq_desc_chip_data(desc);
 
 	pcap->msr |= 1 << irq_to_pcap(pcap, irq);
 	queue_work(pcap->workqueue, &pcap->msr_work);
 }
 
-static void pcap_unmask_irq(unsigned int irq)
+static void pcap_unmask_irq(struct irq_desc *desc)
 {
-	struct pcap_chip *pcap = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct pcap_chip *pcap = get_irq_desc_chip_data(desc);
 
 	pcap->msr &= ~(1 << irq_to_pcap(pcap, irq));
 	queue_work(pcap->workqueue, &pcap->msr_work);
@@ -217,7 +219,7 @@ static void pcap_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
 	struct pcap_chip *pcap = get_irq_data(irq);
 
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 	queue_work(pcap->workqueue, &pcap->isr_work);
 	return;
 }
drivers/mfd/htc-egpio.c +7 -5
index addb846..629176b 100644
@@ -69,22 +69,24 @@ static inline void ack_irqs(struct egpio_info *ei)
 			ei->ack_write, ei->ack_register << ei->bus_shift);
 }
 
-static void egpio_ack(unsigned int irq)
+static void egpio_ack(struct irq_desc *desc)
 {
 }
 
 /* There does not appear to be a way to proactively mask interrupts
  * on the egpio chip itself.  So, we simply ignore interrupts that
  * aren't desired. */
-static void egpio_mask(unsigned int irq)
+static void egpio_mask(struct irq_desc *desc)
 {
-	struct egpio_info *ei = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct egpio_info *ei = get_irq_desc_chip_data(desc);
 	ei->irqs_enabled &= ~(1 << (irq - ei->irq_start));
 	pr_debug("EGPIO mask %d %04x\n", irq, ei->irqs_enabled);
 }
-static void egpio_unmask(unsigned int irq)
+static void egpio_unmask(struct irq_desc *desc)
 {
-	struct egpio_info *ei = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct egpio_info *ei = get_irq_desc_chip_data(desc);
 	ei->irqs_enabled |= 1 << (irq - ei->irq_start);
 	pr_debug("EGPIO unmask %d %04x\n", irq, ei->irqs_enabled);
 }
drivers/mfd/t7l66xb.c +5 -3
index 26d9176..05f23cd 100644
@@ -198,9 +198,10 @@ static void t7l66xb_irq(unsigned int irq, struct irq_desc *desc)
 				generic_handle_irq(irq_base + i);
 }
 
-static void t7l66xb_irq_mask(unsigned int irq)
+static void t7l66xb_irq_mask(struct irq_desc *desc)
 {
-	struct t7l66xb *t7l66xb = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct t7l66xb *t7l66xb = get_irq_desc_chip_data(desc);
 	unsigned long			flags;
 	u8 imr;
 
@@ -211,8 +212,9 @@ static void t7l66xb_irq_mask(unsigned int irq)
 	spin_unlock_irqrestore(&t7l66xb->lock, flags);
 }
 
-static void t7l66xb_irq_unmask(unsigned int irq)
+static void t7l66xb_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	struct t7l66xb *t7l66xb = get_irq_chip_data(irq);
 	unsigned long flags;
 	u8 imr;
drivers/mfd/tc6393xb.c +8 -6
index c59e5c5..882a463 100644
@@ -512,7 +512,7 @@ static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base)
 static void
 tc6393xb_irq(unsigned int irq, struct irq_desc *desc)
 {
-	struct tc6393xb *tc6393xb = get_irq_data(irq);
+	struct tc6393xb *tc6393xb = get_irq_desc_chip_data(desc);
 	unsigned int isr;
 	unsigned int i, irq_base;
 
@@ -526,13 +526,14 @@ tc6393xb_irq(unsigned int irq, struct irq_desc *desc)
 		}
 }
 
-static void tc6393xb_irq_ack(unsigned int irq)
+static void tc6393xb_irq_ack(struct irq_desc *desc)
 {
 }
 
-static void tc6393xb_irq_mask(unsigned int irq)
+static void tc6393xb_irq_mask(struct irq_desc *desc)
 {
-	struct tc6393xb *tc6393xb = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct tc6393xb *tc6393xb = get_irq_desc_chip_data(desc);
 	unsigned long flags;
 	u8 imr;
 
@@ -543,9 +544,10 @@ static void tc6393xb_irq_mask(unsigned int irq)
 	spin_unlock_irqrestore(&tc6393xb->lock, flags);
 }
 
-static void tc6393xb_irq_unmask(unsigned int irq)
+static void tc6393xb_irq_unmask(struct irq_desc *desc)
 {
-	struct tc6393xb *tc6393xb = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct tc6393xb *tc6393xb = get_irq_desc_chip_data(desc);
 	unsigned long flags;
 	u8 imr;
 
drivers/mfd/twl4030-irq.c +9 -7
index 9df9a5a..b5e30d5 100644
@@ -595,9 +595,10 @@ static void twl4030_sih_do_edge(struct work_struct *work)
  * completion, potentially including some re-ordering, of these requests.
  */
 
-static void twl4030_sih_mask(unsigned irq)
+static void twl4030_sih_mask(struct irq_desc *desc)
 {
-	struct sih_agent *sih = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct sih_agent *sih = get_irq_desc_chip_data(desc);
 	unsigned long flags;
 
 	spin_lock_irqsave(&sih_agent_lock, flags);
@@ -607,9 +608,10 @@ static void twl4030_sih_mask(unsigned irq)
 	spin_unlock_irqrestore(&sih_agent_lock, flags);
 }
 
-static void twl4030_sih_unmask(unsigned irq)
+static void twl4030_sih_unmask(struct irq_desc *desc)
 {
-	struct sih_agent *sih = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct sih_agent *sih = get_irq_desc_chip_data(desc);
 	unsigned long flags;
 
 	spin_lock_irqsave(&sih_agent_lock, flags);
@@ -619,10 +621,10 @@ static void twl4030_sih_unmask(unsigned irq)
 	spin_unlock_irqrestore(&sih_agent_lock, flags);
 }
 
-static int twl4030_sih_set_type(unsigned irq, unsigned trigger)
+static int twl4030_sih_set_type(struct irq_desc *desc, unsigned trigger)
 {
-	struct sih_agent *sih = get_irq_chip_data(irq);
-	struct irq_desc *desc = irq_to_desc(irq);
+	unsigned int irq = desc->irq;
+	struct sih_agent *sih = get_irq_desc_chip_data(desc);
 	unsigned long flags;
 
 	if (!desc) {
drivers/mfd/wm831x-irq.c +10 -8
index 3013276..18ec226 100644
@@ -346,16 +346,16 @@ static inline struct wm831x_irq_data *irq_to_wm831x_irq(struct wm831x *wm831x,
 	return &wm831x_irqs[irq - wm831x->irq_base];
 }
 
-static void wm831x_irq_lock(unsigned int irq)
+static void wm831x_irq_lock(struct irq_desc *desc)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
+	struct wm831x *wm831x = get_irq_desc_chip_data(desc);
 
 	mutex_lock(&wm831x->irq_lock);
 }
 
-static void wm831x_irq_sync_unlock(unsigned int irq)
+static void wm831x_irq_sync_unlock(struct irq_desc *des)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
+	struct wm831x *wm831x = get_irq_desc_chip_data(desc);
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) {
@@ -372,17 +372,19 @@ static void wm831x_irq_sync_unlock(unsigned int irq)
 	mutex_unlock(&wm831x->irq_lock);
 }
 
-static void wm831x_irq_unmask(unsigned int irq)
+static void wm831x_irq_unmask(struct irq_desc *desc)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct wm831x *wm831x = get_irq_desc_chip_data(desc);
 	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
 
 	wm831x->irq_masks_cur[irq_data->reg - 1] &= ~irq_data->mask;
 }
 
-static void wm831x_irq_mask(unsigned int irq)
+static void wm831x_irq_mask(struct irq_desc *desc)
 {
-	struct wm831x *wm831x = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct wm831x *wm831x = get_irq_desc_chip_data(desc);
 	struct wm831x_irq_data *irq_data = irq_to_wm831x_irq(wm831x, irq);
 
 	wm831x->irq_masks_cur[irq_data->reg - 1] |= irq_data->mask;
drivers/misc/sgi-gru/grufile.c +1 -1
index cb3b4d2..36281e3 100644
@@ -348,7 +348,7 @@ static unsigned long gru_chiplet_cpu_to_mmr(int chiplet, int cpu, int *corep)
 
 static int gru_irq_count[GRU_CHIPLETS_PER_BLADE];
 
-static void gru_noop(unsigned int irq)
+static void gru_noop(struct irq_desc *desc)
 {
 }
 
drivers/parisc/dino.c +6 -6
index c542c7b..3c89196 100644
@@ -296,9 +296,9 @@ static struct pci_port_ops dino_port_ops = {
 	.outl	= dino_out32
 };
 
-static void dino_disable_irq(unsigned int irq)
+static void dino_disable_irq(struct irq_desc *desc)
 {
-	struct irq_desc *desc = irq_to_desc(irq);
+	unsigned int irq = desc->irq;
 	struct dino_device *dino_dev = desc->chip_data;
 	int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
 
@@ -309,9 +309,9 @@ static void dino_disable_irq(unsigned int irq)
 	__raw_writel(dino_dev->imr, dino_dev->hba.base_addr+DINO_IMR);
 }
 
-static void dino_enable_irq(unsigned int irq)
+static void dino_enable_irq(struct irq_desc *desc)
 {
-	struct irq_desc *desc = irq_to_desc(irq);
+	unsigned int irq = desc->irq;
 	struct dino_device *dino_dev = desc->chip_data;
 	int local_irq = gsc_find_local_irq(irq, dino_dev->global_irq, DINO_LOCAL_IRQS);
 	u32 tmp;
@@ -347,9 +347,9 @@ static void dino_enable_irq(unsigned int irq)
 	}
 }
 
-static unsigned int dino_startup_irq(unsigned int irq)
+static unsigned int dino_startup_irq(struct irq_desc *desc)
 {
-	dino_enable_irq(irq);
+	dino_enable_irq(desc);
 	return 0;
 }
 
drivers/parisc/eisa.c +6 -4
index 46f503f..f00d28e 100644
@@ -144,8 +144,9 @@ static unsigned int eisa_irq_level __read_mostly; /* default to edge triggered *
 
 
 /* called by free irq */
-static void eisa_disable_irq(unsigned int irq)
+static void eisa_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long flags;
 
 	EISA_DBG("disable irq %d\n", irq);
@@ -164,8 +165,9 @@ static void eisa_disable_irq(unsigned int irq)
 }
 
 /* called by request irq */
-static void eisa_enable_irq(unsigned int irq)
+static void eisa_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long flags;
 	EISA_DBG("enable irq %d\n", irq);
 		
@@ -182,9 +184,9 @@ static void eisa_enable_irq(unsigned int irq)
 	EISA_DBG("pic1 mask %02x\n", eisa_in8(0xa1));
 }
 
-static unsigned int eisa_startup_irq(unsigned int irq)
+static unsigned int eisa_startup_irq(struct irq_desc *desc)
 {
-	eisa_enable_irq(irq);
+	eisa_enable_irq(desc);
 	return 0;
 }
 
drivers/parisc/gsc.c +6 -6
index c4e1f3c..d2fc47b 100644
@@ -106,9 +106,9 @@ int gsc_find_local_irq(unsigned int irq, int *global_irqs, int limit)
 	return NO_IRQ;
 }
 
-static void gsc_asic_disable_irq(unsigned int irq)
+static void gsc_asic_disable_irq(struct irq_desc *desc)
 {
-	struct irq_desc *desc = irq_to_desc(irq);
+	unsigned int irq = desc->irq;
 	struct gsc_asic *irq_dev = desc->chip_data;
 	int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
 	u32 imr;
@@ -122,9 +122,9 @@ static void gsc_asic_disable_irq(unsigned int irq)
 	gsc_writel(imr, irq_dev->hpa + OFFSET_IMR);
 }
 
-static void gsc_asic_enable_irq(unsigned int irq)
+static void gsc_asic_enable_irq(struct irq_desc *desc)
 {
-	struct irq_desc *desc = irq_to_desc(irq);
+	unsigned int irq = desc->irq;
 	struct gsc_asic *irq_dev = desc->chip_data;
 	int local_irq = gsc_find_local_irq(irq, irq_dev->global_irq, 32);
 	u32 imr;
@@ -142,9 +142,9 @@ static void gsc_asic_enable_irq(unsigned int irq)
 	 */
 }
 
-static unsigned int gsc_asic_startup_irq(unsigned int irq)
+static unsigned int gsc_asic_startup_irq(struct irq_desc *desc)
 {
-	gsc_asic_enable_irq(irq);
+	gsc_asic_enable_irq(desc);
 	return 0;
 }
 
drivers/parisc/iosapic.c +10 -6
index c768367..2ac290b 100644
@@ -622,8 +622,9 @@ static struct vector_info *iosapic_get_vector(unsigned int irq)
 	return desc->chip_data;
 }
 
-static void iosapic_disable_irq(unsigned int irq)
+static void iosapic_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long flags;
 	struct vector_info *vi = iosapic_get_vector(irq);
 	u32 d0, d1;
@@ -635,8 +636,9 @@ static void iosapic_disable_irq(unsigned int irq)
 	spin_unlock_irqrestore(&iosapic_lock, flags);
 }
 
-static void iosapic_enable_irq(unsigned int irq)
+static void iosapic_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	struct vector_info *vi = iosapic_get_vector(irq);
 	u32 d0, d1;
 
@@ -686,8 +688,9 @@ printk("\n");
  * i386/ia64 support ISA devices and have to deal with
  * edge-triggered interrupts too.
  */
-static void iosapic_end_irq(unsigned int irq)
+static void iosapic_end_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	struct vector_info *vi = iosapic_get_vector(irq);
 	DBG(KERN_DEBUG "end_irq(%d): eoi(%p, 0x%x)\n", irq,
 			vi->eoi_addr, vi->eoi_data);
@@ -695,16 +698,17 @@ static void iosapic_end_irq(unsigned int irq)
 	cpu_end_irq(irq);
 }
 
-static unsigned int iosapic_startup_irq(unsigned int irq)
+static unsigned int iosapic_startup_irq(struct irq_desc *desc)
 {
-	iosapic_enable_irq(irq);
+	iosapic_enable_irq(desc);
 	return 0;
 }
 
 #ifdef CONFIG_SMP
-static int iosapic_set_affinity_irq(unsigned int irq,
+static int iosapic_set_affinity_irq(struct irq_desc *desc,
 				     const struct cpumask *dest)
 {
+	unsigned int irq = desc->irq;
 	struct vector_info *vi = iosapic_get_vector(irq);
 	u32 d0, d1, dummy_d0;
 	unsigned long flags;
drivers/parisc/superio.c +6 -4
index f7806d8..084b1c7 100644
@@ -286,8 +286,9 @@ superio_init(struct pci_dev *pcidev)
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init);
 
-static void superio_disable_irq(unsigned int irq)
+static void superio_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u8 r8;
 
 	if ((irq < 1) || (irq == 2) || (irq > 7)) {
@@ -303,8 +304,9 @@ static void superio_disable_irq(unsigned int irq)
 	outb (r8,IC_PIC1+1);
 }
 
-static void superio_enable_irq(unsigned int irq)
+static void superio_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u8 r8;
 
 	if ((irq < 1) || (irq == 2) || (irq > 7)) {
@@ -319,9 +321,9 @@ static void superio_enable_irq(unsigned int irq)
 	outb (r8,IC_PIC1+1);
 }
 
-static unsigned int superio_startup_irq(unsigned int irq)
+static unsigned int superio_startup_irq(struct irq_desc *desc)
 {
-	superio_enable_irq(irq);
+	superio_enable_irq(desc);
 	return 0;
 }
 
drivers/pci/dmar.c +8 -8
index 83aae47..6b5ad63 100644
@@ -1230,9 +1230,9 @@ const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
 	}
 }
 
-void dmar_msi_unmask(unsigned int irq)
+void dmar_msi_unmask(struct irq_desc *desc)
 {
-	struct intel_iommu *iommu = get_irq_data(irq);
+	struct intel_iommu *iommu = get_irq_desc_data(desc);
 	unsigned long flag;
 
 	/* unmask it */
@@ -1243,10 +1243,10 @@ void dmar_msi_unmask(unsigned int irq)
 	spin_unlock_irqrestore(&iommu->register_lock, flag);
 }
 
-void dmar_msi_mask(unsigned int irq)
+void dmar_msi_mask(struct irq_desc *desc)
 {
 	unsigned long flag;
-	struct intel_iommu *iommu = get_irq_data(irq);
+	struct intel_iommu *iommu = get_irq_desc_data(desc);
 
 	/* mask it */
 	spin_lock_irqsave(&iommu->register_lock, flag);
@@ -1256,9 +1256,9 @@ void dmar_msi_mask(unsigned int irq)
 	spin_unlock_irqrestore(&iommu->register_lock, flag);
 }
 
-void dmar_msi_write(int irq, struct msi_msg *msg)
+void dmar_msi_write(struct irq_desc *desc, struct msi_msg *msg)
 {
-	struct intel_iommu *iommu = get_irq_data(irq);
+	struct intel_iommu *iommu = get_irq_desc_data(desc);
 	unsigned long flag;
 
 	spin_lock_irqsave(&iommu->register_lock, flag);
@@ -1268,9 +1268,9 @@ void dmar_msi_write(int irq, struct msi_msg *msg)
 	spin_unlock_irqrestore(&iommu->register_lock, flag);
 }
 
-void dmar_msi_read(int irq, struct msi_msg *msg)
+void dmar_msi_read(struct irq_desc *desc, struct msi_msg *msg)
 {
-	struct intel_iommu *iommu = get_irq_data(irq);
+	struct intel_iommu *iommu = get_irq_desc_data(desc);
 	unsigned long flag;
 
 	spin_lock_irqsave(&iommu->register_lock, flag);
drivers/pci/htirq.c +11 -11
index 737a1c4..d9c5f0d 100644
@@ -33,9 +33,9 @@ struct ht_irq_cfg {
 };
 
 
-void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg)
+void write_ht_irq_msg(struct irq_desc *desc, struct ht_irq_msg *msg)
 {
-	struct ht_irq_cfg *cfg = get_irq_data(irq);
+	struct ht_irq_cfg *cfg = get_irq_desc_data(desc);
 	unsigned long flags;
 	spin_lock_irqsave(&ht_irq_lock, flags);
 	if (cfg->msg.address_lo != msg->address_lo) {
@@ -47,39 +47,39 @@ void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg)
 		pci_write_config_dword(cfg->dev, cfg->pos + 4, msg->address_hi);
 	}
 	if (cfg->update)
-		cfg->update(cfg->dev, irq, msg);
+		cfg->update(cfg->dev, desc, msg);
 	spin_unlock_irqrestore(&ht_irq_lock, flags);
 	cfg->msg = *msg;
 }
 
-void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg)
+void fetch_ht_irq_msg(struct irq_desc *desc, struct ht_irq_msg *msg)
 {
-	struct ht_irq_cfg *cfg = get_irq_data(irq);
+	struct ht_irq_cfg *cfg = get_irq_desc_data(desc);
 	*msg = cfg->msg;
 }
 
-void mask_ht_irq(unsigned int irq)
+void mask_ht_irq(struct irq_desc *desc)
 {
 	struct ht_irq_cfg *cfg;
 	struct ht_irq_msg msg;
 
-	cfg = get_irq_data(irq);
+	cfg = get_irq_desc_data(desc);
 
 	msg = cfg->msg;
 	msg.address_lo |= 1;
-	write_ht_irq_msg(irq, &msg);
+	write_ht_irq_msg(desc, &msg);
 }
 
-void unmask_ht_irq(unsigned int irq)
+void unmask_ht_irq(struct irq_desc *desc)
 {
 	struct ht_irq_cfg *cfg;
 	struct ht_irq_msg msg;
 
-	cfg = get_irq_data(irq);
+	cfg = get_irq_desc_data(desc);
 
 	msg = cfg->msg;
 	msg.address_lo &= ~1;
-	write_ht_irq_msg(irq, &msg);
+	write_ht_irq_msg(desc, &msg);
 }
 
 /**
drivers/pci/msi.c +7 -6
index f9cf317..3eecee3 100644
@@ -169,9 +169,10 @@ static void msix_mask_irq(struct msi_desc *desc, u32 flag)
 	desc->masked = __msix_mask_irq(desc, flag);
 }
 
-static void msi_set_mask_bit(unsigned irq, u32 flag)
+static void msi_set_mask_bit(struct irq_desc *descx, u32 flag)
 {
-	struct msi_desc *desc = get_irq_msi(irq);
+	unsigned int irq = descx->irq;
+	struct msi_desc *desc = get_irq_desc_msi(descx);
 
 	if (desc->msi_attrib.is_msix) {
 		msix_mask_irq(desc, flag);
@@ -182,14 +183,14 @@ static void msi_set_mask_bit(unsigned irq, u32 flag)
 	}
 }
 
-void mask_msi_irq(unsigned int irq)
+void mask_msi_irq(struct irq_desc *desc)
 {
-	msi_set_mask_bit(irq, 1);
+	msi_set_mask_bit(desc, 1);
 }
 
-void unmask_msi_irq(unsigned int irq)
+void unmask_msi_irq(struct irq_desc *desc)
 {
-	msi_set_mask_bit(irq, 0);
+	msi_set_mask_bit(desc, 0);
 }
 
 void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg)
drivers/vlynq/vlynq.c +13 -10
index 9554ad5..34a11e5 100644
@@ -133,10 +133,11 @@ static void vlynq_reset(struct vlynq_device *dev)
 	msleep(5);
 }
 
-static void vlynq_irq_unmask(unsigned int irq)
+static void vlynq_irq_unmask(struct irq_desc *desc)
 {
 	u32 val;
-	struct vlynq_device *dev = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct vlynq_device *dev = get_irq_desc_chip_data(desc);
 	int virq;
 
 	BUG_ON(!dev);
@@ -146,10 +147,11 @@ static void vlynq_irq_unmask(unsigned int irq)
 	writel(val, &dev->remote->int_device[virq >> 2]);
 }
 
-static void vlynq_irq_mask(unsigned int irq)
+static void vlynq_irq_mask(struct irq_desc *desc)
 {
 	u32 val;
-	struct vlynq_device *dev = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct vlynq_device *dev = get_irq_desc_chip_data(desc);
 	int virq;
 
 	BUG_ON(!dev);
@@ -159,10 +161,11 @@ static void vlynq_irq_mask(unsigned int irq)
 	writel(val, &dev->remote->int_device[virq >> 2]);
 }
 
-static int vlynq_irq_type(unsigned int irq, unsigned int flow_type)
+static int vlynq_irq_type(struct irq_desc *desc, unsigned int flow_type)
 {
 	u32 val;
-	struct vlynq_device *dev = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct vlynq_device *dev = get_irq_desc_chip_data(desc);
 	int virq;
 
 	BUG_ON(!dev);
@@ -190,9 +193,9 @@ static int vlynq_irq_type(unsigned int irq, unsigned int flow_type)
 	return 0;
 }
 
-static void vlynq_local_ack(unsigned int irq)
+static void vlynq_local_ack(struct irq_desc *desc)
 {
-	struct vlynq_device *dev = get_irq_chip_data(irq);
+	struct vlynq_device *dev = get_irq_desc_chip_data(desc);
 
 	u32 status = readl(&dev->local->status);
 
@@ -201,9 +204,9 @@ static void vlynq_local_ack(unsigned int irq)
 	writel(status, &dev->local->status);
 }
 
-static void vlynq_remote_ack(unsigned int irq)
+static void vlynq_remote_ack(struct irq_desc *desc)
 {
-	struct vlynq_device *dev = get_irq_chip_data(irq);
+	struct vlynq_device *dev = get_irq_desc_chip_data(desc);
 
 	u32 status = readl(&dev->remote->status);
 
drivers/xen/events.c +11 -11
index 64cbbe4..fd16b80 100644
@@ -730,11 +730,11 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
 	return 0;
 }
 
-static int set_affinity_irq(unsigned irq, const struct cpumask *dest)
+static int set_affinity_irq(struct irq_desc *desc, const struct cpumask *dest)
 {
 	unsigned tcpu = cpumask_first(dest);
 
-	return rebind_irq_to_cpu(irq, tcpu);
+	return rebind_irq_to_cpu(desc->irq, tcpu);
 }
 
 int resend_irq_on_evtchn(unsigned int irq)
@@ -753,35 +753,35 @@ int resend_irq_on_evtchn(unsigned int irq)
 	return 1;
 }
 
-static void enable_dynirq(unsigned int irq)
+static void enable_dynirq(struct irq_desc *desc)
 {
-	int evtchn = evtchn_from_irq(irq);
+	int evtchn = evtchn_from_irq(desc->irq);
 
 	if (VALID_EVTCHN(evtchn))
 		unmask_evtchn(evtchn);
 }
 
-static void disable_dynirq(unsigned int irq)
+static void disable_dynirq(struct irq_desc *desc)
 {
-	int evtchn = evtchn_from_irq(irq);
+	int evtchn = evtchn_from_irq(desc->irq);
 
 	if (VALID_EVTCHN(evtchn))
 		mask_evtchn(evtchn);
 }
 
-static void ack_dynirq(unsigned int irq)
+static void ack_dynirq(struct irq_desc *desc)
 {
-	int evtchn = evtchn_from_irq(irq);
+	int evtchn = evtchn_from_irq(desc->irq);
 
-	move_native_irq(irq);
+	move_native_irq(desc);
 
 	if (VALID_EVTCHN(evtchn))
 		clear_evtchn(evtchn);
 }
 
-static int retrigger_dynirq(unsigned int irq)
+static int retrigger_dynirq(struct irq_desc *desc)
 {
-	int evtchn = evtchn_from_irq(irq);
+	int evtchn = evtchn_from_irq(desc->irq);
 	struct shared_info *sh = HYPERVISOR_shared_info;
 	int ret = 0;
 
include/asm-generic/hardirq.h +2 -2
index 62f5908..afc7506 100644
@@ -12,9 +12,9 @@ typedef struct {
 #include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */
 
 #ifndef ack_bad_irq
-static inline void ack_bad_irq(unsigned int irq)
+static inline void ack_bad_irq(struct irq_desc *desc)
 {
-	printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
+	printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", desc->irq);
 }
 #endif
 
include/linux/dmar.h +4 -4
index 659a765..6b4227a 100644
@@ -187,10 +187,10 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
 /* Can't use the common MSI interrupt functions
  * since DMAR is not a pci device
  */
-extern void dmar_msi_unmask(unsigned int irq);
-extern void dmar_msi_mask(unsigned int irq);
-extern void dmar_msi_read(int irq, struct msi_msg *msg);
-extern void dmar_msi_write(int irq, struct msi_msg *msg);
+extern void dmar_msi_unmask(struct irq_desc *);
+extern void dmar_msi_mask(struct irq_desc *);
+extern void dmar_msi_read(struct irq_desc *desc, struct msi_msg *msg);
+extern void dmar_msi_write(struct irq_desc *desc, struct msi_msg *msg);
 extern int dmar_set_interrupt(struct intel_iommu *iommu);
 extern irqreturn_t dmar_fault(int irq, void *dev_id);
 extern int arch_setup_dmar_msi(unsigned int irq);
include/linux/htirq.h +6 -5
index c96ea46..91cf055 100644
@@ -7,16 +7,17 @@ struct ht_irq_msg {
 };
 
 /* Helper functions.. */
-void fetch_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
-void write_ht_irq_msg(unsigned int irq, struct ht_irq_msg *msg);
-void mask_ht_irq(unsigned int irq);
-void unmask_ht_irq(unsigned int irq);
+struct irq_desc;
+void fetch_ht_irq_msg(struct irq_desc *desc, struct ht_irq_msg *msg);
+void write_ht_irq_msg(struct irq_desc *desc, struct ht_irq_msg *msg);
+void mask_ht_irq(struct irq_desc *);
+void unmask_ht_irq(struct irq_desc *);
 
 /* The arch hook for getting things started */
 int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev);
 
 /* For drivers of buggy hardware */
-typedef void (ht_irq_update_t)(struct pci_dev *dev, int irq,
+typedef void (ht_irq_update_t)(struct pci_dev *dev, struct irq_desc *desc,
 			       struct ht_irq_msg *msg);
 int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update);
 
include/linux/irq.h +25 -24

81 lines not on this page · raw message

include/linux/msi.h +2 -2
index 6991ab5..dc6a904 100644
@@ -11,8 +11,8 @@ struct msi_msg {
 
 /* Helper functions */
 struct irq_desc;
-extern void mask_msi_irq(unsigned int irq);
-extern void unmask_msi_irq(unsigned int irq);
+extern void mask_msi_irq(struct irq_desc *);
+extern void unmask_msi_irq(struct irq_desc *);
 extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
 extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg);
 extern void read_msi_msg(unsigned int irq, struct msi_msg *msg);
kernel/irq/autoprobe.c +6 -6
index 2295a31..02ab31e 100644
@@ -58,8 +58,8 @@ unsigned long probe_irq_on(void)
 			 * progress:
 			 */
 			if (desc->chip->set_type)
-				desc->chip->set_type(i, IRQ_TYPE_PROBE);
-			desc->chip->startup(i);
+				desc->chip->set_type(desc, IRQ_TYPE_PROBE);
+			desc->chip->startup(desc);
 		}
 		raw_spin_unlock_irq(&desc->lock);
 	}
@@ -76,7 +76,7 @@ unsigned long probe_irq_on(void)
 		raw_spin_lock_irq(&desc->lock);
 		if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
 			desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
-			if (desc->chip->startup(i))
+			if (desc->chip->startup(desc))
 				desc->status |= IRQ_PENDING;
 		}
 		raw_spin_unlock_irq(&desc->lock);
@@ -98,7 +98,7 @@ unsigned long probe_irq_on(void)
 			/* It triggered already - consider it spurious. */
 			if (!(status & IRQ_WAITING)) {
 				desc->status = status & ~IRQ_AUTODETECT;
-				desc->chip->shutdown(i);
+				desc->chip->shutdown(desc);
 			} else
 				if (i < 32)
 					mask |= 1 << i;
@@ -137,7 +137,7 @@ unsigned int probe_irq_mask(unsigned long val)
 				mask |= 1 << i;
 
 			desc->status = status & ~IRQ_AUTODETECT;
-			desc->chip->shutdown(i);
+			desc->chip->shutdown(desc);
 		}
 		raw_spin_unlock_irq(&desc->lock);
 	}
@@ -181,7 +181,7 @@ int probe_irq_off(unsigned long val)
 				nr_of_irqs++;
 			}
 			desc->status = status & ~IRQ_AUTODETECT;
-			desc->chip->shutdown(i);
+			desc->chip->shutdown(desc);
 		}
 		raw_spin_unlock_irq(&desc->lock);
 	}
kernel/irq/chip.c +31 -37

208 lines not on this page · raw message

kernel/irq/handle.c +11 -13
index f30c9c7..d7a61a0 100644
@@ -38,9 +38,9 @@ struct lock_class_key irq_desc_lock_class;
  */
 void handle_bad_irq(unsigned int irq, struct irq_desc *desc)
 {
-	print_irq_desc(irq, desc);
+	print_irq_desc(desc);
 	kstat_incr_irqs_this_cpu(irq, desc);
-	ack_bad_irq(irq);
+	ack_bad_irq(desc);
 }
 
 #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
@@ -295,22 +295,20 @@ void clear_kstat_irqs(struct irq_desc *desc)
  * What should we do if we get a hw irq event on an illegal vector?
  * Each architecture has to answer this themself.
  */
-static void ack_bad(unsigned int irq)
+static void ack_bad(struct irq_desc *desc)
 {
-	struct irq_desc *desc = irq_to_desc(irq);
-
-	print_irq_desc(irq, desc);
-	ack_bad_irq(irq);
+	print_irq_desc(desc);
+	ack_bad_irq(desc);
 }
 
 /*
  * NOP functions
  */
-static void noop(unsigned int irq)
+static void noop(struct irq_desc *desc)
 {
 }
 
-static unsigned int noop_ret(unsigned int irq)
+static unsigned int noop_ret(struct irq_desc *des)
 {
 	return 0;
 }
@@ -464,19 +462,19 @@ unsigned int __do_IRQ(unsigned int irq)
 		 * No locking required for CPU-local interrupts:
 		 */
 		if (desc->chip->ack)
-			desc->chip->ack(irq);
+			desc->chip->ack(desc);
 		if (likely(!(desc->status & IRQ_DISABLED))) {
 			action_ret = handle_IRQ_event(irq, desc->action);
 			if (!noirqdebug)
 				note_interrupt(irq, desc, action_ret);
 		}
-		desc->chip->end(irq);
+		desc->chip->end(desc);
 		return 1;
 	}
 
 	raw_spin_lock(&desc->lock);
 	if (desc->chip->ack)
-		desc->chip->ack(irq);
+		desc->chip->ack(desc);
 	/*
 	 * REPLAY is when Linux resends an IRQ that was dropped earlier
 	 * WAITING is used by probe to mark irqs that are being tested
@@ -536,7 +534,7 @@ out:
 	 * The ->end() handler has to deal with interrupts which got
 	 * disabled while the handler was running.
 	 */
-	desc->chip->end(irq);
+	desc->chip->end(desc);
 	raw_spin_unlock(&desc->lock);
 
 	return 1;
kernel/irq/internals.h +8 -8
index c63f3bc..f74a64f 100644
@@ -12,8 +12,8 @@ extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
 
 extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
 		unsigned long flags);
-extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
-extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
+extern void __disable_irq(struct irq_desc *desc, bool susp);
+extern void __enable_irq(struct irq_desc *desc, bool resume);
 
 extern struct lock_class_key irq_desc_lock_class;
 extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
@@ -41,16 +41,16 @@ extern int irq_select_affinity_usr(unsigned int irq);
 extern void irq_set_thread_affinity(struct irq_desc *desc);
 
 /* Inline functions for support of irq chips on slow busses */
-static inline void chip_bus_lock(unsigned int irq, struct irq_desc *desc)
+static inline void chip_bus_lock(struct irq_desc *desc)
 {
 	if (unlikely(desc->chip->bus_lock))
-		desc->chip->bus_lock(irq);
+		desc->chip->bus_lock(desc);
 }
 
-static inline void chip_bus_sync_unlock(unsigned int irq, struct irq_desc *desc)
+static inline void chip_bus_sync_unlock(struct irq_desc *desc)
 {
 	if (unlikely(desc->chip->bus_sync_unlock))
-		desc->chip->bus_sync_unlock(irq);
+		desc->chip->bus_sync_unlock(desc);
 }
 
 /*
@@ -61,10 +61,10 @@ static inline void chip_bus_sync_unlock(unsigned int irq, struct irq_desc *desc)
 
 #define P(f) if (desc->status & f) printk("%14s set\n", #f)
 
-static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
+static inline void print_irq_desc(struct irq_desc *desc)
 {
 	printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
-		irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
+		desc->irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
 	printk("->handle_irq():  %p, ", desc->handle_irq);
 	print_symbol("%s\n", (unsigned long)desc->handle_irq);
 	printk("->chip(): %p, ", desc->chip);
kernel/irq/manage.c +33 -34

108 lines not on this page · raw message

kernel/irq/migration.c +6 -10
index 2419622..6b3d1aa 100644

Lines of this file are not shown. View the raw message.

kernel/irq/pm.c +2 -2
index 0d4005d..a43c93d 100644

Lines of this file are not shown. View the raw message.

kernel/irq/resend.c +4 -4
index 090c376..ddf75cd 100644

Lines of this file are not shown. View the raw message.

kernel/irq/spurious.c +2 -2
index 89fb90a..42b0972 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.4.2

Part of the diff is not shown here. View the raw message.

author
#65 lore raw

PATCH 13/20 genericirq: change ack/mask in irq_chip to take irq_desc instead of irq -- other arch

In reply to Yinghai Lu

will have

void            (*ack)(struct irq_desc *desc);
void            (*mask)(struct irq_desc *desc);
void            (*mask_ack)(struct irq_desc *desc);
void            (*unmask)(struct irq_desc *desc);
void            (*eoi)(struct irq_desc *desc);

so for sparseirq with raidix tree, we don't call extra irq_to_desc, and could use desc directly

-v2: change all member of irq_chip to use desc only. -v2.1: update after legacy_pic
-v2.2: update to irq one short fix

---
 Documentation/DocBook/genericirq.tmpl            |   24 ++--
 arch/alpha/kernel/irq_alpha.c                    |    4 +-
 arch/alpha/kernel/irq_i8259.c                    |   22 +++--
 arch/alpha/kernel/irq_impl.h                     |   10 +-
 arch/alpha/kernel/irq_pyxis.c                    |   21 ++--
 arch/alpha/kernel/irq_srm.c                      |   18 ++--
 arch/alpha/kernel/sys_alcor.c                    |   28 +++---
 arch/alpha/kernel/sys_cabriolet.c                |   18 ++--
 arch/alpha/kernel/sys_dp264.c                    |   44 ++++----
 arch/alpha/kernel/sys_eb64p.c                    |   18 ++--
 arch/alpha/kernel/sys_eiger.c                    |   18 ++--
 arch/alpha/kernel/sys_jensen.c                   |   40 ++++----
 arch/alpha/kernel/sys_marvel.c                   |   26 +++---
 arch/alpha/kernel/sys_mikasa.c                   |   18 ++--
 arch/alpha/kernel/sys_noritake.c                 |   18 ++--
 arch/alpha/kernel/sys_rawhide.c                  |   19 ++--
 arch/alpha/kernel/sys_rx164.c                    |   18 ++--
 arch/alpha/kernel/sys_sable.c                    |   26 +++---
 arch/alpha/kernel/sys_takara.c                   |   18 ++--
 arch/alpha/kernel/sys_titan.c                    |   22 ++--
 arch/alpha/kernel/sys_wildfire.c                 |   32 ++++---
 arch/arm/common/gic.c                            |   20 ++--
 arch/arm/common/it8152.c                         |    8 +-
 arch/arm/common/locomo.c                         |   18 ++--
 arch/arm/common/sa1111.c                         |   58 ++++++----
 arch/arm/common/vic.c                            |   21 +++--
 arch/arm/kernel/ecard.c                          |   12 ++-
 arch/arm/kernel/smp_twd.c                        |    6 +-
 arch/arm/mach-aaec2000/core.c                    |    6 +-
 arch/arm/mach-at91/gpio.c                        |   17 ++--
 arch/arm/mach-at91/irq.c                         |   15 ++-
 arch/arm/mach-bcmring/irq.c                      |   24 +++-
 arch/arm/mach-clps711x/irq.c                     |   18 ++-
 arch/arm/mach-davinci/cp_intc.c                  |   14 ++-
 arch/arm/mach-davinci/gpio.c                     |   32 +++---
 arch/arm/mach-davinci/irq.c                      |    9 +-
 arch/arm/mach-dove/irq.c                         |    9 +-
 arch/arm/mach-ebsa110/core.c                     |    6 +-
 arch/arm/mach-ep93xx/gpio.c                      |   20 ++--
 arch/arm/mach-footbridge/common.c                |    6 +-
 arch/arm/mach-footbridge/isa-irq.c               |   18 ++-
 arch/arm/mach-gemini/gpio.c                      |   12 ++-
 arch/arm/mach-gemini/irq.c                       |    9 +-
 arch/arm/mach-h720x/common.c                     |   15 ++-
 arch/arm/mach-h720x/cpu-h7202.c                  |    8 +-
 arch/arm/mach-integrator/integrator_ap.c         |    6 +-
 arch/arm/mach-integrator/integrator_cp.c         |   18 ++-
 arch/arm/mach-iop13xx/irq.c                      |   24 +++--
 arch/arm/mach-iop13xx/msi.c                      |    2 +-
 arch/arm/mach-iop32x/irq.c                       |    6 +-
 arch/arm/mach-ixp2000/core.c                     |   30 ++++--
 arch/arm/mach-ixp2000/ixdp2x00.c                 |   10 +-
 arch/arm/mach-ixp2000/ixdp2x01.c                 |   10 +-
 arch/arm/mach-ixp23xx/core.c                     |   25 +++--
 arch/arm/mach-ixp23xx/ixdp2351.c                 |   20 ++--
 arch/arm/mach-ixp4xx/common.c                    |   14 ++-
 arch/arm/mach-ks8695/irq.c                       |   31 +++---
 arch/arm/mach-l7200/core.c                       |    6 +-
 arch/arm/mach-lh7a40x/arch-kev7a400.c            |    9 +-
 arch/arm/mach-lh7a40x/arch-lpd7a40x.c            |   13 ++-
 arch/arm/mach-lh7a40x/irq-lh7a400.c              |    9 +-
 arch/arm/mach-lh7a40x/irq-lh7a404.c              |   18 ++-
 arch/arm/mach-lh7a40x/irq-lpd7a40x.c             |   12 ++-
 arch/arm/mach-netx/generic.c                     |   12 ++-
 arch/arm/mach-nomadik/gpio.c                     |   26 +++--
 arch/arm/mach-ns9xxx/board-a9m9750dev.c          |   15 ++-
 arch/arm/mach-ns9xxx/irq.c                       |   15 ++-
 arch/arm/mach-omap1/fpga.c                       |   14 ++-
 arch/arm/mach-omap1/irq.c                        |   24 +++--
 arch/arm/mach-omap2/irq.c                        |   14 ++-
 arch/arm/mach-pnx4008/irq.c                      |   22 +++--
 arch/arm/mach-pxa/balloon3.c                     |    8 +-
 arch/arm/mach-pxa/generic.h                      |    3 +-
 arch/arm/mach-pxa/irq.c                          |   18 ++-
 arch/arm/mach-pxa/lpd270.c                       |    6 +-
 arch/arm/mach-pxa/lubbock.c                      |    6 +-
 arch/arm/mach-pxa/mainstone.c                    |    6 +-
 arch/arm/mach-pxa/pcm990-baseboard.c             |    6 +-
 arch/arm/mach-pxa/pxa25x.c                       |    4 +-
 arch/arm/mach-pxa/pxa27x.c                       |    4 +-
 arch/arm/mach-pxa/pxa3xx.c                       |    9 +-
 arch/arm/mach-pxa/viper.c                        |    9 +-
 arch/arm/mach-pxa/zeus.c                         |   12 ++-
 arch/arm/mach-rpc/irq.c                          |   27 +++--
 arch/arm/mach-s3c2410/bast-irq.c                 |   24 +++--
 arch/arm/mach-s3c2412/irq.c                      |   39 ++++---
 arch/arm/mach-s3c2440/irq.c                      |   15 ++-
 arch/arm/mach-s3c2443/irq.c                      |   75 ++++++++-----
 arch/arm/mach-sa1100/irq.c                       |   36 ++++--
 arch/arm/mach-sa1100/neponset.c                  |    8 +-
 arch/arm/mach-shark/irq.c                        |   10 ++-
 arch/arm/mach-stmp378x/stmp378x.c                |    9 +-
 arch/arm/mach-stmp37xx/stmp37xx.c                |    9 +-
 arch/arm/mach-versatile/core.c                   |    6 +-
 arch/arm/mach-w90x900/irq.c                      |    8 +-
 arch/arm/oprofile/op_model_mpcore.c              |    4 +-
 arch/arm/plat-mxc/gpio.c                         |   12 ++-
 arch/arm/plat-mxc/irq.c                          |    6 +-
 arch/arm/plat-omap/gpio.c                        |   37 ++++---
 arch/arm/plat-orion/gpio.c                       |   21 ++--
 arch/arm/plat-orion/irq.c                        |   10 +-
 arch/arm/plat-pxa/gpio.c                         |   12 ++-
 arch/arm/plat-pxa/include/plat/gpio.h            |    3 +-
 arch/arm/plat-s3c24xx/include/plat/irq.h         |    4 +-
 arch/arm/plat-s3c24xx/irq-pm.c                   |    3 +-
 arch/arm/plat-s3c24xx/irq.c                      |  116 ++++++++++++---------
 arch/arm/plat-s5pc1xx/irq-eint.c                 |   41 ++++---
 arch/arm/plat-s5pc1xx/irq-gpio.c                 |   18 ++--
 arch/arm/plat-stmp3xxx/irq.c                     |    2 +-
 arch/arm/plat-stmp3xxx/pinmux.c                  |   14 ++-
 arch/avr32/mach-at32ap/extint.c                  |   26 +++--
 arch/avr32/mach-at32ap/pio.c                     |    9 +-
 arch/blackfin/include/asm/bfin-global.h          |    2 +-
 arch/blackfin/include/asm/ipipe.h                |    4 +-
 arch/blackfin/mach-common/ints-priority.c        |   99 ++++++++++-------
 arch/cris/arch-v10/kernel/irq.c                  |   16 ++--
 arch/frv/kernel/irq-mb93091.c                    |   12 ++-
 arch/frv/kernel/irq-mb93093.c                    |   12 ++-
 arch/frv/kernel/irq-mb93493.c                    |    8 +-
 arch/frv/kernel/irq.c                            |   27 +++--
 arch/h8300/kernel/irq.c                          |   14 ++-
 arch/m32r/platforms/m32104ut/setup.c             |   19 ++--
 arch/m32r/platforms/m32700ut/setup.c             |   92 +++++++++-------
 arch/m32r/platforms/mappi/setup.c                |   23 +++--
 arch/m32r/platforms/mappi2/setup.c               |   21 ++--
 arch/m32r/platforms/mappi3/setup.c               |   21 ++--
 arch/m32r/platforms/oaks32r/setup.c              |   21 ++--
 arch/m32r/platforms/opsput/setup.c               |  124 ++++++++++++----------
 arch/m32r/platforms/usrv/setup.c                 |   42 ++++---
 arch/m68knommu/platform/5249/intc2.c             |    9 +-
 arch/m68knommu/platform/5272/intc.c              |   11 ++-
 arch/m68knommu/platform/68328/ints.c             |    6 +-
 arch/m68knommu/platform/68360/ints.c             |    9 +-
 arch/m68knommu/platform/coldfire/intc-2.c        |    6 +-
 arch/m68knommu/platform/coldfire/intc-simr.c     |    9 +-
 arch/m68knommu/platform/coldfire/intc.c          |    8 +-
 arch/microblaze/kernel/intc.c                    |   15 ++-
 arch/mips/alchemy/common/irq.c                   |   54 ++++++----
 arch/mips/alchemy/devboards/bcsr.c               |    9 +-
 arch/mips/ar7/irq.c                              |   18 ++-
 arch/mips/bcm63xx/irq.c                          |   33 ++++---
 arch/mips/cavium-octeon/octeon-irq.c             |  102 ++++++++++--------
 arch/mips/dec/ioasic-irq.c                       |   21 ++--
 arch/mips/dec/kn02-irq.c                         |   10 +-
 arch/mips/emma/markeins/irq.c                    |   24 +++--
 arch/mips/jazz/irq.c                             |    6 +-
 arch/mips/kernel/i8259.c                         |   15 ++-
 arch/mips/kernel/irq-gic.c                       |   17 ++-
 arch/mips/kernel/irq-gt641xx.c                   |   12 ++-
 arch/mips/kernel/irq-msc01.c                     |   22 +++--
 arch/mips/kernel/irq-rm7000.c                    |    6 +-
 arch/mips/kernel/irq-rm9000.c                    |   26 +++--
 arch/mips/kernel/irq_cpu.c                       |   16 ++-
 arch/mips/kernel/irq_txx9.c                      |   14 ++-
 arch/mips/lasat/interrupt.c                      |   14 ++-
 arch/mips/loongson/common/bonito-irq.c           |    6 +-
 arch/mips/nxp/pnx833x/common/interrupts.c        |   33 ++++--
 arch/mips/nxp/pnx8550/common/int.c               |    8 +-
 arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c       |   12 ++-
 arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c       |    9 +-
 arch/mips/powertv/asic/irq_asic.c                |    6 +-
 arch/mips/rb532/irq.c                            |   28 +++--
 arch/mips/sgi-ip22/ip22-int.c                    |   24 +++--
 arch/mips/sgi-ip27/ip27-irq.c                    |   12 ++-
 arch/mips/sgi-ip27/ip27-timer.c                  |    4 +-
 arch/mips/sgi-ip32/ip32-irq.c                    |   68 +++++++-----
 arch/mips/sibyte/bcm1480/irq.c                   |   28 +++--
 arch/mips/sibyte/sb1250/irq.c                    |   28 +++--
 arch/mips/sni/a20r.c                             |   12 ++-
 arch/mips/sni/pcimt.c                            |   12 ++-
 arch/mips/sni/pcit.c                             |   12 ++-
 arch/mips/sni/rm200.c                            |   21 +++--
 arch/mips/txx9/generic/irq_tx4939.c              |   14 ++-
 arch/mips/txx9/jmr3927/irq.c                     |    6 +-
 arch/mips/txx9/rbtx4927/irq.c                    |   10 +-
 arch/mips/txx9/rbtx4938/irq.c                    |   10 +-
 arch/mips/txx9/rbtx4939/irq.c                    |    6 +-
 arch/mips/vr41xx/common/icu.c                    |   12 ++-
 arch/mips/vr41xx/common/irq.c                    |    8 +-
 arch/mn10300/kernel/irq.c                        |   19 +++-
 arch/mn10300/kernel/mn10300-serial.c             |    5 +-
 arch/parisc/include/asm/irq.h                    |   11 +-
 arch/parisc/kernel/irq.c                         |   43 +++++---
 arch/powerpc/include/asm/mpic.h                  |    6 +-
 arch/powerpc/include/asm/qe_ic.h                 |    6 +-
 arch/powerpc/kernel/crash.c                      |    4 +-
 arch/powerpc/kernel/irq.c                        |    2 +-
 arch/powerpc/platforms/512x/mpc5121_ads_cpld.c   |    6 +-
 arch/powerpc/platforms/52xx/media5200.c          |   16 ++--
 arch/powerpc/platforms/52xx/mpc52xx_gpt.c        |   20 ++--
 arch/powerpc/platforms/52xx/mpc52xx_pic.c        |   35 ++++--
 arch/powerpc/platforms/82xx/pq2ads-pci-pic.c     |    6 +-
 arch/powerpc/platforms/85xx/ksi8560.c            |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ads.c        |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c         |    2 +-
 arch/powerpc/platforms/85xx/sbc8560.c            |    2 +-
 arch/powerpc/platforms/85xx/socrates_fpga_pic.c  |   20 +++--
 arch/powerpc/platforms/85xx/stx_gp3.c            |    2 +-
 arch/powerpc/platforms/85xx/tqm85xx.c            |    2 +-
 arch/powerpc/platforms/86xx/gef_pic.c            |   12 ++-
 arch/powerpc/platforms/86xx/pic.c                |    2 +-
 arch/powerpc/platforms/8xx/m8xx_setup.c          |    4 +-
 arch/powerpc/platforms/cell/axon_msi.c           |    2 +-
 arch/powerpc/platforms/cell/beat_interrupt.c     |   14 ++-
 arch/powerpc/platforms/cell/interrupt.c          |   12 +-
 arch/powerpc/platforms/cell/setup.c              |    2 +-
 arch/powerpc/platforms/cell/spider-pic.c         |   15 ++-
 arch/powerpc/platforms/chrp/setup.c              |    2 +-
 arch/powerpc/platforms/embedded6xx/flipper-pic.c |   12 ++-
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c    |   26 +++--
 arch/powerpc/platforms/iseries/irq.c             |   19 ++--
 arch/powerpc/platforms/pasemi/setup.c            |    4 +-
 arch/powerpc/platforms/powermac/pic.c            |   23 +++--
 arch/powerpc/platforms/ps3/interrupt.c           |   27 +++--
 arch/powerpc/platforms/pseries/setup.c           |    2 +-
 arch/powerpc/platforms/pseries/xics.c            |   27 +++--
 arch/powerpc/sysdev/cpm1.c                       |    9 +-
 arch/powerpc/sysdev/cpm2_pic.c                   |   18 ++--
 arch/powerpc/sysdev/fsl_msi.c                    |   12 +-
 arch/powerpc/sysdev/i8259.c                      |   11 ++-
 arch/powerpc/sysdev/ipic.c                       |   16 ++-
 arch/powerpc/sysdev/mpc8xx_pic.c                 |   16 ++-
 arch/powerpc/sysdev/mpic.c                       |   50 +++++----
 arch/powerpc/sysdev/mpic.h                       |    4 +-
 arch/powerpc/sysdev/mpic_pasemi_msi.c            |   14 ++-
 arch/powerpc/sysdev/mpic_u3msi.c                 |   12 +-
 arch/powerpc/sysdev/mv64x60_pic.c                |   21 +++--
 arch/powerpc/sysdev/qe_lib/qe_ic.c               |    6 +-
 arch/powerpc/sysdev/tsi108_pci.c                 |   14 ++-
 arch/powerpc/sysdev/uic.c                        |   36 ++++---
 arch/powerpc/sysdev/xilinx_intc.c                |   26 +++--
 arch/score/kernel/irq.c                          |   10 +-
 arch/sh/boards/mach-cayman/irq.c                 |   10 +-
 arch/sh/boards/mach-dreamcast/irq.c              |    9 +-
 arch/sh/boards/mach-landisk/irq.c                |    6 +-
 arch/sh/boards/mach-microdev/irq.c               |   19 ++--
 arch/sh/boards/mach-se/7206/irq.c                |    9 +-
 arch/sh/boards/mach-se/7343/irq.c                |    8 +-
 arch/sh/boards/mach-se/7722/irq.c                |    8 +-
 arch/sh/boards/mach-se/7724/irq.c                |    6 +-
 arch/sh/boards/mach-systemh/irq.c                |   16 ++--
 arch/sh/cchips/hd6446x/hd64461.c                 |   11 ++-
 arch/sh/kernel/cpu/irq/imask.c                   |    6 +-
 arch/sh/kernel/cpu/irq/intc-sh5.c                |   34 +++---
 arch/sparc/kernel/irq_64.c                       |   78 ++++++++------
 arch/xtensa/variants/s6000/gpio.c                |   18 ++--
 drivers/sh/intc.c                                |   11 +-
 247 files changed, 2572 insertions(+), 1749 deletions(-)
Documentation/DocBook/genericirq.tmpl +12 -12
index 1448b33..b55b054 100644
@@ -233,33 +233,33 @@
 		are used by the default flow implementations.
 		The following helper functions are implemented (simplified excerpt):
 		<programlisting>
-default_enable(irq)
+default_enable(desc)
 {
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
-default_disable(irq)
+default_disable(desc)
 {
-	if (!delay_disable(irq))
-		desc->chip->mask(irq);
+	if (!delay_disable(desc->irq))
+		desc->chip->mask(desc);
 }
 
-default_ack(irq)
+default_ack(desc)
 {
-	chip->ack(irq);
+	chip->ack(desc);
 }
 
-default_mask_ack(irq)
+default_mask_ack(desc)
 {
 	if (chip->mask_ack) {
-		chip->mask_ack(irq);
+		chip->mask_ack(desc);
 	} else {
-		chip->mask(irq);
-		chip->ack(irq);
+		chip->mask(desc);
+		chip->ack(desc);
 	}
 }
 
-noop(irq)
+noop(desc)
 {
 }
 
arch/alpha/kernel/irq_alpha.c +2 -2
index cfde865..beb8e3f 100644
@@ -218,8 +218,8 @@ process_mcheck_info(unsigned long vector, unsigned long la_ptr,
  * processed by PALcode, and comes in via entInt vector 1.
  */
 
-static void rtc_enable_disable(unsigned int irq) { }
-static unsigned int rtc_startup(unsigned int irq) { return 0; }
+static void rtc_enable_disable(struct irq_desc *desc) { }
+static unsigned int rtc_startup(struct irq_desc *desc) { return 0; }
 
 struct irqaction timer_irqaction = {
 	.handler	= timer_interrupt,
arch/alpha/kernel/irq_i8259.c +13 -9
index 83a9ac2..2470b14 100644
@@ -33,8 +33,10 @@ i8259_update_irq_hw(unsigned int irq, unsigned long mask)
 }
 
 inline void
-i8259a_enable_irq(unsigned int irq)
+i8259a_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	spin_lock(&i8259_irq_lock);
 	i8259_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq));
 	spin_unlock(&i8259_irq_lock);
@@ -47,16 +49,18 @@ __i8259a_disable_irq(unsigned int irq)
 }
 
 void
-i8259a_disable_irq(unsigned int irq)
+i8259a_disable_irq(struct irq_desc *desc)
 {
 	spin_lock(&i8259_irq_lock);
-	__i8259a_disable_irq(irq);
+	__i8259a_disable_irq(desc->irq);
 	spin_unlock(&i8259_irq_lock);
 }
 
 void
-i8259a_mask_and_ack_irq(unsigned int irq)
+i8259a_mask_and_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	spin_lock(&i8259_irq_lock);
 	__i8259a_disable_irq(irq);
 
@@ -70,17 +74,17 @@ i8259a_mask_and_ack_irq(unsigned int irq)
 }
 
 unsigned int
-i8259a_startup_irq(unsigned int irq)
+i8259a_startup_irq(struct irq_desc *desc)
 {
-	i8259a_enable_irq(irq);
+	i8259a_enable_irq(desc);
 	return 0; /* never anything pending */
 }
 
 void
-i8259a_end_irq(unsigned int irq)
+i8259a_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		i8259a_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		i8259a_enable_irq(desc);
 }
 
 struct irq_chip i8259a_irq_type = {
arch/alpha/kernel/irq_impl.h +5 -5
index b63ccd7..24e308e 100644
@@ -31,11 +31,11 @@ extern void init_rtc_irq(void);
 
 extern void common_init_isa_dma(void);
 
-extern void i8259a_enable_irq(unsigned int);
-extern void i8259a_disable_irq(unsigned int);
-extern void i8259a_mask_and_ack_irq(unsigned int);
-extern unsigned int i8259a_startup_irq(unsigned int);
-extern void i8259a_end_irq(unsigned int);
+extern void i8259a_enable_irq(struct irq_desc *desc);
+extern void i8259a_disable_irq(struct irq_desc *desc);
+extern void i8259a_mask_and_ack_irq(struct irq_desc *desc);
+extern unsigned int i8259a_startup_irq(struct irq_desc *desc);
+extern void i8259a_end_irq(struct irq_desc *desc);
 extern struct irq_chip i8259a_irq_type;
 extern void init_i8259a_irqs(void);
 
arch/alpha/kernel/irq_pyxis.c +11 -10
index 989ce46..dae795e 100644
@@ -29,34 +29,35 @@ pyxis_update_irq_hw(unsigned long mask)
 }
 
 static inline void
-pyxis_enable_irq(unsigned int irq)
+pyxis_enable_irq(struct irq_desc *desc)
 {
-	pyxis_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16));
+	pyxis_update_irq_hw(cached_irq_mask |= 1UL << (desc->irq - 16));
 }
 
 static void
-pyxis_disable_irq(unsigned int irq)
+pyxis_disable_irq(struct irq_desc *desc)
 {
-	pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16)));
+	pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (desc->irq - 16)));
 }
 
 static unsigned int
-pyxis_startup_irq(unsigned int irq)
+pyxis_startup_irq(struct irq_desc *desc)
 {
-	pyxis_enable_irq(irq);
+	pyxis_enable_irq(desc);
 	return 0;
 }
 
 static void
-pyxis_end_irq(unsigned int irq)
+pyxis_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		pyxis_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		pyxis_enable_irq(desc);
 }
 
 static void
-pyxis_mask_and_ack_irq(unsigned int irq)
+pyxis_mask_and_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long bit = 1UL << (irq - 16);
 	unsigned long mask = cached_irq_mask &= ~bit;
 
arch/alpha/kernel/irq_srm.c +9 -9
index d63e93e..5e6b09a 100644
@@ -18,33 +18,33 @@
 DEFINE_SPINLOCK(srm_irq_lock);
 
 static inline void
-srm_enable_irq(unsigned int irq)
+srm_enable_irq(struct irq_desc *desc)
 {
 	spin_lock(&srm_irq_lock);
-	cserve_ena(irq - 16);
+	cserve_ena(desc->irq - 16);
 	spin_unlock(&srm_irq_lock);
 }
 
 static void
-srm_disable_irq(unsigned int irq)
+srm_disable_irq(struct irq_desc *desc)
 {
 	spin_lock(&srm_irq_lock);
-	cserve_dis(irq - 16);
+	cserve_dis(desc->irq - 16);
 	spin_unlock(&srm_irq_lock);
 }
 
 static unsigned int
-srm_startup_irq(unsigned int irq)
+srm_startup_irq(struct irq_desc *desc)
 {
-	srm_enable_irq(irq);
+	srm_enable_irq(desc);
 	return 0;
 }
 
 static void
-srm_end_irq(unsigned int irq)
+srm_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		srm_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		srm_enable_irq(desc);
 }
 
 /* Handle interrupts from the SRM, assuming no additional weirdness.  */
arch/alpha/kernel/sys_alcor.c +14 -14
index 20a30b8..3ba8767 100644
@@ -44,38 +44,38 @@ alcor_update_irq_hw(unsigned long mask)
 }
 
 static inline void
-alcor_enable_irq(unsigned int irq)
+alcor_enable_irq(struct irq_desc *desc)
 {
-	alcor_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16));
+	alcor_update_irq_hw(cached_irq_mask |= 1UL << (desc->irq - 16));
 }
 
 static void
-alcor_disable_irq(unsigned int irq)
+alcor_disable_irq(struct irq_desc *desc)
 {
-	alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16)));
+	alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (desc->irq - 16)));
 }
 
 static void
-alcor_mask_and_ack_irq(unsigned int irq)
+alcor_mask_and_ack_irq(struct irq_desc *desc)
 {
-	alcor_disable_irq(irq);
+	alcor_disable_irq(desc);
 
 	/* On ALCOR/XLT, need to dismiss interrupt via GRU. */
-	*(vuip)GRU_INT_CLEAR = 1 << (irq - 16); mb();
+	*(vuip)GRU_INT_CLEAR = 1 << (desc->irq - 16); mb();
 	*(vuip)GRU_INT_CLEAR = 0; mb();
 }
 
 static unsigned int
-alcor_startup_irq(unsigned int irq)
+alcor_startup_irq(struct irq_desc *desc)
 {
-	alcor_enable_irq(irq);
+	alcor_enable_irq(desc);
 	return 0;
 }
 
 static void
-alcor_isa_mask_and_ack_irq(unsigned int irq)
+alcor_isa_mask_and_ack_irq(struct irq_desc *desc)
 {
-	i8259a_mask_and_ack_irq(irq);
+	i8259a_mask_and_ack_irq(desc);
 
 	/* On ALCOR/XLT, need to dismiss interrupt via GRU. */
 	*(vuip)GRU_INT_CLEAR = 0x80000000; mb();
@@ -83,10 +83,10 @@ alcor_isa_mask_and_ack_irq(unsigned int irq)
 }
 
 static void
-alcor_end_irq(unsigned int irq)
+alcor_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		alcor_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		alcor_enable_irq(desc);
 }
 
 static struct irq_chip alcor_irq_type = {
arch/alpha/kernel/sys_cabriolet.c +11 -7
index affd0f3..ecbca6b 100644
@@ -46,29 +46,33 @@ cabriolet_update_irq_hw(unsigned int irq, unsigned long mask)
 }
 
 static inline void
-cabriolet_enable_irq(unsigned int irq)
+cabriolet_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	cabriolet_update_irq_hw(irq, cached_irq_mask &= ~(1UL << irq));
 }
 
 static void
-cabriolet_disable_irq(unsigned int irq)
+cabriolet_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	cabriolet_update_irq_hw(irq, cached_irq_mask |= 1UL << irq);
 }
 
 static unsigned int
-cabriolet_startup_irq(unsigned int irq)
+cabriolet_startup_irq(struct irq_desc *desc)
 { 
-	cabriolet_enable_irq(irq);
+	cabriolet_enable_irq(desc);
 	return 0; /* never anything pending */
 }
 
 static void
-cabriolet_end_irq(unsigned int irq)
+cabriolet_end_irq(struct irq_desc *desc)
 { 
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		cabriolet_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		cabriolet_enable_irq(desc);
 }
 
 static struct irq_chip cabriolet_irq_type = {
arch/alpha/kernel/sys_dp264.c +22 -22

109 lines not on this page · raw message

arch/alpha/kernel/sys_eb64p.c +11 -7
index df2090c..8f6b901 100644
@@ -44,29 +44,33 @@ eb64p_update_irq_hw(unsigned int irq, unsigned long mask)
 }
 
 static inline void
-eb64p_enable_irq(unsigned int irq)
+eb64p_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	eb64p_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq));
 }
 
 static void
-eb64p_disable_irq(unsigned int irq)
+eb64p_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	eb64p_update_irq_hw(irq, cached_irq_mask |= 1 << irq);
 }
 
 static unsigned int
-eb64p_startup_irq(unsigned int irq)
+eb64p_startup_irq(struct irq_desc *desc)
 {
-	eb64p_enable_irq(irq);
+	eb64p_enable_irq(desc);
 	return 0; /* never anything pending */
 }
 
 static void
-eb64p_end_irq(unsigned int irq)
+eb64p_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		eb64p_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		eb64p_enable_irq(desc);
 }
 
 static struct irq_chip eb64p_irq_type = {
arch/alpha/kernel/sys_eiger.c +11 -7
index 3ca1dbc..57e0094 100644
@@ -51,33 +51,37 @@ eiger_update_irq_hw(unsigned long irq, unsigned long mask)
 }
 
 static inline void
-eiger_enable_irq(unsigned int irq)
+eiger_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long mask;
+
 	mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63)));
 	eiger_update_irq_hw(irq, mask);
 }
 
 static void
-eiger_disable_irq(unsigned int irq)
+eiger_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long mask;
+
 	mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63));
 	eiger_update_irq_hw(irq, mask);
 }
 
 static unsigned int
-eiger_startup_irq(unsigned int irq)
+eiger_startup_irq(struct irq_desc *desc)
 {
-	eiger_enable_irq(irq);
+	eiger_enable_irq(desc);
 	return 0; /* never anything pending */
 }
 
 static void
-eiger_end_irq(unsigned int irq)
+eiger_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		eiger_enable_irq(irq);
+	if (!(irq_desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		eiger_enable_irq(desc);
 }
 
 static struct irq_chip eiger_irq_type = {
arch/alpha/kernel/sys_jensen.c +20 -20
index 7a7ae36..8ee81c6 100644
@@ -63,59 +63,59 @@
  */
 
 static unsigned int
-jensen_local_startup(unsigned int irq)
+jensen_local_startup(struct irq_desc *desc)
 {
 	/* the parport is really hw IRQ 1, silly Jensen.  */
-	if (irq == 7)
-		i8259a_startup_irq(1);
+	if (desc->irq == 7)
+		i8259a_startup_irq(irq_to_desc(1));
 	else
 		/*
 		 * For all true local interrupts, set the flag that prevents
 		 * the IPL from being dropped during handler processing.
 		 */
-		if (irq_desc[irq].action)
-			irq_desc[irq].action->flags |= IRQF_DISABLED;
+		if (desc->action)
+			desc->action->flags |= IRQF_DISABLED;
 	return 0;
 }
 
 static void
-jensen_local_shutdown(unsigned int irq)
+jensen_local_shutdown(struct irq_desc *desc)
 {
 	/* the parport is really hw IRQ 1, silly Jensen.  */
-	if (irq == 7)
-		i8259a_disable_irq(1);
+	if (desc->irq == 7)
+		i8259a_disable_irq(irq_to_desc(1));
 }
 
 static void
-jensen_local_enable(unsigned int irq)
+jensen_local_enable(struct irq_desc *desc)
 {
 	/* the parport is really hw IRQ 1, silly Jensen.  */
-	if (irq == 7)
-		i8259a_enable_irq(1);
+	if (desc->irq == 7)
+		i8259a_enable_irq(irq_to_desc(1));
 }
 
 static void
-jensen_local_disable(unsigned int irq)
+jensen_local_disable(struct irq_desc *desc)
 {
 	/* the parport is really hw IRQ 1, silly Jensen.  */
-	if (irq == 7)
-		i8259a_disable_irq(1);
+	if (desc->irq == 7)
+		i8259a_disable_irq(irq_to_desc(1));
 }
 
 static void
-jensen_local_ack(unsigned int irq)
+jensen_local_ack(struct irq_desc *desc)
 {
 	/* the parport is really hw IRQ 1, silly Jensen.  */
-	if (irq == 7)
-		i8259a_mask_and_ack_irq(1);
+	if (desc->irq == 7)
+		i8259a_mask_and_ack_irq(irq_to_desc(1));
 }
 
 static void
-jensen_local_end(unsigned int irq)
+jensen_local_end(struct irq_desc *desc)
 {
 	/* the parport is really hw IRQ 1, silly Jensen.  */
-	if (irq == 7)
-		i8259a_end_irq(1);
+	if (desc->irq == 7)
+		i8259a_end_irq(irq_to_desc(1));
 }
 
 static struct irq_chip jensen_local_irq_type = {
arch/alpha/kernel/sys_marvel.c +13 -13
index 0bb3b5c..5229f49 100644
@@ -104,15 +104,15 @@ io7_get_irq_ctl(unsigned int irq, struct io7 **pio7)
 }
 
 static void
-io7_enable_irq(unsigned int irq)
+io7_enable_irq(struct irq_desc *desc)
 {
 	volatile unsigned long *ctl;
 	struct io7 *io7;
 
-	ctl = io7_get_irq_ctl(irq, &io7);
+	ctl = io7_get_irq_ctl(desc->irq, &io7);
 	if (!ctl || !io7) {
 		printk(KERN_ERR "%s: get_ctl failed for irq %x\n",
-		       __func__, irq);
+		       __func__, desc->irq);
 		return;
 	}
 		
@@ -124,15 +124,15 @@ io7_enable_irq(unsigned int irq)
 }
 
 static void
-io7_disable_irq(unsigned int irq)
+io7_disable_irq(struct irq_desc *desc)
 {
 	volatile unsigned long *ctl;
 	struct io7 *io7;
 
-	ctl = io7_get_irq_ctl(irq, &io7);
+	ctl = io7_get_irq_ctl(desc->irq, &io7);
 	if (!ctl || !io7) {
 		printk(KERN_ERR "%s: get_ctl failed for irq %x\n",
-		       __func__, irq);
+		       __func__, desc->irq);
 		return;
 	}
 		
@@ -144,27 +144,27 @@ io7_disable_irq(unsigned int irq)
 }
 
 static unsigned int
-io7_startup_irq(unsigned int irq)
+io7_startup_irq(struct irq_desc *desc)
 {
-	io7_enable_irq(irq);
+	io7_enable_irq(desc);
 	return 0;	/* never anything pending */
 }
 
 static void
-io7_end_irq(unsigned int irq)
+io7_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		io7_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		io7_enable_irq(desc);
 }
 
 static void
-marvel_irq_noop(unsigned int irq) 
+marvel_irq_noop(struct irq_desc *desc)
 { 
 	return; 
 }
 
 static unsigned int
-marvel_irq_noop_return(unsigned int irq) 
+marvel_irq_noop_return(struct irq_desc *desc)
 { 
 	return 0; 
 }
arch/alpha/kernel/sys_mikasa.c +9 -9
index ee88651..d4ce8f3 100644
@@ -43,29 +43,29 @@ mikasa_update_irq_hw(int mask)
 }
 
 static inline void
-mikasa_enable_irq(unsigned int irq)
+mikasa_enable_irq(struct irq_desc *desc)
 {
-	mikasa_update_irq_hw(cached_irq_mask |= 1 << (irq - 16));
+	mikasa_update_irq_hw(cached_irq_mask |= 1 << (desc->irq - 16));
 }
 
 static void
-mikasa_disable_irq(unsigned int irq)
+mikasa_disable_irq(struct irq_desc *desc)
 {
-	mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (irq - 16)));
+	mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (desc->irq - 16)));
 }
 
 static unsigned int
-mikasa_startup_irq(unsigned int irq)
+mikasa_startup_irq(struct irq_desc *desc)
 {
-	mikasa_enable_irq(irq);
+	mikasa_enable_irq(desc);
 	return 0;
 }
 
 static void
-mikasa_end_irq(unsigned int irq)
+mikasa_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		mikasa_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		mikasa_enable_irq(desc);
 }
 
 static struct irq_chip mikasa_irq_type = {
arch/alpha/kernel/sys_noritake.c +11 -7
index 86503fe..5d175de 100644
@@ -48,29 +48,33 @@ noritake_update_irq_hw(int irq, int mask)
 }
 
 static void
-noritake_enable_irq(unsigned int irq)
+noritake_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	noritake_update_irq_hw(irq, cached_irq_mask |= 1 << (irq - 16));
 }
 
 static void
-noritake_disable_irq(unsigned int irq)
+noritake_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	noritake_update_irq_hw(irq, cached_irq_mask &= ~(1 << (irq - 16)));
 }
 
 static unsigned int
-noritake_startup_irq(unsigned int irq)
+noritake_startup_irq(struct irq_desc *desc)
 {
-	noritake_enable_irq(irq);
+	noritake_enable_irq(desc);
 	return 0;
 }
 
 static void
-noritake_end_irq(unsigned int irq)
+noritake_end_irq(struct irq_desc *desc)
 {
-        if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-                noritake_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		noritake_enable_irq(desc);
 }
 
 static struct irq_chip noritake_irq_type = {
arch/alpha/kernel/sys_rawhide.c +11 -8
index 26c322b..e1dacac 100644
@@ -56,8 +56,9 @@ rawhide_update_irq_hw(int hose, int mask)
   (((h) < MCPCIA_MAX_HOSES) && (cached_irq_masks[(h)] != 0))
 
 static inline void 
-rawhide_enable_irq(unsigned int irq)
+rawhide_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask, hose;
 
 	irq -= 16;
@@ -76,8 +77,9 @@ rawhide_enable_irq(unsigned int irq)
 }
 
 static void 
-rawhide_disable_irq(unsigned int irq)
+rawhide_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask, hose;
 
 	irq -= 16;
@@ -96,8 +98,9 @@ rawhide_disable_irq(unsigned int irq)
 }
 
 static void
-rawhide_mask_and_ack_irq(unsigned int irq)
+rawhide_mask_and_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask, mask1, hose;
 
 	irq -= 16;
@@ -122,17 +125,17 @@ rawhide_mask_and_ack_irq(unsigned int irq)
 }
 
 static unsigned int
-rawhide_startup_irq(unsigned int irq)
+rawhide_startup_irq(struct irq_desc *desc)
 {
-	rawhide_enable_irq(irq);
+	rawhide_enable_irq(desc);
 	return 0;
 }
 
 static void
-rawhide_end_irq(unsigned int irq)
+rawhide_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		rawhide_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		rawhide_enable_irq(desc);
 }
 
 static struct irq_chip rawhide_irq_type = {
arch/alpha/kernel/sys_rx164.c +9 -9
index be16112..31cb57e 100644
@@ -47,29 +47,29 @@ rx164_update_irq_hw(unsigned long mask)
 }
 
 static inline void
-rx164_enable_irq(unsigned int irq)
+rx164_enable_irq(struct irq_desc *desc)
 {
-	rx164_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16));
+	rx164_update_irq_hw(cached_irq_mask |= 1UL << (desc->irq - 16));
 }
 
 static void
-rx164_disable_irq(unsigned int irq)
+rx164_disable_irq(struct irq_desc *desc)
 {
-	rx164_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16)));
+	rx164_update_irq_hw(cached_irq_mask &= ~(1UL << (desc->irq - 16)));
 }
 
 static unsigned int
-rx164_startup_irq(unsigned int irq)
+rx164_startup_irq(struct irq_desc *desc)
 {
-	rx164_enable_irq(irq);
+	rx164_enable_irq(desc);
 	return 0;
 }
 
 static void
-rx164_end_irq(unsigned int irq)
+rx164_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		rx164_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		rx164_enable_irq(desc);
 }
 
 static struct irq_chip rx164_irq_type = {
arch/alpha/kernel/sys_sable.c +13 -13
index b2abe27..0eca307 100644
@@ -443,57 +443,57 @@ lynx_swizzle(struct pci_dev *dev, u8 *pinp)
 /* GENERIC irq routines */
 
 static inline void
-sable_lynx_enable_irq(unsigned int irq)
+sable_lynx_enable_irq(struct irq_desc *desc)
 {
 	unsigned long bit, mask;
 
-	bit = sable_lynx_irq_swizzle->irq_to_mask[irq];
+	bit = sable_lynx_irq_swizzle->irq_to_mask[desc->irq];
 	spin_lock(&sable_lynx_irq_lock);
 	mask = sable_lynx_irq_swizzle->shadow_mask &= ~(1UL << bit);
 	sable_lynx_irq_swizzle->update_irq_hw(bit, mask);
 	spin_unlock(&sable_lynx_irq_lock);
 #if 0
 	printk("%s: mask 0x%lx bit 0x%lx irq 0x%x\n",
-	       __func__, mask, bit, irq);
+	       __func__, mask, bit, desc->irq);
 #endif
 }
 
 static void
-sable_lynx_disable_irq(unsigned int irq)
+sable_lynx_disable_irq(struct irq_desc *desc)
 {
 	unsigned long bit, mask;
 
-	bit = sable_lynx_irq_swizzle->irq_to_mask[irq];
+	bit = sable_lynx_irq_swizzle->irq_to_mask[desc->irq];
 	spin_lock(&sable_lynx_irq_lock);
 	mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit;
 	sable_lynx_irq_swizzle->update_irq_hw(bit, mask);
 	spin_unlock(&sable_lynx_irq_lock);
 #if 0
 	printk("%s: mask 0x%lx bit 0x%lx irq 0x%x\n",
-	       __func__, mask, bit, irq);
+	       __func__, mask, bit, desc->irq);
 #endif
 }
 
 static unsigned int
-sable_lynx_startup_irq(unsigned int irq)
+sable_lynx_startup_irq(struct irq_desc *desc)
 {
-	sable_lynx_enable_irq(irq);
+	sable_lynx_enable_irq(desc);
 	return 0;
 }
 
 static void
-sable_lynx_end_irq(unsigned int irq)
+sable_lynx_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		sable_lynx_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		sable_lynx_enable_irq(desc);
 }
 
 static void
-sable_lynx_mask_and_ack_irq(unsigned int irq)
+sable_lynx_mask_and_ack_irq(struct irq_desc *desc)
 {
 	unsigned long bit, mask;
 
-	bit = sable_lynx_irq_swizzle->irq_to_mask[irq];
+	bit = sable_lynx_irq_swizzle->irq_to_mask[desc->irq];
 	spin_lock(&sable_lynx_irq_lock);
 	mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit;
 	sable_lynx_irq_swizzle->update_irq_hw(bit, mask);
arch/alpha/kernel/sys_takara.c +11 -7
index 2304648..6c6fa86 100644
@@ -45,33 +45,37 @@ takara_update_irq_hw(unsigned long irq, unsigned long mask)
 }
 
 static inline void
-takara_enable_irq(unsigned int irq)
+takara_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long mask;
+
 	mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63)));
 	takara_update_irq_hw(irq, mask);
 }
 
 static void
-takara_disable_irq(unsigned int irq)
+takara_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long mask;
+
 	mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63));
 	takara_update_irq_hw(irq, mask);
 }
 
 static unsigned int
-takara_startup_irq(unsigned int irq)
+takara_startup_irq(struct irq_desc *desc)
 {
-	takara_enable_irq(irq);
+	takara_enable_irq(desc);
 	return 0; /* never anything pending */
 }
 
 static void
-takara_end_irq(unsigned int irq)
+takara_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		takara_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		takara_enable_irq(desc);
 }
 
 static struct irq_chip takara_irq_type = {
arch/alpha/kernel/sys_titan.c +11 -11
index 9008d0f..73f661c 100644
@@ -112,35 +112,35 @@ titan_update_irq_hw(unsigned long mask)
 }
 
 static inline void
-titan_enable_irq(unsigned int irq)
+titan_enable_irq(struct irq_desc *desc)
 {
 	spin_lock(&titan_irq_lock);
-	titan_cached_irq_mask |= 1UL << (irq - 16);
+	titan_cached_irq_mask |= 1UL << (desc->irq - 16);
 	titan_update_irq_hw(titan_cached_irq_mask);
 	spin_unlock(&titan_irq_lock);
 }
 
 static inline void
-titan_disable_irq(unsigned int irq)
+titan_disable_irq(struct irq_desc *desc)
 {
 	spin_lock(&titan_irq_lock);
-	titan_cached_irq_mask &= ~(1UL << (irq - 16));
+	titan_cached_irq_mask &= ~(1UL << (desc->irq - 16));
 	titan_update_irq_hw(titan_cached_irq_mask);
 	spin_unlock(&titan_irq_lock);
 }
 
 static unsigned int
-titan_startup_irq(unsigned int irq)
+titan_startup_irq(struct irq_desc *desc)
 {
-	titan_enable_irq(irq);
+	titan_enable_irq(desc);
 	return 0;	/* never anything pending */
 }
 
 static void
-titan_end_irq(unsigned int irq)
+titan_end_irq(struct irq_desc *desc)
 {
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		titan_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		titan_enable_irq(desc);
 }
 
 static void
@@ -158,10 +158,10 @@ titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity)
 }
 
 static int
-titan_set_irq_affinity(unsigned int irq, const struct cpumask *affinity)
+titan_set_irq_affinity(struct irq_desc *desc, const struct cpumask *affinity)
 { 
 	spin_lock(&titan_irq_lock);
-	titan_cpu_set_irq_affinity(irq - 16, *affinity);
+	titan_cpu_set_irq_affinity(desc->irq - 16, *affinity);
 	titan_update_irq_hw(titan_cached_irq_mask);
 	spin_unlock(&titan_irq_lock);
 
arch/alpha/kernel/sys_wildfire.c +19 -13
index 62fd972..e67555b 100644
@@ -104,10 +104,12 @@ wildfire_init_irq_hw(void)
 }
 
 static void
-wildfire_enable_irq(unsigned int irq)
+wildfire_enable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	if (irq < 16)
-		i8259a_enable_irq(irq);
+		i8259a_enable_irq(desc);
 
 	spin_lock(&wildfire_irq_lock);
 	set_bit(irq, &cached_irq_mask);
@@ -116,10 +118,12 @@ wildfire_enable_irq(unsigned int irq)
 }
 
 static void
-wildfire_disable_irq(unsigned int irq)
+wildfire_disable_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	if (irq < 16)
-		i8259a_disable_irq(irq);
+		i8259a_disable_irq(desc);
 
 	spin_lock(&wildfire_irq_lock);
 	clear_bit(irq, &cached_irq_mask);
@@ -128,10 +132,12 @@ wildfire_disable_irq(unsigned int irq)
 }
 
 static void
-wildfire_mask_and_ack_irq(unsigned int irq)
+wildfire_mask_and_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	if (irq < 16)
-		i8259a_mask_and_ack_irq(irq);
+		i8259a_mask_and_ack_irq(desc);
 
 	spin_lock(&wildfire_irq_lock);
 	clear_bit(irq, &cached_irq_mask);
@@ -140,21 +146,21 @@ wildfire_mask_and_ack_irq(unsigned int irq)
 }
 
 static unsigned int
-wildfire_startup_irq(unsigned int irq)
+wildfire_startup_irq(struct irq_desc *desc)
 { 
-	wildfire_enable_irq(irq);
+	wildfire_enable_irq(desc);
 	return 0; /* never anything pending */
 }
 
 static void
-wildfire_end_irq(unsigned int irq)
+wildfire_end_irq(struct irq_desc *desc)
 { 
 #if 0
-	if (!irq_desc[irq].action)
-		printk("got irq %d\n", irq);
+	if (!desc->action)
+		printk("got irq %d\n", desc->irq);
 #endif
-	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-		wildfire_enable_irq(irq);
+	if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		wildfire_enable_irq(desc);
 }
 
 static struct irq_chip wildfire_irq_type = {
arch/arm/common/gic.c +12 -8
index 337741f..7e7f9f7 100644
@@ -80,8 +80,9 @@ static inline unsigned int gic_irq(unsigned int irq)
  * our "acknowledge" routine disable the interrupt, then mark it as
  * complete.
  */
-static void gic_ack_irq(unsigned int irq)
+static void gic_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 mask = 1 << (irq % 32);
 
 	spin_lock(&irq_controller_lock);
@@ -90,8 +91,9 @@ static void gic_ack_irq(unsigned int irq)
 	spin_unlock(&irq_controller_lock);
 }
 
-static void gic_mask_irq(unsigned int irq)
+static void gic_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 mask = 1 << (irq % 32);
 
 	spin_lock(&irq_controller_lock);
@@ -99,8 +101,9 @@ static void gic_mask_irq(unsigned int irq)
 	spin_unlock(&irq_controller_lock);
 }
 
-static void gic_unmask_irq(unsigned int irq)
+static void gic_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 mask = 1 << (irq % 32);
 
 	spin_lock(&irq_controller_lock);
@@ -109,8 +112,9 @@ static void gic_unmask_irq(unsigned int irq)
 }
 
 #ifdef CONFIG_SMP
-static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
+static int gic_set_cpu(struct irq_desc *desc, const struct cpumask *mask_val)
 {
+	unsigned int irq = desc->irq;
 	void __iomem *reg = gic_dist_base(irq) + GIC_DIST_TARGET + (gic_irq(irq) & ~3);
 	unsigned int shift = (irq % 4) * 8;
 	unsigned int cpu = cpumask_first(mask_val);
@@ -129,13 +133,13 @@ static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
 
 static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
 {
-	struct gic_chip_data *chip_data = get_irq_data(irq);
-	struct irq_chip *chip = get_irq_chip(irq);
+	struct gic_chip_data *chip_data = get_irq_desc_data(desc);
+	struct irq_chip *chip = get_irq_desc_chip(desc);
 	unsigned int cascade_irq, gic_irq;
 	unsigned long status;
 
 	/* primary controller ack'ing */
-	chip->ack(irq);
+	chip->ack(desc);
 
 	spin_lock(&irq_controller_lock);
 	status = readl(chip_data->cpu_base + GIC_CPU_INTACK);
@@ -153,7 +157,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
 
  out:
 	/* primary controller unmasking */
-	chip->unmask(irq);
+	chip->unmask(desc);
 }
 
 static struct irq_chip gic_chip = {
arch/arm/common/it8152.c +6 -2
index ee1d3b8..94f5146 100644
@@ -32,8 +32,10 @@
 
 #define MAX_SLOTS		21
 
-static void it8152_mask_irq(unsigned int irq)
+static void it8152_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
        if (irq >= IT8152_LD_IRQ(0)) {
 	       __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) |
 			    (1 << (irq - IT8152_LD_IRQ(0)))),
@@ -49,8 +51,10 @@ static void it8152_mask_irq(unsigned int irq)
        }
 }
 
-static void it8152_unmask_irq(unsigned int irq)
+static void it8152_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
        if (irq >= IT8152_LD_IRQ(0)) {
 	       __raw_writel((__raw_readl(IT8152_INTC_LDCNIMR) &
 			     ~(1 << (irq - IT8152_LD_IRQ(0)))),
arch/arm/common/locomo.c +10 -8
index 90ae00b..d91ec74 100644
@@ -140,11 +140,11 @@ static struct locomo_dev_info locomo_devices[] = {
 
 static void locomo_handler(unsigned int irq, struct irq_desc *desc)
 {
-	struct locomo *lchip = get_irq_chip_data(irq);
+	struct locomo *lchip = get_irq_desc_chip_data(desc);
 	int req, i;
 
 	/* Acknowledge the parent IRQ */
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 
 	/* check why this interrupt was generated */
 	req = locomo_readl(lchip->base + LOCOMO_ICR) & 0x0f00;
@@ -154,29 +154,31 @@ static void locomo_handler(unsigned int irq, struct irq_desc *desc)
 		irq = lchip->irq_base;
 		for (i = 0; i <= 3; i++, irq++) {
 			if (req & (0x0100 << i)) {
-				generic_handle_irq(irq);
+				generic_handle_irq_desc(irq, desc);
 			}
 
 		}
 	}
 }
 
-static void locomo_ack_irq(unsigned int irq)
+static void locomo_ack_irq(struct irq_desc *desc)
 {
 }
 
-static void locomo_mask_irq(unsigned int irq)
+static void locomo_mask_irq(struct irq_desc *desc)
 {
-	struct locomo *lchip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct locomo *lchip = get_irq_desc_chip_data(desc);
 	unsigned int r;
 	r = locomo_readl(lchip->base + LOCOMO_ICR);
 	r &= ~(0x0010 << (irq - lchip->irq_base));
 	locomo_writel(r, lchip->base + LOCOMO_ICR);
 }
 
-static void locomo_unmask_irq(unsigned int irq)
+static void locomo_unmask_irq(struct irq_desc *desc)
 {
-	struct locomo *lchip = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	struct locomo *lchip = get_irq_desc_chip_data(desc);
 	unsigned int r;
 	r = locomo_readl(lchip->base + LOCOMO_ICR);
 	r |= (0x0010 << (irq - lchip->irq_base));
arch/arm/common/sa1111.c +34 -24

148 lines not on this page · raw message

arch/arm/common/vic.c +14 -7
index 1cf999a..c4a5dcd 100644
@@ -204,25 +204,31 @@ static void __init vic_pm_register(void __iomem *base, unsigned int irq, u32 res
 static inline void vic_pm_register(void __iomem *base, unsigned int irq, u32 arg1) { }
 #endif /* CONFIG_PM */
 
-static void vic_ack_irq(unsigned int irq)
+static void vic_ack_irq(struct irq_desc *desc)
 {
-	void __iomem *base = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	void __iomem *base = get_irq_desc_chip_data(desc);
+
 	irq &= 31;
 	writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
 	/* moreover, clear the soft-triggered, in case it was the reason */
 	writel(1 << irq, base + VIC_INT_SOFT_CLEAR);
 }
 
-static void vic_mask_irq(unsigned int irq)
+static void vic_mask_irq(struct irq_desc *desc)
 {
-	void __iomem *base = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	void __iomem *base = get_irq_desc_chip_data(desc);
+
 	irq &= 31;
 	writel(1 << irq, base + VIC_INT_ENABLE_CLEAR);
 }
 
-static void vic_unmask_irq(unsigned int irq)
+static void vic_unmask_irq(struct irq_desc *desc)
 {
-	void __iomem *base = get_irq_chip_data(irq);
+	unsigned int irq = desc->irq;
+	void __iomem *base = get_irq_desc_chip_data(desc);
+
 	irq &= 31;
 	writel(1 << irq, base + VIC_INT_ENABLE);
 }
@@ -242,8 +248,9 @@ static struct vic_device *vic_from_irq(unsigned int irq)
 	return NULL;
 }
 
-static int vic_set_wake(unsigned int irq, unsigned int on)
+static int vic_set_wake(struct irq_desc *desc, unsigned int on)
 {
+	unsigned int irq = desc->irq;
 	struct vic_device *v = vic_from_irq(irq);
 	unsigned int off = irq & 31;
 	u32 bit = 1 << off;
arch/arm/kernel/ecard.c +7 -5
index eed2f79..7310a4d 100644
@@ -443,8 +443,9 @@ static expansioncard_ops_t ecard_default_ops = {
  *
  * They are not meant to be called directly, but via enable/disable_irq.
  */
-static void ecard_irq_unmask(unsigned int irqnr)
+static void ecard_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irqnr = desc->irq;
 	ecard_t *ec = slot_to_ecard(irqnr - 32);
 
 	if (ec) {
@@ -459,8 +460,9 @@ static void ecard_irq_unmask(unsigned int irqnr)
 	}
 }
 
-static void ecard_irq_mask(unsigned int irqnr)
+static void ecard_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irqnr = desc->irq;
 	ecard_t *ec = slot_to_ecard(irqnr - 32);
 
 	if (ec) {
@@ -551,7 +553,7 @@ static void ecard_check_lockup(struct irq_desc *desc)
 			printk(KERN_ERR "\nInterrupt lockup detected - "
 			       "disabling all expansion card interrupts\n");
 
-			desc->chip->mask(IRQ_EXPANSIONCARD);
+			desc->chip->mask(irq_to_desc(IRQ_EXPANSIONCARD));
 			ecard_dump_irq_state();
 		}
 	} else
@@ -574,7 +576,7 @@ ecard_irq_handler(unsigned int irq, struct irq_desc *desc)
 	ecard_t *ec;
 	int called = 0;
 
-	desc->chip->mask(irq);
+	desc->chip->mask(desc);
 	for (ec = cards; ec; ec = ec->next) {
 		int pending;
 
@@ -591,7 +593,7 @@ ecard_irq_handler(unsigned int irq, struct irq_desc *desc)
 			called ++;
 		}
 	}
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 
 	if (called == 0)
 		ecard_check_lockup(desc);
arch/arm/kernel/smp_twd.c +4 -2
index ea02a7b..ff3f4ab 100644
@@ -145,6 +145,7 @@ static void __cpuinit twd_calibrate_rate(void)
 void __cpuinit twd_timer_setup(struct clock_event_device *clk)
 {
 	unsigned long flags;
+	struct irq_desc *desc;
 
 	twd_calibrate_rate();
 
@@ -160,8 +161,9 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
 
 	/* Make sure our local interrupt controller has this enabled */
 	local_irq_save(flags);
-	irq_to_desc(clk->irq)->status |= IRQ_NOPROBE;
-	get_irq_chip(clk->irq)->unmask(clk->irq);
+	desc = irq_to_desc(clk->irq);
+	desc->status |= IRQ_NOPROBE;
+	get_irq_desc_chip(desc)->unmask(desc);
 	local_irq_restore(flags);
 
 	clockevents_register_device(clk);
arch/arm/mach-aaec2000/core.c +3 -3
index b5c5fc6..41a8ad9 100644
@@ -67,17 +67,17 @@ void __init aaec2000_map_io(void)
 /*
  * Interrupt handling routines
  */
-static void aaec2000_int_ack(unsigned int irq)
+static void aaec2000_int_ack(struct irq_desc *desc)
 {
 	IRQ_INTSR = 1 << irq;
 }
 
-static void aaec2000_int_mask(unsigned int irq)
+static void aaec2000_int_mask(struct irq_desc *desc)
 {
 	IRQ_INTENC |= (1 << irq);
 }
 
-static void aaec2000_int_unmask(unsigned int irq)
+static void aaec2000_int_unmask(struct irq_desc *desc)
 {
 	IRQ_INTENS |= (1 << irq);
 }
arch/arm/mach-at91/gpio.c +10 -7
index ae4772e..55bfcbd 100644
@@ -274,8 +274,9 @@ EXPORT_SYMBOL(at91_get_gpio_value);
 static u32 wakeups[MAX_GPIO_BANKS];
 static u32 backups[MAX_GPIO_BANKS];
 
-static int gpio_irq_set_wake(unsigned pin, unsigned state)
+static int gpio_irq_set_wake(struct irq_desc *desc, unsigned state)
 {
+	unsigned int pin = desc->irq;
 	unsigned	mask = pin_to_mask(pin);
 	unsigned	bank = (pin - PIN_BASE) / 32;
 
@@ -344,8 +345,9 @@ void at91_gpio_resume(void)
  * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
  */
 
-static void gpio_irq_mask(unsigned pin)
+static void gpio_irq_mask(struct irq_desc *desc)
 {
+	unsigned int pin = desc->irq;
 	void __iomem	*pio = pin_to_controller(pin);
 	unsigned	mask = pin_to_mask(pin);
 
@@ -353,8 +355,9 @@ static void gpio_irq_mask(unsigned pin)
 		__raw_writel(mask, pio + PIO_IDR);
 }
 
-static void gpio_irq_unmask(unsigned pin)
+static void gpio_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int pin = desc->irq;
 	void __iomem	*pio = pin_to_controller(pin);
 	unsigned	mask = pin_to_mask(pin);
 
@@ -362,7 +365,7 @@ static void gpio_irq_unmask(unsigned pin)
 		__raw_writel(mask, pio + PIO_IER);
 }
 
-static int gpio_irq_type(unsigned pin, unsigned type)
+static int gpio_irq_type(struct irq_desc *desc, unsigned type)
 {
 	switch (type) {
 	case IRQ_TYPE_NONE:
@@ -393,7 +396,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 	pio = at91_gpio->regbase;
 
 	/* temporarily mask (level sensitive) parent IRQ */
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 	for (;;) {
 		/* Reading ISR acks pending (edge triggered) GPIO interrupts.
 		 * When there none are pending, we're finished unless we need
@@ -419,7 +422,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 					 * another IRQ must be generated before it actually gets
 					 * here to be disabled on the GPIO controller.
 					 */
-					gpio_irq_mask(pin);
+					gpio_irq_mask(gpio);
 				}
 				else
 					generic_handle_irq(pin);
@@ -429,7 +432,7 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 			isr >>= 1;
 		}
 	}
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 	/* now it may re-trigger */
 }
 
arch/arm/mach-at91/irq.c +11 -4
index da3494a..4308334 100644
@@ -34,14 +34,18 @@
 #include <asm/mach/map.h>
 
 
-static void at91_aic_mask_irq(unsigned int irq)
+static void at91_aic_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	/* Disable interrupt on AIC */
 	at91_sys_write(AT91_AIC_IDCR, 1 << irq);
 }
 
-static void at91_aic_unmask_irq(unsigned int irq)
+static void at91_aic_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	/* Enable interrupt on AIC */
 	at91_sys_write(AT91_AIC_IECR, 1 << irq);
 }
@@ -50,8 +54,9 @@ unsigned int at91_extern_irq;
 
 #define is_extern_irq(irq) ((1 << (irq)) & at91_extern_irq)
 
-static int at91_aic_set_type(unsigned irq, unsigned type)
+static int at91_aic_set_type(struct irq_desc *desc, unsigned type)
 {
+	unsigned int irq = desc->irq;
 	unsigned int smr, srctype;
 
 	switch (type) {
@@ -87,8 +92,10 @@ static int at91_aic_set_type(unsigned irq, unsigned type)
 static u32 wakeups;
 static u32 backups;
 
-static int at91_aic_set_wake(unsigned irq, unsigned value)
+static int at91_aic_set_wake(struct irq_desc *desc, unsigned value)
 {
+	unsigned int irq = desc->irq;
+
 	if (unlikely(irq >= 32))
 		return -EINVAL;
 
arch/arm/mach-bcmring/irq.c +18 -6
index dc1c493..4685c62 100644
@@ -30,38 +30,50 @@
 #include <mach/csp/intcHw_reg.h>
 #include <mach/csp/mm_io.h>
 
-static void bcmring_mask_irq0(unsigned int irq)
+static void bcmring_mask_irq0(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	writel(1 << (irq - IRQ_INTC0_START),
 	       MM_IO_BASE_INTC0 + INTCHW_INTENCLEAR);
 }
 
-static void bcmring_unmask_irq0(unsigned int irq)
+static void bcmring_unmask_irq0(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	writel(1 << (irq - IRQ_INTC0_START),
 	       MM_IO_BASE_INTC0 + INTCHW_INTENABLE);
 }
 
-static void bcmring_mask_irq1(unsigned int irq)
+static void bcmring_mask_irq1(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	writel(1 << (irq - IRQ_INTC1_START),
 	       MM_IO_BASE_INTC1 + INTCHW_INTENCLEAR);
 }
 
-static void bcmring_unmask_irq1(unsigned int irq)
+static void bcmring_unmask_irq1(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	writel(1 << (irq - IRQ_INTC1_START),
 	       MM_IO_BASE_INTC1 + INTCHW_INTENABLE);
 }
 
-static void bcmring_mask_irq2(unsigned int irq)
+static void bcmring_mask_irq2(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	writel(1 << (irq - IRQ_SINTC_START),
 	       MM_IO_BASE_SINTC + INTCHW_INTENCLEAR);
 }
 
-static void bcmring_unmask_irq2(unsigned int irq)
+static void bcmring_unmask_irq2(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
+
 	writel(1 << (irq - IRQ_SINTC_START),
 	       MM_IO_BASE_SINTC + INTCHW_INTENABLE);
 }
arch/arm/mach-clps711x/irq.c +12 -6
index 9a12d85..f614852 100644
@@ -27,8 +27,9 @@
 
 #include <asm/hardware/clps7111.h>
 
-static void int1_mask(unsigned int irq)
+static void int1_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 intmr1;
 
 	intmr1 = clps_readl(INTMR1);
@@ -36,8 +37,9 @@ static void int1_mask(unsigned int irq)
 	clps_writel(intmr1, INTMR1);
 }
 
-static void int1_ack(unsigned int irq)
+static void int1_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 intmr1;
 
 	intmr1 = clps_readl(INTMR1);
@@ -54,8 +56,9 @@ static void int1_ack(unsigned int irq)
 	}
 }
 
-static void int1_unmask(unsigned int irq)
+static void int1_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 intmr1;
 
 	intmr1 = clps_readl(INTMR1);
@@ -69,8 +72,9 @@ static struct irq_chip int1_chip = {
 	.unmask = int1_unmask,
 };
 
-static void int2_mask(unsigned int irq)
+static void int2_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 intmr2;
 
 	intmr2 = clps_readl(INTMR2);
@@ -78,8 +82,9 @@ static void int2_mask(unsigned int irq)
 	clps_writel(intmr2, INTMR2);
 }
 
-static void int2_ack(unsigned int irq)
+static void int2_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 intmr2;
 
 	intmr2 = clps_readl(INTMR2);
@@ -91,8 +96,9 @@ static void int2_ack(unsigned int irq)
 	}
 }
 
-static void int2_unmask(unsigned int irq)
+static void int2_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 intmr2;
 
 	intmr2 = clps_readl(INTMR2);
arch/arm/mach-davinci/cp_intc.c +9 -5
index 37311d1..8284b53 100644
@@ -27,14 +27,16 @@ static inline void cp_intc_write(unsigned long value, unsigned offset)
 	__raw_writel(value, cp_intc_base + offset);
 }
 
-static void cp_intc_ack_irq(unsigned int irq)
+static void cp_intc_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	cp_intc_write(irq, CP_INTC_SYS_STAT_IDX_CLR);
 }
 
 /* Disable interrupt */
-static void cp_intc_mask_irq(unsigned int irq)
+static void cp_intc_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	/* XXX don't know why we need to disable nIRQ here... */
 	cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_CLR);
 	cp_intc_write(irq, CP_INTC_SYS_ENABLE_IDX_CLR);
@@ -42,13 +44,15 @@ static void cp_intc_mask_irq(unsigned int irq)
 }
 
 /* Enable interrupt */
-static void cp_intc_unmask_irq(unsigned int irq)
+static void cp_intc_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	cp_intc_write(irq, CP_INTC_SYS_ENABLE_IDX_SET);
 }
 
-static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type)
+static int cp_intc_set_irq_type(struct irq_desc *desc, unsigned int flow_type)
 {
+	unsigned int irq = desc->irq;
 	unsigned reg		= BIT_WORD(irq);
 	unsigned mask		= BIT_MASK(irq);
 	unsigned polarity	= cp_intc_read(CP_INTC_SYS_POLARITY(reg));
@@ -86,7 +90,7 @@ static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type)
  * generic drivers which call {enable|disable}_irq_wake for
  * wake up interrupt sources (eg RTC on DA850).
  */
-static int cp_intc_set_wake(unsigned int irq, unsigned int on)
+static int cp_intc_set_wake(struct irq_desc *desc, unsigned int on)
 {
 	return 0;
 }
arch/arm/mach-davinci/gpio.c +16 -16
index 744755b..e557755 100644
@@ -159,20 +159,20 @@ pure_initcall(davinci_gpio_setup);
  * serve as EDMA event triggers.
  */
 
-static void gpio_irq_disable(unsigned irq)
+static void gpio_irq_disable(struct irq_desc *desc)
 {
-	struct gpio_controller *__iomem g = get_irq_chip_data(irq);
-	u32 mask = (u32) get_irq_data(irq);
+	struct gpio_controller *__iomem g = get_irq_desc_chip_data(desc);
+	u32 mask = (u32) get_irq_desc_data(desc);
 
 	__raw_writel(mask, &g->clr_falling);
 	__raw_writel(mask, &g->clr_rising);
 }
 
-static void gpio_irq_enable(unsigned irq)
+static void gpio_irq_enable(struct irq_desc *desc)
 {
-	struct gpio_controller *__iomem g = get_irq_chip_data(irq);
-	u32 mask = (u32) get_irq_data(irq);
-	unsigned status = irq_desc[irq].status;
+	struct gpio_controller *__iomem g = get_irq_desc_chip_data(desc);
+	u32 mask = (u32) get_irq_desc_data(desc);
+	unsigned status = desc->status;
 
 	status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
 	if (!status)
@@ -184,19 +184,19 @@ static void gpio_irq_enable(unsigned irq)
 		__raw_writel(mask, &g->set_rising);
 }
 
-static int gpio_irq_type(unsigned irq, unsigned trigger)
+static int gpio_irq_type(struct irq_desc *desc, unsigned trigger)
 {
-	struct gpio_controller *__iomem g = get_irq_chip_data(irq);
-	u32 mask = (u32) get_irq_data(irq);
+	struct gpio_controller *__iomem g = get_irq_desc_chip_data(desc);
+	u32 mask = (u32) get_irq_desc_data(desc);
 
 	if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
 		return -EINVAL;
 
-	irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
-	irq_desc[irq].status |= trigger;
+	desc->status &= ~IRQ_TYPE_SENSE_MASK;
+	desc->status |= trigger;
 
 	/* don't enable the IRQ if it's currently disabled */
-	if (irq_desc[irq].depth == 0) {
+	if (desc->depth == 0) {
 		__raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
 			     ? &g->set_falling : &g->clr_falling);
 		__raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
@@ -223,8 +223,8 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 		mask <<= 16;
 
 	/* temporarily mask (level sensitive) parent IRQ */
-	desc->chip->mask(irq);
-	desc->chip->ack(irq);
+	desc->chip->mask(desc);
+	desc->chip->ack(desc);
 	while (1) {
 		u32		status;
 		int		n;
@@ -247,7 +247,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
 			status >>= res;
 		}
 	}
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 	/* now it may re-trigger */
 }
 
arch/arm/mach-davinci/irq.c +6 -3
index af92ffe..dc8e7a0 100644
@@ -53,8 +53,9 @@ static inline void davinci_irq_writel(unsigned long value, int offset)
 }
 
 /* Disable interrupt */
-static void davinci_mask_irq(unsigned int irq)
+static void davinci_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask;
 	u32 l;
 
@@ -72,8 +73,9 @@ static void davinci_mask_irq(unsigned int irq)
 }
 
 /* Enable interrupt */
-static void davinci_unmask_irq(unsigned int irq)
+static void davinci_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask;
 	u32 l;
 
@@ -91,8 +93,9 @@ static void davinci_unmask_irq(unsigned int irq)
 }
 
 /* EOI interrupt */
-static void davinci_ack_irq(unsigned int irq)
+static void davinci_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask;
 
 	mask = 1 << IRQ_BIT(irq);
arch/arm/mach-dove/irq.c +6 -3
index 61bfcb3..a19a4dc 100644
@@ -36,8 +36,9 @@ static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
 	}
 }
 
-static void pmu_irq_mask(unsigned int irq)
+static void pmu_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int pin = irq_to_pmu(irq);
 	u32 u;
 
@@ -46,8 +47,9 @@ static void pmu_irq_mask(unsigned int irq)
 	writel(u, PMU_INTERRUPT_MASK);
 }
 
-static void pmu_irq_unmask(unsigned int irq)
+static void pmu_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int pin = irq_to_pmu(irq);
 	u32 u;
 
@@ -56,8 +58,9 @@ static void pmu_irq_unmask(unsigned int irq)
 	writel(u, PMU_INTERRUPT_MASK);
 }
 
-static void pmu_irq_ack(unsigned int irq)
+static void pmu_irq_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int pin = irq_to_pmu(irq);
 	u32 u;
 
arch/arm/mach-ebsa110/core.c +4 -2
index c7bc7fb..f5e1e3d 100644
@@ -35,13 +35,15 @@
 #define IRQ_STAT		0xff000000	/* read */
 #define IRQ_MCLR		0xff000000	/* write */
 
-static void ebsa110_mask_irq(unsigned int irq)
+static void ebsa110_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	__raw_writeb(1 << irq, IRQ_MCLR);
 }
 
-static void ebsa110_unmask_irq(unsigned int irq)
+static void ebsa110_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	__raw_writeb(1 << irq, IRQ_MSET);
 }
 
arch/arm/mach-ep93xx/gpio.c +12 -8
index cc377ae..3457432 100644
@@ -112,13 +112,14 @@ static void ep93xx_gpio_f_irq_handler(unsigned int irq, struct irq_desc *desc)
 	generic_handle_irq(gpio_irq);
 }
 
-static void ep93xx_gpio_irq_ack(unsigned int irq)
+static void ep93xx_gpio_irq_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int line = irq_to_gpio(irq);
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
-	if ((irq_desc[irq].status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
+	if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH) {
 		gpio_int_type2[port] ^= port_mask; /* switch edge direction */
 		ep93xx_gpio_update_int_params(port);
 	}
@@ -126,13 +127,14 @@ static void ep93xx_gpio_irq_ack(unsigned int irq)
 	__raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
 }
 
-static void ep93xx_gpio_irq_mask_ack(unsigned int irq)
+static void ep93xx_gpio_irq_mask_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int line = irq_to_gpio(irq);
 	int port = line >> 3;
 	int port_mask = 1 << (line & 7);
 
-	if ((irq_desc[irq].status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH)
+	if ((desc->status & IRQ_TYPE_SENSE_MASK) == IRQ_TYPE_EDGE_BOTH)
 		gpio_int_type2[port] ^= port_mask; /* switch edge direction */
 
 	gpio_int_unmasked[port] &= ~port_mask;
@@ -141,8 +143,9 @@ static void ep93xx_gpio_irq_mask_ack(unsigned int irq)
 	__raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
 }
 
-static void ep93xx_gpio_irq_mask(unsigned int irq)
+static void ep93xx_gpio_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int line = irq_to_gpio(irq);
 	int port = line >> 3;
 
@@ -150,8 +153,9 @@ static void ep93xx_gpio_irq_mask(unsigned int irq)
 	ep93xx_gpio_update_int_params(port);
 }
 
-static void ep93xx_gpio_irq_unmask(unsigned int irq)
+static void ep93xx_gpio_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int line = irq_to_gpio(irq);
 	int port = line >> 3;
 
@@ -164,9 +168,9 @@ static void ep93xx_gpio_irq_unmask(unsigned int irq)
  * edge (1) triggered, while gpio_int_type2 controls whether it
  * triggers on low/falling (0) or high/rising (1).
  */
-static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type)
+static int ep93xx_gpio_irq_type(struct irq_desc *desc, unsigned int type)
 {
-	struct irq_desc *desc = irq_desc + irq;
+	unsigned int irq = desc->irq;
 	const int gpio = irq_to_gpio(irq);
 	const int port = gpio >> 3;
 	const int port_mask = 1 << (gpio & 7);
arch/arm/mach-footbridge/common.c +4 -2
index e3bc3f6..1a11b2a 100644
@@ -75,13 +75,15 @@ static const int fb_irq_mask[] = {
 	IRQ_MASK_PCI_PERR,	/* 19 */
 };
 
-static void fb_mask_irq(unsigned int irq)
+static void fb_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	*CSR_IRQ_DISABLE = fb_irq_mask[_DC21285_INR(irq)];
 }
 
-static void fb_unmask_irq(unsigned int irq)
+static void fb_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	*CSR_IRQ_ENABLE = fb_irq_mask[_DC21285_INR(irq)];
 }
 
arch/arm/mach-footbridge/isa-irq.c +12 -6
index 8bfd06a..7593eeb 100644
@@ -30,23 +30,26 @@
 
 #include "common.h"
 
-static void isa_mask_pic_lo_irq(unsigned int irq)
+static void isa_mask_pic_lo_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << (irq & 7);
 
 	outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO);
 }
 
-static void isa_ack_pic_lo_irq(unsigned int irq)
+static void isa_ack_pic_lo_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << (irq & 7);
 
 	outb(inb(PIC_MASK_LO) | mask, PIC_MASK_LO);
 	outb(0x20, PIC_LO);
 }
 
-static void isa_unmask_pic_lo_irq(unsigned int irq)
+static void isa_unmask_pic_lo_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << (irq & 7);
 
 	outb(inb(PIC_MASK_LO) & ~mask, PIC_MASK_LO);
@@ -58,15 +61,17 @@ static struct irq_chip isa_lo_chip = {
 	.unmask = isa_unmask_pic_lo_irq,
 };
 
-static void isa_mask_pic_hi_irq(unsigned int irq)
+static void isa_mask_pic_hi_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << (irq & 7);
 
 	outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI);
 }
 
-static void isa_ack_pic_hi_irq(unsigned int irq)
+static void isa_ack_pic_hi_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << (irq & 7);
 
 	outb(inb(PIC_MASK_HI) | mask, PIC_MASK_HI);
@@ -74,8 +79,9 @@ static void isa_ack_pic_hi_irq(unsigned int irq)
 	outb(0x20, PIC_HI);
 }
 
-static void isa_unmask_pic_hi_irq(unsigned int irq)
+static void isa_unmask_pic_hi_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask = 1 << (irq & 7);
 
 	outb(inb(PIC_MASK_HI) & ~mask, PIC_MASK_HI);
arch/arm/mach-gemini/gpio.c +8 -4
index fe3bd5a..66b50ea 100644
@@ -54,24 +54,27 @@ static void _set_gpio_irqenable(unsigned int base, unsigned int index,
 	__raw_writel(reg, base + GPIO_INT_EN);
 }
 
-static void gpio_ack_irq(unsigned int irq)
+static void gpio_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int gpio = irq_to_gpio(irq);
 	unsigned int base = GPIO_BASE(gpio / 32);
 
 	__raw_writel(1 << (gpio % 32), base + GPIO_INT_CLR);
 }
 
-static void gpio_mask_irq(unsigned int irq)
+static void gpio_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int gpio = irq_to_gpio(irq);
 	unsigned int base = GPIO_BASE(gpio / 32);
 
 	_set_gpio_irqenable(base, gpio % 32, 0);
 }
 
-static void gpio_unmask_irq(unsigned int irq)
+static void gpio_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int gpio = irq_to_gpio(irq);
 	unsigned int base = GPIO_BASE(gpio / 32);
 
@@ -80,6 +83,7 @@ static void gpio_unmask_irq(unsigned int irq)
 
 static int gpio_set_irq_type(unsigned int irq, unsigned int type)
 {
+	unsigned int irq = desc->irq;
 	unsigned int gpio = irq_to_gpio(irq);
 	unsigned int gpio_mask = 1 << (gpio % 32);
 	unsigned int base = GPIO_BASE(gpio / 32);
@@ -120,7 +124,7 @@ static int gpio_set_irq_type(unsigned int irq, unsigned int type)
 	__raw_writel(reg_level, base + GPIO_INT_LEVEL);
 	__raw_writel(reg_both, base + GPIO_INT_BOTH_EDGE);
 
-	gpio_ack_irq(irq);
+	gpio_ack_irq(desc);
 
 	return 0;
 }
arch/arm/mach-gemini/irq.c +6 -3
index 9e613ca..30e23be 100644
@@ -32,13 +32,15 @@
 #define FIQ_LEVEL(base_addr)	(base_addr + 0x30)
 #define FIQ_STATUS(base_addr)	(base_addr + 0x34)
 
-static void gemini_ack_irq(unsigned int irq)
+static void gemini_ack_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	__raw_writel(1 << irq, IRQ_CLEAR(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
 }
 
-static void gemini_mask_irq(unsigned int irq)
+static void gemini_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask;
 
 	mask = __raw_readl(IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
@@ -46,8 +48,9 @@ static void gemini_mask_irq(unsigned int irq)
 	__raw_writel(mask, IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
 }
 
-static void gemini_unmask_irq(unsigned int irq)
+static void gemini_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int mask;
 
 	mask = __raw_readl(IRQ_MASK(IO_ADDRESS(GEMINI_INTERRUPT_BASE)));
arch/arm/mach-h720x/common.c +10 -5
index 7a26148..cb945c0 100644
@@ -53,16 +53,18 @@ unsigned long h720x_gettimeoffset(void)
 /*
  * mask Global irq's
  */
-static void mask_global_irq (unsigned int irq )
+static void mask_global_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	CPU_REG (IRQC_VIRT, IRQC_IER) &= ~(1 << irq);
 }
 
 /*
  * unmask Global irq's
  */
-static void unmask_global_irq (unsigned int irq )
+static void unmask_global_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	CPU_REG (IRQC_VIRT, IRQC_IER) |= (1 << irq);
 }
 
@@ -71,8 +73,9 @@ static void unmask_global_irq (unsigned int irq )
  * ack GPIO irq's
  * Ack only for edge triggered int's valid
  */
-static void inline ack_gpio_irq(u32 irq)
+static inline void ack_gpio_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq));
 	u32 bit = IRQ_TO_BIT(irq);
 	if ( (CPU_REG (reg_base, GPIO_EDGE) & bit))
@@ -82,8 +85,9 @@ static void inline ack_gpio_irq(u32 irq)
 /*
  * mask GPIO irq's
  */
-static void inline mask_gpio_irq(u32 irq)
+static inline void mask_gpio_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq));
 	u32 bit = IRQ_TO_BIT(irq);
 	CPU_REG (reg_base, GPIO_MASK) &= ~bit;
@@ -92,8 +96,9 @@ static void inline mask_gpio_irq(u32 irq)
 /*
  * unmask GPIO irq's
  */
-static void inline unmask_gpio_irq(u32 irq)
+static inline void unmask_gpio_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	u32 reg_base = GPIO_VIRT(IRQ_TO_REGNO(irq));
 	u32 bit = IRQ_TO_BIT(irq);
 	CPU_REG (reg_base, GPIO_MASK) |= bit;
arch/arm/mach-h720x/cpu-h7202.c +5 -3
index fd33a19..b73501e 100644
@@ -141,8 +141,9 @@ h7202_timer_interrupt(int irq, void *dev_id)
 /*
  * mask multiplexed timer IRQs
  */
-static void inline mask_timerx_irq (u32 irq)
+static inline void mask_timerx_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int bit;
 	bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1));
 	CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) &= ~bit;
@@ -151,8 +152,9 @@ static void inline mask_timerx_irq (u32 irq)
 /*
  * unmask multiplexed timer IRQs
  */
-static void inline unmask_timerx_irq (u32 irq)
+static inline void unmask_timerx_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned int bit;
 	bit = 2 << ((irq == IRQ_TIMER64B) ? 4 : (irq - IRQ_TIMER1));
 	CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) |= bit;
@@ -196,7 +198,7 @@ void __init h7202_init_irq (void)
 
 	for (irq = IRQ_TIMER1;
 	                  irq < IRQ_CHAINED_TIMERX(NR_TIMERX_IRQS); irq++) {
-		mask_timerx_irq(irq);
+		mask_timerx_irq(irq_to_desc(irq));
 		set_irq_chip(irq, &h7202_timerx_chip);
 		set_irq_handler(irq, handle_edge_irq);
 		set_irq_flags(irq, IRQF_VALID );
arch/arm/mach-integrator/integrator_ap.c +4 -2
index 8138a7e..3c23890 100644
@@ -151,13 +151,15 @@ static void __init ap_map_io(void)
 
 #define INTEGRATOR_SC_VALID_INT	0x003fffff
 
-static void sc_mask_irq(unsigned int irq)
+static void sc_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_CLEAR);
 }
 
-static void sc_unmask_irq(unsigned int irq)
+static void sc_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	writel(1 << irq, VA_IC_BASE + IRQ_ENABLE_SET);
 }
 
arch/arm/mach-integrator/integrator_cp.c +12 -6
index 66ef86d..0c8a89c 100644
@@ -145,14 +145,16 @@ static void __init intcp_map_io(void)
 #define sic_writel	__raw_writel
 #define sic_readl	__raw_readl
 
-static void cic_mask_irq(unsigned int irq)
+static void cic_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq -= IRQ_CIC_START;
 	cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
 }
 
-static void cic_unmask_irq(unsigned int irq)
+static void cic_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq -= IRQ_CIC_START;
 	cic_writel(1 << irq, INTCP_VA_CIC_BASE + IRQ_ENABLE_SET);
 }
@@ -164,14 +166,16 @@ static struct irq_chip cic_chip = {
 	.unmask	= cic_unmask_irq,
 };
 
-static void pic_mask_irq(unsigned int irq)
+static void pic_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq -= IRQ_PIC_START;
 	pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
 }
 
-static void pic_unmask_irq(unsigned int irq)
+static void pic_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq -= IRQ_PIC_START;
 	pic_writel(1 << irq, INTCP_VA_PIC_BASE + IRQ_ENABLE_SET);
 }
@@ -183,14 +187,16 @@ static struct irq_chip pic_chip = {
 	.unmask = pic_unmask_irq,
 };
 
-static void sic_mask_irq(unsigned int irq)
+static void sic_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq -= IRQ_SIC_START;
 	sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
 }
 
-static void sic_unmask_irq(unsigned int irq)
+static void sic_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	irq -= IRQ_SIC_START;
 	sic_writel(1 << irq, INTCP_VA_SIC_BASE + IRQ_ENABLE_SET);
 }
arch/arm/mach-iop13xx/irq.c +16 -8
index 0d099ca..7a41e2f 100644
@@ -123,50 +123,58 @@ static void write_intsize(u32 val)
 
 /* 0 = Interrupt Masked and 1 = Interrupt not masked */
 static void
-iop13xx_irq_mask0 (unsigned int irq)
+iop13xx_irq_mask0(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_0(read_intctl_0() & ~(1 << (irq - 0)));
 }
 
 static void
-iop13xx_irq_mask1 (unsigned int irq)
+iop13xx_irq_mask1(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_1(read_intctl_1() & ~(1 << (irq - 32)));
 }
 
 static void
-iop13xx_irq_mask2 (unsigned int irq)
+iop13xx_irq_mask2(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_2(read_intctl_2() & ~(1 << (irq - 64)));
 }
 
 static void
-iop13xx_irq_mask3 (unsigned int irq)
+iop13xx_irq_mask3(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_3(read_intctl_3() & ~(1 << (irq - 96)));
 }
 
 static void
-iop13xx_irq_unmask0(unsigned int irq)
+iop13xx_irq_unmask0(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_0(read_intctl_0() | (1 << (irq - 0)));
 }
 
 static void
-iop13xx_irq_unmask1(unsigned int irq)
+iop13xx_irq_unmask1(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_1(read_intctl_1() | (1 << (irq - 32)));
 }
 
 static void
-iop13xx_irq_unmask2(unsigned int irq)
+iop13xx_irq_unmask2(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_2(read_intctl_2() | (1 << (irq - 64)));
 }
 
 static void
-iop13xx_irq_unmask3(unsigned int irq)
+iop13xx_irq_unmask3(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	write_intctl_3(read_intctl_3() | (1 << (irq - 96)));
 }
 
arch/arm/mach-iop13xx/msi.c +1 -1
index f34b0ed..3e10b50 100644
@@ -156,7 +156,7 @@ void arch_teardown_msi_irq(unsigned int irq)
 	destroy_irq(irq);
 }
 
-static void iop13xx_msi_nop(unsigned int irq)
+static void iop13xx_msi_nop(struct irq_desc *desc)
 {
 	return;
 }
arch/arm/mach-iop32x/irq.c +4 -2
index ba59b2d..5f8cd81 100644
@@ -32,15 +32,17 @@ static void intstr_write(u32 val)
 }
 
 static void
-iop32x_irq_mask(unsigned int irq)
+iop32x_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	iop32x_mask &= ~(1 << irq);
 	intctl_write(iop32x_mask);
 }
 
 static void
-iop32x_irq_unmask(unsigned int irq)
+iop32x_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	iop32x_mask |= 1 << irq;
 	intctl_write(iop32x_mask);
 }
arch/arm/mach-ixp2000/core.c +20 -10
index babb225..127a945 100644
@@ -309,8 +309,9 @@ static void ixp2000_GPIO_irq_handler(unsigned int irq, struct irq_desc *desc)
 	}
 }
 
-static int ixp2000_GPIO_irq_type(unsigned int irq, unsigned int type)
+static int ixp2000_GPIO_irq_type(struct irq_desc *desc, unsigned int type)
 {
+	unsigned int irq = desc->irq;
 	int line = irq - IRQ_IXP2000_GPIO0;
 
 	/*
@@ -342,8 +343,9 @@ static int ixp2000_GPIO_irq_type(unsigned int irq, unsigned int type)
 	return 0;
 }
 
-static void ixp2000_GPIO_irq_mask_ack(unsigned int irq)
+static void ixp2000_GPIO_irq_mask_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_write(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0)));
 
 	ixp2000_reg_write(IXP2000_GPIO_EDSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
@@ -351,13 +353,15 @@ static void ixp2000_GPIO_irq_mask_ack(unsigned int irq)
 	ixp2000_reg_wrb(IXP2000_GPIO_INST, (1 << (irq - IRQ_IXP2000_GPIO0)));
 }
 
-static void ixp2000_GPIO_irq_mask(unsigned int irq)
+static void ixp2000_GPIO_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_wrb(IXP2000_GPIO_INCR, (1 << (irq - IRQ_IXP2000_GPIO0)));
 }
 
-static void ixp2000_GPIO_irq_unmask(unsigned int irq)
+static void ixp2000_GPIO_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_write(IXP2000_GPIO_INSR, (1 << (irq - IRQ_IXP2000_GPIO0)));
 }
 
@@ -368,8 +372,9 @@ static struct irq_chip ixp2000_GPIO_irq_chip = {
 	.set_type	= ixp2000_GPIO_irq_type,
 };
 
-static void ixp2000_pci_irq_mask(unsigned int irq)
+static void ixp2000_pci_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE;
 	if (irq == IRQ_IXP2000_PCIA)
 		ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 26)));
@@ -377,8 +382,9 @@ static void ixp2000_pci_irq_mask(unsigned int irq)
 		ixp2000_reg_wrb(IXP2000_PCI_XSCALE_INT_ENABLE, (temp & ~(1 << 27)));
 }
 
-static void ixp2000_pci_irq_unmask(unsigned int irq)
+static void ixp2000_pci_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long temp = *IXP2000_PCI_XSCALE_INT_ENABLE;
 	if (irq == IRQ_IXP2000_PCIA)
 		ixp2000_reg_write(IXP2000_PCI_XSCALE_INT_ENABLE, (temp | (1 << 26)));
@@ -401,14 +407,16 @@ static void ixp2000_err_irq_handler(unsigned int irq, struct irq_desc *desc)
 	}
 }
 
-static void ixp2000_err_irq_mask(unsigned int irq)
+static void ixp2000_err_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_CLR,
 			(1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR)));
 }
 
-static void ixp2000_err_irq_unmask(unsigned int irq)
+static void ixp2000_err_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_write(IXP2000_IRQ_ERR_ENABLE_SET,
 			(1 << (irq - IRQ_IXP2000_DRAM0_MIN_ERR)));
 }
@@ -425,13 +433,15 @@ static struct irq_chip ixp2000_pci_irq_chip = {
 	.unmask	= ixp2000_pci_irq_unmask
 };
 
-static void ixp2000_irq_mask(unsigned int irq)
+static void ixp2000_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_wrb(IXP2000_IRQ_ENABLE_CLR, (1 << irq));
 }
 
-static void ixp2000_irq_unmask(unsigned int irq)
+static void ixp2000_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_write(IXP2000_IRQ_ENABLE_SET, (1 << irq));
 }
 
arch/arm/mach-ixp2000/ixdp2x00.c +6 -4
index 3045130..d3e896e 100644
@@ -64,8 +64,9 @@ static struct slowport_cfg slowport_cpld_cfg = {
 };
 #endif
 
-static void ixdp2x00_irq_mask(unsigned int irq)
+static void ixdp2x00_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long dummy;
 	static struct slowport_cfg old_cfg;
 
@@ -88,8 +89,9 @@ static void ixdp2x00_irq_mask(unsigned int irq)
 #endif
 }
 
-static void ixdp2x00_irq_unmask(unsigned int irq)
+static void ixdp2x00_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long dummy;
 	static struct slowport_cfg old_cfg;
 
@@ -112,7 +114,7 @@ static void ixdp2x00_irq_handler(unsigned int irq, struct irq_desc *desc)
 	static struct slowport_cfg old_cfg;
 	int i;
 
-	desc->chip->mask(irq);
+	desc->chip->mask(desc);
 
 #ifdef CONFIG_ARCH_IXDP2400
 	if (machine_is_ixdp2400())
@@ -134,7 +136,7 @@ static void ixdp2x00_irq_handler(unsigned int irq, struct irq_desc *desc)
 		}
 	}
 
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
 static struct irq_chip ixdp2x00_cpld_irq_chip = {
arch/arm/mach-ixp2000/ixdp2x01.c +6 -4
index 4a12327..19c0087 100644
@@ -49,14 +49,16 @@
 /*************************************************************************
  * IXDP2x01 IRQ Handling
  *************************************************************************/
-static void ixdp2x01_irq_mask(unsigned int irq)
+static void ixdp2x01_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_wrb(IXDP2X01_INT_MASK_SET_REG,
 				IXP2000_BOARD_IRQ_MASK(irq));
 }
 
-static void ixdp2x01_irq_unmask(unsigned int irq)
+static void ixdp2x01_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	ixp2000_reg_write(IXDP2X01_INT_MASK_CLR_REG,
 				IXP2000_BOARD_IRQ_MASK(irq));
 }
@@ -68,7 +70,7 @@ static void ixdp2x01_irq_handler(unsigned int irq, struct irq_desc *desc)
 	u32 ex_interrupt;
 	int i;
 
-	desc->chip->mask(irq);
+	desc->chip->mask(desc);
 
 	ex_interrupt = *IXDP2X01_INT_STAT_REG & valid_irq_mask;
 
@@ -84,7 +86,7 @@ static void ixdp2x01_irq_handler(unsigned int irq, struct irq_desc *desc)
 		}
 	}
 
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
 static struct irq_chip ixdp2x01_irq_chip = {
arch/arm/mach-ixp23xx/core.c +15 -10
index aa4c442..3454c62 100644
@@ -111,8 +111,9 @@ enum ixp23xx_irq_type {
 
 static void ixp23xx_config_irq(unsigned int, enum ixp23xx_irq_type);
 
-static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
+static int ixp23xx_irq_set_type(struct irq_desc *desc, unsigned int type)
 {
+	unsigned int irq = desc->irq;
 	int line = irq - IRQ_IXP23XX_GPIO6 + 6;
 	u32 int_style;
 	enum ixp23xx_irq_type irq_type;
@@ -173,8 +174,9 @@ static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
 	return 0;
 }
 
-static void ixp23xx_irq_mask(unsigned int irq)
+static void ixp23xx_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	volatile unsigned long *intr_reg;
 
 	if (irq >= 56)
@@ -184,8 +186,9 @@ static void ixp23xx_irq_mask(unsigned int irq)
 	*intr_reg &= ~(1 << (irq % 32));
 }
 
-static void ixp23xx_irq_ack(unsigned int irq)
+static void ixp23xx_irq_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int line = irq - IRQ_IXP23XX_GPIO6 + 6;
 
 	if ((line < 6) || (line > 15))
@@ -198,11 +201,12 @@ static void ixp23xx_irq_ack(unsigned int irq)
  * Level triggered interrupts on GPIO lines can only be cleared when the
  * interrupt condition disappears.
  */
-static void ixp23xx_irq_level_unmask(unsigned int irq)
+static void ixp23xx_irq_level_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	volatile unsigned long *intr_reg;
 
-	ixp23xx_irq_ack(irq);
+	ixp23xx_irq_ack(desc);
 
 	if (irq >= 56)
 		irq += 8;
@@ -211,8 +215,9 @@ static void ixp23xx_irq_level_unmask(unsigned int irq)
 	*intr_reg |= (1 << (irq % 32));
 }
 
-static void ixp23xx_irq_edge_unmask(unsigned int irq)
+static void ixp23xx_irq_edge_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	volatile unsigned long *intr_reg;
 
 	if (irq >= 56)
@@ -236,12 +241,12 @@ static struct irq_chip ixp23xx_irq_edge_chip = {
 	.set_type	= ixp23xx_irq_set_type
 };
 
-static void ixp23xx_pci_irq_mask(unsigned int irq)
+static void ixp23xx_pci_irq_mask(struct irq_desc *desc)
 {
 	*IXP23XX_PCI_XSCALE_INT_ENABLE &= ~(1 << (IRQ_IXP23XX_INTA + 27 - irq));
 }
 
-static void ixp23xx_pci_irq_unmask(unsigned int irq)
+static void ixp23xx_pci_irq_unmask(struct irq_desc *desc)
 {
 	*IXP23XX_PCI_XSCALE_INT_ENABLE |= (1 << (IRQ_IXP23XX_INTA + 27 - irq));
 }
@@ -256,7 +261,7 @@ static void pci_handler(unsigned int irq, struct irq_desc *desc)
 
 	pci_interrupt = *IXP23XX_PCI_XSCALE_INT_STATUS;
 
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 
 	/* See which PCI_INTA, or PCI_INTB interrupted */
 	if (pci_interrupt & (1 << 26)) {
@@ -269,7 +274,7 @@ static void pci_handler(unsigned int irq, struct irq_desc *desc)
 
 	generic_handle_irq(irqno);
 
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
 static struct irq_chip ixp23xx_pci_irq_chip = {
arch/arm/mach-ixp23xx/ixdp2351.c +12 -8
index f1b124a..63e5f16 100644
@@ -48,13 +48,15 @@
 /*
  * IXDP2351 Interrupt Handling
  */
-static void ixdp2351_inta_mask(unsigned int irq)
+static void ixdp2351_inta_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	*IXDP2351_CPLD_INTA_MASK_SET_REG = IXDP2351_INTA_IRQ_MASK(irq);
 }
 
-static void ixdp2351_inta_unmask(unsigned int irq)
+static void ixdp2351_inta_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	*IXDP2351_CPLD_INTA_MASK_CLR_REG = IXDP2351_INTA_IRQ_MASK(irq);
 }
 
@@ -64,7 +66,7 @@ static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc)
 		*IXDP2351_CPLD_INTA_STAT_REG & IXDP2351_INTA_IRQ_VALID;
 	int i;
 
-	desc->chip->mask(irq);
+	desc->chip->mask(desc);
 
 	for (i = 0; i < IXDP2351_INTA_IRQ_NUM; i++) {
 		if (ex_interrupt & (1 << i)) {
@@ -74,7 +76,7 @@ static void ixdp2351_inta_handler(unsigned int irq, struct irq_desc *desc)
 		}
 	}
 
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
 static struct irq_chip ixdp2351_inta_chip = {
@@ -83,13 +85,15 @@ static struct irq_chip ixdp2351_inta_chip = {
 	.unmask	= ixdp2351_inta_unmask
 };
 
-static void ixdp2351_intb_mask(unsigned int irq)
+static void ixdp2351_intb_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	*IXDP2351_CPLD_INTB_MASK_SET_REG = IXDP2351_INTB_IRQ_MASK(irq);
 }
 
-static void ixdp2351_intb_unmask(unsigned int irq)
+static void ixdp2351_intb_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	*IXDP2351_CPLD_INTB_MASK_CLR_REG = IXDP2351_INTB_IRQ_MASK(irq);
 }
 
@@ -99,7 +103,7 @@ static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc)
 		*IXDP2351_CPLD_INTB_STAT_REG & IXDP2351_INTB_IRQ_VALID;
 	int i;
 
-	desc->chip->ack(irq);
+	desc->chip->ack(desc);
 
 	for (i = 0; i < IXDP2351_INTB_IRQ_NUM; i++) {
 		if (ex_interrupt & (1 << i)) {
@@ -109,7 +113,7 @@ static void ixdp2351_intb_handler(unsigned int irq, struct irq_desc *desc)
 		}
 	}
 
-	desc->chip->unmask(irq);
+	desc->chip->unmask(desc);
 }
 
 static struct irq_chip ixdp2351_intb_chip = {
arch/arm/mach-ixp4xx/common.c +9 -5
index 71728d3..e42760c 100644
@@ -128,8 +128,9 @@ int irq_to_gpio(unsigned int irq)
 }
 EXPORT_SYMBOL(irq_to_gpio);
 
-static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
+static int ixp4xx_set_irq_type(struct irq_desc *desc, unsigned int type)
 {
+	unsigned int irq = desc->irq;
 	int line = irq2gpio[irq];
 	u32 int_style;
 	enum ixp4xx_irq_type irq_type;
@@ -193,16 +194,18 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
 	return 0;
 }
 
-static void ixp4xx_irq_mask(unsigned int irq)
+static void ixp4xx_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32)
 		*IXP4XX_ICMR2 &= ~(1 << (irq - 32));
 	else
 		*IXP4XX_ICMR &= ~(1 << irq);
 }
 
-static void ixp4xx_irq_ack(unsigned int irq)
+static void ixp4xx_irq_ack(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	int line = (irq < 32) ? irq2gpio[irq] : -1;
 
 	if (line >= 0)
@@ -213,10 +216,11 @@ static void ixp4xx_irq_ack(unsigned int irq)
  * Level triggered interrupts on GPIO lines can only be cleared when the
  * interrupt condition disappears.
  */
-static void ixp4xx_irq_unmask(unsigned int irq)
+static void ixp4xx_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	if (!(ixp4xx_irq_edge & (1 << irq)))
-		ixp4xx_irq_ack(irq);
+		ixp4xx_irq_ack(desc);
 
 	if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32)
 		*IXP4XX_ICMR2 |= (1 << (irq - 32));
arch/arm/mach-ks8695/irq.c +18 -13
index e375c1d..05eb2dc 100644
@@ -34,29 +34,32 @@
 #include <mach/regs-irq.h>
 #include <mach/regs-gpio.h>
 
-static void ks8695_irq_mask(unsigned int irqno)
+static void ks8695_irq_mask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long inten;
 
 	inten = __raw_readl(KS8695_IRQ_VA + KS8695_INTEN);
-	inten &= ~(1 << irqno);
+	inten &= ~(1 << irq);
 
 	__raw_writel(inten, KS8695_IRQ_VA + KS8695_INTEN);
 }
 
-static void ks8695_irq_unmask(unsigned int irqno)
+static void ks8695_irq_unmask(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	unsigned long inten;
 
 	inten = __raw_readl(KS8695_IRQ_VA + KS8695_INTEN);
-	inten |= (1 << irqno);
+	inten |= (1 << irq);
 
 	__raw_writel(inten, KS8695_IRQ_VA + KS8695_INTEN);
 }
 
-static void ks8695_irq_ack(unsigned int irqno)
+static void ks8695_irq_ack(struct irq_desc *desc)
 {
-	__raw_writel((1 << irqno), KS8695_IRQ_VA + KS8695_INTST);
+	unsigned int irq = desc->irq;
+	__raw_writel((1 << irq), KS8695_IRQ_VA + KS8695_INTST);
 }
 
 
@@ -64,8 +67,9 @@ static struct irq_chip ks8695_irq_level_chip;
 static struct irq_chip ks8695_irq_edge_chip;
 
 
-static int ks8695_irq_set_type(unsigned int irqno, unsigned int type)
+static int ks8695_irq_set_type(struct irq_desc *desc, unsigned int type)
 {
+	unsigned int irq = desc->irq;
 	unsigned long ctrl, mode;
 	unsigned short level_triggered = 0;
 
@@ -93,7 +97,7 @@ static int ks8695_irq_set_type(unsigned int irqno, unsigned int type)
 			return -EINVAL;
 	}
 
-	switch (irqno) {
+	switch (irq) {
 		case KS8695_IRQ_EXTERN0:
 			ctrl &= ~IOPC_IOEINT0TM;
 			ctrl |= IOPC_IOEINT0_MODE(mode);
@@ -115,12 +119,12 @@ static int ks8695_irq_set_type(unsigned int irqno, unsigned int type)
 	}
 
 	if (level_triggered) {
-		set_irq_chip(irqno, &ks8695_irq_level_chip);
-		set_irq_handler(irqno, handle_level_irq);
+		set_irq_chip(irq, &ks8695_irq_level_chip);
+		set_irq_handler(irq, handle_level_irq);
 	}
 	else {
-		set_irq_chip(irqno, &ks8695_irq_edge_chip);
-		set_irq_handler(irqno, handle_edge_irq);
+		set_irq_chip(irq, &ks8695_irq_edge_chip);
+		set_irq_handler(irq, handle_edge_irq);
 	}
 
 	__raw_writel(ctrl, KS8695_GPIO_VA + KS8695_IOPC);
@@ -164,7 +168,8 @@ void __init ks8695_init_irq(void)
 
 			/* Edge-triggered interrupts */
 			default:
-				ks8695_irq_ack(irq);	/* clear pending bit */
+				/* clear pending bit */	
+				ks8695_irq_ack(irq_to_desc(irq));
 				set_irq_chip(irq, &ks8695_irq_edge_chip);
 				set_irq_handler(irq, handle_edge_irq);
 		}
arch/arm/mach-l7200/core.c +4 -2
index 50d2324..feb33fa 100644
@@ -45,13 +45,15 @@
 #define FIQ_SOFT	(*(volatile unsigned long *) (IRQ_BASE + 0x110))
 #define FIQ_SOURCESEL	(*(volatile unsigned long *) (IRQ_BASE + 0x118))
 
-static void l7200_mask_irq(unsigned int irq)
+static void l7200_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	IRQ_ENABLECLEAR = 1 << irq;
 }
 
-static void l7200_unmask_irq(unsigned int irq)
+static void l7200_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	IRQ_ENABLE = 1 << irq;
 }
 
arch/arm/mach-lh7a40x/arch-kev7a400.c +6 -3
index 3d7bd50..04c7364 100644
@@ -46,19 +46,22 @@ void __init kev7a400_map_io(void)
 
 static u16 CPLD_IRQ_mask;	/* Mask for CPLD IRQs, 1 == unmasked */
 
-static void kev7a400_ack_cpld_irq (u32 irq)
+static void kev7a400_ack_cpld_irq(u32 irq, struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	CPLD_CL_INT = 1 << (irq - IRQ_KEV7A400_CPLD);
 }
 
-static void kev7a400_mask_cpld_irq (u32 irq)
+static void kev7a400_mask_cpld_irq(u32 irq, struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	CPLD_IRQ_mask &= ~(1 << (irq - IRQ_KEV7A400_CPLD));
 	CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
 }
 
-static void kev7a400_unmask_cpld_irq (u32 irq)
+static void kev7a400_unmask_cpld_irq(u32 irq, struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	CPLD_IRQ_mask |= 1 << (irq - IRQ_KEV7A400_CPLD);
 	CPLD_WR_PB_INT_MASK = CPLD_IRQ_mask;
 }
arch/arm/mach-lh7a40x/arch-lpd7a40x.c +8 -5
index cb15e5d..2536349 100644
@@ -159,8 +159,9 @@ static void __init lpd7a40x_init (void)
 #endif
 }
 
-static void lh7a40x_ack_cpld_irq (u32 irq)
+static void lh7a40x_ack_cpld_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	/* CPLD doesn't have ack capability, but some devices may */
 
 #if defined (CPLD_INTMASK_TOUCH)
@@ -172,8 +173,9 @@ static void lh7a40x_ack_cpld_irq (u32 irq)
 #endif
 }
 
-static void lh7a40x_mask_cpld_irq (u32 irq)
+static void lh7a40x_mask_cpld_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	switch (irq) {
 	case IRQ_LPD7A40X_ETH_INT:
 		CPLD_INTERRUPTS |= CPLD_INTMASK_ETHERNET;
@@ -186,8 +188,9 @@ static void lh7a40x_mask_cpld_irq (u32 irq)
 	}
 }
 
-static void lh7a40x_unmask_cpld_irq (u32 irq)
+static void lh7a40x_unmask_cpld_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	switch (irq) {
 	case IRQ_LPD7A40X_ETH_INT:
 		CPLD_INTERRUPTS &= ~CPLD_INTMASK_ETHERNET;
@@ -211,7 +214,7 @@ static void lpd7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
 {
 	unsigned int mask = CPLD_INTERRUPTS;
 
-	desc->chip->ack (irq);
+	desc->chip->ack(desc);
 
 	if ((mask & (1<<0)) == 0)	/* WLAN */
 		generic_handle_irq(IRQ_LPD7A40X_ETH_INT);
@@ -221,7 +224,7 @@ static void lpd7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
 		generic_handle_irq(IRQ_TOUCH);
 #endif
 
-	desc->chip->unmask (irq); /* Level-triggered need this */
+	desc->chip->unmask(desc); /* Level-triggered need this */
 }
 
 
arch/arm/mach-lh7a40x/irq-lh7a400.c +6 -3
index 1ad3afc..b1b9480 100644
@@ -21,18 +21,21 @@
 
   /* CPU IRQ handling */
 
-static void lh7a400_mask_irq (u32 irq)
+static void lh7a400_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	INTC_INTENC = (1 << irq);
 }
 
-static void lh7a400_unmask_irq (u32 irq)
+static void lh7a400_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	INTC_INTENS = (1 << irq);
 }
 
-static void lh7a400_ack_gpio_irq (u32 irq)
+static void lh7a400_ack_gpio_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq));
 	INTC_INTENC = (1 << irq);
 }
arch/arm/mach-lh7a40x/irq-lh7a404.c +12 -6
index 12b045b..cd8c16e 100644
@@ -43,34 +43,40 @@ static unsigned char irq_pri_vic2[] = {
 
   /* CPU IRQ handling */
 
-static void lh7a404_vic1_mask_irq (u32 irq)
+static void lh7a404_vic1_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	VIC1_INTENCLR = (1 << irq);
 }
 
-static void lh7a404_vic1_unmask_irq (u32 irq)
+static void lh7a404_vic1_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	VIC1_INTEN = (1 << irq);
 }
 
-static void lh7a404_vic2_mask_irq (u32 irq)
+static void lh7a404_vic2_mask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	VIC2_INTENCLR = (1 << (irq - 32));
 }
 
-static void lh7a404_vic2_unmask_irq (u32 irq)
+static void lh7a404_vic2_unmask_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	VIC2_INTEN = (1 << (irq - 32));
 }
 
-static void lh7a404_vic1_ack_gpio_irq (u32 irq)
+static void lh7a404_vic1_ack_gpio_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq));
 	VIC1_INTENCLR = (1 << irq);
 }
 
-static void lh7a404_vic2_ack_gpio_irq (u32 irq)
+static void lh7a404_vic2_ack_gpio_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (irq));
 	VIC2_INTENCLR = (1 << irq);
 }
arch/arm/mach-lh7a40x/irq-lpd7a40x.c +7 -5
index fd033bb..364631f 100644
@@ -20,13 +20,14 @@
 
 #include "common.h"
 
-static void lh7a40x_ack_cpld_irq (u32 irq)
+static void lh7a40x_ack_cpld_irq(struct irq_desc *desc)
 {
 	/* CPLD doesn't have ack capability */
 }
 
-static void lh7a40x_mask_cpld_irq (u32 irq)
+static void lh7a40x_mask_cpld_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	switch (irq) {
 	case IRQ_LPD7A40X_ETH_INT:
 		CPLD_INTERRUPTS = CPLD_INTERRUPTS | 0x4;
@@ -37,8 +38,9 @@ static void lh7a40x_mask_cpld_irq (u32 irq)
 	}
 }
 
-static void lh7a40x_unmask_cpld_irq (u32 irq)
+static void lh7a40x_unmask_cpld_irq(struct irq_desc *desc)
 {
+	unsigned int irq = desc->irq;
 	switch (irq) {
 	case IRQ_LPD7A40X_ETH_INT:
 		CPLD_INTERRUPTS = CPLD_INTERRUPTS & ~ 0x4;
@@ -60,7 +62,7 @@ static void lh7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
 {
 	unsigned int mask = CPLD_INTERRUPTS;
 
-	desc->chip->ack (irq);
+	desc->chip->ack(desc);
 
 	if ((mask & 0x1) == 0)	/* WLAN */
 		generic_handle_irq(IRQ_LPD7A40X_ETH_INT);
@@ -68,7 +70,7 @@ static void lh7a40x_cpld_handler (unsigned int irq, struct irq_desc *desc)
 	if ((mask & 0x2) == 0)	/* Touch */
 		generic_handle_irq(IRQ_LPD7A400_TS);
 
-	desc->chip->unmask (irq); /* Level-triggered need this */
+	desc->chip->unmask(desc); /* Level-triggered need this */
 }
 
 
arch/arm/mach-netx/generic.c +8 -4
index 43da8bb..0b1d53d 100644
@@ -88,8 +88,9 @@ netx_hif_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
 }
 
 static int
-netx_hif_irq_type(unsigned int _irq, unsigned int type)
+netx_hif_irq_type(struct irq_desc *desc, unsigned int type)
 {
+	unsigned int _irq = desc->irq;
 	unsigned int val, irq;
 
 	val = readl(NETX_DPMAS_IF_CONF1);
@@ -119,8 +120,9 @@ netx_hif_irq_type(unsigned int _irq, unsigned int type)
 }
 
 static void
-netx_hif_ack_irq(unsigned int _irq)
+netx_hif_ack_irq(struct irq_desc *desc)
 {
+	unsigned int _irq = desc->irq;
 	unsigned int val, irq;
 
 	irq = _irq - NETX_IRQ_HIF_CHAINED(0);
@@ -134,8 +136,9 @@ netx_hif_ack_irq(unsigned int _irq)
 }
 
 static void
-netx_hif_mask_irq(unsigned int _irq)
+netx_hif_mask_irq(struct irq_desc *desc)
 {
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

arch/arm/mach-nomadik/gpio.c +15 -11
index 9a09b27..0635e22 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-ns9xxx/board-a9m9750dev.c +9 -6
index b45bb3b..9b42b41 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-ns9xxx/irq.c +9 -6
index 038f24d..3e21071 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-omap1/fpga.c +8 -6
index 5cfce16..ad013b0 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-omap1/irq.c +14 -10
index db913c3..7dcaf35 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-omap2/irq.c +8 -6
index 26aeef5..32f8da9 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pnx4008/irq.c +13 -9
index a9ce02b..a08d90f 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/balloon3.c +5 -3
index f3b5ace..02b7e00 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/generic.h +2 -1
index 890fb90..2d2cb9c 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/irq.c +12 -6
index 1beb40f..5103a3d 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/lpd270.c +4 -2
index d279507..0d6ba7b 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/lubbock.c +4 -2
index 63d65a2..c133f49 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/mainstone.c +4 -2
index 5543c64..f7da0c6 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/pcm990-baseboard.c +4 -2
index 9d0ecea..9e2f67f 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/pxa25x.c +3 -1
index 0b9ad30..ee62738 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/pxa27x.c +3 -1
index 0af3617..027b5f9 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/pxa3xx.c +6 -3
index 4d7c03e..7204fbd 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/viper.c +6 -3
index 1dd1334..5836c2e 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-pxa/zeus.c +8 -4
index 39896d8..e2c96f7 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-rpc/irq.c +18 -9
index 9dd15d6..e273268 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-s3c2410/bast-irq.c +13 -11
index 217b102..7f16557 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-s3c2412/irq.c +23 -16
index 6000ca9..e7aa082 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-s3c2440/irq.c +9 -6
index 0c049b9..60b88aa 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-s3c2443/irq.c +45 -30

75 lines not on this page · raw message

arch/arm/mach-sa1100/irq.c +24 -12
index 3093d46..f54c973 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-sa1100/neponset.c +4 -4
index 0b505d9..4003df3 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-shark/irq.c +7 -3
index c04eb6a..0f17814 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-stmp378x/stmp378x.c +6 -3
index ddd49a7..5224f31 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-stmp37xx/stmp37xx.c +6 -3
index 8c7d6fb..c080776 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-versatile/core.c +4 -2
index 9ddb49b..79892c8 100644

Lines of this file are not shown. View the raw message.

arch/arm/mach-w90x900/irq.c +5 -3
index 0ce9d8e..03e5834 100644

Lines of this file are not shown. View the raw message.

arch/arm/oprofile/op_model_mpcore.c +2 -2
index f73ce87..1b3afb2 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-mxc/gpio.c +8 -4
index 70b2389..06385cd 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-mxc/irq.c +4 -2
index 778ddfe..3721b92 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-omap/gpio.c +22 -15
index 76a347b..ae0f98c 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-orion/gpio.c +11 -10
index e814803..4fa621a 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-orion/irq.c +6 -4
index 3f9d34f..6cce58b 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-pxa/gpio.c +8 -4
index 98548c6..00a5c10 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-pxa/include/plat/gpio.h +2 -1
index 44248cb..ffc6123 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-s3c24xx/include/plat/irq.h +2 -2
index 69e1be8..b2aac48 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-s3c24xx/irq-pm.c +2 -1
index ea8dea3..a8aeca9 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-s3c24xx/irq.c +68 -48

116 lines not on this page · raw message

arch/arm/plat-s5pc1xx/irq-eint.c +24 -17

41 lines not on this page · raw message

arch/arm/plat-s5pc1xx/irq-gpio.c +11 -7
index fecca7a..32f5395 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-stmp3xxx/irq.c +1 -1
index 20de4e0..eeaf936 100644

Lines of this file are not shown. View the raw message.

arch/arm/plat-stmp3xxx/pinmux.c +9 -5
index 6d6b1a4..c0b7002 100644

Lines of this file are not shown. View the raw message.

arch/avr32/mach-at32ap/extint.c +14 -12
index 310477b..da67541 100644

Lines of this file are not shown. View the raw message.

arch/avr32/mach-at32ap/pio.c +6 -3
index 09a274c..7e31607 100644

Lines of this file are not shown. View the raw message.

arch/blackfin/include/asm/bfin-global.h +1 -1
index e6485c3..912d974 100644

Lines of this file are not shown. View the raw message.

arch/blackfin/include/asm/ipipe.h +2 -2
index d3b4044..4009554 100644

Lines of this file are not shown. View the raw message.

arch/blackfin/mach-common/ints-priority.c +59 -40

99 lines not on this page · raw message

arch/cris/arch-v10/kernel/irq.c +9 -7
index 1a61efc..46a746e 100644

Lines of this file are not shown. View the raw message.

arch/frv/kernel/irq-mb93091.c +8 -4
index 4dd9ada..cc0bf81 100644

Lines of this file are not shown. View the raw message.

arch/frv/kernel/irq-mb93093.c +8 -4
index e452090..db30494 100644

Lines of this file are not shown. View the raw message.

arch/frv/kernel/irq-mb93493.c +5 -3
index ba55ecd..85c4a08 100644

Lines of this file are not shown. View the raw message.

arch/frv/kernel/irq.c +16 -11
index 62d1aba..72c9a73 100644

Lines of this file are not shown. View the raw message.

arch/h8300/kernel/irq.c +9 -5
index c25dc2c..4132b2f 100644

Lines of this file are not shown. View the raw message.

arch/m32r/platforms/m32104ut/setup.c +11 -8
index 922fdfd..d4eaf98 100644

Lines of this file are not shown. View the raw message.

arch/m32r/platforms/m32700ut/setup.c +52 -40

92 lines not on this page · raw message

arch/m32r/platforms/mappi/setup.c +13 -10
index fb4b177..5b29971 100644

Lines of this file are not shown. View the raw message.

arch/m32r/platforms/mappi2/setup.c +12 -9
index 6a65eda..e364894 100644

Lines of this file are not shown. View the raw message.

arch/m32r/platforms/mappi3/setup.c +12 -9
index 9c337ae..5152adf 100644

Lines of this file are not shown. View the raw message.

arch/m32r/platforms/oaks32r/setup.c +12 -9
index ed86574..396beba 100644

Lines of this file are not shown. View the raw message.

arch/m32r/platforms/opsput/setup.c +68 -56

124 lines not on this page · raw message

arch/m32r/platforms/usrv/setup.c +24 -18

42 lines not on this page · raw message

arch/m68knommu/platform/5249/intc2.c +6 -3
index d09d9da..f23483f 100644

Lines of this file are not shown. View the raw message.

arch/m68knommu/platform/5272/intc.c +7 -4
index 7081e0a..0bfea67 100644

Lines of this file are not shown. View the raw message.

arch/m68knommu/platform/68328/ints.c +4 -2
index b91ee85..80421cc 100644

Lines of this file are not shown. View the raw message.

arch/m68knommu/platform/68360/ints.c +6 -3
index 1143f77..e99877b 100644

Lines of this file are not shown. View the raw message.

arch/m68knommu/platform/coldfire/intc-2.c +4 -2
index 5598c8b..598905c 100644

Lines of this file are not shown. View the raw message.

arch/m68knommu/platform/coldfire/intc-simr.c +6 -3
index 1b01e79..f52e94a 100644

Lines of this file are not shown. View the raw message.

arch/m68knommu/platform/coldfire/intc.c +5 -3
index a4560c8..04bf7d5 100644

Lines of this file are not shown. View the raw message.

arch/microblaze/kernel/intc.c +10 -5
index 03172c1..009d2f6 100644

Lines of this file are not shown. View the raw message.

arch/mips/alchemy/common/irq.c +32 -22

54 lines not on this page · raw message

arch/mips/alchemy/devboards/bcsr.c +6 -3
index 3bc4fd2..e801e8c 100644

Lines of this file are not shown. View the raw message.

arch/mips/ar7/irq.c +12 -6
index c781556..d65b855 100644

Lines of this file are not shown. View the raw message.

arch/mips/bcm63xx/irq.c +20 -13
index a0c5cd1..6e0b206 100644

Lines of this file are not shown. View the raw message.

arch/mips/cavium-octeon/octeon-irq.c +59 -43

102 lines not on this page · raw message

arch/mips/dec/ioasic-irq.c +12 -9
index cb41954..e8d60a6 100644

Lines of this file are not shown. View the raw message.

arch/mips/dec/kn02-irq.c +6 -4
index ed90a8d..3ea3682 100644

Lines of this file are not shown. View the raw message.

arch/mips/emma/markeins/irq.c +16 -8
index 9504b7e..3c2e1c9 100644

Lines of this file are not shown. View the raw message.

arch/mips/jazz/irq.c +4 -2
index ee18028..b76cdcd 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/i8259.c +9 -6
index 2779911..f6f63a3 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq-gic.c +11 -6
index b181f2f..c278afa 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq-gt641xx.c +8 -4
index 42ef814..2c323dc 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq-msc01.c +13 -9
index 6a8cd28..b860443 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq-rm7000.c +4 -2
index fb50cc7..0c5e6c0 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq-rm9000.c +14 -12
index b47e461..5491ec0 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq_cpu.c +10 -6
index 55c8a3c..ad7c3d0 100644

Lines of this file are not shown. View the raw message.

arch/mips/kernel/irq_txx9.c +9 -5
index 9b78029..5532280 100644

Lines of this file are not shown. View the raw message.

arch/mips/lasat/interrupt.c +8 -6
index 1353fb1..9e9edf9 100644

Lines of this file are not shown. View the raw message.

arch/mips/loongson/common/bonito-irq.c +4 -2
index 2dc2a4c..00db7a1 100644

Lines of this file are not shown. View the raw message.

arch/mips/nxp/pnx833x/common/interrupts.c +21 -12
index 941916f..9b4f8b1 100644

Lines of this file are not shown. View the raw message.

arch/mips/nxp/pnx8550/common/int.c +5 -3
index 7aca7d5..944fe74 100644

Lines of this file are not shown. View the raw message.

arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c +7 -5
index 94c9c2c..47b2be9 100644

Lines of this file are not shown. View the raw message.

arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c +6 -3
index 61f3902..e73cda1 100644

Lines of this file are not shown. View the raw message.

arch/mips/powertv/asic/irq_asic.c +4 -2
index b54d244..a710bc3 100644

Lines of this file are not shown. View the raw message.

arch/mips/rb532/irq.c +16 -12
index f078820..39f304a 100644

Lines of this file are not shown. View the raw message.

arch/mips/sgi-ip22/ip22-int.c +16 -8
index 383f11d..93ddd8b 100644

Lines of this file are not shown. View the raw message.

arch/mips/sgi-ip27/ip27-irq.c +8 -4
index c1c8e40..3fb93b5 100644

Lines of this file are not shown. View the raw message.

arch/mips/sgi-ip27/ip27-timer.c +2 -2
index d6802d6..13905d4 100644

Lines of this file are not shown. View the raw message.

arch/mips/sgi-ip32/ip32-irq.c +39 -29

68 lines not on this page · raw message

arch/mips/sibyte/bcm1480/irq.c +16 -12
index 06e25d9..1fb5d8c 100644

Lines of this file are not shown. View the raw message.

arch/mips/sibyte/sb1250/irq.c +16 -12
index ab44a2f..0fcde43 100644

Lines of this file are not shown. View the raw message.

arch/mips/sni/a20r.c +7 -5
index e698089..0753f2c 100644

Lines of this file are not shown. View the raw message.

arch/mips/sni/pcimt.c +7 -5
index 51e62bb..671e3f8 100644

Lines of this file are not shown. View the raw message.

arch/mips/sni/pcit.c +7 -5
index f4699d3..cae4b89 100644

Lines of this file are not shown. View the raw message.

arch/mips/sni/rm200.c +13 -8
index 90c558f..14d364a 100644

Lines of this file are not shown. View the raw message.

arch/mips/txx9/generic/irq_tx4939.c +9 -5
index 013213a..e66f101 100644

Lines of this file are not shown. View the raw message.

arch/mips/txx9/jmr3927/irq.c +4 -2
index 6ec626c..b613c2e 100644

Lines of this file are not shown. View the raw message.

arch/mips/txx9/rbtx4927/irq.c +6 -4
index 9c14ebb..136ae1e 100644

Lines of this file are not shown. View the raw message.

arch/mips/txx9/rbtx4938/irq.c +6 -4
index 7d21bef..92cdda6 100644

Lines of this file are not shown. View the raw message.

arch/mips/txx9/rbtx4939/irq.c +4 -2
index 500cc0a..c3798f5 100644

Lines of this file are not shown. View the raw message.

arch/mips/vr41xx/common/icu.c +8 -4
index 6153b6a..cc042eb 100644

Lines of this file are not shown. View the raw message.

arch/mips/vr41xx/common/irq.c +4 -4
index bef0687..c60b2fc 100644

Lines of this file are not shown. View the raw message.

arch/mn10300/kernel/irq.c +14 -5
index bc98665..ccae1ad 100644

Lines of this file are not shown. View the raw message.

arch/mn10300/kernel/mn10300-serial.c +3 -2
index ef34d5a..8cb05fe 100644

Lines of this file are not shown. View the raw message.

arch/parisc/include/asm/irq.h +6 -5
index dfa26b6..2a6516c 100644

Lines of this file are not shown. View the raw message.

arch/parisc/kernel/irq.c +25 -18

43 lines not on this page · raw message

arch/powerpc/include/asm/mpic.h +3 -3
index 61913d9..7f56770 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/include/asm/qe_ic.h +3 -3
index cf51966..ffd0086 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/kernel/crash.c +2 -2
index 6f4613d..e5ccfb2 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/kernel/irq.c +1 -1
index cafd378..bc7a593 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/512x/mpc5121_ads_cpld.c +4 -2
index 4ecf4cf..d754acd 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/52xx/media5200.c +9 -7
index 0bac3a3..948a09d 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/52xx/mpc52xx_gpt.c +12 -8
index 5d7cc88..5de11ef 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/52xx/mpc52xx_pic.c +23 -12
index 4bf4bf7..bee1838 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +4 -2
index d4a09f8..a44214d 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/ksi8560.c +1 -1
index f4d36b5..c6f4825 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/mpc85xx_ads.c +1 -1
index 9438a89..833ab1c 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/mpc85xx_ds.c +1 -1
index 544011a..c27ce8a 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/sbc8560.c +1 -1
index a5ad1c7..b66dd9f 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/socrates_fpga_pic.c +13 -7
index d48527f..c8a131a 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/stx_gp3.c +1 -1
index bc33d18..cfea131 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/85xx/tqm85xx.c +1 -1
index 5b0ab99..462cc1d 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/86xx/gef_pic.c +7 -5
index 6df9e25..7af4ad4 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/86xx/pic.c +1 -1
index 668275d..4cdaf8a 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/8xx/m8xx_setup.c +2 -2
index 242954c..f1ec06b 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/cell/axon_msi.c +1 -1
index 96fe896..64578d4 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/cell/beat_interrupt.c +9 -5
index 682af97..fdb1c60 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/cell/interrupt.c +6 -6
index 10eb1a4..2ea5935 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/cell/setup.c +1 -1
index 5930536..7ca342c 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/cell/spider-pic.c +9 -6
index 5876e88..d80fd72 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/chrp/setup.c +1 -1
index 8f41685..cab9626 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/embedded6xx/flipper-pic.c +8 -4
index c278bd3..74d93d8 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/embedded6xx/hlwd-pic.c +15 -11
index a771f91..58628f7 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/iseries/irq.c +12 -7
index ba446bf..8f64743 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/pasemi/setup.c +2 -2
index 242f809..98a3573 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/powermac/pic.c +15 -8
index 630a533..5737fae 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/ps3/interrupt.c +15 -12
index 59d9712..024680f 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/pseries/setup.c +1 -1
index ca5f2e1..056fecb 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/platforms/pseries/xics.c +16 -11
index 1bcedd8..e51f3d8 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/cpm1.c +6 -3
index ecad10d..5848b07 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/cpm2_pic.c +10 -8
index fcea4ff..ec59695 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/fsl_msi.c +6 -6
index e094367..14c3286 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/i8259.c +7 -4
index 6323e70..ba3bc94 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/ipic.c +10 -6
index d7b9b9c..76a58bf 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/mpc8xx_pic.c +10 -6
index 8c27d26..08435f0 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/mpic.c +30 -20

50 lines not on this page · raw message

arch/powerpc/sysdev/mpic.h +2 -2
index eff433c..19d7ed4 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/mpic_pasemi_msi.c +8 -6
index 3b6a9a4..c05a9c6 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/mpic_u3msi.c +6 -6
index bcbfe79..8c4eadd 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/mv64x60_pic.c +14 -7
index 485b924..72f4dfb 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/qe_lib/qe_ic.c +4 -2
index 541ba98..289c0cb 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/tsi108_pci.c +9 -5
index 595034c..2ff5286 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/uic.c +19 -17
index 0038fb7..fbed0a4 100644

Lines of this file are not shown. View the raw message.

arch/powerpc/sysdev/xilinx_intc.c +15 -11
index 1e0ccfa..f8e3f68 100644

Lines of this file are not shown. View the raw message.

arch/score/kernel/irq.c +6 -4
index 47647dd..663a04b 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-cayman/irq.c +6 -4
index 1394b07..ac3535a 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-dreamcast/irq.c +6 -3
index d932667..16cde3e 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-landisk/irq.c +4 -2
index 96f38a4..3bcfb32 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-microdev/irq.c +11 -8
index a26d166..4b7b5ec 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-se/7206/irq.c +6 -3
index 8d82175..1a71dad 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-se/7343/irq.c +4 -4
index d4305c2..a195d5a 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-se/7722/irq.c +4 -4
index 61605db..69cb49a 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-se/7724/irq.c +4 -2
index 0942be2..b0c094d 100644

Lines of this file are not shown. View the raw message.

arch/sh/boards/mach-systemh/irq.c +9 -7
index 523aea5..fa3a36d 100644

Lines of this file are not shown. View the raw message.

arch/sh/cchips/hd6446x/hd64461.c +7 -4
index bcb31ae..9e9698c 100644

Lines of this file are not shown. View the raw message.

arch/sh/kernel/cpu/irq/imask.c +4 -2
index a351ed8..0598602 100644

Lines of this file are not shown. View the raw message.

arch/sh/kernel/cpu/irq/intc-sh5.c +18 -16
index 96a2395..69a90ae 100644

Lines of this file are not shown. View the raw message.

arch/sparc/kernel/irq_64.c +42 -36

78 lines not on this page · raw message

arch/xtensa/variants/s6000/gpio.c +11 -7
index 380a70f..6d1b690 100644

Lines of this file are not shown. View the raw message.

drivers/sh/intc.c +6 -5
index a3d8677..f9aaed6 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.4.2

Part of the diff is not shown here. View the raw message.

author
#66 lore raw

PATCH 14/20 genericirq: add set_irq_desc_chip/data ...

In reply to Yinghai Lu

with set_irq_chip/data...

to take desc instead of irq

---
 arch/x86/kernel/apic/io_apic.c |    4 +-
 include/linux/irq.h            |   10 +++-
 include/linux/irqnr.h          |    1 +
 kernel/irq/chip.c              |  127 +++++++++++++++++++++++-----------------
 4 files changed, 85 insertions(+), 57 deletions(-)
arch/x86/kernel/apic/io_apic.c +2 -2
index d3b2f0b..5f061b7 100644
@@ -3302,7 +3302,7 @@ unsigned int create_irq_nr(unsigned int irq_want, int node)
 	raw_spin_unlock_irqrestore(&vector_lock, flags);
 
 	if (irq > 0)
-		dynamic_irq_init_keep_chip_data(irq);
+		dynamic_irq_init_keep_chip_data(irq_to_desc(irq));
 
 	return irq;
 }
@@ -3328,7 +3328,7 @@ void destroy_irq(unsigned int irq)
 	struct irq_desc *desc;
 	struct irq_cfg *cfg;
 
-	dynamic_irq_cleanup_keep_chip_data(irq);
+	dynamic_irq_cleanup_keep_chip_data(irq_to_desc(irq));
 
 	free_irte(irq);
 	raw_spin_lock_irqsave(&vector_lock, flags);
include/linux/irq.h +8 -2
index fb8c376..89d49e8 100644
@@ -412,9 +412,9 @@ static inline int irq_has_action(unsigned int irq)
 
 /* Dynamic irq helper functions */
 extern void dynamic_irq_init(unsigned int irq);
-void dynamic_irq_init_keep_chip_data(unsigned int irq);
+void dynamic_irq_init_keep_chip_data(struct irq_desc *desc);
 extern void dynamic_irq_cleanup(unsigned int irq);
-void dynamic_irq_cleanup_keep_chip_data(unsigned int irq);
+void dynamic_irq_cleanup_keep_chip_data(struct irq_desc *desc);
 
 /* Set/get chip/data for an IRQ: */
 extern int set_irq_chip(unsigned int irq, struct irq_chip *chip);
@@ -423,6 +423,12 @@ extern int set_irq_chip_data(unsigned int irq, void *data);
 extern int set_irq_type(unsigned int irq, unsigned int type);
 extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
 
+int set_irq_desc_chip(struct irq_desc *desc, struct irq_chip *chip);
+int set_irq_desc_data(struct irq_desc *desc, void *data);
+int set_irq_desc_chip_data(struct irq_desc *desc, void *data);
+int set_irq_desc_type(struct irq_desc *desc, unsigned int type);
+int set_irq_desc_msi(struct irq_desc *desc, struct msi_desc *entry);
+
 #define get_irq_chip(irq)	(irq_to_desc(irq)->chip)
 #define get_irq_chip_data(irq)	(irq_to_desc(irq)->chip_data)
 #define get_irq_data(irq)	(irq_to_desc(irq)->handler_data)
include/linux/irqnr.h +1 -0
index 7bf89bc..dee8f2b 100644
@@ -43,6 +43,7 @@ extern struct irq_desc *irq_to_desc(unsigned int irq);
 
 #ifdef CONFIG_SMP
 #define irq_node(irq)	(irq_to_desc(irq)->node)
+#define irq_desc_node(desc) ((desc)->node)
 #else
 #define irq_node(irq)	0
 #endif
kernel/irq/chip.c +74 -53

235 lines not on this page · raw message

Signature · 1 line
1.6.4.2
author
#67 lore raw

PATCH 15/20 x86/iommu/dmar: update iommu/inter_remapping to use desc

In reply to Yinghai Lu

to make irq_remapped() not going to call irq_to_desc() ....

---
 arch/x86/include/asm/io_apic.h |    4 --
 arch/x86/kernel/apic/io_apic.c |   80 +++++++++++++++++++---------------------
 drivers/pci/intr_remapping.c   |   69 ++++++++++++++--------------------
 include/linux/dmar.h           |   36 +++++++++--------
 4 files changed, 86 insertions(+), 103 deletions(-)
arch/x86/include/asm/io_apic.h +0 -4
index c4683b9..d249186 100644
@@ -171,10 +171,6 @@ extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
 
 extern void probe_nr_irqs_gsi(void);
 
-extern int setup_ioapic_entry(int apic, int irq,
-			      struct IO_APIC_route_entry *entry,
-			      unsigned int destination, int trigger,
-			      int polarity, int vector, int pin);
 extern void ioapic_write_entry(int apic, int pin,
 			       struct IO_APIC_route_entry e);
 extern void setup_ioapic_ids_from_mpc(void);
arch/x86/kernel/apic/io_apic.c +38 -42

288 lines not on this page · raw message

drivers/pci/intr_remapping.c +29 -40

223 lines not on this page · raw message

include/linux/dmar.h +19 -17
index 6b4227a..a5f04a1 100644
@@ -113,17 +113,17 @@ extern int enable_intr_remapping(int);
 extern void disable_intr_remapping(void);
 extern int reenable_intr_remapping(int);
 
-extern int get_irte(int irq, struct irte *entry);
-extern int modify_irte(int irq, struct irte *irte_modified);
-extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
-extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
-   			u16 sub_handle);
-extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
-extern int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index);
-extern int flush_irte(int irq);
-extern int free_irte(int irq);
-
-extern int irq_remapped(int irq);
+int get_irte(struct irq_desc *desc, struct irte *entry);
+int modify_irte(struct irq_desc *desc, struct irte *irte_modified);
+int alloc_irte(struct intel_iommu *iommu, struct irq_desc *desc, u16 count);
+int set_irte_irq(struct irq_desc *desc, struct intel_iommu *iommu, u16 index,
+			u16 sub_handle);
+int map_irq_to_irte_handle(struct irq_desc *desc, u16 *sub_handle);
+int clear_irte_irq(struct irq_desc *desc, struct intel_iommu *iommu, u16 index);
+int flush_irte(struct irq_desc *desc);
+int free_irte(struct irq_desc *desc);
+
+extern int irq_remapped(struct irq_desc *desc);
 extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
 extern struct intel_iommu *map_ioapic_to_ir(int apic);
 extern struct intel_iommu *map_hpet_to_ir(u8 id);
@@ -131,23 +131,25 @@ extern int set_ioapic_sid(struct irte *irte, int apic);
 extern int set_hpet_sid(struct irte *irte, u8 id);
 extern int set_msi_sid(struct irte *irte, struct pci_dev *dev);
 #else
-static inline int alloc_irte(struct intel_iommu *iommu, int irq, u16 count)
+static inline int
+alloc_irte(struct intel_iommu *iommu, struct irq_desc *desc, u16 count)
 {
 	return -1;
 }
-static inline int modify_irte(int irq, struct irte *irte_modified)
+static inline int modify_irte(struct irq_desc *desc, struct irte *irte_modified)
 {
 	return -1;
 }
-static inline int free_irte(int irq)
+static inline int free_irte(struct irq_desc *desc)
 {
 	return -1;
 }
-static inline int map_irq_to_irte_handle(int irq, u16 *sub_handle)
+static inline int map_irq_to_irte_handle(struct irq_desc *desc, u16 *sub_handle)
 {
 	return -1;
 }
-static inline int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
+static inline int
+set_irte_irq(struct irq_desc *desc, struct intel_iommu *iommu, u16 index,
 			       u16 sub_handle)
 {
 	return -1;
@@ -177,7 +179,7 @@ static inline int set_msi_sid(struct irte *irte, struct pci_dev *dev)
 	return 0;
 }
 
-#define irq_remapped(irq)		(0)
+#define irq_remapped(desc)		(0)
 #define enable_intr_remapping(mode)	(-1)
 #define disable_intr_remapping()	(0)
 #define reenable_intr_remapping(mode)	(0)
Signature · 1 line
1.6.4.2
author
#68 lore raw

PATCH 16/20 x86: use num_processors for possible cpus

In reply to Yinghai Lu

some systems that have disable cpus entries because same
BIOS will support 2 sockets and 4 sockets and more at same time, BIOS just leave some disable entries, but those system do not support cpu hotplug. we don't need treat disabled_cpus as hotplug cpus.
so we can make nr_cpu_ids smaller and save more space
(pcpu data allocations), and could make some systems run with logical flat instead of physical flat apic mode

-v2: change to black list instead
-v3: just remove that, and the one use possible_cpus= directly.

---
 arch/x86/kernel/smpboot.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/kernel/smpboot.c +1 -2
index a1483ac..3f92885 100644
@@ -1251,7 +1251,6 @@ early_param("possible_cpus", _setup_possible_cpus);
  * - Ashok Raj
  *
  * Three ways to find out the number of additional hotplug CPUs:
- * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
  * - The user can overwrite it with possible_cpus=NUM
  * - Otherwise don't reserve additional CPUs.
  * We do this because additional CPUs waste a lot of memory.
@@ -1266,7 +1265,7 @@ __init void prefill_possible_map(void)
 		num_processors = 1;
 
 	if (setup_possible_cpus == -1)
-		possible = num_processors + disabled_cpus;
+		possible = num_processors;
 	else
 		possible = setup_possible_cpus;
 
Signature · 1 line
1.6.4.2
author
#69 lore raw

PATCH 17/20 x86: make 32bit apic flat to physflat switch like 64bit

In reply to Yinghai Lu

kill def_to_bigsmp
and move switch from default to bigsmp at default_setup_apic_routing... so make default_setup_apic_routing more like 64 bit
also make the dmi relate code to be __init/__initdata

-v2: refresh it according to change in upstream

---
 arch/x86/include/asm/apic.h      |    3 -
 arch/x86/include/asm/mpspec.h    |    1 -
 arch/x86/kernel/apic/bigsmp_32.c |   48 +---------------
 arch/x86/kernel/apic/probe_32.c  |  115 ++++++++++++++++++++------------------
 arch/x86/kernel/apic/probe_64.c  |    2 +-
 arch/x86/kernel/setup.c          |    2 -
 arch/x86/kernel/smpboot.c        |    2 +-
 7 files changed, 65 insertions(+), 108 deletions(-)
arch/x86/include/asm/apic.h +0 -3
index 1fa03e0..6a34763 100644
@@ -465,9 +465,6 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert)
 	return;
 }
 
-extern void generic_bigsmp_probe(void);
-
-
 #ifdef CONFIG_X86_LOCAL_APIC
 
 #include <asm/smp.h>
arch/x86/include/asm/mpspec.h +0 -1
index 1a221e0..cb398c8 100644
@@ -23,7 +23,6 @@ extern int pic_mode;
 
 #define MAX_IRQ_SOURCES		256
 
-extern unsigned int def_to_bigsmp;
 extern u8 apicid_2_node[];
 
 #ifdef CONFIG_X86_NUMAQ
arch/x86/kernel/apic/bigsmp_32.c +2 -46

81 lines not on this page · raw message

arch/x86/kernel/apic/probe_32.c +61 -54

168 lines not on this page · raw message

arch/x86/kernel/apic/probe_64.c +1 -1
index 83e9be4..ea25de8 100644
@@ -67,7 +67,7 @@ void __init default_setup_apic_routing(void)
 	}
 #endif
 
-	if (apic == &apic_flat && num_possible_cpus() > 8)
+	if (apic == &apic_flat && nr_cpu_ids > 8)
 			apic = &apic_physflat;
 
 	printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
arch/x86/kernel/setup.c +0 -2
index 82533cf..e6ea918 100644
@@ -186,8 +186,6 @@ static void set_mca_bus(int x)
 #endif
 }
 
-unsigned int def_to_bigsmp;
-
 /* for MCA, but anyone else can use it if they want */
 unsigned int machine_id;
 unsigned int machine_submodel_id;
arch/x86/kernel/smpboot.c +1 -1
index 3f92885..ffd93b4 100644
@@ -991,7 +991,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
 	preempt_disable();
 
 #if !defined(CONFIG_X86_BIGSMP) && defined(CONFIG_X86_32)
-	if (def_to_bigsmp && nr_cpu_ids > 8) {
+	if (apic == &apic_default && nr_cpu_ids > 8) {
 		unsigned int cpu;
 		unsigned nr;
 
Signature · 1 line
1.6.4.2
author
#70 lore raw

PATCH 18/20 x86: remove arch_probe_nr_irqs

In reply to Yinghai Lu

so keep nr_irqs == NR_IRQS

---
 arch/x86/kernel/apic/io_apic.c |   22 ----------------------
 1 files changed, 0 insertions(+), 22 deletions(-)
arch/x86/kernel/apic/io_apic.c +0 -22
index c03bcd4..ed8002b 100644
@@ -3917,28 +3917,6 @@ void __init probe_nr_irqs_gsi(void)
 	printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
 }
 
-#ifdef CONFIG_SPARSE_IRQ
-int __init arch_probe_nr_irqs(void)
-{
-	int nr;
-
-	if (nr_irqs > (NR_VECTORS * nr_cpu_ids))
-		nr_irqs = NR_VECTORS * nr_cpu_ids;
-
-	nr = nr_irqs_gsi + 8 * nr_cpu_ids;
-#if defined(CONFIG_PCI_MSI) || defined(CONFIG_HT_IRQ)
-	/*
-	 * for MSI and HT dyn irq
-	 */
-	nr += nr_irqs_gsi * 16;
-#endif
-	if (nr < nr_irqs)
-		nr_irqs = nr;
-
-	return 0;
-}
-#endif
-
 static int __io_apic_set_pci_routing(struct device *dev, int irq,
 				struct io_apic_irq_attr *irq_attr)
 {
Signature · 1 line
1.6.4.2
author
#71 lore raw

PATCH 19/20 x86/pci: ioh new version read all at same time

In reply to Yinghai Lu

also it will add back default range to legacy IOH

---
 arch/x86/include/asm/pci_x86.h |    5 +
 arch/x86/pci/Makefile          |    1 +
 arch/x86/pci/init.c            |    2 +
 arch/x86/pci/intel_bus.c       |  281 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 arch/x86/pci/intel_bus.c
arch/x86/include/asm/pci_x86.h +5 -0
index 8d8797e..e52c02a 100644
@@ -107,6 +107,11 @@ extern void pci_direct_init(int type);
 extern void pci_pcbios_init(void);
 extern void __init dmi_check_pciprobe(void);
 extern void __init dmi_check_skip_isa_align(void);
+#ifdef CONFIG_PCI_MMCONFIG
+int intel_postarch_init(void);
+#else
+static inline int intel_postarch_init(void) { return 0; }
+#endif
 
 /* some common used subsys_initcalls */
 extern int __init pci_acpi_init(void);
arch/x86/pci/Makefile +1 -0
index b110d97..08e76bc 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_X86_MRST)		+= mrst.o
 
 obj-y				+= common.o early.o
 obj-y				+= amd_bus.o bus_numa.o
+obj-$(CONFIG_PCI_MMCONFIG)	+= intel_bus.o
 
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
arch/x86/pci/init.c +2 -0
index adb62aa..08d5dcf 100644
@@ -39,6 +39,8 @@ static __init int pci_arch_init(void)
 
 	dmi_check_skip_isa_align();
 
+	intel_postarch_init();
+
 	return 0;
 }
 arch_initcall(pci_arch_init);
arch/x86/pci/intel_bus.c new file +281 -0

281 lines not on this page · raw message

Signature · 1 line
1.6.4.2
#72 lore raw

Re: [PATCH 19/20] x86/pci: ioh new version read all at same time

Quoted 2 lines · On Sun, 21 Mar 2010 00:13:20 -0700 Yinghai Lu <[email protected]> wrote:

also it will add back default range to legacy IOH

This patch is a bit short on details. Are we fixing a real bug here that _CRS fails to cover? Or is it just for debug purposes?

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
author
#73 lore raw

Re: [PATCH 19/20] x86/pci: ioh new version read all at same time

Quoted 9 lines · Jesse Barnes
Quoted 2 lines · On Sun, 21 Mar 2010 00:13:20 -0700 Yinghai Lu <[email protected]> wrote:

also it will add back default range to legacy IOH

This patch is a bit short on details. Are we fixing a real bug here that _CRS fails to cover? Or is it just for debug purposes?

yes for debug purpose. anyway BIOS need to keep them the same.

one from HW register reading, and one from acpi.

Yinghai

author
#74 lore raw

PATCH 20/20 x86/pci: add mmconf range into e820 for when it is from MSR with amd faml0h

In reply to Yinghai Lu

for AMD Fam10h, it we read mmconf from MSR early, we should just trust it because we check it and correct it already.

so add it to e820

---
 arch/x86/kernel/mmconf-fam10h_64.c |   40 ++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 17 deletions(-)
arch/x86/kernel/mmconf-fam10h_64.c +23 -17
index 7182580..4426fd2 100644
@@ -16,6 +16,7 @@
 #include <asm/acpi.h>
 #include <asm/mmconfig.h>
 #include <asm/pci_x86.h>
+#include <asm/e820.h>
 
 struct pci_hostbridge_probe {
 	u32 bus;
@@ -27,23 +28,26 @@ struct pci_hostbridge_probe {
 static u64 __cpuinitdata fam10h_pci_mmconf_base;
 static int __cpuinitdata fam10h_pci_mmconf_base_status;
 
+/* only on BSP */
+static void __init_refok e820_add_mmconf_range(int busnbits)
+{
+	u64 end;
+
+	end = fam10h_pci_mmconf_base + (1ULL<<(busnbits + 20)) - 1;
+	if (!e820_all_mapped(fam10h_pci_mmconf_base, end+1, E820_RESERVED)) {
+		printk(KERN_DEBUG "Fam 10h mmconf [%llx, %llx]\n",
+				 fam10h_pci_mmconf_base, end);
+		e820_add_region(fam10h_pci_mmconf_base, 1ULL<<(busnbits + 20),
+				 E820_RESERVED);
+		sanitize_e820_map();
+	}
+}
+
 static struct pci_hostbridge_probe pci_probes[] __cpuinitdata = {
 	{ 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 },
 	{ 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 },
 };
 
-static int __cpuinit cmp_range(const void *x1, const void *x2)
-{
-	const struct range *r1 = x1;
-	const struct range *r2 = x2;
-	int start1, start2;
-
-	start1 = r1->start >> 32;
-	start2 = r2->start >> 32;
-
-	return start1 - start2;
-}
-
 /*[47:0] */
 /* need to avoid (0xfd<<32) and (0xfe<<32), ht used space */
 #define FAM10H_PCI_MMCONF_BASE (0xfcULL<<32)
@@ -115,6 +119,7 @@ static void __cpuinit get_fam10h_pci_mmconf_base(void)
 	 * above 4G
 	 */
 	hi_mmio_num = 0;
+	memset(range, 0, sizeof(range));
 	for (i = 0; i < 8; i++) {
 		u32 reg;
 		u64 start;
@@ -130,16 +135,14 @@ static void __cpuinit get_fam10h_pci_mmconf_base(void)
 		if (!end)
 			continue;
 
-		range[hi_mmio_num].start = start;
-		range[hi_mmio_num].end = end;
-		hi_mmio_num++;
+		hi_mmio_num = add_range(range, 8, hi_mmio_num, start, end);
 	}
 
 	if (!hi_mmio_num)
 		goto out;
 
 	/* sort the range */
-	sort(range, hi_mmio_num, sizeof(struct range), cmp_range, NULL);
+	sort_range(range, hi_mmio_num);
 
 	if (range[hi_mmio_num - 1].end < base)
 		goto out;
@@ -169,6 +172,7 @@ fail:
 out:
 	fam10h_pci_mmconf_base = base;
 	fam10h_pci_mmconf_base_status = 1;
+	e820_add_mmconf_range(8);
 }
 
 void __cpuinit fam10h_check_enable_mmcfg(void)
@@ -191,10 +195,12 @@ void __cpuinit fam10h_check_enable_mmcfg(void)
 		/* only trust the one handle 256 buses, if acpi=off */
 		if (!acpi_pci_disabled || busnbits >= 8) {
 			u64 base;
-			base = val & (0xffffULL << 32);
+			base = val & (FAM10H_MMIO_CONF_BASE_MASK <<
+					FAM10H_MMIO_CONF_BASE_SHIFT);
 			if (fam10h_pci_mmconf_base_status <= 0) {
 				fam10h_pci_mmconf_base = base;
 				fam10h_pci_mmconf_base_status = 1;
+				e820_add_mmconf_range(busnbits);
 				return;
 			} else if (fam10h_pci_mmconf_base ==  base)
 				return;
Signature · 1 line
1.6.4.2
author
#76 lore raw
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 3 lines · Yinghai Lu

01 - 06: early_res related
07 - 15: irq_desc releated
19 - 20: pci related

First of all, please post separate series, it's hard enough as it-is.

ok, next version seperate early_res and irq_desc related.

YH