diff options
Diffstat (limited to 'arch/x86/kernel/io_apic.c')
-rw-r--r-- | arch/x86/kernel/io_apic.c | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c index 9043251210fb..1184210e6d0c 100644 --- a/arch/x86/kernel/io_apic.c +++ b/arch/x86/kernel/io_apic.c | |||
@@ -361,7 +361,8 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, u8 vector) | |||
361 | 361 | ||
362 | static int assign_irq_vector(int irq, cpumask_t mask); | 362 | static int assign_irq_vector(int irq, cpumask_t mask); |
363 | 363 | ||
364 | static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | 364 | static void set_ioapic_affinity_irq(unsigned int irq, |
365 | const struct cpumask *mask) | ||
365 | { | 366 | { |
366 | struct irq_cfg *cfg; | 367 | struct irq_cfg *cfg; |
367 | unsigned long flags; | 368 | unsigned long flags; |
@@ -369,15 +370,14 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | |||
369 | cpumask_t tmp; | 370 | cpumask_t tmp; |
370 | struct irq_desc *desc; | 371 | struct irq_desc *desc; |
371 | 372 | ||
372 | cpus_and(tmp, mask, cpu_online_map); | 373 | if (!cpumask_intersects(mask, cpu_online_mask)) |
373 | if (cpus_empty(tmp)) | ||
374 | return; | 374 | return; |
375 | 375 | ||
376 | cfg = irq_cfg(irq); | 376 | cfg = irq_cfg(irq); |
377 | if (assign_irq_vector(irq, mask)) | 377 | if (assign_irq_vector(irq, *mask)) |
378 | return; | 378 | return; |
379 | 379 | ||
380 | cpus_and(tmp, cfg->domain, mask); | 380 | cpumask_and(&tmp, &cfg->domain, mask); |
381 | dest = cpu_mask_to_apicid(tmp); | 381 | dest = cpu_mask_to_apicid(tmp); |
382 | /* | 382 | /* |
383 | * Only the high 8 bits are valid. | 383 | * Only the high 8 bits are valid. |
@@ -387,7 +387,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | |||
387 | desc = irq_to_desc(irq); | 387 | desc = irq_to_desc(irq); |
388 | spin_lock_irqsave(&ioapic_lock, flags); | 388 | spin_lock_irqsave(&ioapic_lock, flags); |
389 | __target_IO_APIC_irq(irq, dest, cfg->vector); | 389 | __target_IO_APIC_irq(irq, dest, cfg->vector); |
390 | desc->affinity = mask; | 390 | cpumask_copy(&desc->affinity, mask); |
391 | spin_unlock_irqrestore(&ioapic_lock, flags); | 391 | spin_unlock_irqrestore(&ioapic_lock, flags); |
392 | } | 392 | } |
393 | #endif /* CONFIG_SMP */ | 393 | #endif /* CONFIG_SMP */ |
@@ -2189,7 +2189,7 @@ static void ir_irq_migration(struct work_struct *work) | |||
2189 | continue; | 2189 | continue; |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | desc->chip->set_affinity(irq, desc->pending_mask); | 2192 | desc->chip->set_affinity(irq, &desc->pending_mask); |
2193 | spin_unlock_irqrestore(&desc->lock, flags); | 2193 | spin_unlock_irqrestore(&desc->lock, flags); |
2194 | } | 2194 | } |
2195 | } | 2195 | } |
@@ -2198,18 +2198,19 @@ static void ir_irq_migration(struct work_struct *work) | |||
2198 | /* | 2198 | /* |
2199 | * Migrates the IRQ destination in the process context. | 2199 | * Migrates the IRQ destination in the process context. |
2200 | */ | 2200 | */ |
2201 | static void set_ir_ioapic_affinity_irq(unsigned int irq, cpumask_t mask) | 2201 | static void set_ir_ioapic_affinity_irq(unsigned int irq, |
2202 | const struct cpumask *mask) | ||
2202 | { | 2203 | { |
2203 | struct irq_desc *desc = irq_to_desc(irq); | 2204 | struct irq_desc *desc = irq_to_desc(irq); |
2204 | 2205 | ||
2205 | if (desc->status & IRQ_LEVEL) { | 2206 | if (desc->status & IRQ_LEVEL) { |
2206 | desc->status |= IRQ_MOVE_PENDING; | 2207 | desc->status |= IRQ_MOVE_PENDING; |
2207 | desc->pending_mask = mask; | 2208 | cpumask_copy(&desc->pending_mask, mask); |
2208 | migrate_irq_remapped_level(irq); | 2209 | migrate_irq_remapped_level(irq); |
2209 | return; | 2210 | return; |
2210 | } | 2211 | } |
2211 | 2212 | ||
2212 | migrate_ioapic_irq(irq, mask); | 2213 | migrate_ioapic_irq(irq, *mask); |
2213 | } | 2214 | } |
2214 | #endif | 2215 | #endif |
2215 | 2216 | ||
@@ -3027,7 +3028,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms | |||
3027 | } | 3028 | } |
3028 | 3029 | ||
3029 | #ifdef CONFIG_SMP | 3030 | #ifdef CONFIG_SMP |
3030 | static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | 3031 | static void set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask) |
3031 | { | 3032 | { |
3032 | struct irq_cfg *cfg; | 3033 | struct irq_cfg *cfg; |
3033 | struct msi_msg msg; | 3034 | struct msi_msg msg; |
@@ -3035,15 +3036,14 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
3035 | cpumask_t tmp; | 3036 | cpumask_t tmp; |
3036 | struct irq_desc *desc; | 3037 | struct irq_desc *desc; |
3037 | 3038 | ||
3038 | cpus_and(tmp, mask, cpu_online_map); | 3039 | if (!cpumask_intersects(mask, cpu_online_mask)) |
3039 | if (cpus_empty(tmp)) | ||
3040 | return; | 3040 | return; |
3041 | 3041 | ||
3042 | if (assign_irq_vector(irq, mask)) | 3042 | if (assign_irq_vector(irq, *mask)) |
3043 | return; | 3043 | return; |
3044 | 3044 | ||
3045 | cfg = irq_cfg(irq); | 3045 | cfg = irq_cfg(irq); |
3046 | cpus_and(tmp, cfg->domain, mask); | 3046 | cpumask_and(&tmp, &cfg->domain, mask); |
3047 | dest = cpu_mask_to_apicid(tmp); | 3047 | dest = cpu_mask_to_apicid(tmp); |
3048 | 3048 | ||
3049 | read_msi_msg(irq, &msg); | 3049 | read_msi_msg(irq, &msg); |
@@ -3055,7 +3055,7 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
3055 | 3055 | ||
3056 | write_msi_msg(irq, &msg); | 3056 | write_msi_msg(irq, &msg); |
3057 | desc = irq_to_desc(irq); | 3057 | desc = irq_to_desc(irq); |
3058 | desc->affinity = mask; | 3058 | cpumask_copy(&desc->affinity, mask); |
3059 | } | 3059 | } |
3060 | 3060 | ||
3061 | #ifdef CONFIG_INTR_REMAP | 3061 | #ifdef CONFIG_INTR_REMAP |
@@ -3063,7 +3063,8 @@ static void set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
3063 | * Migrate the MSI irq to another cpumask. This migration is | 3063 | * Migrate the MSI irq to another cpumask. This migration is |
3064 | * done in the process context using interrupt-remapping hardware. | 3064 | * done in the process context using interrupt-remapping hardware. |
3065 | */ | 3065 | */ |
3066 | static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | 3066 | static void ir_set_msi_irq_affinity(unsigned int irq, |
3067 | const struct cpumask *mask) | ||
3067 | { | 3068 | { |
3068 | struct irq_cfg *cfg; | 3069 | struct irq_cfg *cfg; |
3069 | unsigned int dest; | 3070 | unsigned int dest; |
@@ -3071,18 +3072,17 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
3071 | struct irte irte; | 3072 | struct irte irte; |
3072 | struct irq_desc *desc; | 3073 | struct irq_desc *desc; |
3073 | 3074 | ||
3074 | cpus_and(tmp, mask, cpu_online_map); | 3075 | if (!cpumask_intersects(mask, cpu_online_mask)) |
3075 | if (cpus_empty(tmp)) | ||
3076 | return; | 3076 | return; |
3077 | 3077 | ||
3078 | if (get_irte(irq, &irte)) | 3078 | if (get_irte(irq, &irte)) |
3079 | return; | 3079 | return; |
3080 | 3080 | ||
3081 | if (assign_irq_vector(irq, mask)) | 3081 | if (assign_irq_vector(irq, *mask)) |
3082 | return; | 3082 | return; |
3083 | 3083 | ||
3084 | cfg = irq_cfg(irq); | 3084 | cfg = irq_cfg(irq); |
3085 | cpus_and(tmp, cfg->domain, mask); | 3085 | cpumask_and(&tmp, &cfg->domain, mask); |
3086 | dest = cpu_mask_to_apicid(tmp); | 3086 | dest = cpu_mask_to_apicid(tmp); |
3087 | 3087 | ||
3088 | irte.vector = cfg->vector; | 3088 | irte.vector = cfg->vector; |
@@ -3106,7 +3106,7 @@ static void ir_set_msi_irq_affinity(unsigned int irq, cpumask_t mask) | |||
3106 | } | 3106 | } |
3107 | 3107 | ||
3108 | desc = irq_to_desc(irq); | 3108 | desc = irq_to_desc(irq); |
3109 | desc->affinity = mask; | 3109 | cpumask_copy(&desc->affinity, mask); |
3110 | } | 3110 | } |
3111 | #endif | 3111 | #endif |
3112 | #endif /* CONFIG_SMP */ | 3112 | #endif /* CONFIG_SMP */ |
@@ -3308,7 +3308,7 @@ void arch_teardown_msi_irq(unsigned int irq) | |||
3308 | 3308 | ||
3309 | #ifdef CONFIG_DMAR | 3309 | #ifdef CONFIG_DMAR |
3310 | #ifdef CONFIG_SMP | 3310 | #ifdef CONFIG_SMP |
3311 | static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) | 3311 | static void dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask) |
3312 | { | 3312 | { |
3313 | struct irq_cfg *cfg; | 3313 | struct irq_cfg *cfg; |
3314 | struct msi_msg msg; | 3314 | struct msi_msg msg; |
@@ -3316,15 +3316,14 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) | |||
3316 | cpumask_t tmp; | 3316 | cpumask_t tmp; |
3317 | struct irq_desc *desc; | 3317 | struct irq_desc *desc; |
3318 | 3318 | ||
3319 | cpus_and(tmp, mask, cpu_online_map); | 3319 | if (!cpumask_intersects(mask, cpu_online_mask)) |
3320 | if (cpus_empty(tmp)) | ||
3321 | return; | 3320 | return; |
3322 | 3321 | ||
3323 | if (assign_irq_vector(irq, mask)) | 3322 | if (assign_irq_vector(irq, *mask)) |
3324 | return; | 3323 | return; |
3325 | 3324 | ||
3326 | cfg = irq_cfg(irq); | 3325 | cfg = irq_cfg(irq); |
3327 | cpus_and(tmp, cfg->domain, mask); | 3326 | cpumask_and(&tmp, &cfg->domain, mask); |
3328 | dest = cpu_mask_to_apicid(tmp); | 3327 | dest = cpu_mask_to_apicid(tmp); |
3329 | 3328 | ||
3330 | dmar_msi_read(irq, &msg); | 3329 | dmar_msi_read(irq, &msg); |
@@ -3336,7 +3335,7 @@ static void dmar_msi_set_affinity(unsigned int irq, cpumask_t mask) | |||
3336 | 3335 | ||
3337 | dmar_msi_write(irq, &msg); | 3336 | dmar_msi_write(irq, &msg); |
3338 | desc = irq_to_desc(irq); | 3337 | desc = irq_to_desc(irq); |
3339 | desc->affinity = mask; | 3338 | cpumask_copy(&desc->affinity, mask); |
3340 | } | 3339 | } |
3341 | #endif /* CONFIG_SMP */ | 3340 | #endif /* CONFIG_SMP */ |
3342 | 3341 | ||
@@ -3369,7 +3368,7 @@ int arch_setup_dmar_msi(unsigned int irq) | |||
3369 | #ifdef CONFIG_HPET_TIMER | 3368 | #ifdef CONFIG_HPET_TIMER |
3370 | 3369 | ||
3371 | #ifdef CONFIG_SMP | 3370 | #ifdef CONFIG_SMP |
3372 | static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask) | 3371 | static void hpet_msi_set_affinity(unsigned int irq, const struct cpumask *mask) |
3373 | { | 3372 | { |
3374 | struct irq_cfg *cfg; | 3373 | struct irq_cfg *cfg; |
3375 | struct irq_desc *desc; | 3374 | struct irq_desc *desc; |
@@ -3377,15 +3376,14 @@ static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask) | |||
3377 | unsigned int dest; | 3376 | unsigned int dest; |
3378 | cpumask_t tmp; | 3377 | cpumask_t tmp; |
3379 | 3378 | ||
3380 | cpus_and(tmp, mask, cpu_online_map); | 3379 | if (!cpumask_intersects(mask, cpu_online_mask)) |
3381 | if (cpus_empty(tmp)) | ||
3382 | return; | 3380 | return; |
3383 | 3381 | ||
3384 | if (assign_irq_vector(irq, mask)) | 3382 | if (assign_irq_vector(irq, *mask)) |
3385 | return; | 3383 | return; |
3386 | 3384 | ||
3387 | cfg = irq_cfg(irq); | 3385 | cfg = irq_cfg(irq); |
3388 | cpus_and(tmp, cfg->domain, mask); | 3386 | cpumask_and(&tmp, &cfg->domain, mask); |
3389 | dest = cpu_mask_to_apicid(tmp); | 3387 | dest = cpu_mask_to_apicid(tmp); |
3390 | 3388 | ||
3391 | hpet_msi_read(irq, &msg); | 3389 | hpet_msi_read(irq, &msg); |
@@ -3397,7 +3395,7 @@ static void hpet_msi_set_affinity(unsigned int irq, cpumask_t mask) | |||
3397 | 3395 | ||
3398 | hpet_msi_write(irq, &msg); | 3396 | hpet_msi_write(irq, &msg); |
3399 | desc = irq_to_desc(irq); | 3397 | desc = irq_to_desc(irq); |
3400 | desc->affinity = mask; | 3398 | cpumask_copy(&desc->affinity, mask); |
3401 | } | 3399 | } |
3402 | #endif /* CONFIG_SMP */ | 3400 | #endif /* CONFIG_SMP */ |
3403 | 3401 | ||
@@ -3451,27 +3449,26 @@ static void target_ht_irq(unsigned int irq, unsigned int dest, u8 vector) | |||
3451 | write_ht_irq_msg(irq, &msg); | 3449 | write_ht_irq_msg(irq, &msg); |
3452 | } | 3450 | } |
3453 | 3451 | ||
3454 | static void set_ht_irq_affinity(unsigned int irq, cpumask_t mask) | 3452 | static void set_ht_irq_affinity(unsigned int irq, const struct cpumask *mask) |
3455 | { | 3453 | { |
3456 | struct irq_cfg *cfg; | 3454 | struct irq_cfg *cfg; |
3457 | unsigned int dest; | 3455 | unsigned int dest; |
3458 | cpumask_t tmp; | 3456 | cpumask_t tmp; |
3459 | struct irq_desc *desc; | 3457 | struct irq_desc *desc; |
3460 | 3458 | ||
3461 | cpus_and(tmp, mask, cpu_online_map); | 3459 | if (!cpumask_intersects(mask, cpu_online_mask)) |
3462 | if (cpus_empty(tmp)) | ||
3463 | return; | 3460 | return; |
3464 | 3461 | ||
3465 | if (assign_irq_vector(irq, mask)) | 3462 | if (assign_irq_vector(irq, *mask)) |
3466 | return; | 3463 | return; |
3467 | 3464 | ||
3468 | cfg = irq_cfg(irq); | 3465 | cfg = irq_cfg(irq); |
3469 | cpus_and(tmp, cfg->domain, mask); | 3466 | cpumask_and(&tmp, &cfg->domain, mask); |
3470 | dest = cpu_mask_to_apicid(tmp); | 3467 | dest = cpu_mask_to_apicid(tmp); |
3471 | 3468 | ||
3472 | target_ht_irq(irq, dest, cfg->vector); | 3469 | target_ht_irq(irq, dest, cfg->vector); |
3473 | desc = irq_to_desc(irq); | 3470 | desc = irq_to_desc(irq); |
3474 | desc->affinity = mask; | 3471 | cpumask_copy(&desc->affinity, mask); |
3475 | } | 3472 | } |
3476 | #endif | 3473 | #endif |
3477 | 3474 | ||
@@ -3794,10 +3791,10 @@ void __init setup_ioapic_dest(void) | |||
3794 | 3791 | ||
3795 | #ifdef CONFIG_INTR_REMAP | 3792 | #ifdef CONFIG_INTR_REMAP |
3796 | if (intr_remapping_enabled) | 3793 | if (intr_remapping_enabled) |
3797 | set_ir_ioapic_affinity_irq(irq, mask); | 3794 | set_ir_ioapic_affinity_irq(irq, &mask); |
3798 | else | 3795 | else |
3799 | #endif | 3796 | #endif |
3800 | set_ioapic_affinity_irq(irq, mask); | 3797 | set_ioapic_affinity_irq(irq, &mask); |
3801 | } | 3798 | } |
3802 | 3799 | ||
3803 | } | 3800 | } |