firefly-linux-kernel-4.4.55.git
16 years agox86: print out apic id in hex format
Yinghai Lu [Thu, 11 Sep 2008 04:56:46 +0000 (21:56 -0700)]
x86: print out apic id in hex format

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: io-apic - get rid of __DO_ACTION macro
Cyrill Gorcunov [Wed, 10 Sep 2008 18:19:50 +0000 (22:19 +0400)]
x86: io-apic - get rid of __DO_ACTION macro

Replace __DO_ACTION macro with io_apic_modify_irq function.
This allow us to 'grep' definitions being hided by
__DO_ACTION macro:

__unmask_IO_APIC_irq
__mask_IO_APIC_irq
__mask_and_edge_IO_APIC_irq
__unmask_and_level_IO_APIC_irq

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fix HPET compiler error when not using CONFIG_PCI_MSI
Steven Noonan [Mon, 8 Sep 2008 23:19:09 +0000 (16:19 -0700)]
x86: fix HPET compiler error when not using CONFIG_PCI_MSI

Added dummy function for hpet_setup_msi_irq().

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: using HPET in MSI mode and setting up per CPU HPET timers, fix
Venki Pallipadi [Mon, 8 Sep 2008 17:18:40 +0000 (10:18 -0700)]
x86: using HPET in MSI mode and setting up per CPU HPET timers, fix

On Sat, Sep 06, 2008 at 06:03:53AM -0700, Ingo Molnar wrote:
>
> it crashes two testsystems, the fault on a NULL pointer in hpet init,
> with:
>
> initcall print_all_ICs+0x0/0x520 returned 0 after 26 msecs
> calling  hpet_late_init+0x0/0x1c0
> BUG: unable to handle kernel NULL pointer dereference at 000000000000008c
> IP: [<ffffffff80d228be>] hpet_late_init+0xfe/0x1c0
> PGD 0
> Oops: 0000 [1] SMP
> CPU 0
> Modules linked in:
> Pid: 1, comm: swapper Not tainted 2.6.27-rc5 #29725
> RIP: 0010:[<ffffffff80d228be>]  [<ffffffff80d228be>] hpet_late_init+0xfe/0x1c0
> RSP: 0018:ffff88003fa07dd0  EFLAGS: 00010246
> RAX: 0000000000000000 RBX: 0000000000000003 RCX: 0000000000000000
> RDX: ffffc20000000160 RSI: 0000000000000000 RDI: 0000000000000003
> RBP: ffff88003fa07e90 R08: 0000000000000000 R09: ffff88003fa07dd0
> R10: 0000000000000001 R11: 0000000000000000 R12: ffff88003fa07dd0
> R13: 0000000000000002 R14: ffffc20000000000 R15: 000000006f57e511
> FS:  0000000000000000(0000) GS:ffffffff80cf6a80(0000) knlGS:0000000000000000
> CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
> CR2: 000000000000008c CR3: 0000000000201000 CR4: 00000000000006e0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
> Process swapper (pid: 1, threadinfo ffff88003fa06000, task ffff88003fa08000)
> Stack:  00000000fed00000 ffffc20000000000 0000000100000003 0000000800000002
>  0000000000000000 0000000000000000 0000000000000000 0000000000000000
>  0000000000000000 0000000000000000 0000000000000000 0000000000000000
> Call Trace:
>  [<ffffffff80d227c0>] ? hpet_late_init+0x0/0x1c0
>  [<ffffffff80209045>] do_one_initcall+0x45/0x190
>  [<ffffffff80296f39>] ? register_irq_proc+0x19/0xe0
>  [<ffffffff80d0d140>] ? early_idt_handler+0x0/0x73
>  [<ffffffff80d0dabc>] kernel_init+0x14c/0x1b0
>  [<ffffffff80942ac1>] ? trace_hardirqs_on_thunk+0x3a/0x3f
>  [<ffffffff8020dbd9>] child_rip+0xa/0x11
>  [<ffffffff8020ceee>] ? restore_args+0x0/0x30
>  [<ffffffff80d0d970>] ? kernel_init+0x0/0x1b0
>  [<ffffffff8020dbcf>] ? child_rip+0x0/0x11
> Code: 20 48 83 c1 01 48 39 f1 75 e3 44 89 e8 4c 8b 05 29 29 22 00 31 f6 48 8d 78 01 66 66 90 89 f0 48 8d 04 80 48 c1 e0 05 4a 8d 0c 00 <f6> 81 8c 00 00 00 08 74 26 8b 81 80 00 00 00 8b 91 88 00 00 00
> RIP  [<ffffffff80d228be>] hpet_late_init+0xfe/0x1c0
>  RSP <ffff88003fa07dd0>
> CR2: 000000000000008c
> Kernel panic - not syncing: Fatal exception

There was one code path, with CONFIG_PCI_MSI disabled, where we were accessing
hpet_devs without initialization. That resulted in the above crash. The change
below adds a check for hpet_devs.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: io-apic - do not use KERN_DEBUG marker too much
Cyrill Gorcunov [Mon, 8 Sep 2008 15:38:06 +0000 (19:38 +0400)]
x86: io-apic - do not use KERN_DEBUG marker too much

