From: Eric W. Biederman Date: Mon, 17 Oct 2011 18:46:06 +0000 (-0700) Subject: PCI: msi: Disable msi interrupts when we initialize a pci device X-Git-Tag: next-20111207~64^2~62 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d3fe695b816e2f33ee816ee0c69ccd95a830206f;p=karo-tx-linux.git PCI: msi: Disable msi interrupts when we initialize a pci device I traced a nasty kexec on panic boot failure to the fact that we had screaming msi interrupts and we were not disabling the msi messages at kernel startup. The booting kernel had not enabled those interupts so was not prepared to handle them. I can see no reason why we would ever want to leave the msi interrupts enabled at boot if something else has enabled those interrupts. The pci spec specifies that msi interrupts should be off by default. Drivers are expected to enable the msi interrupts if they want to use them. Our interrupt handling code reprograms the interrupt handlers at boot and will not be be able to do anything useful with an unexpected interrupt. This patch applies cleanly all of the way back to 2.6.32 where I noticed the problem. Cc: stable@kernel.org Signed-off-by: Eric W. Biederman Signed-off-by: Jesse Barnes --- diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index e6b6b9c67023..337e16ab4a92 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -981,5 +981,15 @@ EXPORT_SYMBOL(pci_msi_enabled); void pci_msi_init_pci_dev(struct pci_dev *dev) { + int pos; INIT_LIST_HEAD(&dev->msi_list); + + /* Disable the msi hardware to avoid screaming interrupts + * during boot. This is the power on reset default so + * usually this should be a noop. + */ + pos = pci_find_capability(dev, PCI_CAP_ID_MSI); + if (pos) + msi_set_enable(dev, pos, 0); + msix_set_enable(dev, 0); }