diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/Kbuild | 1 | ||||
| -rw-r--r-- | include/linux/interrupt.h | 2 | ||||
| -rw-r--r-- | include/linux/irq.h | 45 | ||||
| -rw-r--r-- | include/linux/irqnr.h | 26 | ||||
| -rw-r--r-- | include/linux/kernel_stat.h | 14 | ||||
| -rw-r--r-- | include/linux/msi.h | 3 | ||||
| -rw-r--r-- | include/linux/random.h | 51 |
7 files changed, 134 insertions, 8 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index e531783e5d78..95ac82340c3b 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -313,6 +313,7 @@ unifdef-y += ptrace.h | |||
| 313 | unifdef-y += qnx4_fs.h | 313 | unifdef-y += qnx4_fs.h |
| 314 | unifdef-y += quota.h | 314 | unifdef-y += quota.h |
| 315 | unifdef-y += random.h | 315 | unifdef-y += random.h |
| 316 | unifdef-y += irqnr.h | ||
| 316 | unifdef-y += reboot.h | 317 | unifdef-y += reboot.h |
| 317 | unifdef-y += reiserfs_fs.h | 318 | unifdef-y += reiserfs_fs.h |
| 318 | unifdef-y += reiserfs_xattr.h | 319 | unifdef-y += reiserfs_xattr.h |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index f58a0cf8929a..777f89e00b4a 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include <linux/irqflags.h> | 14 | #include <linux/irqflags.h> |
| 15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
| 16 | #include <linux/percpu.h> | 16 | #include <linux/percpu.h> |
| 17 | #include <linux/irqnr.h> | ||
| 18 | |||
| 17 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
| 18 | #include <asm/ptrace.h> | 20 | #include <asm/ptrace.h> |
| 19 | #include <asm/system.h> | 21 | #include <asm/system.h> |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 3dddfa703ebd..b5749db3e5a1 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
| @@ -129,6 +129,8 @@ struct irq_chip { | |||
| 129 | const char *typename; | 129 | const char *typename; |
| 130 | }; | 130 | }; |
| 131 | 131 | ||
| 132 | struct timer_rand_state; | ||
| 133 | struct irq_2_iommu; | ||
| 132 | /** | 134 | /** |
| 133 | * struct irq_desc - interrupt descriptor | 135 | * struct irq_desc - interrupt descriptor |
| 134 | * @irq: interrupt number for this descriptor | 136 | * @irq: interrupt number for this descriptor |
| @@ -154,6 +156,13 @@ struct irq_chip { | |||
| 154 | */ | 156 | */ |
| 155 | struct irq_desc { | 157 | struct irq_desc { |
| 156 | unsigned int irq; | 158 | unsigned int irq; |
| 159 | #ifdef CONFIG_SPARSE_IRQ | ||
| 160 | struct timer_rand_state *timer_rand_state; | ||
| 161 | unsigned int *kstat_irqs; | ||
| 162 | # ifdef CONFIG_INTR_REMAP | ||
| 163 | struct irq_2_iommu *irq_2_iommu; | ||
| 164 | # endif | ||
| 165 | #endif | ||
| 157 | irq_flow_handler_t handle_irq; | 166 | irq_flow_handler_t handle_irq; |
| 158 | struct irq_chip *chip; | 167 | struct irq_chip *chip; |
| 159 | struct msi_desc *msi_desc; | 168 | struct msi_desc *msi_desc; |
| @@ -181,14 +190,43 @@ struct irq_desc { | |||
| 181 | const char *name; | 190 | const char *name; |
| 182 | } ____cacheline_internodealigned_in_smp; | 191 | } ____cacheline_internodealigned_in_smp; |
| 183 | 192 | ||
| 193 | extern void early_irq_init(void); | ||
| 194 | extern void arch_early_irq_init(void); | ||
| 195 | extern void arch_init_chip_data(struct irq_desc *desc, int cpu); | ||
| 196 | extern void arch_init_copy_chip_data(struct irq_desc *old_desc, | ||
| 197 | struct irq_desc *desc, int cpu); | ||
| 198 | extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc); | ||
| 184 | 199 | ||
| 200 | #ifndef CONFIG_SPARSE_IRQ | ||
| 185 | extern struct irq_desc irq_desc[NR_IRQS]; | 201 | extern struct irq_desc irq_desc[NR_IRQS]; |
| 186 | 202 | ||
| 187 | static inline struct irq_desc *irq_to_desc(unsigned int irq) | 203 | static inline struct irq_desc *irq_to_desc(unsigned int irq) |
| 188 | { | 204 | { |
| 189 | return (irq < nr_irqs) ? irq_desc + irq : NULL; | 205 | return (irq < NR_IRQS) ? irq_desc + irq : NULL; |
| 206 | } | ||
| 207 | static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | ||
| 208 | { | ||
| 209 | return irq_to_desc(irq); | ||
| 190 | } | 210 | } |
| 191 | 211 | ||
| 212 | #else | ||
| 213 | |||
| 214 | extern struct irq_desc *irq_to_desc(unsigned int irq); | ||
| 215 | extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu); | ||
| 216 | extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); | ||
| 217 | |||
| 218 | # define for_each_irq_desc(irq, desc) \ | ||
| 219 | for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq)) | ||
| 220 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
| 221 | for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq)) | ||
| 222 | |||
| 223 | #define kstat_irqs_this_cpu(DESC) \ | ||
| 224 | ((DESC)->kstat_irqs[smp_processor_id()]) | ||
| 225 | #define kstat_incr_irqs_this_cpu(irqno, DESC) \ | ||
| 226 | ((DESC)->kstat_irqs[smp_processor_id()]++) | ||
| 227 | |||
| 228 | #endif | ||
| 229 | |||
| 192 | /* | 230 | /* |
| 193 | * Migration helpers for obsolete names, they will go away: | 231 | * Migration helpers for obsolete names, they will go away: |
| 194 | */ | 232 | */ |
| @@ -380,6 +418,11 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry); | |||
| 380 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) | 418 | #define get_irq_data(irq) (irq_to_desc(irq)->handler_data) |
| 381 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) | 419 | #define get_irq_msi(irq) (irq_to_desc(irq)->msi_desc) |
| 382 | 420 | ||
| 421 | #define get_irq_desc_chip(desc) ((desc)->chip) | ||
| 422 | #define get_irq_desc_chip_data(desc) ((desc)->chip_data) | ||
| 423 | #define get_irq_desc_data(desc) ((desc)->handler_data) | ||
| 424 | #define get_irq_desc_msi(desc) ((desc)->msi_desc) | ||
| 425 | |||
| 383 | #endif /* CONFIG_GENERIC_HARDIRQS */ | 426 | #endif /* CONFIG_GENERIC_HARDIRQS */ |
| 384 | 427 | ||
| 385 | #endif /* !CONFIG_S390 */ | 428 | #endif /* !CONFIG_S390 */ |
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 452c280c8115..95d2b74641f5 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h | |||
| @@ -1,24 +1,38 @@ | |||
| 1 | #ifndef _LINUX_IRQNR_H | 1 | #ifndef _LINUX_IRQNR_H |
| 2 | #define _LINUX_IRQNR_H | 2 | #define _LINUX_IRQNR_H |
| 3 | 3 | ||
| 4 | /* | ||
| 5 | * Generic irq_desc iterators: | ||
| 6 | */ | ||
| 7 | #ifdef __KERNEL__ | ||
| 8 | |||
| 4 | #ifndef CONFIG_GENERIC_HARDIRQS | 9 | #ifndef CONFIG_GENERIC_HARDIRQS |
| 5 | #include <asm/irq.h> | 10 | #include <asm/irq.h> |
| 6 | # define nr_irqs NR_IRQS | 11 | # define nr_irqs NR_IRQS |
| 7 | 12 | ||
| 8 | # define for_each_irq_desc(irq, desc) \ | 13 | # define for_each_irq_desc(irq, desc) \ |
| 9 | for (irq = 0; irq < nr_irqs; irq++) | 14 | for (irq = 0; irq < nr_irqs; irq++) |
| 15 | |||
| 16 | # define for_each_irq_desc_reverse(irq, desc) \ | ||
| 17 | for (irq = nr_irqs - 1; irq >= 0; irq--) | ||
| 10 | #else | 18 | #else |
| 19 | |||
| 11 | extern int nr_irqs; | 20 | extern int nr_irqs; |
| 12 | 21 | ||
| 22 | #ifndef CONFIG_SPARSE_IRQ | ||
| 23 | |||
| 24 | struct irq_desc; | ||
| 13 | # define for_each_irq_desc(irq, desc) \ | 25 | # define for_each_irq_desc(irq, desc) \ |
| 14 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) | 26 | for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) |
| 15 | 27 | # define for_each_irq_desc_reverse(irq, desc) \ | |
| 16 | # define for_each_irq_desc_reverse(irq, desc) \ | 28 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ |
| 17 | for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ | 29 | irq >= 0; irq--, desc--) |
| 18 | irq >= 0; irq--, desc--) | 30 | #endif |
| 19 | #endif | 31 | #endif |
| 20 | 32 | ||
| 21 | #define for_each_irq_nr(irq) \ | 33 | #define for_each_irq_nr(irq) \ |
| 22 | for (irq = 0; irq < nr_irqs; irq++) | 34 | for (irq = 0; irq < nr_irqs; irq++) |
| 35 | |||
| 36 | #endif /* __KERNEL__ */ | ||
| 23 | 37 | ||
| 24 | #endif | 38 | #endif |
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index 4a145caeee07..4ee4b3d2316f 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h | |||
| @@ -28,7 +28,9 @@ struct cpu_usage_stat { | |||
| 28 | 28 | ||
| 29 | struct kernel_stat { | 29 | struct kernel_stat { |
| 30 | struct cpu_usage_stat cpustat; | 30 | struct cpu_usage_stat cpustat; |
| 31 | unsigned int irqs[NR_IRQS]; | 31 | #ifndef CONFIG_SPARSE_IRQ |
| 32 | unsigned int irqs[NR_IRQS]; | ||
| 33 | #endif | ||
| 32 | }; | 34 | }; |
| 33 | 35 | ||
| 34 | DECLARE_PER_CPU(struct kernel_stat, kstat); | 36 | DECLARE_PER_CPU(struct kernel_stat, kstat); |
| @@ -39,6 +41,10 @@ DECLARE_PER_CPU(struct kernel_stat, kstat); | |||
| 39 | 41 | ||
| 40 | extern unsigned long long nr_context_switches(void); | 42 | extern unsigned long long nr_context_switches(void); |
| 41 | 43 | ||
| 44 | #ifndef CONFIG_SPARSE_IRQ | ||
| 45 | #define kstat_irqs_this_cpu(irq) \ | ||
| 46 | (kstat_this_cpu.irqs[irq]) | ||
| 47 | |||
| 42 | struct irq_desc; | 48 | struct irq_desc; |
| 43 | 49 | ||
| 44 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | 50 | static inline void kstat_incr_irqs_this_cpu(unsigned int irq, |
| @@ -46,11 +52,17 @@ static inline void kstat_incr_irqs_this_cpu(unsigned int irq, | |||
| 46 | { | 52 | { |
| 47 | kstat_this_cpu.irqs[irq]++; | 53 | kstat_this_cpu.irqs[irq]++; |
| 48 | } | 54 | } |
| 55 | #endif | ||
| 56 | |||
| 49 | 57 | ||
| 58 | #ifndef CONFIG_SPARSE_IRQ | ||
| 50 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) | 59 | static inline unsigned int kstat_irqs_cpu(unsigned int irq, int cpu) |
| 51 | { | 60 | { |
| 52 | return kstat_cpu(cpu).irqs[irq]; | 61 | return kstat_cpu(cpu).irqs[irq]; |
| 53 | } | 62 | } |
| 63 | #else | ||
| 64 | extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu); | ||
| 65 | #endif | ||
| 54 | 66 | ||
| 55 | /* | 67 | /* |
| 56 | * Number of interrupts per specific IRQ source, since bootup | 68 | * Number of interrupts per specific IRQ source, since bootup |
diff --git a/include/linux/msi.h b/include/linux/msi.h index 8f2939227207..d2b8a1e8ca11 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h | |||
| @@ -10,8 +10,11 @@ struct msi_msg { | |||
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | /* Helper functions */ | 12 | /* Helper functions */ |
| 13 | struct irq_desc; | ||
| 13 | extern void mask_msi_irq(unsigned int irq); | 14 | extern void mask_msi_irq(unsigned int irq); |
| 14 | extern void unmask_msi_irq(unsigned int irq); | 15 | extern void unmask_msi_irq(unsigned int irq); |
| 16 | extern void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); | ||
| 17 | extern void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg); | ||
| 15 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); | 18 | extern void read_msi_msg(unsigned int irq, struct msi_msg *msg); |
| 16 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); | 19 | extern void write_msi_msg(unsigned int irq, struct msi_msg *msg); |
| 17 | 20 | ||
diff --git a/include/linux/random.h b/include/linux/random.h index 36f125c0c603..adbf3bd3c6b3 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #define _LINUX_RANDOM_H | 8 | #define _LINUX_RANDOM_H |
| 9 | 9 | ||
| 10 | #include <linux/ioctl.h> | 10 | #include <linux/ioctl.h> |
| 11 | #include <linux/irqnr.h> | ||
| 11 | 12 | ||
| 12 | /* ioctl()'s for the random number generator */ | 13 | /* ioctl()'s for the random number generator */ |
| 13 | 14 | ||
| @@ -44,6 +45,56 @@ struct rand_pool_info { | |||
| 44 | 45 | ||
| 45 | extern void rand_initialize_irq(int irq); | 46 | extern void rand_initialize_irq(int irq); |
| 46 | 47 | ||
| 48 | struct timer_rand_state; | ||
| 49 | #ifndef CONFIG_SPARSE_IRQ | ||
| 50 | |||
| 51 | extern struct timer_rand_state *irq_timer_state[]; | ||
| 52 | |||
| 53 | static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
| 54 | { | ||
| 55 | if (irq >= nr_irqs) | ||
| 56 | return NULL; | ||
| 57 | |||
| 58 | return irq_timer_state[irq]; | ||
| 59 | } | ||
| 60 | |||
| 61 | static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) | ||
| 62 | { | ||
| 63 | if (irq >= nr_irqs) | ||
| 64 | return; | ||
| 65 | |||
| 66 | irq_timer_state[irq] = state; | ||
| 67 | } | ||
| 68 | |||
| 69 | #else | ||
| 70 | |||
| 71 | #include <linux/irq.h> | ||
| 72 | static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq) | ||
| 73 | { | ||
| 74 | struct irq_desc *desc; | ||
| 75 | |||
| 76 | desc = irq_to_desc(irq); | ||
| 77 | |||
| 78 | if (!desc) | ||
| 79 | return NULL; | ||
| 80 | |||
| 81 | return desc->timer_rand_state; | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state) | ||
| 85 | { | ||
| 86 | struct irq_desc *desc; | ||
| 87 | |||
| 88 | desc = irq_to_desc(irq); | ||
| 89 | |||
| 90 | if (!desc) | ||
| 91 | return; | ||
| 92 | |||
| 93 | desc->timer_rand_state = state; | ||
| 94 | } | ||
| 95 | #endif | ||
| 96 | |||
| 97 | |||
| 47 | extern void add_input_randomness(unsigned int type, unsigned int code, | 98 | extern void add_input_randomness(unsigned int type, unsigned int code, |
| 48 | unsigned int value); | 99 | unsigned int value); |
| 49 | extern void add_interrupt_randomness(int irq); | 100 | extern void add_interrupt_randomness(int irq); |
