[PATCH 5/15] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James/Linux-scsi,

The following patch for megaraid_sas fixes megasas_probe_one() to
clear MSI-X flags in kdump when the 'reset_devices' kernel parameter
is passed in.

Signed-off-by: Adam Radford <aradford@xxxxxxxxx>

diff -Naur linux-2.6.38-rc5/drivers/scsi/megaraid/megaraid_sas_base.c
linux-2.6.38-rc5.new/drivers/scsi/megaraid/megaraid_sas_base.c
--- linux-2.6.38-rc5/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-19
13:58:52.649363761 -0800
+++ linux-2.6.38-rc5.new/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-19
14:01:52.407362948 -0800
@@ -3901,9 +3901,26 @@
 static int __devinit
 megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-	int rval;
+	int rval, pos;
 	struct Scsi_Host *host;
 	struct megasas_instance *instance;
+	u16 control = 0;
+
+	/* Reset MSI-X in the kdump kernel */
+	if (reset_devices) {
+		pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
+		if (pos) {
+			pci_read_config_word(pdev, msi_control_reg(pos),
+					     &control);
+			if (control & PCI_MSIX_FLAGS_ENABLE) {
+				dev_info(&pdev->dev, "resetting MSI-X\n");
+				pci_write_config_word(pdev,
+						      msi_control_reg(pos),
+						      control &
+						      ~PCI_MSIX_FLAGS_ENABLE);
+			}
+		}
+	}

 	/*
 	 * Announce PCI information
diff -Naur linux-2.6.38-rc5/drivers/scsi/megaraid/megaraid_sas.h
linux-2.6.38-rc5.new/drivers/scsi/megaraid/megaraid_sas.h
--- linux-2.6.38-rc5/drivers/scsi/megaraid/megaraid_sas.h	2011-02-15
19:23:45.000000000 -0800
+++ linux-2.6.38-rc5.new/drivers/scsi/megaraid/megaraid_sas.h	2011-02-19
14:04:00.565333377 -0800
@@ -1477,4 +1477,7 @@
 	int max_index;
 };

+#define msi_control_reg(base) (base + PCI_MSI_FLAGS)
+#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
+
 #endif				/*LSI_MEGARAID_SAS_H */

Attachment: megaraid_sas.patch5
Description: Binary data


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux