diff options
-rw-r--r-- | arch/x86/include/asm/apic.h | 8 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic_noop.c | 3 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 12 |
3 files changed, 16 insertions, 7 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index feb2dbdae9ec..e3fecd50d5ca 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -306,7 +306,7 @@ struct apic { | |||
306 | unsigned long (*check_apicid_used)(physid_mask_t *map, int apicid); | 306 | unsigned long (*check_apicid_used)(physid_mask_t *map, int apicid); |
307 | unsigned long (*check_apicid_present)(int apicid); | 307 | unsigned long (*check_apicid_present)(int apicid); |
308 | 308 | ||
309 | void (*vector_allocation_domain)(int cpu, struct cpumask *retmask); | 309 | bool (*vector_allocation_domain)(int cpu, struct cpumask *retmask); |
310 | void (*init_apic_ldr)(void); | 310 | void (*init_apic_ldr)(void); |
311 | 311 | ||
312 | void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap); | 312 | void (*ioapic_phys_id_map)(physid_mask_t *phys_map, physid_mask_t *retmap); |
@@ -615,7 +615,7 @@ extern unsigned int | |||
615 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 615 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
616 | const struct cpumask *andmask); | 616 | const struct cpumask *andmask); |
617 | 617 | ||
618 | static inline void | 618 | static inline bool |
619 | flat_vector_allocation_domain(int cpu, struct cpumask *retmask) | 619 | flat_vector_allocation_domain(int cpu, struct cpumask *retmask) |
620 | { | 620 | { |
621 | /* Careful. Some cpus do not strictly honor the set of cpus | 621 | /* Careful. Some cpus do not strictly honor the set of cpus |
@@ -628,12 +628,14 @@ flat_vector_allocation_domain(int cpu, struct cpumask *retmask) | |||
628 | */ | 628 | */ |
629 | cpumask_clear(retmask); | 629 | cpumask_clear(retmask); |
630 | cpumask_bits(retmask)[0] = APIC_ALL_CPUS; | 630 | cpumask_bits(retmask)[0] = APIC_ALL_CPUS; |
631 | return false; | ||
631 | } | 632 | } |
632 | 633 | ||
633 | static inline void | 634 | static inline bool |
634 | default_vector_allocation_domain(int cpu, struct cpumask *retmask) | 635 | default_vector_allocation_domain(int cpu, struct cpumask *retmask) |
635 | { | 636 | { |
636 | cpumask_copy(retmask, cpumask_of(cpu)); | 637 | cpumask_copy(retmask, cpumask_of(cpu)); |
638 | return true; | ||
637 | } | 639 | } |
638 | 640 | ||
639 | static inline unsigned long default_check_apicid_used(physid_mask_t *map, int apicid) | 641 | static inline unsigned long default_check_apicid_used(physid_mask_t *map, int apicid) |
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c index 3e43cf528939..ac9edf247b15 100644 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c | |||
@@ -100,11 +100,12 @@ static unsigned long noop_check_apicid_present(int bit) | |||
100 | return physid_isset(bit, phys_cpu_present_map); | 100 | return physid_isset(bit, phys_cpu_present_map); |
101 | } | 101 | } |
102 | 102 | ||
103 | static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask) | 103 | static bool noop_vector_allocation_domain(int cpu, struct cpumask *retmask) |
104 | { | 104 | { |
105 | if (cpu != 0) | 105 | if (cpu != 0) |
106 | pr_warning("APIC: Vector allocated for non-BSP cpu\n"); | 106 | pr_warning("APIC: Vector allocated for non-BSP cpu\n"); |
107 | cpumask_copy(retmask, cpumask_of(cpu)); | 107 | cpumask_copy(retmask, cpumask_of(cpu)); |
108 | return true; | ||
108 | } | 109 | } |
109 | 110 | ||
110 | static u32 noop_apic_read(u32 reg) | 111 | static u32 noop_apic_read(u32 reg) |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 05af3d341aaa..4061a7dee5c9 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -1137,8 +1137,9 @@ __assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask) | |||
1137 | for_each_cpu_and(cpu, mask, cpu_online_mask) { | 1137 | for_each_cpu_and(cpu, mask, cpu_online_mask) { |
1138 | int new_cpu; | 1138 | int new_cpu; |
1139 | int vector, offset; | 1139 | int vector, offset; |
1140 | bool more_domains; | ||
1140 | 1141 | ||
1141 | apic->vector_allocation_domain(cpu, tmp_mask); | 1142 | more_domains = apic->vector_allocation_domain(cpu, tmp_mask); |
1142 | 1143 | ||
1143 | if (cpumask_subset(tmp_mask, cfg->domain)) { | 1144 | if (cpumask_subset(tmp_mask, cfg->domain)) { |
1144 | free_cpumask_var(tmp_mask); | 1145 | free_cpumask_var(tmp_mask); |
@@ -1153,8 +1154,13 @@ next: | |||
1153 | offset = (offset + 1) % 16; | 1154 | offset = (offset + 1) % 16; |
1154 | vector = FIRST_EXTERNAL_VECTOR + offset; | 1155 | vector = FIRST_EXTERNAL_VECTOR + offset; |
1155 | } | 1156 | } |
1156 | if (unlikely(current_vector == vector)) | 1157 | |
1157 | continue; | 1158 | if (unlikely(current_vector == vector)) { |
1159 | if (more_domains) | ||
1160 | continue; | ||
1161 | else | ||
1162 | break; | ||
1163 | } | ||
1158 | 1164 | ||
1159 | if (test_bit(vector, used_vectors)) | 1165 | if (test_bit(vector, used_vectors)) |
1160 | goto next; | 1166 | goto next; |