Do not use KERN_DEBUG several times on the same line being printed.
Introduced by mine previous patch, sorry.

Reported-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: lapic address print out like io apic addr
Yinghai Lu [Mon, 8 Sep 2008 00:58:57 +0000 (17:58 -0700)]
x86: lapic address print out like io apic addr

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodyn_array: remove one panic
Yinghai Lu [Sat, 6 Sep 2008 17:26:50 +0000 (10:26 -0700)]
dyn_array: remove one panic

Andrew said, we don't need duplicated panic.
because __alloc_bootmem already have that.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: io-apic - code style cleaning for setup_IO_APIC_irqs
Cyrill Gorcunov [Sat, 6 Sep 2008 10:15:33 +0000 (14:15 +0400)]
x86: io-apic - code style cleaning for setup_IO_APIC_irqs

By changing printout form we are able to shrink (and clean up) code a bit.

Former printout example:

init IO_APIC IRQs
 IO-APIC (apicid-pin) 1-1, 1-2, 1-3 not connected.
 IO-APIC (apicid-pin) 2-1, 2-2, 2-3 not connected.

New printout example:

init IO_APIC IRQs
 1-1 1-2 1-3 (apicid-pin) not connected
 2-1 2-2 2-3 (apicid-pin) not connected

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: HPET_MSI Initialise per-cpu HPET timers
venkatesh.pallipadi@intel.com [Sat, 6 Sep 2008 01:02:18 +0000 (18:02 -0700)]
x86: HPET_MSI Initialise per-cpu HPET timers

Initialize a per CPU HPET MSI timer when possible. We retain the HPET
timer 0 (IRQ 0) and timer 1 (IRQ 8) as is when legacy mode is being used. We
setup the remaining HPET timers as per CPU MSI based timers. This per CPU
timer will eliminate the need for timer broadcasting with IRQ 0 when there
is non-functional LAPIC timer across CPU deep C-states.

If there are more CPUs than number of available timers, CPUs that do not
find any timer to use will continue using LAPIC and IRQ 0 broadcast.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: HPET_MSI Basic HPET_MSI setup code, cleanups
Ingo Molnar [Sat, 6 Sep 2008 12:19:17 +0000 (14:19 +0200)]
x86: HPET_MSI Basic HPET_MSI setup code, cleanups

small style cleanups.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: HPET_MSI Basic HPET_MSI setup code
venkatesh.pallipadi@intel.com [Sat, 6 Sep 2008 01:02:17 +0000 (18:02 -0700)]
x86: HPET_MSI Basic HPET_MSI setup code

Basic HPET MSI setup code. Routines to perform basic MSI read write
in HPET memory map and setting up irq_chip for HPET MSI.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: HPET_MSI Refactor code in preparation for HPET_MSI
venkatesh.pallipadi@intel.com [Sat, 6 Sep 2008 01:02:16 +0000 (18:02 -0700)]
x86: HPET_MSI Refactor code in preparation for HPET_MSI

Preparatory patch before the actual HPET MSI changes. Sets up hpet_set_mode
and hpet_next_event for the MSI related changes. Just the code
refactoring and should be zero functional change.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: HPET_MSI change IRQ affinity in process context when it is disabled
venkatesh.pallipadi@intel.com [Sat, 6 Sep 2008 01:02:15 +0000 (18:02 -0700)]
x86: HPET_MSI change IRQ affinity in process context when it is disabled

Change the IRQ affinity in the process context when the IRQ is disabled.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: error missed ifndef CONFIG_HAVE_SPARSE_IRQ, v2
Yinghai Lu [Fri, 5 Sep 2008 17:03:37 +0000 (10:03 -0700)]
irq: error missed ifndef CONFIG_HAVE_SPARSE_IRQ, v2

need to change irq to int too

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: set_irq_chip() has redundant call to irq_to_desc()
Dean Nelson [Fri, 5 Sep 2008 14:10:40 +0000 (09:10 -0500)]
irq: set_irq_chip() has redundant call to irq_to_desc()

Extraneous call to irq_to_desc().

Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: error missed ifndef CONFIG_HAVE_SPARSE_IRQ
Dean Nelson [Fri, 5 Sep 2008 14:07:20 +0000 (09:07 -0500)]
irq: error missed ifndef CONFIG_HAVE_SPARSE_IRQ

An error return from create_irq_nr() is 0, but an error return from
create_irq() is -1.

Signed-off-by: Dean Nelson <dcn@sgi.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: io-apic - declare irq_cfg_lock for SPARSE_IRQ only
Cyrill Gorcunov [Thu, 4 Sep 2008 18:37:50 +0000 (22:37 +0400)]
x86: io-apic - declare irq_cfg_lock for SPARSE_IRQ only

