x86: Prepare the affinity common functions for taking struct irq_data *
While at it rename it to sensible function names and fix the return value from unsigned to int for __ioapic_set_affinity (set_desc_affinity). Returning -1 in a function returning unsigned int is somewhat strange. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
60c69948e5
commit
f7e909eae4
3 changed files with 33 additions and 52 deletions
|
@ -95,9 +95,9 @@ extern struct irq_cfg *irq_cfg(unsigned int);
|
||||||
extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
|
extern int assign_irq_vector(int, struct irq_cfg *, const struct cpumask *);
|
||||||
extern void send_cleanup_vector(struct irq_cfg *);
|
extern void send_cleanup_vector(struct irq_cfg *);
|
||||||
|
|
||||||
struct irq_desc;
|
struct irq_data;
|
||||||
extern unsigned int set_desc_affinity(struct irq_desc *, const struct cpumask *,
|
int __ioapic_set_affinity(struct irq_data *, const struct cpumask *,
|
||||||
unsigned int *dest_id);
|
unsigned int *dest_id);
|
||||||
extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr);
|
extern int IO_APIC_get_PCI_irq_vector(int bus, int devfn, int pin, struct io_apic_irq_attr *irq_attr);
|
||||||
extern void setup_ioapic_dest(void);
|
extern void setup_ioapic_dest(void);
|
||||||
|
|
||||||
|
|
|
@ -2279,65 +2279,46 @@ static void __target_IO_APIC_irq(unsigned int irq, unsigned int dest, struct irq
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Either sets desc->affinity to a valid value, and returns
|
* Either sets data->affinity to a valid value, and returns
|
||||||
* ->cpu_mask_to_apicid of that in dest_id, or returns -1 and
|
* ->cpu_mask_to_apicid of that in dest_id, or returns -1 and
|
||||||
* leaves desc->affinity untouched.
|
* leaves data->affinity untouched.
|
||||||
*/
|
*/
|
||||||
unsigned int
|
int __ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
|
||||||
set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask,
|
unsigned int *dest_id)
|
||||||
unsigned int *dest_id)
|
|
||||||
{
|
{
|
||||||
struct irq_cfg *cfg;
|
struct irq_cfg *cfg = data->chip_data;
|
||||||
unsigned int irq;
|
|
||||||
|
|
||||||
if (!cpumask_intersects(mask, cpu_online_mask))
|
if (!cpumask_intersects(mask, cpu_online_mask))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
irq = desc->irq;
|
if (assign_irq_vector(data->irq, data->chip_data, mask))
|
||||||
cfg = get_irq_desc_chip_data(desc);
|
|
||||||
if (assign_irq_vector(irq, cfg, mask))
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cpumask_copy(desc->affinity, mask);
|
cpumask_copy(data->affinity, mask);
|
||||||
|
|
||||||
*dest_id = apic->cpu_mask_to_apicid_and(desc->affinity, cfg->domain);
|
*dest_id = apic->cpu_mask_to_apicid_and(mask, cfg->domain);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
set_ioapic_affinity_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
|
ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
|
||||||
|
bool force)
|
||||||
{
|
{
|
||||||
struct irq_cfg *cfg;
|
unsigned int dest, irq = data->irq;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
unsigned int dest;
|
int ret;
|
||||||
unsigned int irq;
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
irq = desc->irq;
|
|
||||||
cfg = get_irq_desc_chip_data(desc);
|
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&ioapic_lock, flags);
|
raw_spin_lock_irqsave(&ioapic_lock, flags);
|
||||||
ret = set_desc_affinity(desc, mask, &dest);
|
ret = __ioapic_set_affinity(data, mask, &dest);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
/* Only the high 8 bits are valid. */
|
/* Only the high 8 bits are valid. */
|
||||||
dest = SET_APIC_LOGICAL_ID(dest);
|
dest = SET_APIC_LOGICAL_ID(dest);
|
||||||
__target_IO_APIC_irq(irq, dest, cfg);
|
__target_IO_APIC_irq(irq, dest, data->chip_data);
|
||||||
}
|
}
|
||||||
raw_spin_unlock_irqrestore(&ioapic_lock, flags);
|
raw_spin_unlock_irqrestore(&ioapic_lock, flags);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
set_ioapic_affinity_irq(unsigned int irq, const struct cpumask *mask)
|
|
||||||
{
|
|
||||||
struct irq_desc *desc;
|
|
||||||
|
|
||||||
desc = irq_to_desc(irq);
|
|
||||||
|
|
||||||
return set_ioapic_affinity_irq_desc(desc, mask);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_INTR_REMAP
|
#ifdef CONFIG_INTR_REMAP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2668,16 +2649,16 @@ static void ir_ack_apic_level(struct irq_data *data)
|
||||||
#endif /* CONFIG_INTR_REMAP */
|
#endif /* CONFIG_INTR_REMAP */
|
||||||
|
|
||||||
static struct irq_chip ioapic_chip __read_mostly = {
|
static struct irq_chip ioapic_chip __read_mostly = {
|
||||||
.name = "IO-APIC",
|
.name = "IO-APIC",
|
||||||
.irq_startup = startup_ioapic_irq,
|
.irq_startup = startup_ioapic_irq,
|
||||||
.irq_mask = mask_ioapic_irq,
|
.irq_mask = mask_ioapic_irq,
|
||||||
.irq_unmask = unmask_ioapic_irq,
|
.irq_unmask = unmask_ioapic_irq,
|
||||||
.irq_ack = ack_apic_edge,
|
.irq_ack = ack_apic_edge,
|
||||||
.irq_eoi = ack_apic_level,
|
.irq_eoi = ack_apic_level,
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
.set_affinity = set_ioapic_affinity_irq,
|
.irq_set_affinity = ioapic_set_affinity,
|
||||||
#endif
|
#endif
|
||||||
.irq_retrigger = ioapic_retrigger_irq,
|
.irq_retrigger = ioapic_retrigger_irq,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct irq_chip ir_ioapic_chip __read_mostly = {
|
static struct irq_chip ir_ioapic_chip __read_mostly = {
|
||||||
|
@ -3327,7 +3308,7 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||||
struct msi_msg msg;
|
struct msi_msg msg;
|
||||||
unsigned int dest;
|
unsigned int dest;
|
||||||
|
|
||||||
if (set_desc_affinity(desc, mask, &dest))
|
if (__ioapic_set_affinity(&desc->irq_data, mask, &dest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cfg = get_irq_desc_chip_data(desc);
|
cfg = get_irq_desc_chip_data(desc);
|
||||||
|
@ -3359,7 +3340,7 @@ ir_set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||||
if (get_irte(irq, &irte))
|
if (get_irte(irq, &irte))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (set_desc_affinity(desc, mask, &dest))
|
if (__ioapic_set_affinity(&desc->irq_data, mask, &dest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
irte.vector = cfg->vector;
|
irte.vector = cfg->vector;
|
||||||
|
@ -3534,7 +3515,7 @@ static int dmar_msi_set_affinity(unsigned int irq, const struct cpumask *mask)
|
||||||
struct msi_msg msg;
|
struct msi_msg msg;
|
||||||
unsigned int dest;
|
unsigned int dest;
|
||||||
|
|
||||||
if (set_desc_affinity(desc, mask, &dest))
|
if (__ioapic_set_affinity(&desc->irq_data, mask, &dest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cfg = get_irq_desc_chip_data(desc);
|
cfg = get_irq_desc_chip_data(desc);
|
||||||
|
@ -3590,7 +3571,7 @@ static int hpet_msi_set_affinity(struct irq_data *data,
|
||||||
struct msi_msg msg;
|
struct msi_msg msg;
|
||||||
unsigned int dest;
|
unsigned int dest;
|
||||||
|
|
||||||
if (set_desc_affinity(desc, mask, &dest))
|
if (__ioapic_set_affinity(&desc->irq_data, mask, &dest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
hpet_msi_read(data->handler_data, &msg);
|
hpet_msi_read(data->handler_data, &msg);
|
||||||
|
@ -3693,7 +3674,7 @@ static int set_ht_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||||
struct irq_cfg *cfg;
|
struct irq_cfg *cfg;
|
||||||
unsigned int dest;
|
unsigned int dest;
|
||||||
|
|
||||||
if (set_desc_affinity(desc, mask, &dest))
|
if (__ioapic_set_affinity(&desc->irq_data, mask, &dest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
cfg = get_irq_desc_chip_data(desc);
|
cfg = get_irq_desc_chip_data(desc);
|
||||||
|
@ -4045,14 +4026,14 @@ void __init setup_ioapic_dest(void)
|
||||||
*/
|
*/
|
||||||
if (desc->status &
|
if (desc->status &
|
||||||
(IRQ_NO_BALANCING | IRQ_AFFINITY_SET))
|
(IRQ_NO_BALANCING | IRQ_AFFINITY_SET))
|
||||||
mask = desc->affinity;
|
mask = desc->irq_data.affinity;
|
||||||
else
|
else
|
||||||
mask = apic->target_cpus();
|
mask = apic->target_cpus();
|
||||||
|
|
||||||
if (intr_remapping_enabled)
|
if (intr_remapping_enabled)
|
||||||
set_ir_ioapic_affinity_irq_desc(desc, mask);
|
set_ir_ioapic_affinity_irq_desc(desc, mask);
|
||||||
else
|
else
|
||||||
set_ioapic_affinity_irq_desc(desc, mask);
|
ioapic_set_affinity(&desc->irq_data, mask, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,7 +216,7 @@ static int uv_set_irq_affinity(unsigned int irq, const struct cpumask *mask)
|
||||||
unsigned long mmr_offset;
|
unsigned long mmr_offset;
|
||||||
int mmr_pnode;
|
int mmr_pnode;
|
||||||
|
|
||||||
if (set_desc_affinity(desc, mask, &dest))
|
if (__ioapic_set_affinity(&desc->irq_data, mask, &dest))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
mmr_value = 0;
|
mmr_value = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue