diff options
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
| -rw-r--r-- | arch/x86/kernel/apic/apic.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 39a222e094af..c421512ca5eb 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
| @@ -2123,6 +2123,25 @@ void default_init_apic_ldr(void) | |||
| 2123 | apic_write(APIC_LDR, val); | 2123 | apic_write(APIC_LDR, val); |
| 2124 | } | 2124 | } |
| 2125 | 2125 | ||
| 2126 | int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
| 2127 | const struct cpumask *andmask, | ||
| 2128 | unsigned int *apicid) | ||
| 2129 | { | ||
| 2130 | unsigned int cpu; | ||
| 2131 | |||
| 2132 | for_each_cpu_and(cpu, cpumask, andmask) { | ||
| 2133 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | ||
| 2134 | break; | ||
| 2135 | } | ||
| 2136 | |||
| 2137 | if (likely(cpu < nr_cpu_ids)) { | ||
| 2138 | *apicid = per_cpu(x86_cpu_to_apicid, cpu); | ||
| 2139 | return 0; | ||
| 2140 | } | ||
| 2141 | |||
| 2142 | return -EINVAL; | ||
| 2143 | } | ||
| 2144 | |||
| 2126 | /* | 2145 | /* |
| 2127 | * Power management | 2146 | * Power management |
| 2128 | */ | 2147 | */ |