We use irq_cfg_lock lock in SPARSE_IRQ only context so
move it under #ifdef and compiler will be happy.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: io-apic - use ARRAY_SIZE macro
Cyrill Gorcunov [Thu, 4 Sep 2008 18:37:49 +0000 (22:37 +0400)]
x86: io-apic - use ARRAY_SIZE macro

Make the code width a bit shorter with ARRAY_SIZE macro.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodyn_array: fix typo
Yinghai Lu [Thu, 4 Sep 2008 18:57:13 +0000 (20:57 +0200)]
dyn_array: fix typo

Andrew found the typo could break some platforms.

also fix a checkpatch warning.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: print out if acpi want physical flat of all
Yinghai Lu [Thu, 4 Sep 2008 18:57:11 +0000 (20:57 +0200)]
x86: print out if acpi want physical flat of all

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodyn_array: don't break compiling for !CONFIG_SMP
H. Peter Anvin [Thu, 4 Sep 2008 16:56:10 +0000 (09:56 -0700)]
dyn_array: don't break compiling for !CONFIG_SMP

Impact: build failure on uniprocessor

When compiling for !CONFIG_SMP, per_cpu_alloc_dyn_array() would fail
to compile, since it uses per_cpu_offset, which is not defined for
uniprocessor builds.

Hence, do not compile per_cpu_alloc_dyn_array() for !CONFIG_SMP.
Attempting to call this function in a uniprocessor configuration would
be simply wrong in the first place.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
16 years agodmar: fix dmar_parse_dev() devices_cnt error condition check
Suresh Siddha [Wed, 3 Sep 2008 23:58:35 +0000 (16:58 -0700)]
dmar: fix dmar_parse_dev() devices_cnt error condition check

It is possible that,
instead of PCI endpoint/sub-hierarchy structures, only IO-APIC/HPET
devices may be reported under device scope structures. Fix the devices_cnt
error check, which cares about only PCI structures and removes the
dma-remapping unit structure (dmaru) when the devices_cnt is zero
and include_all flag is not set.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodmar: use list_for_each_entry_safe() in dmar_dev_scope_init()
Suresh Siddha [Wed, 3 Sep 2008 23:58:34 +0000 (16:58 -0700)]
dmar: use list_for_each_entry_safe() in dmar_dev_scope_init()

In dmar_dev_scope_init(), functions called under for_each_drhd_unit()/
for_each_rmrr_units() can delete the list entry under some error conditions.

So we should use list_for_each_entry_safe() for safe traversal.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Acked-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodmar: initialize the return value in dmar_parse_dev()
Yinghai Lu [Wed, 3 Sep 2008 23:58:33 +0000 (16:58 -0700)]
dmar: initialize the return value in dmar_parse_dev()

initialize the return value in dmar_parse_dev()

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodmar: fix using early fixmap mapping for DMAR table parsing
Yinghai Lu [Wed, 3 Sep 2008 23:58:32 +0000 (16:58 -0700)]
dmar: fix using early fixmap mapping for DMAR table parsing

Very early detection of the DMAR tables will setup fixmap mapping. For
parsing these tables later (while enabling dma and/or interrupt remapping),
early fixmap mapping shouldn't be used. Fix it by calling table detection
routines again, which will call generic apci_get_table() for setting up
the correct mapping.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox2apic: fix reserved APIC register accesses in print_local_APIC()
Yinghai Lu [Wed, 3 Sep 2008 23:58:31 +0000 (16:58 -0700)]
x2apic: fix reserved APIC register accesses in print_local_APIC()

APIC_ARBPRI is a reserved register for XAPIC and beyond.
APIC_RRR is a reserved register except for 82489DX, APIC for Pentium processors.
APIC_EOI is a write only register.
APIC_DFR is reserved in x2apic mode.

Access to these registers in x2apic will result in #GP fault. Fix these
apic register accesses.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosparseirq: export nr_irqs on m68k/sparc/s390
Ingo Molnar [Thu, 28 Aug 2008 06:56:33 +0000 (08:56 +0200)]
sparseirq: export nr_irqs on m68k/sparc/s390

Stephen Rothwell reported such build failures on m68k/sparc/s390:

> ERROR: "nr_irqs" [drivers/net/hamradio/baycom_ser_fdx.ko] undefined!
> ERROR: "nr_irqs" [drivers/net/3c59x.ko] undefined!

export nr_irqs on these architectures too.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic - unify smp_spurious/error_interrupt declaration
Cyrill Gorcunov [Mon, 25 Aug 2008 17:27:26 +0000 (21:27 +0400)]
x86: apic - unify smp_spurious/error_interrupt declaration

According to entry_64.S we do pass pt_regs pointer
into interrupt handlers but don't use them. So we
safely may merge the declarations.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosparseirq: move kstat_irqs from kstat to irq_desc - fix
Yinghai Lu [Mon, 25 Aug 2008 19:41:19 +0000 (12:41 -0700)]
sparseirq: move kstat_irqs from kstat to irq_desc - fix

