diff options
author | Yinghai Lu <yhlu.kernel.send@gmail.com> | 2008-04-23 17:58:09 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@hobbes.lan> | 2008-04-29 12:12:51 -0400 |
commit | d52877c7b1afb8c37ebe17e2005040b79cb618b0 (patch) | |
tree | b5cc4252cad0d7f22a6b63e50d1ec46a9a495773 | |
parent | 8e149e09f91098fd72bf9ac5b4a77a693abf721e (diff) |
pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2
[PATCH 2/2] pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2
this change
| commit 23a274c8a5adafc74a66f16988776fc7dd6f6e51
| Author: Prakash, Sathya <sathya.prakash@lsi.com>
| Date: Fri Mar 7 15:53:21 2008 +0530
|
| [SCSI] mpt fusion: Enable MSI by default for SAS controllers
|
| This patch modifies the driver to enable MSI by default for all SAS chips.
|
| Signed-off-by: Sathya Prakash <sathya.prakash@lsi.com>
| Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
|
Causes the kexec of a RHEL 5.1 kernel to fail.
root casue: the rhel 5.1 kernel still uses INTx emulation. and
mptscsih_shutdown doesn't call pci_disable_msi to reenable INTx on kexec path
So call pci_msi_shutdown in the shutdown path to do the same thing to msix
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Jesse Barnes <jbarnes@hobbes.lan>
-rw-r--r-- | drivers/pci/msi.c | 35 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 2 | ||||
-rw-r--r-- | include/linux/pci.h | 6 |
3 files changed, 34 insertions, 9 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index e3a05cc9a595..8c61304cbb37 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -571,10 +571,9 @@ int pci_enable_msi(struct pci_dev* dev) | |||
571 | } | 571 | } |
572 | EXPORT_SYMBOL(pci_enable_msi); | 572 | EXPORT_SYMBOL(pci_enable_msi); |
573 | 573 | ||
574 | void pci_disable_msi(struct pci_dev* dev) | 574 | void pci_msi_shutdown(struct pci_dev* dev) |
575 | { | 575 | { |
576 | struct msi_desc *entry; | 576 | struct msi_desc *entry; |
577 | int default_irq; | ||
578 | 577 | ||
579 | if (!pci_msi_enable || !dev || !dev->msi_enabled) | 578 | if (!pci_msi_enable || !dev || !dev->msi_enabled) |
580 | return; | 579 | return; |
@@ -590,15 +589,26 @@ void pci_disable_msi(struct pci_dev* dev) | |||
590 | u32 mask = entry->msi_attrib.maskbits_mask; | 589 | u32 mask = entry->msi_attrib.maskbits_mask; |
591 | msi_set_mask_bits(dev->irq, mask, ~mask); | 590 | msi_set_mask_bits(dev->irq, mask, ~mask); |
592 | } | 591 | } |
593 | if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { | 592 | if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) |
594 | return; | 593 | return; |
595 | } | ||
596 | |||
597 | default_irq = entry->msi_attrib.default_irq; | ||
598 | msi_free_irqs(dev); | ||
599 | 594 | ||
600 | /* Restore dev->irq to its default pin-assertion irq */ | 595 | /* Restore dev->irq to its default pin-assertion irq */ |
601 | dev->irq = default_irq; | 596 | dev->irq = entry->msi_attrib.default_irq; |
597 | } | ||
598 | void pci_disable_msi(struct pci_dev* dev) | ||
599 | { | ||
600 | struct msi_desc *entry; | ||
601 | |||
602 | if (!pci_msi_enable || !dev || !dev->msi_enabled) | ||
603 | return; | ||
604 | |||
605 | pci_msi_shutdown(dev); | ||
606 | |||
607 | entry = list_entry(dev->msi_list.next, struct msi_desc, list); | ||
608 | if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) | ||
609 | return; | ||
610 | |||
611 | msi_free_irqs(dev); | ||
602 | } | 612 | } |
603 | EXPORT_SYMBOL(pci_disable_msi); | 613 | EXPORT_SYMBOL(pci_disable_msi); |
604 | 614 | ||
@@ -691,7 +701,7 @@ static void msix_free_all_irqs(struct pci_dev *dev) | |||
691 | msi_free_irqs(dev); | 701 | msi_free_irqs(dev); |
692 | } | 702 | } |
693 | 703 | ||
694 | void pci_disable_msix(struct pci_dev* dev) | 704 | void pci_msix_shutdown(struct pci_dev* dev) |
695 | { | 705 | { |
696 | if (!pci_msi_enable || !dev || !dev->msix_enabled) | 706 | if (!pci_msi_enable || !dev || !dev->msix_enabled) |
697 | return; | 707 | return; |
@@ -699,6 +709,13 @@ void pci_disable_msix(struct pci_dev* dev) | |||
699 | msix_set_enable(dev, 0); | 709 | msix_set_enable(dev, 0); |
700 | pci_intx_for_msi(dev, 1); | 710 | pci_intx_for_msi(dev, 1); |
701 | dev->msix_enabled = 0; | 711 | dev->msix_enabled = 0; |
712 | } | ||
713 | void pci_disable_msix(struct pci_dev* dev) | ||
714 | { | ||
715 | if (!pci_msi_enable || !dev || !dev->msix_enabled) | ||
716 | return; | ||
717 | |||
718 | pci_msix_shutdown(dev); | ||
702 | 719 | ||
703 | msix_free_all_irqs(dev); | 720 | msix_free_all_irqs(dev); |
704 | } | 721 | } |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index e8d94fafc280..72cf61ed8f96 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -360,6 +360,8 @@ static void pci_device_shutdown(struct device *dev) | |||
360 | 360 | ||
361 | if (drv && drv->shutdown) | 361 | if (drv && drv->shutdown) |
362 | drv->shutdown(pci_dev); | 362 | drv->shutdown(pci_dev); |
363 | pci_msi_shutdown(pci_dev); | ||
364 | pci_msix_shutdown(pci_dev); | ||
363 | } | 365 | } |
364 | 366 | ||
365 | /** | 367 | /** |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 7a0770d4c4e2..e09c57e9c373 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -701,6 +701,8 @@ static inline int pci_enable_msi(struct pci_dev *dev) | |||
701 | return -1; | 701 | return -1; |
702 | } | 702 | } |
703 | 703 | ||
704 | static inline void pci_msi_shutdown(struct pci_dev *dev) | ||
705 | { } | ||
704 | static inline void pci_disable_msi(struct pci_dev *dev) | 706 | static inline void pci_disable_msi(struct pci_dev *dev) |
705 | { } | 707 | { } |
706 | 708 | ||
@@ -710,6 +712,8 @@ static inline int pci_enable_msix(struct pci_dev *dev, | |||
710 | return -1; | 712 | return -1; |
711 | } | 713 | } |
712 | 714 | ||
715 | static inline void pci_msix_shutdown(struct pci_dev *dev) | ||
716 | { } | ||
713 | static inline void pci_disable_msix(struct pci_dev *dev) | 717 | static inline void pci_disable_msix(struct pci_dev *dev) |
714 | { } | 718 | { } |
715 | 719 | ||
@@ -720,9 +724,11 @@ static inline void pci_restore_msi_state(struct pci_dev *dev) | |||
720 | { } | 724 | { } |
721 | #else | 725 | #else |
722 | extern int pci_enable_msi(struct pci_dev *dev); | 726 | extern int pci_enable_msi(struct pci_dev *dev); |
727 | extern void pci_msi_shutdown(struct pci_dev *dev); | ||
723 | extern void pci_disable_msi(struct pci_dev *dev); | 728 | extern void pci_disable_msi(struct pci_dev *dev); |
724 | extern int pci_enable_msix(struct pci_dev *dev, | 729 | extern int pci_enable_msix(struct pci_dev *dev, |
725 | struct msix_entry *entries, int nvec); | 730 | struct msix_entry *entries, int nvec); |
731 | extern void pci_msix_shutdown(struct pci_dev *dev); | ||
726 | extern void pci_disable_msix(struct pci_dev *dev); | 732 | extern void pci_disable_msix(struct pci_dev *dev); |
727 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); | 733 | extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); |
728 | extern void pci_restore_msi_state(struct pci_dev *dev); | 734 | extern void pci_restore_msi_state(struct pci_dev *dev); |