Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7d6c9dd authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

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: default avatarThomas 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
parent ef1c2cc8
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -87,6 +87,7 @@ config X86
	select GENERIC_EARLY_IOREMAP
	select GENERIC_EARLY_IOREMAP
	select GENERIC_FIND_FIRST_BIT
	select GENERIC_FIND_FIRST_BIT
	select GENERIC_IOMAP
	select GENERIC_IOMAP
	select GENERIC_IRQ_EFFECTIVE_AFF_MASK	if SMP
	select GENERIC_IRQ_MIGRATION		if SMP
	select GENERIC_IRQ_MIGRATION		if SMP
	select GENERIC_IRQ_PROBE
	select GENERIC_IRQ_PROBE
	select GENERIC_IRQ_SHOW
	select GENERIC_IRQ_SHOW
+3 −0
Original line number Original line Diff line number Diff line
@@ -2210,6 +2210,7 @@ int default_cpu_mask_to_apicid(const struct cpumask *mask,
	if (cpu >= nr_cpu_ids)
	if (cpu >= nr_cpu_ids)
		return -EINVAL;
		return -EINVAL;
	*apicid = per_cpu(x86_cpu_to_apicid, cpu);
	*apicid = per_cpu(x86_cpu_to_apicid, cpu);
	irq_data_update_effective_affinity(irqdata, cpumask_of(cpu));
	return 0;
	return 0;
}
}


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


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


	if (!cpu_mask)
	if (!cpu_mask)
		return -EINVAL;
		return -EINVAL;
	*apicid = (unsigned int)cpu_mask;
	*apicid = (unsigned int)cpu_mask;
	cpumask_bits(effmsk)[0] = cpu_mask;
	return 0;
	return 0;
}
}


+4 −0
Original line number Original line Diff line number Diff line
@@ -4,6 +4,7 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <linux/ctype.h>
#include <linux/dmar.h>
#include <linux/dmar.h>
#include <linux/irq.h>
#include <linux/cpu.h>
#include <linux/cpu.h>


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


	cpumask_clear(effmsk);
	for_each_cpu(cpu, mask) {
	for_each_cpu(cpu, mask) {
		if (cluster != x2apic_cluster(cpu))
		if (cluster != x2apic_cluster(cpu))
			continue;
			continue;
		dest |= per_cpu(x86_cpu_to_logical_apicid, cpu);
		dest |= per_cpu(x86_cpu_to_logical_apicid, cpu);
		cpumask_set_cpu(cpu, effmsk);
	}
	}


	*apicid = dest;
	*apicid = dest;