diff options
Diffstat (limited to 'arch/x86/kernel/apic/apic.c')
| -rw-r--r-- | arch/x86/kernel/apic/apic.c | 35 | 
1 files changed, 22 insertions, 13 deletions
| diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 2d75faf743f2..e7409468efc6 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -2201,23 +2201,32 @@ void default_init_apic_ldr(void)  	apic_write(APIC_LDR, val);  } -int default_cpu_mask_to_apicid_and(const struct cpumask *cpumask, -				   const struct cpumask *andmask, -				   unsigned int *apicid) +int default_cpu_mask_to_apicid(const struct cpumask *mask, +			       struct irq_data *irqdata, +			       unsigned int *apicid)  { -	unsigned int cpu; +	unsigned int cpu = cpumask_first(mask); -	for_each_cpu_and(cpu, cpumask, andmask) { -		if (cpumask_test_cpu(cpu, cpu_online_mask)) -			break; -	} +	if (cpu >= nr_cpu_ids) +		return -EINVAL; +	*apicid = per_cpu(x86_cpu_to_apicid, cpu); +	irq_data_update_effective_affinity(irqdata, cpumask_of(cpu)); +	return 0; +} -	if (likely(cpu < nr_cpu_ids)) { -		*apicid = per_cpu(x86_cpu_to_apicid, cpu); -		return 0; -	} +int flat_cpu_mask_to_apicid(const struct cpumask *mask, +			    struct irq_data *irqdata, +			    unsigned int *apicid) -	return -EINVAL; +{ +	struct cpumask *effmsk = irq_data_get_effective_affinity_mask(irqdata); +	unsigned long cpu_mask = cpumask_bits(mask)[0] & APIC_ALL_CPUS; + +	if (!cpu_mask) +		return -EINVAL; +	*apicid = (unsigned int)cpu_mask; +	cpumask_bits(effmsk)[0] = cpu_mask; +	return 0;  }  /* |