Skip to content

Commit c7d6c9d

Browse files
committed
x86/apic: Implement effective irq mask update
Add the effective irq mask update to the apic implementations and enable effective irq masks for x86. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Jens Axboe <axboe@kernel.dk> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Keith Busch <keith.busch@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Christoph Hellwig <hch@lst.de> Link: http://lkml.kernel.org/r/20170619235446.878370703@linutronix.de
1 parent ef1c2cc commit c7d6c9d

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ config X86
8787
select GENERIC_EARLY_IOREMAP
8888
select GENERIC_FIND_FIRST_BIT
8989
select GENERIC_IOMAP
90+
select GENERIC_IRQ_EFFECTIVE_AFF_MASK if SMP
9091
select GENERIC_IRQ_MIGRATION if SMP
9192
select GENERIC_IRQ_PROBE
9293
select GENERIC_IRQ_SHOW

arch/x86/kernel/apic/apic.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2210,6 +2210,7 @@ int default_cpu_mask_to_apicid(const struct cpumask *mask,
22102210
if (cpu >= nr_cpu_ids)
22112211
return -EINVAL;
22122212
*apicid = per_cpu(x86_cpu_to_apicid, cpu);
2213+
irq_data_update_effective_affinity(irqdata, cpumask_of(cpu));
22132214
return 0;
22142215
}
22152216

@@ -2218,11 +2219,13 @@ int flat_cpu_mask_to_apicid(const struct cpumask *mask,
22182219
unsigned int *apicid)
22192220

22202221
{
2222+
struct cpumask *effmsk = irq_data_get_effective_affinity_mask(irqdata);
22212223
unsigned long cpu_mask = cpumask_bits(mask)[0] & APIC_ALL_CPUS;
22222224

22232225
if (!cpu_mask)
22242226
return -EINVAL;
22252227
*apicid = (unsigned int)cpu_mask;
2228+
cpumask_bits(effmsk)[0] = cpu_mask;
22262229
return 0;
22272230
}
22282231

arch/x86/kernel/apic/x2apic_cluster.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <linux/kernel.h>
55
#include <linux/ctype.h>
66
#include <linux/dmar.h>
7+
#include <linux/irq.h>
78
#include <linux/cpu.h>
89

910
#include <asm/smp.h>
@@ -107,6 +108,7 @@ static int
107108
x2apic_cpu_mask_to_apicid(const struct cpumask *mask, struct irq_data *irqdata,
108109
unsigned int *apicid)
109110
{
111+
struct cpumask *effmsk = irq_data_get_effective_affinity_mask(irqdata);
110112
unsigned int cpu;
111113
u32 dest = 0;
112114
u16 cluster;
@@ -118,10 +120,12 @@ x2apic_cpu_mask_to_apicid(const struct cpumask *mask, struct irq_data *irqdata,
118120
dest = per_cpu(x86_cpu_to_logical_apicid, cpu);
119121
cluster = x2apic_cluster(cpu);
120122

123+
cpumask_clear(effmsk);
121124
for_each_cpu(cpu, mask) {
122125
if (cluster != x2apic_cluster(cpu))
123126
continue;
124127
dest |= per_cpu(x86_cpu_to_logical_apicid, cpu);
128+
cpumask_set_cpu(cpu, effmsk);
125129
}
126130

127131
*apicid = dest;

0 commit comments

Comments
 (0)