x86, io_apic: Introduce set_affinity function pointer
With interrupt remapping a special function is used to change the affinity of an IO-APIC interrupt. Abstract this with a function pointer. Signed-off-by: Joerg Roedel <joro@8bytes.org> Acked-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
This commit is contained in:
@@ -182,6 +182,9 @@ extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned
|
|||||||
extern void native_disable_io_apic(void);
|
extern void native_disable_io_apic(void);
|
||||||
extern void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries);
|
extern void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries);
|
||||||
extern void intel_ir_io_apic_print_entries(unsigned int apic, unsigned int nr_entries);
|
extern void intel_ir_io_apic_print_entries(unsigned int apic, unsigned int nr_entries);
|
||||||
|
extern int native_ioapic_set_affinity(struct irq_data *,
|
||||||
|
const struct cpumask *,
|
||||||
|
bool);
|
||||||
|
|
||||||
static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
|
static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
|
||||||
{
|
{
|
||||||
@@ -228,6 +231,7 @@ static inline void disable_ioapic_support(void) { }
|
|||||||
#define native_io_apic_modify NULL
|
#define native_io_apic_modify NULL
|
||||||
#define native_disable_io_apic NULL
|
#define native_disable_io_apic NULL
|
||||||
#define native_io_apic_print_entries NULL
|
#define native_io_apic_print_entries NULL
|
||||||
|
#define native_ioapic_set_affinity NULL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _ASM_X86_IO_APIC_H */
|
#endif /* _ASM_X86_IO_APIC_H */
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ extern int setup_ioapic_remapped_entry(int irq,
|
|||||||
unsigned int destination,
|
unsigned int destination,
|
||||||
int vector,
|
int vector,
|
||||||
struct io_apic_irq_attr *attr);
|
struct io_apic_irq_attr *attr);
|
||||||
extern int set_remapped_irq_affinity(struct irq_data *data,
|
|
||||||
const struct cpumask *mask,
|
|
||||||
bool force);
|
|
||||||
extern void free_remapped_irq(int irq);
|
extern void free_remapped_irq(int irq);
|
||||||
extern void compose_remapped_msi_msg(struct pci_dev *pdev,
|
extern void compose_remapped_msi_msg(struct pci_dev *pdev,
|
||||||
unsigned int irq, unsigned int dest,
|
unsigned int irq, unsigned int dest,
|
||||||
@@ -68,12 +65,6 @@ static inline int setup_ioapic_remapped_entry(int irq,
|
|||||||
{
|
{
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
static inline int set_remapped_irq_affinity(struct irq_data *data,
|
|
||||||
const struct cpumask *mask,
|
|
||||||
bool force)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
static inline void free_remapped_irq(int irq) { }
|
static inline void free_remapped_irq(int irq) { }
|
||||||
static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
|
static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
|
||||||
unsigned int irq, unsigned int dest,
|
unsigned int irq, unsigned int dest,
|
||||||
|
|||||||
@@ -190,6 +190,9 @@ struct x86_msi_ops {
|
|||||||
int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
|
int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct irq_data;
|
||||||
|
struct cpumask;
|
||||||
|
|
||||||
struct x86_io_apic_ops {
|
struct x86_io_apic_ops {
|
||||||
void (*init) (void);
|
void (*init) (void);
|
||||||
unsigned int (*read) (unsigned int apic, unsigned int reg);
|
unsigned int (*read) (unsigned int apic, unsigned int reg);
|
||||||
@@ -197,6 +200,9 @@ struct x86_io_apic_ops {
|
|||||||
void (*modify) (unsigned int apic, unsigned int reg, unsigned int value);
|
void (*modify) (unsigned int apic, unsigned int reg, unsigned int value);
|
||||||
void (*disable)(void);
|
void (*disable)(void);
|
||||||
void (*print_entries)(unsigned int apic, unsigned int nr_entries);
|
void (*print_entries)(unsigned int apic, unsigned int nr_entries);
|
||||||
|
int (*set_affinity)(struct irq_data *data,
|
||||||
|
const struct cpumask *mask,
|
||||||
|
bool force);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct x86_init_ops x86_init;
|
extern struct x86_init_ops x86_init;
|
||||||
|
|||||||
@@ -2369,8 +2369,9 @@ int __ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
|
int native_ioapic_set_affinity(struct irq_data *data,
|
||||||
|
const struct cpumask *mask,
|
||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
unsigned int dest, irq = data->irq;
|
unsigned int dest, irq = data->irq;
|
||||||
@@ -2570,8 +2571,7 @@ static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
|
|||||||
chip->irq_print_chip = ir_print_prefix;
|
chip->irq_print_chip = ir_print_prefix;
|
||||||
chip->irq_ack = ir_ack_apic_edge;
|
chip->irq_ack = ir_ack_apic_edge;
|
||||||
chip->irq_eoi = ir_ack_apic_level;
|
chip->irq_eoi = ir_ack_apic_level;
|
||||||
|
chip->irq_set_affinity = x86_io_apic_ops.set_affinity;
|
||||||
chip->irq_set_affinity = set_remapped_irq_affinity;
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_IRQ_REMAP */
|
#endif /* CONFIG_IRQ_REMAP */
|
||||||
|
|
||||||
@@ -2582,7 +2582,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
|
|||||||
.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,
|
||||||
.irq_set_affinity = ioapic_set_affinity,
|
.irq_set_affinity = native_ioapic_set_affinity,
|
||||||
.irq_retrigger = ioapic_retrigger_irq,
|
.irq_retrigger = ioapic_retrigger_irq,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -3694,10 +3694,7 @@ void __init setup_ioapic_dest(void)
|
|||||||
else
|
else
|
||||||
mask = apic->target_cpus();
|
mask = apic->target_cpus();
|
||||||
|
|
||||||
if (irq_remapping_enabled)
|
x86_io_apic_ops.set_affinity(idata, mask, false);
|
||||||
set_remapped_irq_affinity(idata, mask, false);
|
|
||||||
else
|
|
||||||
ioapic_set_affinity(idata, mask, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,4 +126,5 @@ struct x86_io_apic_ops x86_io_apic_ops = {
|
|||||||
.modify = native_io_apic_modify,
|
.modify = native_io_apic_modify,
|
||||||
.disable = native_disable_io_apic,
|
.disable = native_disable_io_apic,
|
||||||
.print_entries = native_io_apic_print_entries,
|
.print_entries = native_io_apic_print_entries,
|
||||||
|
.set_affinity = native_ioapic_set_affinity,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ static struct irq_remap_ops *remap_ops;
|
|||||||
static int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec);
|
static int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec);
|
||||||
static int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
|
static int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
|
||||||
int index, int sub_handle);
|
int index, int sub_handle);
|
||||||
|
static int set_remapped_irq_affinity(struct irq_data *data,
|
||||||
|
const struct cpumask *mask,
|
||||||
|
bool force);
|
||||||
|
|
||||||
static void irq_remapping_disable_io_apic(void)
|
static void irq_remapping_disable_io_apic(void)
|
||||||
{
|
{
|
||||||
@@ -142,6 +145,7 @@ static int irq_remapping_setup_msi_irqs(struct pci_dev *dev,
|
|||||||
static void __init irq_remapping_modify_x86_ops(void)
|
static void __init irq_remapping_modify_x86_ops(void)
|
||||||
{
|
{
|
||||||
x86_io_apic_ops.disable = irq_remapping_disable_io_apic;
|
x86_io_apic_ops.disable = irq_remapping_disable_io_apic;
|
||||||
|
x86_io_apic_ops.set_affinity = set_remapped_irq_affinity;
|
||||||
x86_msi.setup_msi_irqs = irq_remapping_setup_msi_irqs;
|
x86_msi.setup_msi_irqs = irq_remapping_setup_msi_irqs;
|
||||||
x86_msi.setup_hpet_msi = setup_hpet_msi_remapped;
|
x86_msi.setup_hpet_msi = setup_hpet_msi_remapped;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user