public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yhlu.kernel.send@gmail.com>
To: "Andrew Morton" <akpm@linux-foundation.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"Jesse Barnes" <jbarnes@virtuousgeek.org>
Cc: "Greg KH" <greg@kroah.com>, "David Miller" <davem@davemloft.net>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Jeff Garzik" <jeff@garzik.org>,
	"linux-pci" <linux-pci@atrey.karlin.mff.cuni.cz>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Sathya Prakash <sathya.prakash@lsi.com>
Subject: [PATCH] pci: let pci_device_shutdown to call pci_disable_msi
Date: Tue, 22 Apr 2008 21:48:16 -0700	[thread overview]
Message-ID: <200804222148.17530.yhlu.kernel@gmail.com> (raw)


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>
|
cause kexec RHEL 5.1 kernel fail.

root casue: the rhel 5.1 kernel still use INTx emulation.
and mptscsih_shutdown doesn't call pci_disable_msi to reenable INTx on kexec path

so try to call pci_disable_msi in shutdown patch

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

Index: linux-2.6/drivers/pci/pci-driver.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci-driver.c
+++ linux-2.6/drivers/pci/pci-driver.c
@@ -360,6 +360,8 @@ static void pci_device_shutdown(struct d
 
 	if (drv && drv->shutdown)
 		drv->shutdown(pci_dev);
+	pci_disable_msi_simple(pci_dev);
+	pci_disable_msix_simple(pci_dev);
 }
 
 /**
Index: linux-2.6/include/linux/pci.h
===================================================================
--- linux-2.6.orig/include/linux/pci.h
+++ linux-2.6/include/linux/pci.h
@@ -722,9 +722,11 @@ static inline void pci_restore_msi_state
 { }
 #else
 extern int pci_enable_msi(struct pci_dev *dev);
+extern void pci_disable_msi_simple(struct pci_dev *dev);
 extern void pci_disable_msi(struct pci_dev *dev);
 extern int pci_enable_msix(struct pci_dev *dev,
 	struct msix_entry *entries, int nvec);
+extern void pci_disable_msix_simple(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 pci_restore_msi_state(struct pci_dev *dev);
Index: linux-2.6/drivers/pci/msi.c
===================================================================
--- linux-2.6.orig/drivers/pci/msi.c
+++ linux-2.6/drivers/pci/msi.c
@@ -569,7 +569,7 @@ int pci_enable_msi(struct pci_dev* dev)
 }
 EXPORT_SYMBOL(pci_enable_msi);
 
-void pci_disable_msi(struct pci_dev* dev)
+static void __pci_disable_msi(struct pci_dev* dev, int msi_free)
 {
 	struct msi_desc *entry;
 	int default_irq;
@@ -591,11 +591,20 @@ void pci_disable_msi(struct pci_dev* dev
 	}
 
 	default_irq = entry->msi_attrib.default_irq;
-	msi_free_irqs(dev);
+	if (msi_free)
+		msi_free_irqs(dev);
 
 	/* Restore dev->irq to its default pin-assertion irq */
 	dev->irq = default_irq;
 }
+void pci_disable_msi_simple(struct pci_dev* dev)
+{
+	__pci_disable_msi(dev, 0);
+}
+void pci_disable_msi(struct pci_dev* dev)
+{
+	__pci_disable_msi(dev, 1);
+}
 EXPORT_SYMBOL(pci_disable_msi);
 
 static int msi_free_irqs(struct pci_dev* dev)
@@ -687,7 +696,7 @@ static void msix_free_all_irqs(struct pc
 	msi_free_irqs(dev);
 }
 
-void pci_disable_msix(struct pci_dev* dev)
+static void __pci_disable_msix(struct pci_dev* dev, int msix_free)
 {
 	if (!pci_msi_enable || !dev || !dev->msix_enabled)
 		return;
@@ -696,7 +705,16 @@ void pci_disable_msix(struct pci_dev* de
 	pci_intx_for_msi(dev, 1);
 	dev->msix_enabled = 0;
 
-	msix_free_all_irqs(dev);
+	if (msix_free)
+		msix_free_all_irqs(dev);
+}
+void pci_disable_msix_simple(struct pci_dev* dev)
+{
+	__pci_disable_msix(dev, 0);
+}
+void pci_disable_msix(struct pci_dev* dev)
+{
+	__pci_disable_msix(dev, 1);
 }
 EXPORT_SYMBOL(pci_disable_msix);
 

             reply	other threads:[~2008-04-23  4:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23  4:48 Yinghai Lu [this message]
2008-04-23  5:24 ` [PATCH] pci: let pci_device_shutdown to call pci_disable_msi Michael Ellerman
2008-04-23  6:08   ` Yinghai Lu
2008-04-23 13:08   ` Eric W. Biederman
2008-04-23 17:31     ` Yinghai Lu
2008-04-24  0:17     ` Michael Ellerman
2008-04-24  1:22       ` Yinghai Lu
2008-04-24  2:11         ` Yinghai Lu
2008-04-23 12:57 ` Eric W. Biederman
2008-04-23 17:32   ` Yinghai Lu
2008-04-23 21:56 ` [PATCH 1/2] pci/irq: restore mask_bits in msi shutdown -v3 Yinghai Lu
2008-04-23 21:58   ` [PATCH 2/2] pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2 Yinghai Lu
2008-04-25  0:40   ` [PATCH 1/2] pci/irq: restore mask_bits in msi shutdown -v3 Yinghai Lu
2008-04-25 21:48   ` Jesse Barnes
2008-04-25 22:08     ` Yinghai Lu
2008-04-29 16:13       ` Jesse Barnes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804222148.17530.yhlu.kernel@gmail.com \
    --to=yhlu.kernel.send@gmail.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=mingo@elte.hu \
    --cc=sathya.prakash@lsi.com \
    --cc=yhlu.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox