diff options
author | Joerg Roedel <joro@8bytes.org> | 2012-09-26 06:44:39 -0400 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2013-01-28 06:17:26 -0500 |
commit | 373dd7a27f2469020e7b56744cf47b82986b9749 (patch) | |
tree | 1fb77f5d3b11ad5d2c97c1244e1460cabb94593a | |
parent | 5afba62cc8a16716508605e02c1b02ee5f969184 (diff) |
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>
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/irq_remapping.h | 9 | ||||
-rw-r--r-- | arch/x86/include/asm/x86_init.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 17 | ||||
-rw-r--r-- | arch/x86/kernel/x86_init.c | 1 | ||||
-rw-r--r-- | drivers/iommu/irq_remapping.c | 4 |
6 files changed, 22 insertions, 19 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 21aa81e6ec27..a744cbbe02de 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -182,6 +182,9 @@ extern void native_io_apic_modify(unsigned int apic, unsigned int reg, unsigned | |||
182 | extern void native_disable_io_apic(void); | 182 | extern void native_disable_io_apic(void); |
183 | extern void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries); | 183 | extern void native_io_apic_print_entries(unsigned int apic, unsigned int nr_entries); |
184 | extern void intel_ir_io_apic_print_entries(unsigned int apic, unsigned int nr_entries); | 184 | extern void intel_ir_io_apic_print_entries(unsigned int apic, unsigned int nr_entries); |
185 | extern int native_ioapic_set_affinity(struct irq_data *, | ||
186 | const struct cpumask *, | ||
187 | bool); | ||
185 | 188 | ||
186 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) | 189 | static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) |
187 | { | 190 | { |
@@ -228,6 +231,7 @@ static inline void disable_ioapic_support(void) { } | |||
228 | #define native_io_apic_modify NULL | 231 | #define native_io_apic_modify NULL |
229 | #define native_disable_io_apic NULL | 232 | #define native_disable_io_apic NULL |
230 | #define native_io_apic_print_entries NULL | 233 | #define native_io_apic_print_entries NULL |
234 | #define native_ioapic_set_affinity NULL | ||
231 | #endif | 235 | #endif |
232 | 236 | ||
233 | #endif /* _ASM_X86_IO_APIC_H */ | 237 | #endif /* _ASM_X86_IO_APIC_H */ |
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h index 0ee1e88bd17a..f1afa04c3f6a 100644 --- a/arch/x86/include/asm/irq_remapping.h +++ b/arch/x86/include/asm/irq_remapping.h | |||
@@ -40,9 +40,6 @@ extern int setup_ioapic_remapped_entry(int irq, | |||
40 | unsigned int destination, | 40 | unsigned int destination, |
41 | int vector, | 41 | int vector, |
42 | struct io_apic_irq_attr *attr); | 42 | struct io_apic_irq_attr *attr); |
43 | extern int set_remapped_irq_affinity(struct irq_data *data, | ||
44 | const struct cpumask *mask, | ||
45 | bool force); | ||
46 | extern void free_remapped_irq(int irq); | 43 | extern void free_remapped_irq(int irq); |
47 | extern void compose_remapped_msi_msg(struct pci_dev *pdev, | 44 | extern void compose_remapped_msi_msg(struct pci_dev *pdev, |
48 | unsigned int irq, unsigned int dest, | 45 | unsigned int irq, unsigned int dest, |
@@ -68,12 +65,6 @@ static inline int setup_ioapic_remapped_entry(int irq, | |||
68 | { | 65 | { |
69 | return -ENODEV; | 66 | return -ENODEV; |
70 | } | 67 | } |
71 | static inline int set_remapped_irq_affinity(struct irq_data *data, | ||
72 | const struct cpumask *mask, | ||
73 | bool force) | ||
74 | { | ||
75 | return 0; | ||
76 | } | ||
77 | static inline void free_remapped_irq(int irq) { } | 68 | static inline void free_remapped_irq(int irq) { } |
78 | static inline void compose_remapped_msi_msg(struct pci_dev *pdev, | 69 | static inline void compose_remapped_msi_msg(struct pci_dev *pdev, |
79 | unsigned int irq, unsigned int dest, | 70 | unsigned int irq, unsigned int dest, |
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h index 1ee10ca46675..20d9f97c14a2 100644 --- a/arch/x86/include/asm/x86_init.h +++ b/arch/x86/include/asm/x86_init.h | |||
@@ -190,6 +190,9 @@ struct x86_msi_ops { | |||
190 | int (*setup_hpet_msi)(unsigned int irq, unsigned int id); | 190 | int (*setup_hpet_msi)(unsigned int irq, unsigned int id); |
191 | }; | 191 | }; |
192 | 192 | ||
193 | struct irq_data; | ||
194 | struct cpumask; | ||
195 | |||
193 | struct x86_io_apic_ops { | 196 | struct x86_io_apic_ops { |
194 | void (*init) (void); | 197 | void (*init) (void); |
195 | unsigned int (*read) (unsigned int apic, unsigned int reg); | 198 | unsigned int (*read) (unsigned int apic, unsigned int reg); |
@@ -197,6 +200,9 @@ struct x86_io_apic_ops { | |||
197 | void (*modify) (unsigned int apic, unsigned int reg, unsigned int value); | 200 | void (*modify) (unsigned int apic, unsigned int reg, unsigned int value); |
198 | void (*disable)(void); | 201 | void (*disable)(void); |
199 | void (*print_entries)(unsigned int apic, unsigned int nr_entries); | 202 | void (*print_entries)(unsigned int apic, unsigned int nr_entries); |
203 | int (*set_affinity)(struct irq_data *data, | ||
204 | const struct cpumask *mask, | ||
205 | bool force); | ||
200 | }; | 206 | }; |
201 | 207 | ||
202 | extern struct x86_init_ops x86_init; | 208 | extern struct x86_init_ops x86_init; |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index d4b045e018fb..d9ca3be9636c 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2369,9 +2369,10 @@ int __ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, | |||
2369 | return 0; | 2369 | return 0; |
2370 | } | 2370 | } |
2371 | 2371 | ||
2372 | static int | 2372 | |
2373 | ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, | 2373 | int native_ioapic_set_affinity(struct irq_data *data, |
2374 | bool force) | 2374 | const struct cpumask *mask, |
2375 | bool force) | ||
2375 | { | 2376 | { |
2376 | unsigned int dest, irq = data->irq; | 2377 | unsigned int dest, irq = data->irq; |
2377 | unsigned long flags; | 2378 | unsigned long flags; |
@@ -2570,8 +2571,7 @@ static void irq_remap_modify_chip_defaults(struct irq_chip *chip) | |||
2570 | chip->irq_print_chip = ir_print_prefix; | 2571 | chip->irq_print_chip = ir_print_prefix; |
2571 | chip->irq_ack = ir_ack_apic_edge; | 2572 | chip->irq_ack = ir_ack_apic_edge; |
2572 | chip->irq_eoi = ir_ack_apic_level; | 2573 | chip->irq_eoi = ir_ack_apic_level; |
2573 | 2574 | chip->irq_set_affinity = x86_io_apic_ops.set_affinity; | |
2574 | chip->irq_set_affinity = set_remapped_irq_affinity; | ||
2575 | } | 2575 | } |
2576 | #endif /* CONFIG_IRQ_REMAP */ | 2576 | #endif /* CONFIG_IRQ_REMAP */ |
2577 | 2577 | ||
@@ -2582,7 +2582,7 @@ static struct irq_chip ioapic_chip __read_mostly = { | |||
2582 | .irq_unmask = unmask_ioapic_irq, | 2582 | .irq_unmask = unmask_ioapic_irq, |
2583 | .irq_ack = ack_apic_edge, | 2583 | .irq_ack = ack_apic_edge, |
2584 | .irq_eoi = ack_apic_level, | 2584 | .irq_eoi = ack_apic_level, |
2585 | .irq_set_affinity = ioapic_set_affinity, | 2585 | .irq_set_affinity = native_ioapic_set_affinity, |
2586 | .irq_retrigger = ioapic_retrigger_irq, | 2586 | .irq_retrigger = ioapic_retrigger_irq, |
2587 | }; | 2587 | }; |
2588 | 2588 | ||
@@ -3694,10 +3694,7 @@ void __init setup_ioapic_dest(void) | |||
3694 | else | 3694 | else |
3695 | mask = apic->target_cpus(); | 3695 | mask = apic->target_cpus(); |
3696 | 3696 | ||
3697 | if (irq_remapping_enabled) | 3697 | x86_io_apic_ops.set_affinity(idata, mask, false); |
3698 | set_remapped_irq_affinity(idata, mask, false); | ||
3699 | else | ||
3700 | ioapic_set_affinity(idata, mask, false); | ||
3701 | } | 3698 | } |
3702 | 3699 | ||
3703 | } | 3700 | } |
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c index 0357eee65673..2ca3475e90a8 100644 --- a/arch/x86/kernel/x86_init.c +++ b/arch/x86/kernel/x86_init.c | |||
@@ -126,4 +126,5 @@ struct x86_io_apic_ops x86_io_apic_ops = { | |||
126 | .modify = native_io_apic_modify, | 126 | .modify = native_io_apic_modify, |
127 | .disable = native_disable_io_apic, | 127 | .disable = native_disable_io_apic, |
128 | .print_entries = native_io_apic_print_entries, | 128 | .print_entries = native_io_apic_print_entries, |
129 | .set_affinity = native_ioapic_set_affinity, | ||
129 | }; | 130 | }; |
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c index 20f04b67efd2..67b243c6c4e9 100644 --- a/drivers/iommu/irq_remapping.c +++ b/drivers/iommu/irq_remapping.c | |||
@@ -26,6 +26,9 @@ static struct irq_remap_ops *remap_ops; | |||
26 | static int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec); | 26 | static int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec); |
27 | static int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq, | 27 | static int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq, |
28 | int index, int sub_handle); | 28 | int index, int sub_handle); |
29 | static int set_remapped_irq_affinity(struct irq_data *data, | ||
30 | const struct cpumask *mask, | ||
31 | bool force); | ||
29 | 32 | ||
30 | static void irq_remapping_disable_io_apic(void) | 33 | static void irq_remapping_disable_io_apic(void) |
31 | { | 34 | { |
@@ -142,6 +145,7 @@ static int irq_remapping_setup_msi_irqs(struct pci_dev *dev, | |||
142 | static void __init irq_remapping_modify_x86_ops(void) | 145 | static void __init irq_remapping_modify_x86_ops(void) |
143 | { | 146 | { |
144 | x86_io_apic_ops.disable = irq_remapping_disable_io_apic; | 147 | x86_io_apic_ops.disable = irq_remapping_disable_io_apic; |
148 | x86_io_apic_ops.set_affinity = set_remapped_irq_affinity; | ||
145 | x86_msi.setup_msi_irqs = irq_remapping_setup_msi_irqs; | 149 | x86_msi.setup_msi_irqs = irq_remapping_setup_msi_irqs; |
146 | x86_msi.setup_hpet_msi = setup_hpet_msi_remapped; | 150 | x86_msi.setup_hpet_msi = setup_hpet_msi_remapped; |
147 | } | 151 | } |