fix non-sparseirq architectures.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: let 64 bit to use 32 bit calibrate_apic_clock
Yinghai Lu [Mon, 25 Aug 2008 05:41:26 +0000 (22:41 -0700)]
x86: let 64 bit to use 32 bit calibrate_apic_clock

Use the 32-bit APIC calibration code - it's more mature.

Signed-of-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: rename apic_32.c and apic_64.c to apic.c
Yinghai Lu [Sun, 24 Aug 2008 09:01:56 +0000 (02:01 -0700)]
x86: rename apic_32.c and apic_64.c to apic.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic copy apic_64.c to apic_32.c
Yinghai Lu [Sun, 24 Aug 2008 09:01:55 +0000 (02:01 -0700)]
x86: apic copy apic_64.c to apic_32.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic copy calibrate_APIC_clock to each other in apic_32/64.c
Yinghai Lu [Sun, 24 Aug 2008 09:01:54 +0000 (02:01 -0700)]
x86: apic copy calibrate_APIC_clock to each other in apic_32/64.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic unify smp_spurious/error_interrupt
Yinghai Lu [Sun, 24 Aug 2008 09:01:53 +0000 (02:01 -0700)]
x86: apic unify smp_spurious/error_interrupt

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge header files in apic_xx.c
Yinghai Lu [Sun, 24 Aug 2008 09:01:52 +0000 (02:01 -0700)]
x86: merge header files in apic_xx.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: copy detect_init_APIC to the other
Yinghai Lu [Sun, 24 Aug 2008 09:01:51 +0000 (02:01 -0700)]
x86: copy detect_init_APIC to the other

Signed-off-by: Yinghai Lu <yhlu.kernel@mgail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge APIC_init_uniprocessor
Yinghai Lu [Sun, 24 Aug 2008 09:01:50 +0000 (02:01 -0700)]
x86: merge APIC_init_uniprocessor

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make apic_32/64.c more like
Yinghai Lu [Sun, 24 Aug 2008 09:01:49 +0000 (02:01 -0700)]
x86: make apic_32/64.c more like

except x2apic, detec_init_APIC, and calibrating_APIC_clock

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add hard_smp_prossor_id with MACRO in io_apic_xx.c
Yinghai Lu [Sun, 24 Aug 2008 09:01:48 +0000 (02:01 -0700)]
x86: add hard_smp_prossor_id with MACRO in io_apic_xx.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use HAVE_X2APIC in apic_64.c
Yinghai Lu [Sun, 24 Aug 2008 09:01:47 +0000 (02:01 -0700)]
x86: use HAVE_X2APIC in apic_64.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic_xx.c order variables
Yinghai Lu [Sun, 24 Aug 2008 09:01:46 +0000 (02:01 -0700)]
x86: apic_xx.c order variables

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic - unify smp_apic_timer_interrupt
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:45 +0000 (02:01 -0700)]
x86: apic - unify smp_apic_timer_interrupt

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic_32.c should use __cpuinit section
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:44 +0000 (02:01 -0700)]
x86: apic_32.c should use __cpuinit section

All callers are __init or __cpuinit so there is no need
to hold this code without CPU_HOTPLUG being set.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic - unify setup_local_APIC
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:43 +0000 (02:01 -0700)]
x86: apic - unify setup_local_APIC

- remove useless read of APIC_LVR
- wrap with preempt_disable/enable
- check for integrated APIC just in place

v2: fix by Yinghai Lu.
fix lapic_is_integrated using
let 64-bit too have pic_mode

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic_64.c - add sanity check for spurious vector definition
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:42 +0000 (02:01 -0700)]
x86: apic_64.c - add sanity check for spurious vector definition

Do not check for SPUTIOUS_APIC_VECTOR definition twice.
Check it once - is what we need.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic - unify setup_apicpmtimer
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:41 +0000 (02:01 -0700)]
x86: apic - unify setup_apicpmtimer

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic - introduce get_physical_broadcast for 64bit
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:40 +0000 (02:01 -0700)]
x86: apic - introduce get_physical_broadcast for 64bit

We don't really use it now on 64bit mode but
could reserve it for future.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: apic_64.c - setup_APIC_timer has to be __cpuinit function
Cyrill Gorcunov [Sun, 24 Aug 2008 09:01:39 +0000 (02:01 -0700)]
x86: apic_64.c - setup_APIC_timer has to be __cpuinit function

There is no need to hold this code if CPU_HOTPLUG is not
defined.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: VMI, initialize IRQ vector
Alok Kataria [Thu, 21 Aug 2008 18:26:43 +0000 (11:26 -0700)]
x86: VMI, initialize IRQ vector

Initialize vector_irq for the vmi used vector, to point to correct irq.

Signed-off-by: Alok N Kataria <akataria@vmware.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fix probe_nr_irqs for xen
Yinghai Lu [Thu, 21 Aug 2008 20:10:09 +0000 (13:10 -0700)]
x86: fix probe_nr_irqs for xen

