Commit d52877c7 authored by Yinghai Lu's avatar Yinghai Lu Committed by Jesse Barnes

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 23a274c8
| 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: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@hobbes.lan>
parent 8e149e09
...@@ -571,10 +571,9 @@ int pci_enable_msi(struct pci_dev* dev) ...@@ -571,10 +571,9 @@ int pci_enable_msi(struct pci_dev* dev)
} }
EXPORT_SYMBOL(pci_enable_msi); EXPORT_SYMBOL(pci_enable_msi);
void pci_disable_msi(struct pci_dev* dev) void pci_msi_shutdown(struct pci_dev* dev)
{ {
struct msi_desc *entry; struct msi_desc *entry;
int default_irq;
if (!pci_msi_enable || !dev || !dev->msi_enabled) if (!pci_msi_enable || !dev || !dev->msi_enabled)
return; return;
...@@ -590,15 +589,26 @@ void pci_disable_msi(struct pci_dev* dev) ...@@ -590,15 +589,26 @@ void pci_disable_msi(struct pci_dev* dev)
u32 mask = entry->msi_attrib.maskbits_mask; u32 mask = entry->msi_attrib.maskbits_mask;
msi_set_mask_bits(dev->irq, mask, ~mask); msi_set_mask_bits(dev->irq, mask, ~mask);
} }
if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) { if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI)
return; return;
}
default_irq = entry->msi_attrib.default_irq;
msi_free_irqs(dev);
/* Restore dev->irq to its default pin-assertion irq */ /* Restore dev->irq to its default pin-assertion irq */
dev->irq = default_irq; dev->irq = entry->msi_attrib.default_irq;
}
void pci_disable_msi(struct pci_dev* dev)
{
struct msi_desc *entry;
if (!pci_msi_enable || !dev || !dev->msi_enabled)
return;
pci_msi_shutdown(dev);
entry = list_entry(dev->msi_list.next, struct msi_desc, list);
if (!entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI)
return;
msi_free_irqs(dev);
} }
EXPORT_SYMBOL(pci_disable_msi); EXPORT_SYMBOL(pci_disable_msi);
...@@ -691,7 +701,7 @@ static void msix_free_all_irqs(struct pci_dev *dev) ...@@ -691,7 +701,7 @@ static void msix_free_all_irqs(struct pci_dev *dev)
msi_free_irqs(dev); msi_free_irqs(dev);
} }
void pci_disable_msix(struct pci_dev* dev) void pci_msix_shutdown(struct pci_dev* dev)
{ {
if (!pci_msi_enable || !dev || !dev->msix_enabled) if (!pci_msi_enable || !dev || !dev->msix_enabled)
return; return;
...@@ -699,6 +709,13 @@ void pci_disable_msix(struct pci_dev* dev) ...@@ -699,6 +709,13 @@ void pci_disable_msix(struct pci_dev* dev)
msix_set_enable(dev, 0); msix_set_enable(dev, 0);
pci_intx_for_msi(dev, 1); pci_intx_for_msi(dev, 1);
dev->msix_enabled = 0; dev->msix_enabled = 0;
}
void pci_disable_msix(struct pci_dev* dev)
{
if (!pci_msi_enable || !dev || !dev->msix_enabled)
return;
pci_msix_shutdown(dev);
msix_free_all_irqs(dev); msix_free_all_irqs(dev);
} }
......
...@@ -360,6 +360,8 @@ static void pci_device_shutdown(struct device *dev) ...@@ -360,6 +360,8 @@ static void pci_device_shutdown(struct device *dev)
if (drv && drv->shutdown) if (drv && drv->shutdown)
drv->shutdown(pci_dev); drv->shutdown(pci_dev);
pci_msi_shutdown(pci_dev);
pci_msix_shutdown(pci_dev);
} }
/** /**
......
...@@ -701,6 +701,8 @@ static inline int pci_enable_msi(struct pci_dev *dev) ...@@ -701,6 +701,8 @@ static inline int pci_enable_msi(struct pci_dev *dev)
return -1; return -1;
} }
static inline void pci_msi_shutdown(struct pci_dev *dev)
{ }
static inline void pci_disable_msi(struct pci_dev *dev) static inline void pci_disable_msi(struct pci_dev *dev)
{ } { }
...@@ -710,6 +712,8 @@ static inline int pci_enable_msix(struct pci_dev *dev, ...@@ -710,6 +712,8 @@ static inline int pci_enable_msix(struct pci_dev *dev,
return -1; return -1;
} }
static inline void pci_msix_shutdown(struct pci_dev *dev)
{ }
static inline void pci_disable_msix(struct pci_dev *dev) static inline void pci_disable_msix(struct pci_dev *dev)
{ } { }
...@@ -720,9 +724,11 @@ static inline void pci_restore_msi_state(struct pci_dev *dev) ...@@ -720,9 +724,11 @@ static inline void pci_restore_msi_state(struct pci_dev *dev)
{ } { }
#else #else
extern int pci_enable_msi(struct pci_dev *dev); extern int pci_enable_msi(struct pci_dev *dev);
extern void pci_msi_shutdown(struct pci_dev *dev);
extern void pci_disable_msi(struct pci_dev *dev); extern void pci_disable_msi(struct pci_dev *dev);
extern int pci_enable_msix(struct pci_dev *dev, extern int pci_enable_msix(struct pci_dev *dev,
struct msix_entry *entries, int nvec); struct msix_entry *entries, int nvec);
extern void pci_msix_shutdown(struct pci_dev *dev);
extern void pci_disable_msix(struct pci_dev *dev); extern void pci_disable_msix(struct pci_dev *dev);
extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
extern void pci_restore_msi_state(struct pci_dev *dev); extern void pci_restore_msi_state(struct pci_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment