diff options
author | Alexander Gordeev <agordeev@redhat.com> | 2012-06-05 07:23:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-06-06 04:22:18 -0400 |
commit | 6398268d2bc454735f11e08705e858f9fdf5c750 (patch) | |
tree | f6b430e540f1a5da11b371d450d3262550a330b0 /arch/x86/kernel/apic/apic.c | |
parent | bf721d3a3bc7a731add45c8078b142b494ab413e (diff) |
x86/apic: Factor out default cpu_mask_to_apicid() operations
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/20120605112340.GA11454@dhcp-26-207.brq.redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 39a222e094af..96a2608252f1 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -2123,6 +2123,34 @@ 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) | ||
2127 | { | ||
2128 | int cpu; | ||
2129 | |||
2130 | /* | ||
2131 | * We're using fixed IRQ delivery, can only return one phys APIC ID. | ||
2132 | * May as well be the first. | ||
2133 | */ | ||
2134 | cpu = cpumask_first(cpumask); | ||
2135 | if (likely((unsigned)cpu < nr_cpu_ids)) | ||
2136 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
2137 | |||
2138 | return BAD_APICID; | ||
2139 | } | ||
2140 | |||
2141 | unsigned int | ||
2142 | default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, | ||
2143 | const struct cpumask *andmask) | ||
2144 | { | ||
2145 | int cpu; | ||
2146 | |||
2147 | for_each_cpu_and(cpu, cpumask, andmask) { | ||
2148 | if (cpumask_test_cpu(cpu, cpu_online_mask)) | ||
2149 | break; | ||
2150 | } | ||
2151 | return per_cpu(x86_cpu_to_apicid, cpu); | ||
2152 | } | ||
2153 | |||
2126 | /* | 2154 | /* |
2127 | * Power management | 2155 | * Power management |
2128 | */ | 2156 | */ |