diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2011-02-08 11:22:00 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2011-02-19 06:58:20 -0500 |
commit | 2bdd10558c8d93009cb6c32ce9e30800fbb08add (patch) | |
tree | f25b36c02faa8709628e2dbb93748f370678bb52 | |
parent | bce43032ad79fae0ce5b6174ce1321e643ceb54b (diff) |
genirq: Move IRQ_AFFINITY_SET to core
Keep status in sync until last abuser is gone.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/irq.h | 9 | ||||
-rw-r--r-- | kernel/irq/compat.h | 11 | ||||
-rw-r--r-- | kernel/irq/internals.h | 4 | ||||
-rw-r--r-- | kernel/irq/manage.c | 11 | ||||
-rw-r--r-- | kernel/irq/settings.h | 2 |
5 files changed, 32 insertions, 5 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h index d5312e6fe1aa..8da1782ecfca 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -60,6 +60,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq, | |||
60 | #define IRQ_MASKED 0x00002000 /* DEPRECATED */ | 60 | #define IRQ_MASKED 0x00002000 /* DEPRECATED */ |
61 | /* DEPRECATED use irq_setaffinity_pending() instead*/ | 61 | /* DEPRECATED use irq_setaffinity_pending() instead*/ |
62 | #define IRQ_MOVE_PENDING 0x00004000 | 62 | #define IRQ_MOVE_PENDING 0x00004000 |
63 | #define IRQ_AFFINITY_SET 0x02000000 /* DEPRECATED */ | ||
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | #define IRQ_LEVEL 0x00008000 /* IRQ level triggered */ | 66 | #define IRQ_LEVEL 0x00008000 /* IRQ level triggered */ |
@@ -70,7 +71,6 @@ typedef void (*irq_flow_handler_t)(unsigned int irq, | |||
70 | #define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ | 71 | #define IRQ_WAKEUP 0x00100000 /* IRQ triggers system wakeup */ |
71 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ | 72 | #define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ |
72 | #define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ | 73 | #define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */ |
73 | #define IRQ_AFFINITY_SET 0x02000000 /* IRQ affinity was set from userspace*/ | ||
74 | #define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */ | 74 | #define IRQ_NESTED_THREAD 0x10000000 /* IRQ is nested into another, no own handler thread */ |
75 | 75 | ||
76 | #define IRQF_MODIFY_MASK \ | 76 | #define IRQF_MODIFY_MASK \ |
@@ -134,12 +134,14 @@ struct irq_data { | |||
134 | * IRQD_SETAFFINITY_PENDING - Affinity setting is pending | 134 | * IRQD_SETAFFINITY_PENDING - Affinity setting is pending |
135 | * IRQD_NO_BALANCING - Balancing disabled for this IRQ | 135 | * IRQD_NO_BALANCING - Balancing disabled for this IRQ |
136 | * IRQD_PER_CPU - Interrupt is per cpu | 136 | * IRQD_PER_CPU - Interrupt is per cpu |
137 | * IRQD_AFFINITY_SET - Interrupt affinity was set | ||
137 | */ | 138 | */ |
138 | enum { | 139 | enum { |
139 | /* Bit 0 - 7 reserved for TYPE will use later */ | 140 | /* Bit 0 - 7 reserved for TYPE will use later */ |
140 | IRQD_SETAFFINITY_PENDING = (1 << 8), | 141 | IRQD_SETAFFINITY_PENDING = (1 << 8), |
141 | IRQD_NO_BALANCING = (1 << 10), | 142 | IRQD_NO_BALANCING = (1 << 10), |
142 | IRQD_PER_CPU = (1 << 11), | 143 | IRQD_PER_CPU = (1 << 11), |
144 | IRQD_AFFINITY_SET = (1 << 12), | ||
143 | }; | 145 | }; |
144 | 146 | ||
145 | static inline bool irqd_is_setaffinity_pending(struct irq_data *d) | 147 | static inline bool irqd_is_setaffinity_pending(struct irq_data *d) |
@@ -157,6 +159,11 @@ static inline bool irqd_can_balance(struct irq_data *d) | |||
157 | return !(d->state_use_accessors & (IRQD_PER_CPU | IRQD_NO_BALANCING)); | 159 | return !(d->state_use_accessors & (IRQD_PER_CPU | IRQD_NO_BALANCING)); |
158 | } | 160 | } |
159 | 161 | ||
162 | static inline bool irqd_affinity_was_set(struct irq_data *d) | ||
163 | { | ||
164 | return d->state_use_accessors & IRQD_AFFINITY_SET; | ||
165 | } | ||
166 | |||
160 | /** | 167 | /** |
161 | * struct irq_chip - hardware interrupt chip descriptor | 168 | * struct irq_chip - hardware interrupt chip descriptor |
162 | * | 169 | * |
diff --git a/kernel/irq/compat.h b/kernel/irq/compat.h index 5e33aadadacc..6bbaf66aca85 100644 --- a/kernel/irq/compat.h +++ b/kernel/irq/compat.h | |||
@@ -46,6 +46,15 @@ static inline void irq_compat_clr_move_pending(struct irq_desc *desc) | |||
46 | { | 46 | { |
47 | desc->status &= ~IRQ_MOVE_PENDING; | 47 | desc->status &= ~IRQ_MOVE_PENDING; |
48 | } | 48 | } |
49 | static inline void irq_compat_set_affinity(struct irq_desc *desc) | ||
50 | { | ||
51 | desc->status |= IRQ_AFFINITY_SET; | ||
52 | } | ||
53 | |||
54 | static inline void irq_compat_clr_affinity(struct irq_desc *desc) | ||
55 | { | ||
56 | desc->status &= ~IRQ_AFFINITY_SET; | ||
57 | } | ||
49 | #else | 58 | #else |
50 | static inline void irq_compat_set_progress(struct irq_desc *desc) { } | 59 | static inline void irq_compat_set_progress(struct irq_desc *desc) { } |
51 | static inline void irq_compat_clr_progress(struct irq_desc *desc) { } | 60 | static inline void irq_compat_clr_progress(struct irq_desc *desc) { } |
@@ -57,5 +66,7 @@ static inline void irq_compat_set_masked(struct irq_desc *desc) { } | |||
57 | static inline void irq_compat_clr_masked(struct irq_desc *desc) { } | 66 | static inline void irq_compat_clr_masked(struct irq_desc *desc) { } |
58 | static inline void irq_compat_set_move_pending(struct irq_desc *desc) { } | 67 | static inline void irq_compat_set_move_pending(struct irq_desc *desc) { } |
59 | static inline void irq_compat_clr_move_pending(struct irq_desc *desc) { } | 68 | static inline void irq_compat_clr_move_pending(struct irq_desc *desc) { } |
69 | static inline void irq_compat_set_affinity(struct irq_desc *desc) { } | ||
70 | static inline void irq_compat_clr_affinity(struct irq_desc *desc) { } | ||
60 | #endif | 71 | #endif |
61 | 72 | ||
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index a80b44d2735e..6776453c454c 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -150,3 +150,7 @@ static inline void irqd_set(struct irq_data *d, unsigned int mask) | |||
150 | d->state_use_accessors |= mask; | 150 | d->state_use_accessors |= mask; |
151 | } | 151 | } |
152 | 152 | ||
153 | static inline bool irqd_has_set(struct irq_data *d, unsigned int mask) | ||
154 | { | ||
155 | return d->state_use_accessors & mask; | ||
156 | } | ||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 550ae97a0040..8246afc81956 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -164,7 +164,8 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *mask) | |||
164 | kref_get(&desc->affinity_notify->kref); | 164 | kref_get(&desc->affinity_notify->kref); |
165 | schedule_work(&desc->affinity_notify->work); | 165 | schedule_work(&desc->affinity_notify->work); |
166 | } | 166 | } |
167 | desc->status |= IRQ_AFFINITY_SET; | 167 | irq_compat_set_affinity(desc); |
168 | irqd_set(&desc->irq_data, IRQD_AFFINITY_SET); | ||
168 | raw_spin_unlock_irqrestore(&desc->lock, flags); | 169 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
169 | return ret; | 170 | return ret; |
170 | } | 171 | } |
@@ -272,12 +273,14 @@ setup_affinity(unsigned int irq, struct irq_desc *desc, struct cpumask *mask) | |||
272 | * Preserve an userspace affinity setup, but make sure that | 273 | * Preserve an userspace affinity setup, but make sure that |
273 | * one of the targets is online. | 274 | * one of the targets is online. |
274 | */ | 275 | */ |
275 | if (desc->status & (IRQ_AFFINITY_SET)) { | 276 | if (irqd_has_set(&desc->irq_data, IRQD_AFFINITY_SET)) { |
276 | if (cpumask_intersects(desc->irq_data.affinity, | 277 | if (cpumask_intersects(desc->irq_data.affinity, |
277 | cpu_online_mask)) | 278 | cpu_online_mask)) |
278 | set = desc->irq_data.affinity; | 279 | set = desc->irq_data.affinity; |
279 | else | 280 | else { |
280 | desc->status &= ~IRQ_AFFINITY_SET; | 281 | irq_compat_clr_affinity(desc); |
282 | irqd_clear(&desc->irq_data, IRQD_AFFINITY_SET); | ||
283 | } | ||
281 | } | 284 | } |
282 | 285 | ||
283 | cpumask_and(mask, cpu_online_mask, set); | 286 | cpumask_and(mask, cpu_online_mask, set); |
diff --git a/kernel/irq/settings.h b/kernel/irq/settings.h index ba0fffe410ad..da5acb446b1c 100644 --- a/kernel/irq/settings.h +++ b/kernel/irq/settings.h | |||
@@ -29,6 +29,8 @@ enum { | |||
29 | #define IRQ_PER_CPU GOT_YOU_MORON | 29 | #define IRQ_PER_CPU GOT_YOU_MORON |
30 | #undef IRQ_NO_BALANCING | 30 | #undef IRQ_NO_BALANCING |
31 | #define IRQ_NO_BALANCING GOT_YOU_MORON | 31 | #define IRQ_NO_BALANCING GOT_YOU_MORON |
32 | #undef IRQ_AFFINITY_SET | ||
33 | #define IRQ_AFFINITY_SET GOT_YOU_MORON | ||
32 | #undef IRQF_MODIFY_MASK | 34 | #undef IRQF_MODIFY_MASK |
33 | #define IRQF_MODIFY_MASK GOT_YOU_MORON | 35 | #define IRQF_MODIFY_MASK GOT_YOU_MORON |
34 | 36 | ||