The patch titled msi: only use a single irq_chip for msi interrupts has been added to the -mm tree. Its filename is msi-only-use-a-single-irq_chip-for-msi-interrupts.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: msi: only use a single irq_chip for msi interrupts From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> The logic works like this. Since we no longer track the state logic by hand in msi.c startup and shutdown are no longer needed. By updating msi_set_mask_bit to work on msi devices that do not implement a mask bit we can always call the mask/unmask functions. What we really have are mask and unmask so we use them to implement the .mask and .unmask functions instead of .enable and .disable. By switching to the handle_edge_irq handler we only need an ack function that moves the irq if necessary. Which removes the old end and ack functions and their peculiar logic of sometimes disabling an irq. This removes the reliance on pre genirq irq handling methods. Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Cc: Andi Kleen <ak@xxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Cc: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/pci/msi.c | 115 +++++++++----------------------------------- 1 files changed, 24 insertions(+), 91 deletions(-) diff -puN drivers/pci/msi.c~msi-only-use-a-single-irq_chip-for-msi-interrupts drivers/pci/msi.c --- a/drivers/pci/msi.c~msi-only-use-a-single-irq_chip-for-msi-interrupts +++ a/drivers/pci/msi.c @@ -53,21 +53,20 @@ static void msi_set_mask_bit(unsigned in struct msi_desc *entry; entry = msi_desc[irq]; - if (!entry || !entry->dev || !entry->mask_base) - return; + BUG_ON(!entry || !entry->dev); switch (entry->msi_attrib.type) { case PCI_CAP_ID_MSI: - { - int pos; - u32 mask_bits; - - pos = (long)entry->mask_base; - pci_read_config_dword(entry->dev, pos, &mask_bits); - mask_bits &= ~(1); - mask_bits |= flag; - pci_write_config_dword(entry->dev, pos, mask_bits); + if (entry->msi_attrib.maskbit) { + int pos; + u32 mask_bits; + + pos = (long)entry->mask_base; + pci_read_config_dword(entry->dev, pos, &mask_bits); + mask_bits &= ~(1); + mask_bits |= flag; + pci_write_config_dword(entry->dev, pos, mask_bits); + } break; - } case PCI_CAP_ID_MSIX: { int offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + @@ -76,6 +75,7 @@ static void msi_set_mask_bit(unsigned in break; } default: + BUG(); break; } } @@ -186,83 +186,21 @@ static void unmask_MSI_irq(unsigned int msi_set_mask_bit(irq, 0); } -static unsigned int startup_msi_irq_wo_maskbit(unsigned int irq) -{ - return 0; /* never anything pending */ -} - -static unsigned int startup_msi_irq_w_maskbit(unsigned int irq) -{ - startup_msi_irq_wo_maskbit(irq); - unmask_MSI_irq(irq); - return 0; /* never anything pending */ -} - -static void shutdown_msi_irq(unsigned int irq) -{ -} - -static void end_msi_irq_wo_maskbit(unsigned int irq) -{ - move_native_irq(irq); - ack_APIC_irq(); -} - -static void end_msi_irq_w_maskbit(unsigned int irq) +static void ack_msi_irq(unsigned int irq) { move_native_irq(irq); - unmask_MSI_irq(irq); ack_APIC_irq(); } -static void do_nothing(unsigned int irq) -{ -} - /* - * Interrupt Type for MSI-X PCI/PCI-X/PCI-Express Devices, - * which implement the MSI-X Capability Structure. + * IRQ Chip for MSI PCI/PCI-X/PCI-Express Devices, + * which implement the MSI or MSI-X Capability Structure. */ -static struct hw_interrupt_type msix_irq_type = { - .typename = "PCI-MSI-X", - .startup = startup_msi_irq_w_maskbit, - .shutdown = shutdown_msi_irq, - .enable = unmask_MSI_irq, - .disable = mask_MSI_irq, - .ack = mask_MSI_irq, - .end = end_msi_irq_w_maskbit, - .set_affinity = set_msi_affinity -}; - -/* - * Interrupt Type for MSI PCI/PCI-X/PCI-Express Devices, - * which implement the MSI Capability Structure with - * Mask-and-Pending Bits. - */ -static struct hw_interrupt_type msi_irq_w_maskbit_type = { - .typename = "PCI-MSI", - .startup = startup_msi_irq_w_maskbit, - .shutdown = shutdown_msi_irq, - .enable = unmask_MSI_irq, - .disable = mask_MSI_irq, - .ack = mask_MSI_irq, - .end = end_msi_irq_w_maskbit, - .set_affinity = set_msi_affinity -}; - -/* - * Interrupt Type for MSI PCI/PCI-X/PCI-Express Devices, - * which implement the MSI Capability Structure without - * Mask-and-Pending Bits. - */ -static struct hw_interrupt_type msi_irq_wo_maskbit_type = { - .typename = "PCI-MSI", - .startup = startup_msi_irq_wo_maskbit, - .shutdown = shutdown_msi_irq, - .enable = do_nothing, - .disable = do_nothing, - .ack = do_nothing, - .end = end_msi_irq_wo_maskbit, +static struct irq_chip msi_chip = { + .name = "PCI-MSI", + .unmask = unmask_MSI_irq, + .mask = mask_MSI_irq, + .ack = ack_msi_irq, .set_affinity = set_msi_affinity }; @@ -330,7 +268,7 @@ static void attach_msi_entry(struct msi_ spin_unlock_irqrestore(&msi_lock, flags); } -static int create_msi_irq(struct hw_interrupt_type *handler) +static int create_msi_irq(struct irq_chip *chip) { struct msi_desc *entry; int irq; @@ -345,7 +283,7 @@ static int create_msi_irq(struct hw_inte return -EBUSY; } - set_irq_chip(irq, handler); + set_irq_chip_and_handler(irq, chip, handle_edge_irq); set_irq_data(irq, entry); return irq; @@ -634,16 +572,11 @@ static int msi_capability_init(struct pc struct msi_desc *entry; int pos, irq; u16 control; - struct hw_interrupt_type *handler; pos = pci_find_capability(dev, PCI_CAP_ID_MSI); pci_read_config_word(dev, msi_control_reg(pos), &control); /* MSI Entry Initialization */ - handler = &msi_irq_wo_maskbit_type; - if (is_mask_bit_support(control)) - handler = &msi_irq_w_maskbit_type; - - irq = create_msi_irq(handler); + irq = create_msi_irq(&msi_chip); if (irq < 0) return irq; @@ -715,7 +648,7 @@ static int msix_capability_init(struct p /* MSI-X Table Initialization */ for (i = 0; i < nvec; i++) { - irq = create_msi_irq(&msix_irq_type); + irq = create_msi_irq(&msi_chip); if (irq < 0) break; _ Patches currently in -mm which might be from ebiederm@xxxxxxxxxxxx are origin.patch git-scsi-misc.patch fix-conflict-with-the-is_init-identifier-on-parisc.patch pidspace-is_init.patch simplify-update_times-avoid-jiffies-jiffies_64-aliasing-problem-2.patch kexec-warning-fix.patch kill-extraneous-printk-in-kernel_restart.patch fix-mem_write-return-value.patch kcore-elf-note-namesz-field-fix.patch stack-overflow-safe-kdump-safe_smp_processor_id.patch stack-overflow-safe-kdump-safe_smp_processor_id_voyager.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id.patch stack-overflow-safe-kdump-crash_use_safe_smp_processor_id-fix.patch stack-overflow-safe-kdump-safe_smp_send_nmi_allbutself.patch proc-readdir-race-fix-take-3.patch proc-readdir-race-fix-take-3-race-fix.patch proc-reorder-the-functions-in-basec.patch proc-modify-proc_pident_lookup-to-be-completely-table-driven.patch proc-give-the-root-directory-a-task.patch pid-implement-access-helpers-for-a-tacks-various-process-groups.patch pid-add-do_each_pid_task.patch pid-implement-signal-functions-that-take-a-struct-pid.patch pid-export-the-symbols-needed-to-use-struct-pid.patch pid-implement-pid_nr.patch vt-rework-the-console-spawning-variables.patch vt-make-vt_pid-a-struct-pid-making-it-pid-wrap-around-safe.patch file-modify-struct-fown_struct-to-use-a-struct-pid.patch file-modify-struct-fown_struct-to-use-a-struct-pid-fix.patch pids-coding-style-use-struct-pidmap.patch proc-readdir-race-fix-take-3-fix-1.patch simplify-pid-iterators.patch move-pidmap-to-pspaceh.patch move-pidmap-to-pspaceh-fix.patch define-struct-pspace.patch proc-readdir-race-fix-take-3-fix-2.patch update-mq_notify-to-use-a-struct-pid.patch file-add-locking-to-f_getown.patch usb-fixup-usb-so-it-uses-struct-pid.patch s390-update-fs3270-to-use-a-struct-pid.patch proc-sysctl-add-_proc_do_string-helper.patch namespaces-add-nsproxy.patch namespaces-add-nsproxy-move-init_nsproxy-into-kernel-nsproxyc.patch namespaces-incorporate-fs-namespace-into-nsproxy.patch namespaces-incorporate-fs-namespace-into-nsproxy-whitespace.patch namespaces-exit_task_namespaces-invalidates-nsproxy.patch namespaces-utsname-introduce-temporary-helpers.patch namespaces-utsname-switch-to-using-uts-namespaces.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit.patch namespaces-utsname-use-init_utsname-when-appropriate-klibc-bit.patch namespaces-utsname-switch-to-using-uts-namespaces-klibc-bit-2.patch namespaces-utsname-use-init_utsname-when-appropriate.patch namespaces-utsname-implement-utsname-namespaces.patch namespaces-utsname-sysctl-hack.patch namespaces-utsname-remove-system_utsname.patch namespaces-utsname-implement-clone_newuts-flag.patch namespaces-utsname-implement-clone_newuts-flag-fix.patch uts-copy-nsproxy-only-when-needed.patch ipc-namespace-core.patch ipc-namespace-utils.patch proc-make-the-generation-of-the-self-symlink-table-driven.patch proc-factor-out-an-instantiate-method-from-every-lookup-method.patch proc-remove-the-hard-coded-inode-numbers.patch proc-merge-proc_tid_attr-and-proc_tgid_attr.patch proc-use-pid_task-instead-of-open-coding-it.patch proc-convert-task_sig-to-use-lock_task_sighand.patch proc-convert-do_task_stat-to-use-lock_task_sighand.patch proc-drop-tasklist-lock-in-task_state.patch proc-properly-compute-tgid_offset.patch proc-remove-trailing-blank-entry-from-pid_entry-arrays.patch proc-remove-the-useless-smp-safe-comments-from-proc.patch proc-comment-what-proc_fill_cache-does.patch introduce-get_task_pid-to-fix-unsafe-get_pid.patch replace-cad_pid-by-a-struct-pid.patch replace-cad_pid-by-a-struct-pid-fixes.patch genirq-msi-restore-__do_irq-compat-logic-temporarily.patch genirq-irq-convert-the-move_irq-flag-from-a-32bit-word-to-a-single-bit.patch genirq-irq-add-moved_masked_irq.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-msi-make-the-msi-boolean-tests-return-either-0-or-1.patch genirq-msi-implement-helper-functions-read_msi_msg-and-write_msi_msg.patch genirq-msi-refactor-the-msi_ops.patch genirq-msi-simplify-the-msi-irq-limit-policy.patch genirq-irq-add-a-dynamic-irq-creation-api.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-i386-irq-dynamic-irq-support.patch genirq-x86_64-irq-dynamic-irq-support.patch genirq-msi-make-the-msi-code-irq-based-and-not-vector-based.patch genirq-x86_64-irq-move-msi-message-composition-into-io_apicc.patch genirq-i386-irq-move-msi-message-composition-into-io_apicc.patch genirq-msi-only-build-msi-apicc-on-ia64.patch genirq-msi-only-build-msi-apicc-on-ia64-fix.patch genirq-x86_64-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-irq-remove-msi-hacks.patch genirq-irq-generalize-the-check-for-hardirq_bits.patch genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number.patch genirq-x86_64-irq-make-vector_irq-per-cpu.patch genirq-x86_64-irq-make-vector_irq-per-cpu-fix.patch genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch genirq-x86_64-irq-kill-gsi_irq_sharing.patch genirq-x86_64-irq-kill-irq-compression.patch add-hypertransport-capability-defines.patch add-hypertransport-capability-defines-fix.patch initial-generic-hypertransport-interrupt-support.patch initial-generic-hypertransport-interrupt-support-Kconfig-fix.patch msi-simplify-msi-sanity-checks-by-adding-with-generic-irq-code.patch msi-only-use-a-single-irq_chip-for-msi-interrupts.patch msi-refactor-and-move-the-msi-irq_chip-into-the-arch-code.patch msi-move-the-ia64-code-into-arch-ia64.patch htirq-tidy-up-the-htirq-code.patch pidhash-temporary-debug-checks.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html