otherwise Xen is _completely_ unusable with 5 or more VCPUs.
(when !CONFIG_HAVE_SPARSE_IRQ).

based on Alex Nixon's patch.

also add +1 offset after redir_entries

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Acked-by: Alex Nixon <alex.nixon@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fix 32-bit ioapic lockup with sparseirqs
Yinghai Lu [Thu, 21 Aug 2008 19:56:32 +0000 (12:56 -0700)]
x86: fix 32-bit ioapic lockup with sparseirqs

Missed two lines when copying.

Fix panic on one of Ingo's machines that need to adjust ioapic id when
acpi off/ 32bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: sparse_irq needs spin_lock in allocations
Yinghai Lu [Thu, 21 Aug 2008 03:46:25 +0000 (20:46 -0700)]
x86: sparse_irq needs spin_lock in allocations

Suresh Siddha noticed that we should have a spinlock around it.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosparseirq: fix intr-remap with dyn_array/nr_irqs changes]
Suresh Siddha [Thu, 21 Aug 2008 00:22:51 +0000 (17:22 -0700)]
sparseirq: fix intr-remap with dyn_array/nr_irqs changes]

In irq_2_iommu_alloc() and set_irte_irq(), irq_to_desc or
irq_2_iommu pointers may not be allocated. So use the routines
which will allocate them if they are not already allocated.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agowarning: fix arch x86 kernel io_apic c
Ingo Molnar [Mon, 18 Aug 2008 11:04:26 +0000 (13:04 +0200)]
warning: fix arch x86 kernel io_apic c

fix warning:

  arch/x86/kernel/io_apic.c: In function â€˜print_local_APIC’:
  arch/x86/kernel/io_apic.c:1786: warning: format â€˜%08x’ expects type â€˜unsigned int’, but argument 2 has type â€˜u64’
  arch/x86/kernel/io_apic.c:1787: warning: format â€˜%08x’ expects type â€˜unsigned int’, but argument 2 has type â€˜u64’

By creating uniform behavior on 32-bit and 64-bit and printing out the ICR
value in two 32-bit words.

Code has changed:

   text    data     bss     dec     hex filename
  22901   19650   17040   59591    e8c7 io_apic.o.before
  22899   19650   17040   59589    e8c5 io_apic.o.after

Due to the 32-bit cast narrowing the printed out value on 64-bit.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoxen: Fix bug `do_IRQ: cannot handle IRQ -1 vector 0x6 cpu 1'
Alex Nixon [Tue, 19 Aug 2008 05:17:08 +0000 (22:17 -0700)]
xen: Fix bug `do_IRQ: cannot handle IRQ -1 vector 0x6 cpu 1'

Following commit 9c3f2468d8339866d9ef6a25aae31a8909c6be0d, do_IRQ()
looks up the IRQ number in the per-cpu variable vector_irq.

This commit makes Xen initialise an identity vector_irq map for both X86_32 and X86_64.

Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agodyn_array: split dyn_array functions from init/main.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:54 +0000 (20:50 -0700)]
dyn_array: split dyn_array functions from init/main.c

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoxen: fix memory access violation bug when CONFIG_HAVE_SPARSE_IRQ is enabled
Alex Nixon [Wed, 20 Aug 2008 03:50:53 +0000 (20:50 -0700)]
xen: fix memory access violation bug when CONFIG_HAVE_SPARSE_IRQ is enabled

When sparse IRQs are enabled, it is not safe to assume an IRQ descriptor
exists for every possible IRQ.  This patch causes init_evtchn_cpu_bindings
to skip initialisation of IRQ descriptors which don't exist.

Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: probe nr_irqs even only mptable is used
Yinghai Lu [Wed, 20 Aug 2008 03:50:52 +0000 (20:50 -0700)]
x86: probe nr_irqs even only mptable is used

for !CONFIG_HAVE_SPARSE_IRQ

fix:

 In file included from arch/x86/kernel/early-quirks.c:18:
 include/asm/io_apic.h: In function 'probe_nr_irqs':
 include/asm/io_apic.h:209: error: 'NR_IRQS' undeclared (first use in this function)
 include/asm/io_apic.h:209: error: (Each undeclared identifier is reported only once
 include/asm/io_apic.h:209: error: for each function it appears in.)

v2: fix by Ingo

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make HAVE_SPARSE_IRQ support selectable
Yinghai Lu [Wed, 20 Aug 2008 03:50:51 +0000 (20:50 -0700)]
x86: make HAVE_SPARSE_IRQ support selectable

Ingo said sparse_irq is some intrusive. need to make it selectable

to make it simple, remove irq_desc as parameter in some functions.
(ack, eoi, set_affinity).
may need to make member if irq_chip to take irq_desc, or struct irq later.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: print local APIC of APs one by one
Yinghai Lu [Wed, 20 Aug 2008 03:50:50 +0000 (20:50 -0700)]
x86: print local APIC of APs one by one

