diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2007-07-25 04:59:22 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2007-07-25 14:09:01 -0400 |
commit | 6ffbc82351c62eeeeaeb9e817ddf93049353493d (patch) | |
tree | 1cc8c58070d0688632c77ae13eddfc6bfdc99949 | |
parent | 8f5ad1a8227aa110d633b5ed04dde535381c16c7 (diff) |
[IA64] vector-domain - fix vector_table
Fix wrong access to vector_table[].
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | arch/ia64/kernel/irq_ia64.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c index 158eafb5f1aa..fcb77338cc09 100644 --- a/arch/ia64/kernel/irq_ia64.c +++ b/arch/ia64/kernel/irq_ia64.c | |||
@@ -85,8 +85,8 @@ DEFINE_PER_CPU(int[IA64_NUM_VECTORS], vector_irq) = { | |||
85 | [0 ... IA64_NUM_VECTORS - 1] = IA64_SPURIOUS_INT_VECTOR | 85 | [0 ... IA64_NUM_VECTORS - 1] = IA64_SPURIOUS_INT_VECTOR |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static cpumask_t vector_table[IA64_MAX_DEVICE_VECTORS] = { | 88 | static cpumask_t vector_table[IA64_NUM_VECTORS] = { |
89 | [0 ... IA64_MAX_DEVICE_VECTORS - 1] = CPU_MASK_NONE | 89 | [0 ... IA64_NUM_VECTORS - 1] = CPU_MASK_NONE |
90 | }; | 90 | }; |
91 | 91 | ||
92 | static int irq_status[NR_IRQS] = { | 92 | static int irq_status[NR_IRQS] = { |
@@ -123,17 +123,18 @@ static inline int find_unassigned_irq(void) | |||
123 | static inline int find_unassigned_vector(cpumask_t domain) | 123 | static inline int find_unassigned_vector(cpumask_t domain) |
124 | { | 124 | { |
125 | cpumask_t mask; | 125 | cpumask_t mask; |
126 | int pos; | 126 | int pos, vector; |
127 | 127 | ||
128 | cpus_and(mask, domain, cpu_online_map); | 128 | cpus_and(mask, domain, cpu_online_map); |
129 | if (cpus_empty(mask)) | 129 | if (cpus_empty(mask)) |
130 | return -EINVAL; | 130 | return -EINVAL; |
131 | 131 | ||
132 | for (pos = 0; pos < IA64_NUM_DEVICE_VECTORS; pos++) { | 132 | for (pos = 0; pos < IA64_NUM_DEVICE_VECTORS; pos++) { |
133 | cpus_and(mask, domain, vector_table[pos]); | 133 | vector = IA64_FIRST_DEVICE_VECTOR + pos; |
134 | cpus_and(mask, domain, vector_table[vector]); | ||
134 | if (!cpus_empty(mask)) | 135 | if (!cpus_empty(mask)) |
135 | continue; | 136 | continue; |
136 | return IA64_FIRST_DEVICE_VECTOR + pos; | 137 | return vector; |
137 | } | 138 | } |
138 | return -ENOSPC; | 139 | return -ENOSPC; |
139 | } | 140 | } |
@@ -141,7 +142,7 @@ static inline int find_unassigned_vector(cpumask_t domain) | |||
141 | static int __bind_irq_vector(int irq, int vector, cpumask_t domain) | 142 | static int __bind_irq_vector(int irq, int vector, cpumask_t domain) |
142 | { | 143 | { |
143 | cpumask_t mask; | 144 | cpumask_t mask; |
144 | int cpu, pos; | 145 | int cpu; |
145 | struct irq_cfg *cfg = &irq_cfg[irq]; | 146 | struct irq_cfg *cfg = &irq_cfg[irq]; |
146 | 147 | ||
147 | cpus_and(mask, domain, cpu_online_map); | 148 | cpus_and(mask, domain, cpu_online_map); |
@@ -156,8 +157,7 @@ static int __bind_irq_vector(int irq, int vector, cpumask_t domain) | |||
156 | cfg->vector = vector; | 157 | cfg->vector = vector; |
157 | cfg->domain = domain; | 158 | cfg->domain = domain; |
158 | irq_status[irq] = IRQ_USED; | 159 | irq_status[irq] = IRQ_USED; |
159 | pos = vector - IA64_FIRST_DEVICE_VECTOR; | 160 | cpus_or(vector_table[vector], vector_table[vector], domain); |
160 | cpus_or(vector_table[pos], vector_table[pos], domain); | ||
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
@@ -174,7 +174,7 @@ int bind_irq_vector(int irq, int vector, cpumask_t domain) | |||
174 | 174 | ||
175 | static void __clear_irq_vector(int irq) | 175 | static void __clear_irq_vector(int irq) |
176 | { | 176 | { |
177 | int vector, cpu, pos; | 177 | int vector, cpu; |
178 | cpumask_t mask; | 178 | cpumask_t mask; |
179 | cpumask_t domain; | 179 | cpumask_t domain; |
180 | struct irq_cfg *cfg = &irq_cfg[irq]; | 180 | struct irq_cfg *cfg = &irq_cfg[irq]; |
@@ -189,8 +189,7 @@ static void __clear_irq_vector(int irq) | |||
189 | cfg->vector = IRQ_VECTOR_UNASSIGNED; | 189 | cfg->vector = IRQ_VECTOR_UNASSIGNED; |
190 | cfg->domain = CPU_MASK_NONE; | 190 | cfg->domain = CPU_MASK_NONE; |
191 | irq_status[irq] = IRQ_UNUSED; | 191 | irq_status[irq] = IRQ_UNUSED; |
192 | pos = vector - IA64_FIRST_DEVICE_VECTOR; | 192 | cpus_andnot(vector_table[vector], vector_table[vector], domain); |
193 | cpus_andnot(vector_table[pos], vector_table[pos], domain); | ||
194 | } | 193 | } |
195 | 194 | ||
196 | static void clear_irq_vector(int irq) | 195 | static void clear_irq_vector(int irq) |