diff options
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 96a2608252f1..b8d92606f84f 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2123,24 +2123,26 @@ void default_init_apic_ldr(void) | |||
2123 | apic_write(APIC_LDR, val); | 2123 | apic_write(APIC_LDR, val); |
2124 | } | 2124 | } |
2125 | 2125 | ||
2126 | unsigned int default_cpu_mask_to_apicid(const struct cpumask *cpumask) | 2126 | static inline int __default_cpu_to_apicid(int cpu, unsigned int *apicid) |
2127 | { | 2127 | { |
2128 | int cpu; | 2128 | if (likely((unsigned int)cpu < nr_cpu_ids)) { |
2129 | 2129 | *apicid = per_cpu(x86_cpu_to_apicid, cpu); | |
2130 | /* | 2130 | return 0; |
2131 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | 2131 | } else { |
2132 | * May as well be the first. | 2132 | return -EINVAL; |
2133 | */ | 2133 | } |
2134 | cpu = cpumask_first(cpumask); | 2134 | } |
2135 | if (likely((unsigned)cpu < nr_cpu_ids)) | ||
2136 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
2137 | 2135 | ||
2138 | return BAD_APICID; | 2136 | int default_cpu_mask_to_apicid(const struct cpumask *cpumask, |
2137 | unsigned int *apicid) | ||
2138 | { | ||
2139 | int cpu = cpumask_first(cpumask); | ||
2140 | return __default_cpu_to_apicid(cpu, apicid); | ||
2139 | } | 2141 | } |
2140 | 2142 | ||
2141 | unsigned int | 2143 | int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, |
2142 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | 2144 | const struct cpumask *andmask, |
2143 | const struct cpumask *andmask) | 2145 | unsigned int *apicid) |
2144 | { | 2146 | { |
2145 | int cpu; | 2147 | int cpu; |
2146 | 2148 | ||
@@ -2148,7 +2150,8 @@ default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | |||
2148 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | 2150 | if (cpumask_test_cpu(cpu, cpu_online_mask)) |
2149 | break; | 2151 | break; |
2150 | } | 2152 | } |
2151 | return per_cpu(x86_cpu_to_apicid, cpu); | 2153 | |
2154 | return __default_cpu_to_apicid(cpu, apicid); | ||
2152 | } | 2155 | } |
2153 | 2156 | ||
2154 | /* | 2157 | /* |