instead of print that of all APs at the time

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove first_free_entry/pin_map_size
Yinghai Lu [Wed, 20 Aug 2008 03:50:49 +0000 (20:50 -0700)]
x86: remove first_free_entry/pin_map_size

no user now

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify ack_apic_edge
Yinghai Lu [Wed, 20 Aug 2008 03:50:48 +0000 (20:50 -0700)]
x86: unify ack_apic_edge

use code in 64 to replace
move_native_irq(irq, desc);
in 32 bit

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify mask_IO_APIC_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:47 +0000 (20:50 -0700)]
x86: unify mask_IO_APIC_irq

use MACRO for 32 bit too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: irq: interrupt array size should be NR_VECTORS
Yinghai Lu [Wed, 20 Aug 2008 03:50:46 +0000 (20:50 -0700)]
x86: irq: interrupt array size should be NR_VECTORS

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agopci: change msi-x vector to 32bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:45 +0000 (20:50 -0700)]
pci: change msi-x vector to 32bit

we are using 28bit pci (bus/dev/fn + 12 bits) as irq number, so the
cache for irq number should be 32 bit too.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoio_apic: make 32 bit have io_apic resource in /proc/iomem
Yinghai Lu [Wed, 20 Aug 2008 03:50:43 +0000 (20:50 -0700)]
io_apic: make 32 bit have io_apic resource in /proc/iomem

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agorename io_apic_64.c and io_apic_32.c to io_apic.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:42 +0000 (20:50 -0700)]
rename io_apic_64.c and io_apic_32.c to io_apic.c

The two files are now line by line equal. (sans a printk)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make io_apic_32.c the same as io_apic_64.c
Ingo Molnar [Wed, 20 Aug 2008 07:07:45 +0000 (09:07 +0200)]
x86: make io_apic_32.c the same as io_apic_64.c

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make io_apic_64.c and io_apic_32.c the same
Yinghai Lu [Wed, 20 Aug 2008 03:50:41 +0000 (20:50 -0700)]
x86: make io_apic_64.c and io_apic_32.c the same

all the same except INTR_REMAPPING related and ioapic io resource.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove ioapic_force
Yinghai Lu [Wed, 20 Aug 2008 03:50:40 +0000 (20:50 -0700)]
x86: remove ioapic_force

no user left.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make 64 handle sis_apic_bug like the 32 bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:39 +0000 (20:50 -0700)]
x86: make 64 handle sis_apic_bug like the 32 bit

do we have 64bit system with sis chipset?

[ mingo@elte.hu: nope, the problem chipset was 32-bit only.
                 The code symmetry is good nevertheless. ]

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make headers files the same in io_apic_xx.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:38 +0000 (20:50 -0700)]
x86: make headers files the same in io_apic_xx.c

also make no_timer_check to be global on 64 bit, because vmi_32 is using that.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agosparseirq: fix lockdep
Ingo Molnar [Wed, 20 Aug 2008 03:50:37 +0000 (20:50 -0700)]
sparseirq: fix lockdep

-tip testing found this lockdep splat:

[    0.000000] Initializing CPU#0
[    0.000000] found new irq_desc for irq 0
[    0.000000] INFO: trying to register non-static key.
[    0.000000] the code is fine but needs lockdep annotation.
[    0.000000] turning off the locking correctness validator.
[    0.000000] Pid: 0, comm: swapper Not tainted 2.6.27-rc3-tip-00191-g98ccb89-dirty #1
[    0.000000]  [<c0153c22>] register_lock_class+0x3d2/0x400
[    0.000000]  [<c0104d87>] ? mcount_call+0x5/0xa
[    0.000000]  [<c0154f3a>] __lock_acquire+0x22a/0x5d0
[    0.000000]  [<c0104d87>] ? mcount_call+0x5/0xa
[    0.000000]  [<c0155351>] lock_acquire+0x71/0xa0
[    0.000000]  [<c016d61f>] ? set_irq_chip+0x3f/0x90
[    0.000000]  [<c070f148>] _spin_lock_irqsave+0x58/0x90
[    0.000000]  [<c016d61f>] ? set_irq_chip+0x3f/0x90
[    0.000000]  [<c016d61f>] set_irq_chip+0x3f/0x90
[    0.000000]  [<c016d7e0>] ? handle_level_irq+0x0/0xe0
[    0.000000]  [<c016da1a>] set_irq_chip_and_handler_name+0x1a/0x40
[    0.000000]  [<c0a396c1>] init_ISA_irqs+0x51/0xa0
[    0.000000]  [<c0a4a365>] pre_intr_init_hook+0x25/0x30
[    0.000000]  [<c0a39723>] native_init_IRQ+0x13/0x370
[    0.000000]  [<c015569c>] ? lock_release+0xcc/0x1d0
[    0.000000]  [<c0104d87>] ? mcount_call+0x5/0xa
[    0.000000]  [<c070dc22>] ? __mutex_unlock_slowpath+0x92/0x110
[    0.000000]  [<c070dcad>] ? mutex_unlock+0xd/0x10
[    0.000000]  [<c0135f62>] ? cpu_maps_update_done+0x12/0x20
[    0.000000]  [<c06c6743>] ? register_cpu_notifier+0x23/0x30
[    0.000000]  [<c011e8ae>] init_IRQ+0xe/0x10
[    0.000000]  [<c0a357a5>] start_kernel+0x1c5/0x340
[    0.000000]  [<c0a35280>] ? unknown_bootoption+0x0/0x210
[    0.000000]  [<c0a3506b>] i386_start_kernel+0x6b/0x80
[    0.000000]  =======================
[    0.000000] found new irq_desc for irq 1
[    0.000000] found new irq_desc for irq 2
[    0.000000] found new irq_desc for irq 3

