From b439617e1c5e7dd52ac9064359c37e61735db1a8 Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Tue, 24 Jun 2008 09:27:19 -0300 Subject: [PATCH] --- yaml --- r: 100040 b: refs/heads/master c: ff1b15b646177c6cc465ac2dd0be6ae16e965654 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/acpi/boot.c | 44 +------- trunk/arch/x86/kernel/e820.c | 26 +---- trunk/arch/x86/kernel/io_apic_32.c | 10 -- trunk/arch/x86/kernel/io_apic_64.c | 10 -- trunk/arch/x86/kernel/setup.c | 13 ++- trunk/arch/x86/lib/delay_32.c | 4 +- trunk/arch/x86/mm/init_64.c | 175 ++++++++--------------------- trunk/include/asm-x86/e820.h | 2 +- trunk/include/asm-x86/genapic_32.h | 1 - trunk/include/asm-x86/genapic_64.h | 2 - 11 files changed, 73 insertions(+), 216 deletions(-) diff --git a/[refs] b/[refs] index 9b1c72817ff0..688ae4460d1b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a737abd11ac4eb9f4226fa8c9f1d9b5be12a96c1 +refs/heads/master: ff1b15b646177c6cc465ac2dd0be6ae16e965654 diff --git a/trunk/arch/x86/kernel/acpi/boot.c b/trunk/arch/x86/kernel/acpi/boot.c index bf7b4f7f60e1..5c0107602b62 100644 --- a/trunk/arch/x86/kernel/acpi/boot.c +++ b/trunk/arch/x86/kernel/acpi/boot.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -1374,6 +1373,8 @@ static void __init acpi_process_madt(void) return; } +#ifdef __i386__ + static int __init disable_acpi_irq(const struct dmi_system_id *d) { if (!acpi_force) { @@ -1434,17 +1435,6 @@ dmi_disable_irq0_through_ioapic(const struct dmi_system_id *d) return 0; } -/* - * Force ignoring BIOS IRQ0 pin2 override - */ -static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d) -{ - pr_notice("%s detected: Ignoring BIOS IRQ0 pin2 override\n", d->ident); - acpi_skip_timer_override = 1; - force_mask_ioapic_irq_2(); - return 0; -} - /* * If your system is blacklisted here, but you find that acpi=force * works for you, please contact acpi-devel@sourceforge.net @@ -1638,35 +1628,11 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"), }, }, - /* - * HP laptops which use a DSDT reporting as HP/SB400/10000, - * which includes some code which overrides all temperature - * trip points to 16C if the INTIN2 input of the I/O APIC - * is enabled. This input is incorrectly designated the - * ISA IRQ 0 via an interrupt source override even though - * it is wired to the output of the master 8259A and INTIN0 - * is not connected at all. Force ignoring BIOS IRQ0 pin2 - * override in that cases. - */ - { - .callback = dmi_ignore_irq0_timer_override, - .ident = "HP NX6125 laptop", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6125"), - }, - }, - { - .callback = dmi_ignore_irq0_timer_override, - .ident = "HP NX6325 laptop", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), - DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nx6325"), - }, - }, {} }; +#endif /* __i386__ */ + /* * acpi_boot_table_init() and acpi_boot_init() * called from setup_arch(), always. @@ -1694,7 +1660,9 @@ int __init acpi_boot_table_init(void) { int error; +#ifdef __i386__ dmi_check_system(acpi_dmi_table); +#endif /* * If acpi_disabled, bail out diff --git a/trunk/arch/x86/kernel/e820.c b/trunk/arch/x86/kernel/e820.c index 66fd5bd78318..e07d4019e266 100644 --- a/trunk/arch/x86/kernel/e820.c +++ b/trunk/arch/x86/kernel/e820.c @@ -1056,25 +1056,12 @@ unsigned long __initdata end_user_pfn = MAX_ARCH_PFN; /* * Find the highest page frame number we have available */ -unsigned long __init e820_end(void) +unsigned long __init e820_end_of_ram(void) { - int i; - unsigned long last_pfn = 0; + unsigned long last_pfn; unsigned long max_arch_pfn = MAX_ARCH_PFN; - for (i = 0; i < e820.nr_map; i++) { - struct e820entry *ei = &e820.map[i]; - unsigned long end_pfn; - -#ifdef CONFIG_X86_32 - if (ei->type != E820_RAM) - continue; -#endif - - end_pfn = (ei->addr + ei->size) >> PAGE_SHIFT; - if (end_pfn > last_pfn) - last_pfn = end_pfn; - } + last_pfn = find_max_pfn_with_active_regions(); if (last_pfn > max_arch_pfn) last_pfn = max_arch_pfn; @@ -1198,9 +1185,6 @@ static int __init parse_memmap_opt(char *p) char *oldp; u64 start_at, mem_size; - if (!p) - return -EINVAL; - if (!strcmp(p, "exactmap")) { #ifdef CONFIG_CRASH_DUMP /* @@ -1208,7 +1192,9 @@ static int __init parse_memmap_opt(char *p) * the real mem size before original memory map is * reset. */ - saved_max_pfn = e820_end(); + e820_register_active_regions(0, 0, -1UL); + saved_max_pfn = e820_end_of_ram(); + remove_all_active_ranges(); #endif e820.nr_map = 0; userdef = 1; diff --git a/trunk/arch/x86/kernel/io_apic_32.c b/trunk/arch/x86/kernel/io_apic_32.c index 6b220b9dcbb3..337ec3438a8f 100644 --- a/trunk/arch/x86/kernel/io_apic_32.c +++ b/trunk/arch/x86/kernel/io_apic_32.c @@ -59,13 +59,6 @@ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 }; static DEFINE_SPINLOCK(ioapic_lock); static DEFINE_SPINLOCK(vector_lock); -static bool mask_ioapic_irq_2 __initdata; - -void __init force_mask_ioapic_irq_2(void) -{ - mask_ioapic_irq_2 = true; -} - int timer_through_8259 __initdata; /* @@ -2179,9 +2172,6 @@ static inline void __init check_timer(void) printk(KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", vector, apic1, pin1, apic2, pin2); - if (mask_ioapic_irq_2) - mask_IO_APIC_irq(2); - /* * Some BIOS writers are clueless and report the ExtINTA * I/O APIC input from the cascaded 8259A as the timer diff --git a/trunk/arch/x86/kernel/io_apic_64.c b/trunk/arch/x86/kernel/io_apic_64.c index 0494cdb270c5..2b4c40bc12c9 100644 --- a/trunk/arch/x86/kernel/io_apic_64.c +++ b/trunk/arch/x86/kernel/io_apic_64.c @@ -94,13 +94,6 @@ static int no_timer_check; static int disable_timer_pin_1 __initdata; -static bool mask_ioapic_irq_2 __initdata; - -void __init force_mask_ioapic_irq_2(void) -{ - mask_ioapic_irq_2 = true; -} - int timer_through_8259 __initdata; /* Where if anywhere is the i8259 connect in external int mode */ @@ -1705,9 +1698,6 @@ static inline void __init check_timer(void) apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n", cfg->vector, apic1, pin1, apic2, pin2); - if (mask_ioapic_irq_2) - mask_IO_APIC_irq(2); - /* * Some BIOS writers are clueless and report the ExtINTA * I/O APIC input from the cascaded 8259A as the timer diff --git a/trunk/arch/x86/kernel/setup.c b/trunk/arch/x86/kernel/setup.c index a7c3471ea17c..bea8ae77d059 100644 --- a/trunk/arch/x86/kernel/setup.c +++ b/trunk/arch/x86/kernel/setup.c @@ -709,18 +709,22 @@ void __init setup_arch(char **cmdline_p) early_gart_iommu_check(); #endif + e820_register_active_regions(0, 0, -1UL); /* * partially used pages are not usable - thus * we are rounding upwards: */ - max_pfn = e820_end(); + max_pfn = e820_end_of_ram(); /* preallocate 4k for mptable mpc */ early_reserve_e820_mpc_new(); /* update e820 for memory not covered by WB MTRRs */ mtrr_bp_init(); - if (mtrr_trim_uncached_memory(max_pfn)) - max_pfn = e820_end(); + if (mtrr_trim_uncached_memory(max_pfn)) { + remove_all_active_ranges(); + e820_register_active_regions(0, 0, -1UL); + max_pfn = e820_end_of_ram(); + } #ifdef CONFIG_X86_32 /* max_low_pfn get updated here */ @@ -763,6 +767,9 @@ void __init setup_arch(char **cmdline_p) */ acpi_boot_table_init(); + /* Remove active ranges so rediscovery with NUMA-awareness happens */ + remove_all_active_ranges(); + #ifdef CONFIG_ACPI_NUMA /* * Parse SRAT to discover nodes. diff --git a/trunk/arch/x86/lib/delay_32.c b/trunk/arch/x86/lib/delay_32.c index ef691316f8b6..54013f87d956 100644 --- a/trunk/arch/x86/lib/delay_32.c +++ b/trunk/arch/x86/lib/delay_32.c @@ -38,9 +38,9 @@ static void delay_loop(unsigned long loops) "1: jmp 2f \n" ".align 16 \n" - "2: decl %0 \n" + "2: dec %0 \n" " jnz 2b \n" - "3: decl %0 \n" + "3: dec %0 \n" : /* we don't need output */ :"a" (loops) diff --git a/trunk/arch/x86/mm/init_64.c b/trunk/arch/x86/mm/init_64.c index 51f69b39b752..57d5eff754c9 100644 --- a/trunk/arch/x86/mm/init_64.c +++ b/trunk/arch/x86/mm/init_64.c @@ -340,8 +340,7 @@ phys_pte_update(pmd_t *pmd, unsigned long address, unsigned long end) } static unsigned long __meminit -phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, - unsigned long page_size_mask) +phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end) { unsigned long pages = 0; @@ -366,7 +365,7 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, continue; } - if (page_size_mask & (1<> PAGE_SHIFT, PAGE_KERNEL_LARGE)); @@ -384,22 +383,20 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end, } static unsigned long __meminit -phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end, - unsigned long page_size_mask) +phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end) { pmd_t *pmd = pmd_offset(pud, 0); unsigned long last_map_addr; spin_lock(&init_mm.page_table_lock); - last_map_addr = phys_pmd_init(pmd, address, end, page_size_mask); + last_map_addr = phys_pmd_init(pmd, address, end); spin_unlock(&init_mm.page_table_lock); __flush_tlb_all(); return last_map_addr; } static unsigned long __meminit -phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, - unsigned long page_size_mask) +phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end) { unsigned long pages = 0; unsigned long last_map_addr = end; @@ -421,12 +418,11 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, if (pud_val(*pud)) { if (!pud_large(*pud)) - last_map_addr = phys_pmd_update(pud, addr, end, - page_size_mask); + last_map_addr = phys_pmd_update(pud, addr, end); continue; } - if (page_size_mask & (1<> PAGE_SHIFT, PAGE_KERNEL_LARGE)); @@ -437,7 +433,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, pmd = alloc_low_page(&pmd_phys); spin_lock(&init_mm.page_table_lock); - last_map_addr = phys_pmd_init(pmd, addr, end, page_size_mask); + last_map_addr = phys_pmd_init(pmd, addr, end); unmap_low_page(pmd); pud_populate(&init_mm, pud, __va(pmd_phys)); spin_unlock(&init_mm.page_table_lock); @@ -450,37 +446,29 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end, } static unsigned long __meminit -phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end, - unsigned long page_size_mask) +phys_pud_update(pgd_t *pgd, unsigned long addr, unsigned long end) { pud_t *pud; pud = (pud_t *)pgd_page_vaddr(*pgd); - return phys_pud_init(pud, addr, end, page_size_mask); + return phys_pud_init(pud, addr, end); } static void __init find_early_table_space(unsigned long end) { - unsigned long puds, pmds, ptes, tables, start; + unsigned long puds, tables, start; puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; tables = round_up(puds * sizeof(pud_t), PAGE_SIZE); - if (direct_gbpages) { - unsigned long extra; - extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT); - pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT; - } else - pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; - tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE); - - if (cpu_has_pse) { - unsigned long extra; - extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); - ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; - } else - ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; - tables += round_up(ptes * sizeof(pte_t), PAGE_SIZE); + if (!direct_gbpages) { + unsigned long pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; + tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE); + } + if (!cpu_has_pse) { + unsigned long ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT; + tables += round_up(ptes * sizeof(pte_t), PAGE_SIZE); + } /* * RED-PEN putting page tables only on node 0 could @@ -620,12 +608,29 @@ static void __init early_memtest(unsigned long start, unsigned long end) } #endif -static unsigned long __init kernel_physical_mapping_init(unsigned long start, - unsigned long end, - unsigned long page_size_mask) +/* + * Setup the direct mapping of the physical memory at PAGE_OFFSET. + * This runs before bootmem is initialized and gets pages directly from + * the physical memory. To access them they are temporarily mapped. + */ +unsigned long __init_refok init_memory_mapping(unsigned long start, unsigned long end) { - unsigned long next, last_map_addr = end; + unsigned long start_phys = start, end_phys = end; + + printk(KERN_INFO "init_memory_mapping\n"); + + /* + * Find space for the kernel direct mapping tables. + * + * Later we should allocate these tables in the local node of the + * memory mapped. Unfortunately this is done currently before the + * nodes are discovered. + */ + if (!after_bootmem) { + init_gbpages(); + find_early_table_space(end); + } start = (unsigned long)__va(start); end = (unsigned long)__va(end); @@ -640,8 +645,7 @@ static unsigned long __init kernel_physical_mapping_init(unsigned long start, next = end; if (pgd_val(*pgd)) { - last_map_addr = phys_pud_update(pgd, __pa(start), - __pa(end), page_size_mask); + last_map_addr = phys_pud_update(pgd, __pa(start), __pa(end)); continue; } @@ -650,107 +654,22 @@ static unsigned long __init kernel_physical_mapping_init(unsigned long start, else pud = alloc_low_page(&pud_phys); - last_map_addr = phys_pud_init(pud, __pa(start), __pa(next), - page_size_mask); + last_map_addr = phys_pud_init(pud, __pa(start), __pa(next)); unmap_low_page(pud); pgd_populate(&init_mm, pgd_offset_k(start), __va(pud_phys)); } - return last_map_addr; -} -/* - * Setup the direct mapping of the physical memory at PAGE_OFFSET. - * This runs before bootmem is initialized and gets pages directly from - * the physical memory. To access them they are temporarily mapped. - */ -unsigned long __init_refok init_memory_mapping(unsigned long start, - unsigned long end) -{ - unsigned long last_map_addr = end; - unsigned long page_size_mask = 0; - unsigned long start_pfn, end_pfn; - - printk(KERN_INFO "init_memory_mapping\n"); - - /* - * Find space for the kernel direct mapping tables. - * - * Later we should allocate these tables in the local node of the - * memory mapped. Unfortunately this is done currently before the - * nodes are discovered. - */ - if (!after_bootmem) { - init_gbpages(); - find_early_table_space(end); - } - - if (direct_gbpages) - page_size_mask |= 1 << PG_LEVEL_1G; - if (cpu_has_pse) - page_size_mask |= 1 << PG_LEVEL_2M; - - /* head if not big page aligment ?*/ - start_pfn = start >> PAGE_SHIFT; - end_pfn = ((start + (PMD_SIZE - 1)) >> PMD_SHIFT) - << (PMD_SHIFT - PAGE_SHIFT); - if (start_pfn < end_pfn) - last_map_addr = kernel_physical_mapping_init( - start_pfn<>PMD_SHIFT) - << (PMD_SHIFT - PAGE_SHIFT); - end_pfn = ((start + (PUD_SIZE - 1))>>PUD_SHIFT) - << (PUD_SHIFT - PAGE_SHIFT); - if (end_pfn > ((end>>PUD_SHIFT)<<(PUD_SHIFT - PAGE_SHIFT))) - end_pfn = ((end>>PUD_SHIFT)<<(PUD_SHIFT - PAGE_SHIFT)); - if (start_pfn < end_pfn) - last_map_addr = kernel_physical_mapping_init( - start_pfn<>PUD_SHIFT) << (PUD_SHIFT - PAGE_SHIFT); - if (start_pfn < end_pfn) - last_map_addr = kernel_physical_mapping_init( - start_pfn<>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT); - if (start_pfn < end_pfn) - last_map_addr = kernel_physical_mapping_init( - start_pfn<>PAGE_SHIFT; - if (start_pfn < end_pfn) - last_map_addr = kernel_physical_mapping_init( - start_pfn< table_start) + if (!after_bootmem) reserve_early(table_start << PAGE_SHIFT, table_end << PAGE_SHIFT, "PGTABLE"); - printk(KERN_INFO "last_map_addr: %lx end: %lx\n", - last_map_addr, end); - if (!after_bootmem) - early_memtest(start, end); + early_memtest(start_phys, end_phys); return last_map_addr >> PAGE_SHIFT; } @@ -1157,6 +1076,9 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node) PAGE_KERNEL_LARGE); set_pmd(pmd, __pmd(pte_val(entry))); + addr_end = addr + PMD_SIZE; + p_end = p + PMD_SIZE; + /* check to see if we have contiguous blocks */ if (p_end != p || node_start != node) { if (p_start) @@ -1166,9 +1088,6 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node) node_start = node; p_start = p; } - - addr_end = addr + PMD_SIZE; - p_end = p + PMD_SIZE; } else vmemmap_verify((pte_t *)pmd, node, addr, next); } diff --git a/trunk/include/asm-x86/e820.h b/trunk/include/asm-x86/e820.h index 78c03d7bf441..a20d0a7f5892 100644 --- a/trunk/include/asm-x86/e820.h +++ b/trunk/include/asm-x86/e820.h @@ -99,7 +99,7 @@ extern void free_early(u64 start, u64 end); extern void early_res_to_bootmem(u64 start, u64 end); extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); -extern unsigned long e820_end(void); +extern unsigned long e820_end_of_ram(void); extern int e820_find_active_region(const struct e820entry *ei, unsigned long start_pfn, unsigned long last_pfn, diff --git a/trunk/include/asm-x86/genapic_32.h b/trunk/include/asm-x86/genapic_32.h index 8d4c8bdb9065..b02ea6e17de8 100644 --- a/trunk/include/asm-x86/genapic_32.h +++ b/trunk/include/asm-x86/genapic_32.h @@ -119,6 +119,5 @@ enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; #define is_uv_system() 0 #define uv_wakeup_secondary(a, b) 1 -extern void force_mask_ioapic_irq_2(void); #endif diff --git a/trunk/include/asm-x86/genapic_64.h b/trunk/include/asm-x86/genapic_64.h index 082ad020e412..0f8504627c41 100644 --- a/trunk/include/asm-x86/genapic_64.h +++ b/trunk/include/asm-x86/genapic_64.h @@ -46,6 +46,4 @@ extern int uv_wakeup_secondary(int phys_apicid, unsigned int start_rip); extern void setup_apic_routing(void); -extern void force_mask_ioapic_irq_2(void); - #endif