* [PATCH 5/15] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump
@ 2011-02-20 2:22 adam radford
2011-02-21 8:04 ` Hannes Reinecke
0 siblings, 1 reply; 2+ messages in thread
From: adam radford @ 2011-02-20 2:22 UTC (permalink / raw)
To: linux-scsi, Bo.Yang
[-- Attachment #1: Type: text/plain, Size: 1755 bytes --]
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@gmail.com>
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 #2: megaraid_sas.patch5 --]
[-- Type: application/octet-stream, Size: 1538 bytes --]
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 */
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH 5/15] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump
2011-02-20 2:22 [PATCH 5/15] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump adam radford
@ 2011-02-21 8:04 ` Hannes Reinecke
0 siblings, 0 replies; 2+ messages in thread
From: Hannes Reinecke @ 2011-02-21 8:04 UTC (permalink / raw)
To: adam radford; +Cc: linux-scsi, Bo.Yang
On 02/20/2011 03:22 AM, adam radford wrote:
> 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.
>
This is actually the one bit where I'm quite puzzled by.
Problem here is the pci_enable_msix() actually fails when MSI-X is
already enabled. Which is odd, given that MSI-X _is_ enabled
already, so taken at face value pci_enable_msix() shouldn't fail here.
I know that there are several stages to the MSI-X initialisation, so
this is the safe route here. But I also have seen _LOTS_ of failures
with kdump and raid HBAs, most of which point to the same problem here.
Can't we put in a 'force' parameter to pci_enable_msix() to avoid
having to code this one in each and every driver?
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-21 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-20 2:22 [PATCH 5/15] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump adam radford
2011-02-21 8:04 ` Hannes Reinecke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.