this:

 static void init_one_irq_desc(struct irq_desc *desc)
 {
         memcpy(desc, &irq_desc_init, sizeof(struct irq_desc));
 #ifdef CONFIG_TRACE_IRQFLAGS
         lockdep_set_class(&desc->lock, &irq_desc_lock_class);
 #endif
 }

should be unconditional.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: order variables in io_apic_xx.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:36 +0000 (20:50 -0700)]
x86: order variables in io_apic_xx.c

move first_system_vector to apic_64.c.

also add #ifdef CONFIG_INTR_REMAP to prepare 32 bit to use
same file.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: ordering functions in io_apic_64.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:35 +0000 (20:50 -0700)]
x86: ordering functions in io_apic_64.c

try to make functions have the same order between 32-bit and 64-bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: ordering functions in io_apic_32.c
Yinghai Lu [Wed, 20 Aug 2008 03:50:34 +0000 (20:50 -0700)]
x86: ordering functions in io_apic_32.c

prepare for unification:

try to make functions be of the same order to io_apic_64.c.

v2: add calling setup_msi_irq back to arch_setup_msi_irq

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86, io-apic: remove union about dest for log/phy
Yinghai Lu [Wed, 20 Aug 2008 03:50:33 +0000 (20:50 -0700)]
x86, io-apic: remove union about dest for log/phy

let user decide the meaning of the bits.

This unifies the 32-bit and 64-bit io-apic code a bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add debug info for 32bit sparse_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:32 +0000 (20:50 -0700)]
x86: add debug info for 32bit sparse_irq

so could figure out bugs where we get an interrupt, but vector_irq is
not initialized yet.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make 32bit support per_cpu vector
Yinghai Lu [Wed, 20 Aug 2008 03:50:28 +0000 (20:50 -0700)]
x86: make 32bit support per_cpu vector

so we can merge io_apic_32.c and io_apic_64.c

v2: Use cpu_online_map as target cpus for bigsmp, just like 64-bit is doing.

Also remove some unused TARGET_CPUS macro.

v3: need to check if desc is null in smp_irq_move_cleanup

also migration needs to reset vector too, so copy __target_IO_APIC_irq
from 64bit.

(the duplication will go away once the two files are unified.)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make 32 bit to use sparse_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:27 +0000 (20:50 -0700)]
x86: make 32 bit to use sparse_irq

but actually irq still needs to be less than NR_IRQS, because
interrupt[NR_IRQS] in entry.S.

need to enable per_cpu vector...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make 32bit to use irq_2_pin in irq_cfg
Yinghai Lu [Wed, 20 Aug 2008 03:50:26 +0000 (20:50 -0700)]
x86: make 32bit to use irq_2_pin in irq_cfg

so it is more like 64 bit.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make 32bit use irq_cfg_alloc, etc
Yinghai Lu [Wed, 20 Aug 2008 03:50:25 +0000 (20:50 -0700)]
x86: make 32bit use irq_cfg_alloc, etc

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add irq_cfg for 32bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:24 +0000 (20:50 -0700)]
x86: add irq_cfg for 32bit

it only contains vector ...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove irqbalance in kernel for 32 bit
Yinghai Lu [Wed, 20 Aug 2008 03:50:23 +0000 (20:50 -0700)]
x86: remove irqbalance in kernel for 32 bit

This has been deprecated for years, the user space irqbalanced utility
works better with numa, has configurable policies, etc...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmai.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use 28 bits irq NR for pci msi/msix and ht
Yinghai Lu [Wed, 20 Aug 2008 03:50:22 +0000 (20:50 -0700)]
x86: use 28 bits irq NR for pci msi/msix and ht

also print out irq no in /proc/interrups and /proc/stat in hex, so could
tell bus/dev/func.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: put irq_2_iommu pointer into irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:21 +0000 (20:50 -0700)]
x86: put irq_2_iommu pointer into irq_desc

when CONFIG_HAVE_SPARSE_IRQ
preallocate some irq_2_iommu entries, and use get_one_free_irq_2_iomm to
get new one and link to irq_desc if needed.

else will use dyn_array or static array.

v2: <= nr_irqs fix

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86_64: make /proc/interrupts work with dyn irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:20 +0000 (20:50 -0700)]
x86_64: make /proc/interrupts work with dyn irq_desc

