x86_64: make /proc/interrupts work with dyn irq_desc
[deliverable/linux.git] / arch / x86 / kernel / genapic_flat_64.c
CommitLineData
1da177e4
LT
1/*
2 * Copyright 2004 James Cleverdon, IBM.
3 * Subject to the GNU Public License, v.2
4 *
f8d31193 5 * Flat APIC subarch code.
1da177e4
LT
6 *
7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
9 * James Cleverdon.
10 */
f19cccf3 11#include <linux/errno.h>
1da177e4
LT
12#include <linux/threads.h>
13#include <linux/cpumask.h>
14#include <linux/string.h>
15#include <linux/kernel.h>
16#include <linux/ctype.h>
17#include <linux/init.h>
0c81c746 18#include <linux/hardirq.h>
1da177e4
LT
19#include <asm/smp.h>
20#include <asm/ipi.h>
00f1ea69 21#include <asm/genapic.h>
0c81c746 22#include <mach_apicdef.h>
1da177e4 23
1b9b89e7
YL
24#ifdef CONFIG_ACPI
25#include <acpi/acpi_bus.h>
26#endif
27
28static int __init flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
29{
30 return 1;
31}
32
1da177e4
LT
33static cpumask_t flat_target_cpus(void)
34{
35 return cpu_online_map;
36}
37
c7111c13
EB
38static cpumask_t flat_vector_allocation_domain(int cpu)
39{
40 /* Careful. Some cpus do not strictly honor the set of cpus
41 * specified in the interrupt destination when using lowest
42 * priority interrupt delivery mode.
43 *
44 * In particular there was a hyperthreading cpu observed to
45 * deliver interrupts to the wrong hyperthread when only one
46 * hyperthread was specified in the interrupt desitination.
47 */
48 cpumask_t domain = { { [0] = APIC_ALL_CPUS, } };
49 return domain;
50}
51
1da177e4
LT
52/*
53 * Set up the logical destination ID.
54 *
55 * Intel recommends to set DFR, LDR and TPR before enabling
56 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
57 * document number 292116). So here it goes...
58 */
59static void flat_init_apic_ldr(void)
60{
61 unsigned long val;
62 unsigned long num, id;
63
64 num = smp_processor_id();
65 id = 1UL << num;
eddfb4ed 66 apic_write(APIC_DFR, APIC_DFR_FLAT);
1da177e4
LT
67 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
68 val |= SET_APIC_LOGICAL_ID(id);
eddfb4ed 69 apic_write(APIC_LDR, val);
1da177e4
LT
70}
71
1da177e4
LT
72static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
73{
74 unsigned long mask = cpus_addr(cpumask)[0];
1da177e4
LT
75 unsigned long flags;
76