x86, irq: Support ioapic controller hotplug
Subsystems (6)
cover x86, irq: Support ioapic controller hotplug
Hi,
Intel cpu (from IVB) include cpu cores, mem controller, and IIO. When hotplug cpu physically, it will involve cpu hotplug, mem hotplug, and pci root hotplug.
IIO includes pci host bridge, ioapic controller and iommu etc. pci devices will need to use ioapic and iommu.
So to make pci root bus hotplug working, we need ioapic hotplug support.
Now ioapics are with ACPI MADT table. During booting, kernel will parse MADT and put info into ioapic arrays.
Also Bjorn added one pci device based driver, but it is not wired in yet, as it need to call acpi_register_ioapic, and that is TBD.
This patchset will
1. extend genirq to support reserve/alloc_reserved method. because we want irqs for one ioapic controller to be linear mapping to the gsi range.
2. change ioapic array operation code so we could insert new ioapic and remove one leave the blank slot.
3. record irq_base in gsi_config in ioapic struct, and use it to convert gsi to irq for pci device using that ioapic controller
4. make static ioapic path (from MADT) use same code as hot-add path, with reserve/alloc_reserved method.
5. change ioapic add/remove to use acpi way, as that is only needed when pci root bus hotplug.
6. also support the case that ioapic controller is hiding in pci config space or ioapic address is not managed by pci reallocation subsys.
Also include some cleanups
1. print MSI-X clearly in /proc/interrupts and dmesg.
2. convert ioapic irq_2_pin to be generic list.
It is based on linus's tree of 2013/08/10 aka v3.11-rc4.
could get them from:
git://git.kernel.org/pub/scm/linux/kernel/git/yinghai/linux-yinghai.git for-x86-irq
-v3: split last patch to 4 patches per request from Bjorn.
drop one patch that will put pci device name in proc/interrupts update changelog.
-v4: address review from tglx, change to realloc to alloc_reserved.
separate x86 code and core code into different patches.
Yinghai Lu (28):
genirq: Split __irq_reserve_irqs from irq_alloc_descs
genirq: Add irq_alloc_reserved_desc()
genirq: Do not free unallocated irq descriptors
x86, irq: Change irq_remap_modify_chip_defaults() to static x86, irq: Modify irq chip once for irq remapping
x86, irq: Show MSI-X clearly in debug message
x86, irq: Show MSI-X in /proc/interrupt
x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent ia64, irq: Add dummy create_irq_nr()
iommu, irq: Allocate irq_desc for dmar_msi with local node x86, irq: Kill create_irq()
x86, irq: Convert irq_2_pin list to generic list
x86, irq: Add alloc_reserved_irq_and_cfg_at()
x86, irq: Move down arch_early_irq_init()
x86, irq: Split out alloc_ioapic_save_registers()
xen, irq: Call irq_alloc_reserved_desc_at() at first
x86, irq: Reserve irq range and alloc_reserved for booting path x86, irq: Add ioapic_gsi_to_irq
x86, irq: Add for_each_ioapic helper
x86, irq: More strict checking about registering ioapic x86, irq: Make mp_register_ioapic handle hot-added ioapic x86, irq: Add mp_unregister_ioapic to handle hot-remove ioapic x86, ioapic: Find usable ioapic id for 64bit.
x86: Move declaration for mp_register_ioapic()
PCI, x86: Make ioapic hotplug support built-in
PCI, x86, ACPI: Link acpi ioapic register to ioapic
PCI, x86, ACPI: Enable ioapic hotplug support with acpi host bridge. PCI, x86, ACPI: get ioapic address from acpi device
arch/ia64/kernel/irq_ia64.c | 10 + arch/x86/include/asm/hw_irq.h | 2 +- arch/x86/include/asm/io_apic.h | 13 + arch/x86/include/asm/irq_remapping.h | 14 +- arch/x86/include/asm/mpspec.h | 21 +- arch/x86/kernel/acpi/boot.c | 32 +-- arch/x86/kernel/apic/apic.c | 9 +- arch/x86/kernel/apic/io_apic.c | 480 +++++++++++++++++++++++++---------- arch/x86/kernel/devicetree.c | 2 +- drivers/acpi/pci_root.c | 4 + drivers/iommu/amd_iommu_init.c | 2 +- drivers/iommu/dmar.c | 2 +- drivers/iommu/intel_irq_remapping.c | 2 +- drivers/iommu/irq_remapping.c | 18 +- drivers/pci/Kconfig | 3 +- drivers/pci/ioapic.c | 229 ++++++++++++----- drivers/xen/events.c | 8 +- include/linux/irq.h | 4 + include/linux/pci-acpi.h | 8 + kernel/irq/irqdesc.c | 80 ++++-- 20 files changed, 679 insertions(+), 264 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/28 genirq: Split __irq_reserve_irqs from irq_alloc_descs
irq_alloc_descs and irq_reserve_irqs are almost the same. Separate code out to __irq_reserved_irqs, and other two reuse __irq_reserve_irqs.
We will use __irq_reserve_irqs for coming ioapic hotplug support.
-v2: fix func docbook related comments, pointed out by tglx.
--- include/linux/irq.h | 1 + kernel/irq/irqdesc.c | 54 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 32 insertions(+), 23 deletions(-)
include/linux/irq.h +1 -0
@@ -611,6 +611,7 @@ int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,void irq_free_descs (unsigned int irq,unsigned int cnt);int irq_reserve_irqs (unsigned int from,unsigned int cnt); +int __irq_reserve_irqs (int irq,unsigned int from,unsigned int cnt);static inline void irq_free_desc (unsigned int irq) {
kernel/irq/irqdesc.c +31 -23
88 lines not on this page · raw message
Signature · 1 line
1.8.1.4
PATCH 2/28 genirq: Add irq_alloc_reserved_desc()
In reply to Yinghai LuFor ioapic hot-add support, it would be easy if we have continuous irq numbers for hot added ioapic controller.
We can reserve irq range at first, and later allocate desc for those pre-reserved irqs when they are needed.
The reasons for not allocating them during reserving:
1. only several pins of one ioapic are used, allocate for all pins, will waste memory for not used pins.
2. allocate later when is needed could make sure irq_desc is allocated on local node ram, as dev->node is set at that point.
-v2: update changelog by adding reasons, requested by Konrad. -v3: according to tglx:
separate core code change with arch code change. change function name to irq_alloc_reserved_desc. kill __irq_is_reserved().
remove not need exports.
according to Sebastian:
spare one comments by put two functions together.
--- include/linux/irq.h | 3 +++ kernel/irq/irqdesc.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+)
include/linux/irq.h +3 -0
@@ -592,10 +592,13 @@ static inline u32 irq_get_trigger_type(unsigned int irq)int __irq_alloc_descs (int irq,unsigned int from,unsigned int cnt,int node,struct module *owner); +int __irq_alloc_reserved_desc (int at,int node,struct module *owner);/* use macros to avoid needing export.h for THIS_MODULE */ #define irq_alloc_descs (irq, from, cnt, node) \ __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE) +#define irq_alloc_reserved_desc_at (at, node) \ + __irq_alloc_reserved_desc(at, node, THIS_MODULE)#define irq_alloc_desc (node) \ irq_alloc_descs(-1, 0, 1, node)
kernel/irq/irqdesc.c +23 -0
@@ -410,6 +410,29 @@ __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,EXPORT_SYMBOL_GPL (__irq_alloc_descs);/** +* __irq_alloc_reserved_desc - allocate irq descriptor for irq that is already reserved +* @irq: Allocate for specific irq number if irq >= 0 +* @node: Preferred node on which the irq descriptor should be allocated +* @owner: Owning module (can be NULL) +* +* Returns the irq number or error code +*/ +int __ref __irq_alloc_reserved_desc (int irq,int node,struct module *owner) +{ +mutex_lock (&sparse_irq_lock); +if (!test_bit (irq, allocated_irqs)) { +mutex_unlock (&sparse_irq_lock); +return -EINVAL ; + } +mutex_unlock (&sparse_irq_lock); + +if (irq_to_desc (irq)) +return irq; + +return alloc_descs (irq,1 , node, owner); +} + +/** * irq_reserve_irqs - mark irqs allocated * @from: mark from irq number * @cnt: number of irqs to mark
Signature · 1 line
1.8.1.4
PATCH 3/28 genirq: Do not free unallocated irq descriptors
In reply to Yinghai LuHot-added interrupt controllers can reserve a range of interrupt numbers, but only allocate some of them. To simplify the release on hot-remove allow them to iterate over the reserved range, let the free_desc() code return early when the descriptor does not exist
-v2: changelog from tglx
--- kernel/irq/irqdesc.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/irq/irqdesc.c +3 -0
@@ -165,6 +165,9 @@ static void free_desc(unsigned int irq) {struct irq_desc *desc =irq_to_desc (irq); +if (!desc) +return ; +unregister_irq_proc (irq, desc);mutex_lock (&sparse_irq_lock);
Signature · 1 line
1.8.1.4
PATCH 4/28 x86, irq: Change irq_remap_modify_chip_defaults() to static
In reply to Yinghai LuChange irq_remap_modify_chip_defaults() to static, as we have no outside user.
--- arch/x86/include/asm/irq_remapping.h | 6 ------ drivers/iommu/irq_remapping.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-)
arch/x86/include/asm/irq_remapping.h +0 -6
@@ -56,8 +56,6 @@ extern bool setup_remapped_irq(int irq,struct irq_cfg *cfg, struct irq_chip *chip); -void irq_remap_modify_chip_defaults (struct irq_chip *chip); -#else /* CONFIG_IRQ_REMAP */ static inline void setup_irq_remapping_ops (void ) { }
@@ -91,10 +89,6 @@ static inline void panic_if_irq_remap(const char *msg) { } -static inline void irq_remap_modify_chip_defaults (struct irq_chip *chip) -{ -} -static inline bool setup_remapped_irq (int irq,struct irq_cfg *cfg,struct irq_chip *chip)
drivers/iommu/irq_remapping.c +1 -1
@@ -375,7 +375,7 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)seq_printf (p," IR-%s" , data->chip->name); } -void irq_remap_modify_chip_defaults (struct irq_chip *chip) +static void irq_remap_modify_chip_defaults (struct irq_chip *chip) { chip->irq_print_chip = ir_print_prefix; chip->irq_ack = ir_ack_apic_edge;
Signature · 1 line
1.8.1.4
PATCH 4/28 x86, irqi: Change irq_remap_modify_chip_defaults() to static
In reply to Yinghai LuChange irq_remap_modify_chip_defaults() to static, as we have no outside user.
--- arch/x86/include/asm/irq_remapping.h | 6 ------ drivers/iommu/irq_remapping.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-)
arch/x86/include/asm/irq_remapping.h +0 -6
@@ -56,8 +56,6 @@ extern bool setup_remapped_irq(int irq,struct irq_cfg *cfg, struct irq_chip *chip); -void irq_remap_modify_chip_defaults (struct irq_chip *chip); -#else /* CONFIG_IRQ_REMAP */ static inline void setup_irq_remapping_ops (void ) { }
@@ -91,10 +89,6 @@ static inline void panic_if_irq_remap(const char *msg) { } -static inline void irq_remap_modify_chip_defaults (struct irq_chip *chip) -{ -} -static inline bool setup_remapped_irq (int irq,struct irq_cfg *cfg,struct irq_chip *chip)
drivers/iommu/irq_remapping.c +1 -1
@@ -375,7 +375,7 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)seq_printf (p," IR-%s" , data->chip->name); } -void irq_remap_modify_chip_defaults (struct irq_chip *chip) +static void irq_remap_modify_chip_defaults (struct irq_chip *chip) { chip->irq_print_chip = ir_print_prefix; chip->irq_ack = ir_ack_apic_edge;
Signature · 1 line
1.8.1.4
PATCH 5/28 x86, irq: Modify irq chip once for irq remapping
In reply to Yinghai LuCurrent code: after irq remapping is enabled, irq_chip fields are modified during every irq setup.
mp_register_gsi
io_apic_set_pci_routing
io_apic_setup_irq_pin
setup_ioapic_irq
ioapic_register_intr
setup_remapped_irq
native_setup_msi_irqs
setup_msi_irq
setup_remapped_irq
default_setup_hpet_msi
setup_remapped_irq
that is not efficient.
We only need to modify those irq chip one time after we enable irq remapping.
Change irq_remap_modify_chip_defaults() to __init as it only gets called during booting stage, via irq_remap_modify_chips().
Affected irq_chip: ioapic_chip, msi_chip, hpet_msi_type. We don't need to use #ifdef in irq_remap_modify_chips():IRQ_REMAP only support x86_64 && X86_IO_APIC && PCI_MSI. HPET_TIMER is selected when x86_64 is set.
When we have IRQ_REMAP enabled, al three chips are defined and used.
-v3: Remove irq_chip in setup_remapped_irq according to Sebastian.
also add missing "\n" in printk.
--- arch/x86/include/asm/io_apic.h | 5 +++++ arch/x86/include/asm/irq_remapping.h | 8 ++------ arch/x86/kernel/apic/apic.c | 9 ++++++++- arch/x86/kernel/apic/io_apic.c | 14 ++++++-------- drivers/iommu/irq_remapping.c | 13 ++++++++++--- 5 files changed, 31 insertions(+), 18 deletions(-)
arch/x86/include/asm/io_apic.h +5 -0
@@ -215,6 +215,11 @@ static inline void io_apic_modify(unsigned int apic, unsigned int reg, unsignedextern void io_apic_eoi (unsigned int apic,unsigned int vector); +extern struct irq_chip ioapic_chip; +extern struct irq_chip msi_chip; +extern struct irq_chip hpet_msi_type; +void irq_remap_modify_chips (void ); +#else /* !CONFIG_X86_IO_APIC */ #define io_apic_assign_pci_irqs 0
arch/x86/include/asm/irq_remapping.h +2 -6
@@ -52,9 +52,7 @@ extern void compose_remapped_msi_msg(struct pci_dev *pdev, struct msi_msg *msg, u8 hpet_id);extern int setup_hpet_msi_remapped (unsigned int irq,unsigned int id);extern void panic_if_irq_remap (const char *msg); -extern bool setup_remapped_irq (int irq, -struct irq_cfg *cfg, -struct irq_chip *chip); +extern bool setup_remapped_irq (int irq,struct irq_cfg *cfg);#else /* CONFIG_IRQ_REMAP */
@@ -89,9 +87,7 @@ static inline void panic_if_irq_remap(const char *msg) { } -static inline bool setup_remapped_irq (int irq, -struct irq_cfg *cfg, -struct irq_chip *chip) +static inline bool setup_remapped_irq (int irq,struct irq_cfg *cfg) {return false; }
arch/x86/kernel/apic/apic.c +8 -1
@@ -1571,6 +1571,8 @@ void enable_x2apic(void)int __init enable_IR (void ) {#ifdef CONFIG_IRQ_REMAP +int ret; +if (!irq_remapping_supported ()) {pr_debug ("intr-remapping not supported\n" );return -1 ;
@@ -1582,7 +1584,12 @@ int __init enable_IR(void) return -1; } -return irq_remapping_enable (); + ret =irq_remapping_enable (); + +if (ret >=0 ) +irq_remap_modify_chips (); + +return ret;#endif return -1 ; }
arch/x86/kernel/apic/io_apic.c +6 -8
@@ -1238,8 +1238,6 @@ void __setup_vector_irq(int cpu)raw_spin_unlock (&vector_lock); } -static struct irq_chip ioapic_chip; -#ifdef CONFIG_X86_32 static inline int IO_APIC_irq_trigger (int irq) {
@@ -1280,7 +1278,7 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg, fasteoi = false; } -if (setup_remapped_irq (irq, cfg, chip)) +if (setup_remapped_irq (irq, cfg)) fasteoi = trigger !=0 ; hdl = fasteoi ? handle_fasteoi_irq : handle_edge_irq;
@@ -2511,7 +2509,7 @@ static void ack_apic_level(struct irq_data *data)ioapic_irqd_unmask (data, cfg, masked); } -static struct irq_chip ioapic_chip__read_mostly = { +struct irq_chip ioapic_chip__read_mostly = { .name ="IO-APIC" , .irq_startup = startup_ioapic_irq, .irq_mask = mask_ioapic_irq,
@@ -3093,7 +3091,7 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)* IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices, * which implement the MSI or MSI-X Capability Structure. */ -static struct irq_chip msi_chip = { +struct irq_chip msi_chip = { .name ="PCI-MSI" , .irq_unmask = unmask_msi_irq, .irq_mask = mask_msi_irq,
@@ -3123,7 +3121,7 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,if (!irq_offset)write_msi_msg (irq, &msg); -setup_remapped_irq (irq,irq_get_chip_data (irq), chip); +setup_remapped_irq (irq,irq_get_chip_data (irq));irq_set_chip_and_handler_name (irq, chip, handle_edge_irq,"edge" );
@@ -3240,7 +3238,7 @@ static int hpet_msi_set_affinity(struct irq_data *data,return IRQ_SET_MASK_OK_NOCOPY ; } -static struct irq_chip hpet_msi_type = { +struct irq_chip hpet_msi_type = { .name ="HPET_MSI" , .irq_unmask = hpet_msi_unmask, .irq_mask = hpet_msi_mask,
@@ -3261,7 +3259,7 @@ int default_setup_hpet_msi(unsigned int irq, unsigned int id)hpet_msi_write (irq_get_handler_data (irq), &msg);irq_set_status_flags (irq,IRQ_MOVE_PCNTXT ); -setup_remapped_irq (irq,irq_get_chip_data (irq), chip); +setup_remapped_irq (irq,irq_get_chip_data (irq));irq_set_chip_and_handler_name (irq, chip, handle_edge_irq,"edge" );return 0 ;
drivers/iommu/irq_remapping.c +10 -3
@@ -375,19 +375,26 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)seq_printf (p," IR-%s" , data->chip->name); } -static void irq_remap_modify_chip_defaults (struct irq_chip *chip) +static void __init irq_remap_modify_chip_defaults (struct irq_chip *chip) { +printk (KERN_DEBUG "irq_chip: %s ==> IR-%s\n" , chip->name, chip->name); chip->irq_print_chip = ir_print_prefix; chip->irq_ack = ir_ack_apic_edge; chip->irq_eoi = ir_ack_apic_level; chip->irq_set_affinity = x86_io_apic_ops.set_affinity; } -bool setup_remapped_irq (int irq,struct irq_cfg *cfg,struct irq_chip *chip) +void __init irq_remap_modify_chips (void ) +{ +irq_remap_modify_chip_defaults (&ioapic_chip); +irq_remap_modify_chip_defaults (&msi_chip); +irq_remap_modify_chip_defaults (&hpet_msi_type); +} + +bool setup_remapped_irq (int irq,struct irq_cfg *cfg) {if (!irq_remapped (cfg))return false;irq_set_status_flags (irq,IRQ_MOVE_PCNTXT ); -irq_remap_modify_chip_defaults (chip);return true; }
Signature · 1 line
1.8.1.4
PATCH 6/28 x86, irq: Show MSI-X clearly in debug message
In reply to Yinghai LuPrint out exact MSI or MSI-X instead of MSI/MSI-X.
--- arch/x86/kernel/apic/io_apic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/io_apic.c +2 -1
@@ -3125,7 +3125,8 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,irq_set_chip_and_handler_name (irq, chip, handle_edge_irq,"edge" ); -dev_printk (KERN_DEBUG , &dev->dev,"irq %d for MSI/MSI-X\n" , irq); +dev_printk (KERN_DEBUG , &dev->dev,"irq %d for MSI%s\n" , irq, + msidesc->msi_attrib.is_msix ?"-X" :"" );return 0 ; }
Signature · 1 line
1.8.1.4
PATCH 7/28 x86, irq: Show MSI-X in /proc/interrupt
In reply to Yinghai LuNow MSI-X is shown as MSI in /proc/interrupt.
We could use new added irq_print_chip() interface to append -X for MSI-X.
After this patch, we will have PCI-MSI-X-edge IR-PCI-MSI-X-edge for MSI-X instead of PCI-MSI-edge IR-PCI-MSI-edge in the /proc/interrupt.
-v2: do not need to check if msi_desc is null in msi_irq_print_chip().
--- arch/x86/kernel/apic/io_apic.c | 7 +++++++ drivers/iommu/irq_remapping.c | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-)
arch/x86/kernel/apic/io_apic.c +7 -0
@@ -3087,6 +3087,12 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)return IRQ_SET_MASK_OK_NOCOPY ; } +static void msi_irq_print_chip (struct irq_data *data,struct seq_file *p) +{ +seq_printf (p," %s%s" , data->chip->name, + data->msi_desc->msi_attrib.is_msix ?"-X" :"" ); +} +/* * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices, * which implement the MSI or MSI-X Capability Structure.
@@ -3098,6 +3104,7 @@ struct irq_chip msi_chip = { .irq_ack = ack_apic_edge, .irq_set_affinity = msi_set_affinity, .irq_retrigger = ioapic_retrigger_irq, + .irq_print_chip = msi_irq_print_chip, }; int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
drivers/iommu/irq_remapping.c +4 -1
@@ -372,7 +372,10 @@ static void ir_ack_apic_level(struct irq_data *data)static void ir_print_prefix (struct irq_data *data,struct seq_file *p) { -seq_printf (p," IR-%s" , data->chip->name); +seq_printf (p," IR-%s%s" , data->chip->name, + data->msi_desc ? + (data->msi_desc->msi_attrib.is_msix ?"-X" :"" ) + :"" ); }static void __init irq_remap_modify_chip_defaults (struct irq_chip *chip)
Signature · 1 line
1.8.1.4
PATCH 8/28 x86, irq: Make dmar_msi/hpet_msi irq_chip name consistent
In reply to Yinghai LuAll others are using "-" instead of "_".
Change dmar_msi and hpet_msi to use "-".
--- arch/x86/kernel/apic/io_apic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/apic/io_apic.c +2 -2
@@ -3199,7 +3199,7 @@ dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask, }static struct irq_chip dmar_msi_type = { - .name ="DMAR_MSI" , + .name ="DMAR-MSI" , .irq_unmask = dmar_msi_unmask, .irq_mask = dmar_msi_mask, .irq_ack = ack_apic_edge,
@@ -3247,7 +3247,7 @@ static int hpet_msi_set_affinity(struct irq_data *data, }struct irq_chip hpet_msi_type = { - .name ="HPET_MSI" , + .name ="HPET-MSI" , .irq_unmask = hpet_msi_unmask, .irq_mask = hpet_msi_mask, .irq_ack = ack_apic_edge,
Signature · 1 line
1.8.1.4
PATCH 9/28 ia64, irq: Add dummy create_irq_nr()
In reply to Yinghai Lucreate_irq() will return -1 when fail to allocate. create_irq_nr() will return 0 when fail to allocate.
Will use it to fix one return value checking for dmar_msi irq.
--- arch/ia64/kernel/irq_ia64.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/ia64/kernel/irq_ia64.c +10 -0
@@ -429,6 +429,16 @@ int create_irq(void)return irq; } +unsigned int create_irq_nr (unsigned int from,int node) +{ +int irq =create_irq (); + +if (irq <0 ) + irq =0 ; + +return irq; +} +void destroy_irq (unsigned int irq) {dynamic_irq_cleanup (irq);
Signature · 1 line
1.8.1.4
PATCH 10/28 iommu, irq: Allocate irq_desc for dmar_msi with local node
In reply to Yinghai Luiommu irq's irq_desc should be on local node ram.
Fix the return value checking problem.
create_irq() will return -1 when fail to allocate. create_irq_nr() will return 0 when fail to allocate.
here only check !irq, so need to change it to use create_irq_nr instead.
-v2: According to Sebastian, add cc to stable.
--- drivers/iommu/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/dmar.c +1 -1
@@ -1277,7 +1277,7 @@ int dmar_set_interrupt(struct intel_iommu *iommu)if (iommu->irq)return 0 ; - irq =create_irq (); + irq =create_irq_nr (0 , iommu->node);if (!irq) {pr_err ("IOMMU: no free vectors\n" );return -EINVAL ;
Signature · 1 line
1.8.1.4