loop with irq_desc list

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86_64: separate irq_cfgx from irq_cfgx_free
Yinghai Lu [Wed, 20 Aug 2008 03:50:19 +0000 (20:50 -0700)]
x86_64: separate irq_cfgx from irq_cfgx_free

so later don't need to compare with -1U

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: separate sparse_irqs from sparse_irqs_free
Yinghai Lu [Wed, 20 Aug 2008 03:50:18 +0000 (20:50 -0700)]
irq: separate sparse_irqs from sparse_irqs_free

so later don't need compare with -1U

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86_64: rename irq_desc/irq_desc_alloc
Yinghai Lu [Wed, 20 Aug 2008 03:50:17 +0000 (20:50 -0700)]
x86_64: rename irq_desc/irq_desc_alloc

change names:

          irq_desc() ==> irq_desc_alloc
__irq_desc() ==> irq_desc

Also split a few of the uses in lowlevel x86 code.

v2: need to check if desc is null in smp_irq_move_cleanup

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: check with without_new in show_interrupts
Yinghai Lu [Wed, 20 Aug 2008 03:50:16 +0000 (20:50 -0700)]
x86: check with without_new in show_interrupts

so we don't get new one that we don't need it.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agogeneric: add irq_desc in function in parameter
Yinghai Lu [Wed, 20 Aug 2008 03:50:15 +0000 (20:50 -0700)]
generic: add irq_desc in function in parameter

So we could remove some duplicated calling to irq_desc

v2: make sure irq_desc in  init/main.c is not used without generic_hardirqs

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: remove >= nr_irqs checking with config_have_sparse_irq
Yinghai Lu [Wed, 20 Aug 2008 03:50:14 +0000 (20:50 -0700)]
irq: remove >= nr_irqs checking with config_have_sparse_irq

remove irq limit checks - nr_irqs is dynamic and we expand anytime.

v2: fix checking about result irq_cfg_without_new, so could use msi again
v3: use irq_desc_without_new to check irq is valid

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86, ioapic: replace loop with nr_irqs with for_each_irq_icfg
Yinghai Lu [Wed, 20 Aug 2008 03:50:13 +0000 (20:50 -0700)]
x86, ioapic: replace loop with nr_irqs with for_each_irq_icfg

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq, fs/proc: replace loop with nr_irqs for proc/stat
Yinghai Lu [Wed, 20 Aug 2008 03:50:12 +0000 (20:50 -0700)]
irq, fs/proc: replace loop with nr_irqs for proc/stat

Replace another nr_irqs loop to avoid the allocation of all sparse
irq entries - use for_each_irq_desc instead.

v2: make sure arch without GENERIC_HARDIRQS works too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: replace loop with nr_irqs with for_each_irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:11 +0000 (20:50 -0700)]
irq: replace loop with nr_irqs with for_each_irq_desc

There are a handful of loops that go from 0 to nr_irqs and use
get_irq_desc() on them. These would allocate all the irq_desc
entries, regardless of the need for them.

Use the smarter for_each_irq_desc() iterator that will only iterate
over the present ones.

v2: make sure arch without GENERIC_HARDIRQS work too

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agoirq: add irq_desc_without_new
Yinghai Lu [Wed, 20 Aug 2008 03:50:10 +0000 (20:50 -0700)]
irq: add irq_desc_without_new

add an irq_desc accessor that will not allocate any sparse entry
but returns failure if there's no entry present.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move kstat_irqs from kstat to irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:09 +0000 (20:50 -0700)]
x86: move kstat_irqs from kstat to irq_desc

based on Eric's patch ...

together mold it with dyn_array for irq_desc, will allcate kstat_irqs for
nr_irq_desc alltogether if needed. -- at that point nr_cpus is known already.

v2: make sure system without generic_hardirqs works they don't have irq_desc
v3: fix merging
v4: [mingo@elte.hu] fix typo

[ mingo@elte.hu ] irq: build fix

fix:

 arch/x86/xen/spinlock.c: In function 'xen_spin_lock_slow':
 arch/x86/xen/spinlock.c:90: error: 'struct kernel_stat' has no member named 'irqs'

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: put timer_rand_state pointer into irq_desc
Yinghai Lu [Wed, 20 Aug 2008 03:50:08 +0000 (20:50 -0700)]
x86: put timer_rand_state pointer into irq_desc

irq_timer_state[] is a NR_IRQS sized array that is a side-by array to
the real irq_desc[] array.

Integrate that field into the (now dynamic) irq_desc dynamic array and
save some RAM.

v2: keep the old way to support arch not support irq_desc

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: put irq_2_pin pointer into irq_cfg
Yinghai Lu [Wed, 20 Aug 2008 03:50:07 +0000 (20:50 -0700)]
x86: put irq_2_pin pointer into irq_cfg

preallocate 32 irq_2_pin entries, and use get_one_free_irq_2_pin() to get
one more and link to irq_cfg if needed.

so don't waste one where no irq is enabled.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>