aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/ioremap.c
diff options
context:
space:
mode:
authorWang Chen <wangchen@cn.fujitsu.com>2009-03-07 00:34:19 -0500
committerIngo Molnar <mingo@elte.hu>2009-03-08 12:07:47 -0400
commit8827247ffcc9e880cbe4705655065cf011265157 (patch)
treec2b7a0300ae9e83b368b779154b3c217c09b0d86 /arch/x86/mm/ioremap.c
parent31bbed527e7039203920c51c9fb48c27aed0820c (diff)
x86: don't define __this_fixmap_does_not_exist()
Impact: improve out-of-range fixmap index debugging Commit "1b42f51630c7eebce6fb780b480731eb81afd325" defined the __this_fixmap_does_not_exist() function with a WARN_ON(1) in it. This causes the linker to not report an error when __this_fixmap_does_not_exist() is called with a non-constant parameter. Ingo defined __this_fixmap_does_not_exist() because he wanted to get virt addresses of fix memory of nest level by non-constant index. But we can fix this and still keep the link-time check: We can get the four slot virt addresses on link time and store them to array slot_virt[]. Then we can then refer the slot_virt with non-constant index, in the ioremap-leak detection code. Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com> LKML-Reference: <49B2075B.4070509@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/ioremap.c')
-rw-r--r--arch/x86/mm/ioremap.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 62773abdf088..96786ef2c9a9 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -504,13 +504,19 @@ static inline pte_t * __init early_ioremap_pte(unsigned long addr)
504 return &bm_pte[pte_index(addr)]; 504 return &bm_pte[pte_index(addr)];
505} 505}
506 506
507static unsigned long slot_virt[FIX_BTMAPS_SLOTS] __initdata;
508
507void __init early_ioremap_init(void) 509void __init early_ioremap_init(void)
508{ 510{
509 pmd_t *pmd; 511 pmd_t *pmd;
512 int i;
510 513
511 if (early_ioremap_debug) 514 if (early_ioremap_debug)
512 printk(KERN_INFO "early_ioremap_init()\n"); 515 printk(KERN_INFO "early_ioremap_init()\n");
513 516
517 for (i = 0; i < FIX_BTMAPS_SLOTS; i++)
518 slot_virt[i] = fix_to_virt(FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*i);
519
514 pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN)); 520 pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN));
515 memset(bm_pte, 0, sizeof(bm_pte)); 521 memset(bm_pte, 0, sizeof(bm_pte));
516 pmd_populate_kernel(&init_mm, pmd, bm_pte); 522 pmd_populate_kernel(&init_mm, pmd, bm_pte);
@@ -577,6 +583,7 @@ static inline void __init early_clear_fixmap(enum fixed_addresses idx)
577 583
578static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata; 584static void __iomem *prev_map[FIX_BTMAPS_SLOTS] __initdata;
579static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata; 585static unsigned long prev_size[FIX_BTMAPS_SLOTS] __initdata;
586
580static int __init check_early_ioremap_leak(void) 587static int __init check_early_ioremap_leak(void)
581{ 588{
582 int count = 0; 589 int count = 0;
@@ -598,7 +605,8 @@ static int __init check_early_ioremap_leak(void)
598} 605}
599late_initcall(check_early_ioremap_leak); 606late_initcall(check_early_ioremap_leak);
600 607
601static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot) 608static void __init __iomem *
609__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot)
602{ 610{
603 unsigned long offset, last_addr; 611 unsigned long offset, last_addr;
604 unsigned int nrpages; 612 unsigned int nrpages;
@@ -664,9 +672,9 @@ static void __init __iomem *__early_ioremap(unsigned long phys_addr, unsigned lo
664 --nrpages; 672 --nrpages;
665 } 673 }
666 if (early_ioremap_debug) 674 if (early_ioremap_debug)
667 printk(KERN_CONT "%08lx + %08lx\n", offset, fix_to_virt(idx0)); 675 printk(KERN_CONT "%08lx + %08lx\n", offset, slot_virt[slot]);
668 676
669 prev_map[slot] = (void __iomem *)(offset + fix_to_virt(idx0)); 677 prev_map[slot] = (void __iomem *)(offset + slot_virt[slot]);
670 return prev_map[slot]; 678 return prev_map[slot];
671} 679}
672 680
@@ -734,8 +742,3 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)
734 } 742 }
735 prev_map[slot] = NULL; 743 prev_map[slot] = NULL;
736} 744}
737
738void __this_fixmap_does_not_exist(void)
739{
740 WARN_ON(1);
741}