x86: use BUILD_BUG_ON() for the size of struct intel_mp_floating
Subsystems (4)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/10 x86: use BUILD_BUG_ON() for the size of struct intel_mp_floating
Use BUILD_BUG_ON() instead of compile-time error technique with extern non-exsistent function.
--- arch/x86/kernel/mpparse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/x86/kernel/mpparse.c +1 -3
@@ -686,13 +686,11 @@ void __init get_smp_config(void)static int __init smp_scan_config (unsigned long base,unsigned long length,unsigned reserve) { -extern void __bad_mpf_size (void );unsigned int *bp =phys_to_virt (base);struct intel_mp_floating *mpf;Dprintk ("Scan SMP from %p for %ld bytes.\n" , bp, length); -if (sizeof (*mpf) !=16 ) -__bad_mpf_size (); +BUILD_BUG_ON (sizeof (*mpf) !=16 );while (length >0 ) { mpf = (struct intel_mp_floating *)bp;
PATCH 2/10 x86: use MP_intsrc_info()
In reply to a message not in the archiveRemove duplicate code by using MP_intsrc_info() in mpparse.c
--- arch/x86/kernel/mpparse.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
arch/x86/kernel/mpparse.c +2 -17
@@ -907,14 +907,7 @@ void __init mp_override_legacy_irq(u8 bu intsrc.mpc_dstapic = mp_ioapics[ioapic].mpc_apicid;/* APIC ID */ intsrc.mpc_dstirq = pin;/* INTIN# */ -Dprintk ("Int: type %d, pol %d, trig %d, bus %d, irq %d, %d-%d\n" , - intsrc.mpc_irqtype, intsrc.mpc_irqflag &3 , - (intsrc.mpc_irqflag >>2 ) &3 , intsrc.mpc_srcbus, - intsrc.mpc_srcbusirq, intsrc.mpc_dstapic, intsrc.mpc_dstirq); - - mp_irqs[mp_irq_entries] = intsrc; -if (++mp_irq_entries ==MAX_IRQ_SOURCES ) -panic ("Max # of irq sources exceeded!\n" ); +MP_intsrc_info (&intsrc); }int es7000_plat;
@@ -983,15 +976,7 @@ void __init mp_config_acpi_legacy_irqs(v intsrc.mpc_srcbusirq = i;/* Identity mapped */ intsrc.mpc_dstirq = i; -Dprintk ("Int: type %d, pol %d, trig %d, bus %d, irq %d, " -"%d-%d\n" , intsrc.mpc_irqtype, intsrc.mpc_irqflag &3 , - (intsrc.mpc_irqflag >>2 ) &3 , intsrc.mpc_srcbus, - intsrc.mpc_srcbusirq, intsrc.mpc_dstapic, - intsrc.mpc_dstirq); - - mp_irqs[mp_irq_entries] = intsrc; -if (++mp_irq_entries ==MAX_IRQ_SOURCES ) -panic ("Max # of irq sources exceeded!\n" ); +MP_intsrc_info (&intsrc); } }
PATCH 3/10 x86: use bitmap library for pin_programmed
In reply to a message not in the archiveUse bitmap library for pin_programmed rather than reinvent bitmaps.
--- arch/x86/kernel/mpparse.c | 14 +++++--------- include/asm-x86/io_apic.h | 6 ++++-- 2 files changed, 9 insertions(+), 11 deletions(-)
arch/x86/kernel/mpparse.c +5 -9
@@ -799,7 +799,6 @@ void __init find_smp_config(void)#ifdef CONFIG_X86_IO_APIC #define MP_ISA_BUS 0 -#define MP_MAX_IOAPIC_PIN 127extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS ];
@@ -982,9 +981,8 @@ void __init mp_config_acpi_legacy_irqs(vint mp_register_gsi (u32 gsi,int triggering,int polarity) { -int ioapic =-1 ; -int ioapic_pin =0 ; -int idx, bit =0 ; +int ioapic; +int ioapic_pin;#ifdef CONFIG_X86_32 #define MAX_GSI_NUM 4096#define IRQ_COMPRESSION_START 64
@@ -1024,15 +1022,13 @@ int mp_register_gsi(u32 gsi, int trigger* with redundant pin->gsi mappings (but unique PCI devices); * we only program the IOAPIC on the first. */ - bit = ioapic_pin %32 ; - idx = (ioapic_pin <32 ) ?0 : (ioapic_pin /32 ); -if (idx >3 ) { +if (ioapic_pin >MP_MAX_IOAPIC_PIN ) {printk (KERN_ERR "Invalid reference to IOAPIC pin " "%d-%d\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin);return gsi; } -if ((1 << bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { +if (test_bit (ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {Dprintk (KERN_DEBUG "Pin %d-%d already programmed\n" , mp_ioapic_routing[ioapic].apic_id, ioapic_pin);#ifdef CONFIG_X86_32
@@ -1042,7 +1038,7 @@ int mp_register_gsi(u32 gsi, int trigger#endif } - mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1 << bit); +set_bit (ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed);#ifdef CONFIG_X86_32 /* * For GSI >= 64, use IRQ compression
include/asm-x86/io_apic.h +4 -2
@@ -1,7 +1,7 @@#ifndef __ASM_IO_APIC_H#define __ASM_IO_APIC_H -#include <asm/types.h> +#include <linux/types.h> #include <asm/mpspec.h> #include <asm/apicdef.h>
@@ -110,11 +110,13 @@ extern int nr_ioapic_registers[MAX_IO_AP* MP-BIOS irq configuration table structures: */ +#define MP_MAX_IOAPIC_PIN 127 +struct mp_ioapic_routing {int apic_id;int gsi_base;int gsi_end; -u32 pin_programmed[4 ]; + DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); };/* I/O APIC entries */
PATCH 4/10 x86: remove unnecessary memset and NULL check after alloc_bootmem()
In reply to a message not in the archivememset and NULL check after alloc_bootmem() are unnecessary. Because it returns zeroed memory and it never return NULL.
--- arch/x86/kernel/acpi/boot.c | 4 ---- 1 file changed, 4 deletions(-)
arch/x86/kernel/acpi/boot.c +0 -4
@@ -697,10 +697,6 @@ static int __init acpi_parse_hpet(struct#define HPET_RESOURCE_NAME_SIZE 9 hpet_res =alloc_bootmem (sizeof (*hpet_res) +HPET_RESOURCE_NAME_SIZE ); -if (!hpet_res) -return 0 ; - -memset (hpet_res,0 ,sizeof (*hpet_res)); hpet_res->name = (void *)&hpet_res[1 ]; hpet_res->flags =IORESOURCE_MEM ; snprintf((char *)hpet_res->name, HPET_RESOURCE_NAME_SIZE, "HPET %u",
PATCH 5/10 x86: cleanup clocksource_hz2mult usage
In reply to a message not in the archiveRemove the magic number in the second argument of clocksource_hz2mult()
--- arch/x86/kernel/i8253.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/i8253.c +2 -1
@@ -224,7 +224,8 @@ static int __init init_pit_clocksource(v pit_clockevent.mode != CLOCK_EVT_MODE_PERIODIC)return 0 ; - clocksource_pit.mult =clocksource_hz2mult (CLOCK_TICK_RATE ,20 ); + clocksource_pit.mult =clocksource_hz2mult (CLOCK_TICK_RATE , + clocksource_pit.shift);return clocksource_register (&clocksource_pit); }arch_initcall (init_pit_clocksource);
PATCH 6/10 x86: cleanup div_sc() usage
In reply to a message not in the archiveRemove the magic number in the third argment of div_sc().
--- arch/x86/kernel/apic_32.c | 3 ++- arch/x86/kernel/apic_64.c | 3 ++- arch/x86/kernel/hpet.c | 2 +- arch/x86/kernel/i8253.c | 3 ++- arch/x86/kernel/mfgpt_32.c | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-)
arch/x86/kernel/apic_32.c +2 -1
@@ -451,7 +451,8 @@ void __init setup_boot_APIC_clock(void) }/* Calculate the scaled math multiplication factor */ - lapic_clockevent.mult =div_sc (delta,TICK_NSEC *LAPIC_CAL_LOOPS ,32 ); + lapic_clockevent.mult =div_sc (delta,TICK_NSEC *LAPIC_CAL_LOOPS , + lapic_clockevent.shift); lapic_clockevent.max_delta_ns =clockevent_delta2ns (0x7FFFFF , &lapic_clockevent); lapic_clockevent.min_delta_ns =
arch/x86/kernel/apic_64.c +2 -1
@@ -360,7 +360,8 @@ static void __init calibrate_APIC_clock( result / 1000 / 1000, result / 1000 % 1000);/* Calculate the scaled math multiplication factor */ - lapic_clockevent.mult =div_sc (result,NSEC_PER_SEC ,32 ); + lapic_clockevent.mult =div_sc (result,NSEC_PER_SEC , + lapic_clockevent.shift); lapic_clockevent.max_delta_ns =clockevent_delta2ns (0x7FFFFF , &lapic_clockevent); lapic_clockevent.min_delta_ns =
arch/x86/kernel/hpet.c +1 -1
@@ -218,7 +218,7 @@ static void hpet_legacy_clockevent_regis hpet_freq =1000000000000000ULL ;do_div (hpet_freq, hpet_period); hpet_clockevent.mult =div_sc ((unsigned long ) hpet_freq, -NSEC_PER_SEC ,32 ); +NSEC_PER_SEC , hpet_clockevent.shift);/* Calculate the min / max delta */ hpet_clockevent.max_delta_ns =clockevent_delta2ns (0x7FFFFFFF , &hpet_clockevent);
arch/x86/kernel/i8253.c +2 -1
@@ -115,7 +115,8 @@ void __init setup_pit_timer(void)* IO_APIC has been initialized. */ pit_clockevent.cpumask =cpumask_of_cpu (smp_processor_id ()); - pit_clockevent.mult =div_sc (CLOCK_TICK_RATE ,NSEC_PER_SEC ,32 ); + pit_clockevent.mult =div_sc (CLOCK_TICK_RATE ,NSEC_PER_SEC , + pit_clockevent.shift); pit_clockevent.max_delta_ns =clockevent_delta2ns (0x7FFF , &pit_clockevent); pit_clockevent.min_delta_ns =
arch/x86/kernel/mfgpt_32.c +2 -1
@@ -364,7 +364,8 @@ int __init mfgpt_timer_setup(void)geode_mfgpt_write (mfgpt_event_clock,MFGPT_REG_SETUP , val);/* Set up the clock event */ - mfgpt_clockevent.mult =div_sc (MFGPT_HZ ,NSEC_PER_SEC ,32 ); + mfgpt_clockevent.mult =div_sc (MFGPT_HZ ,NSEC_PER_SEC , + mfgpt_clockevent.shift); mfgpt_clockevent.min_delta_ns =clockevent_delta2ns (0xF , &mfgpt_clockevent); mfgpt_clockevent.max_delta_ns = clockevent_delta2ns(0xFFFE,
PATCH 7/10 x86: use cpumask function for present, possible, and online cpus
In reply to a message not in the archivecpu_online(), cpu_present(), for_each_possible_cpu(), num_possible_cpus()
--- arch/x86/kernel/genapic_64.c | 2 +- arch/x86/kernel/smpboot.c | 4 ++-- arch/x86/kernel/tlb_64.c | 4 ++-- arch/x86/mach-voyager/voyager_smp.c | 10 +++++----- arch/x86/xen/smp.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-)
arch/x86/mach-voyager/voyager_smp.c +5 -5
@@ -115,7 +115,7 @@ static inline void send_QIC_CPI(__u32 cpfor_each_online_cpu (cpu) {if (cpuset & (1 << cpu)) {#ifdef VOYAGER_DEBUG -if (!cpu_isset (cpu, cpu_online_map)) +if (!cpu_online (cpu))VDEBUG (("CPU%d sending cpi %d to CPU%d not in " "cpu_online_map\n" ,hard_smp_processor_id (), cpi, cpu));
@@ -702,9 +702,9 @@ void __init smp_boot_cpus(void)* Code added from smpboot.c */ {unsigned long bogosum =0 ; -for (i =0 ; i <NR_CPUS ; i++) -if (cpu_isset (i, cpu_online_map)) - bogosum +=cpu_data (i).loops_per_jiffy; + +for_each_online_cpu (i) + bogosum +=cpu_data (i).loops_per_jiffy; printk(KERN_INFO "Total of %d processors activated " "(%lu.%02lu BogoMIPS).\n", cpucount + 1, bogosum / (500000 / HZ),
@@ -1857,7 +1857,7 @@ static int __cpuinit voyager_cpu_up(unsireturn -EIO ;/* Unleash the CPU! */ cpu_set (cpu, smp_commenced_mask); -while (!cpu_isset (cpu, cpu_online_map)) +while (!cpu_online (cpu))mb ();return 0 ; }
arch/x86/kernel/smpboot.c +2 -2
@@ -1047,7 +1047,7 @@ int __cpuinit native_cpu_up(unsigned intcheck_tsc_sync_source (cpu);local_irq_restore (flags); -while (!cpu_isset (cpu, cpu_online_map)) { +while (!cpu_online (cpu)) {cpu_relax ();touch_nmi_watchdog (); }
@@ -1157,7 +1157,7 @@ static void __init smp_cpu_index_defaultint i;struct cpuinfo_x86 *c; -for_each_cpu_mask (i, cpu_possible_map) { +for_each_possible_cpu (i) { c = &cpu_data (i);/* mark all to hotplug */ c->cpu_index =NR_CPUS ;
arch/x86/kernel/genapic_64.c +1 -1
@@ -51,7 +51,7 @@ void __init setup_apic_routing(void) else#endif -if (cpus_weight (cpu_possible_map) <=8 ) +if (num_possible_cpus () <=8 ) genapic = &apic_flat;else genapic = &apic_physflat;
arch/x86/kernel/tlb_64.c +2 -2
@@ -195,9 +195,9 @@ int __cpuinit init_smp_flush(void) {int i; -for_each_cpu_mask (i, cpu_possible_map) { +for_each_possible_cpu (i)spin_lock_init (&per_cpu (flush_state, i).tlbstate_lock); - } +return 0 ; }core_initcall (init_smp_flush);
arch/x86/xen/smp.c +1 -1
@@ -183,7 +183,7 @@ void __init xen_smp_prepare_cpus(unsigne/* Restrict the possible_map according to max_cpus. */ while ((num_possible_cpus () >1 ) && (num_possible_cpus () > max_cpus)) { -for (cpu =NR_CPUS -1 ; !cpu_isset (cpu, cpu_possible_map); cpu--) +for (cpu =NR_CPUS -1 ; !cpu_possible (cpu); cpu--)continue ;cpu_clear (cpu, cpu_possible_map); }
PATCH 8/10 x86: get_bios_ebda() requires asm/io.h
In reply to a message not in the archiveinclude <asm/io.h> for phys_to_virt()
--- include/asm-x86/bios_ebda.h | 2 ++ 1 file changed, 2 insertions(+)
include/asm-x86/bios_ebda.h +2 -0
@@ -1,6 +1,8 @@#ifndef _MACH_BIOS_EBDA_H#define _MACH_BIOS_EBDA_H +#include <asm/io.h> +/* * there is a real-mode segmented pointer pointing to the * 4K EBDA area at 0x40E.
PATCH 9/10 x86: remove duplicate get_bios_ebda() from rio.h
In reply to a message not in the archiveget_bios_ebda() exists in asm/rio.h and asm/bios_ebda.h. This patch removes the one in asm/rio.h.
--- arch/x86/kernel/pci-calgary_64.c | 1 + include/asm-x86/rio.h | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-)
arch/x86/kernel/pci-calgary_64.c +1 -0
@@ -43,6 +43,7 @@#include <asm/system.h> #include <asm/dma.h> #include <asm/rio.h> +#include <asm/bios_ebda.h> #ifdef CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT int use_calgary__read_mostly =1 ;
include/asm-x86/rio.h +0 -11
@@ -60,15 +60,4 @@ enum { ALT_CALGARY = 5, /* Second Planar Calgary */ }; -/* -* there is a real-mode segmented pointer pointing to the -* 4K EBDA area at 0x40E. -*/ -static inline unsigned long get_bios_ebda (void ) -{ -unsigned long address = *(unsigned short *)phys_to_virt (0x40EUL ); - address <<=4 ; -return address; -} -#endif /* __ASM_RIO_H */
PATCH 10/10 x86: use get_bios_ebda()
In reply to a message not in the archiveUse get_bios_ebda().
--- arch/x86/kernel/head64.c | 5 ++--- arch/x86/kernel/setup_32.c | 4 +--- arch/x86/kernel/summit_32.c | 5 +++-- 3 files changed, 6 insertions(+), 8 deletions(-)
arch/x86/kernel/summit_32.c +3 -2
@@ -29,6 +29,7 @@#include <linux/mm.h> #include <linux/init.h> #include <asm/io.h> +#include <asm/bios_ebda.h> #include <asm/mach-summit/mach_mpparse.h> static struct rio_table_hdr *rio_table_hdr__initdata ;
@@ -140,8 +141,8 @@ void __init setup_summit(void)int i, next_wpeg, next_bus =0 ;/* The pointer to the EBDA is stored in the word @ phys 0x40E(40:0E) */ - ptr = *(unsigned short *)phys_to_virt (0x40Eul ); - ptr = (unsigned long )phys_to_virt (ptr <<4 ); + ptr =get_bios_ebda (); + ptr = (unsigned long )phys_to_virt (ptr); rio_table_hdr =NULL ; offset =0x180 ;
arch/x86/kernel/head64.c +2 -3
@@ -22,6 +22,7 @@#include <asm/sections.h> #include <asm/kdebug.h> #include <asm/e820.h> +#include <asm/bios_ebda.h> static void __init zap_identity_mappings (void ) {
@@ -49,7 +50,6 @@ static void __init copy_bootdata(char *r } } -#define BIOS_EBDA_SEGMENT 0x40E#define BIOS_LOWMEM_KILOBYTES 0x413/*
@@ -80,8 +80,7 @@ static void __init reserve_ebda_region(v lowmem <<=10 ;/* start of EBDA area */ - ebda_addr = *(unsigned short *)__va (BIOS_EBDA_SEGMENT ); - ebda_addr <<=4 ; + ebda_addr =get_bios_ebda ();/* Fixup: bios puts an EBDA in the top 64K segment */ /* of conventional memory, but does not adjust lowmem. */
arch/x86/kernel/setup_32.c +1 -3
@@ -388,7 +388,6 @@ unsigned long __init find_max_low_pfn(voreturn max_low_pfn; } -#define BIOS_EBDA_SEGMENT 0x40E#define BIOS_LOWMEM_KILOBYTES 0x413/*
@@ -419,8 +418,7 @@ static void __init reserve_ebda_region(v lowmem <<=10 ;/* start of EBDA area */ - ebda_addr = *(unsigned short *)__va (BIOS_EBDA_SEGMENT ); - ebda_addr <<=4 ; + ebda_addr =get_bios_ebda ();/* Fixup: bios puts an EBDA in the top 64K segment */ /* of conventional memory, but does not adjust lowmem. */