linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/14] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump
@ 2011-02-25  4:56 adam radford
  2011-03-30 12:30 ` Tomas Henzl
  0 siblings, 1 reply; 4+ messages in thread
From: adam radford @ 2011-02-25  4:56 UTC (permalink / raw)
  To: linux-scsi, Bo.Yang

[-- Attachment #1: Type: text/plain, Size: 1731 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 scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas_base.c
scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas_base.c
--- scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-24
18:43:13.853276151 -0800
+++ scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-24
18:47:27.480306538 -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 scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas.h
scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas.h
--- scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas.h	2011-02-24
18:03:29.324307767 -0800
+++ scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas.h	2011-02-24
18:47:51.394307254 -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: 1514 bytes --]

diff -Naur scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas_base.c scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas_base.c
--- scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-24 18:43:13.853276151 -0800
+++ scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-24 18:47:27.480306538 -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 scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas.h scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas.h
--- scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas.h	2011-02-24 18:03:29.324307767 -0800
+++ scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas.h	2011-02-24 18:47:51.394307254 -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] 4+ messages in thread

* Re: [PATCH 5/14] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump
  2011-02-25  4:56 [PATCH 5/14] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump adam radford
@ 2011-03-30 12:30 ` Tomas Henzl
  2011-03-31 18:50   ` adam radford
  0 siblings, 1 reply; 4+ messages in thread
From: Tomas Henzl @ 2011-03-30 12:30 UTC (permalink / raw)
  To: adam radford; +Cc: linux-scsi, Bo.Yang

On 02/25/2011 05:56 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.
>
> Signed-off-by: Adam Radford <aradford@gmail.com>
>
>   

> diff -Naur scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas_base.c
> scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas_base.c
> --- scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-24
> 18:43:13.853276151 -0800
> +++ scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas_base.c	2011-02-24
> 18:47:27.480306538 -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 scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas.h
> scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas.h
> --- scsi-misc-2.6/drivers/scsi/megaraid/megaraid_sas.h	2011-02-24
> 18:03:29.324307767 -0800
> +++ scsi-misc-2.6.new/drivers/scsi/megaraid/megaraid_sas.h	2011-02-24
> 18:47:51.394307254 -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 */
>   
Hi Adam,
sorry I'm late, but this is still not applied I think.

The above #define are already defined in msi.h and pci_regs.h
I'd prefer to include those files instead of define the values.

Thanks, Tomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/14] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump
  2011-03-30 12:30 ` Tomas Henzl
@ 2011-03-31 18:50   ` adam radford
  2011-04-01 16:31     ` Tomas Henzl
  0 siblings, 1 reply; 4+ messages in thread
From: adam radford @ 2011-03-31 18:50 UTC (permalink / raw)
  To: Tomas Henzl; +Cc: linux-scsi, Bo.Yang

On Wed, Mar 30, 2011 at 5:30 AM, Tomas Henzl <thenzl@redhat.com> wrote:

> Hi Adam,
> sorry I'm late, but this is still not applied I think.

Yes, it is here:

http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=66192dfe1e74eae31a76cfc36092dabdba1324e6

>
> The above #define are already defined in msi.h and pci_regs.h
> I'd prefer to include those files instead of define the values.
>

msi_control_reg() macro is defined in drivers/pci/msi.h _not_
include/linux/msi.h.

Are you suggesting I try to include drivers/pci/msi.h ?

-Adam

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/14] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump
  2011-03-31 18:50   ` adam radford
@ 2011-04-01 16:31     ` Tomas Henzl
  0 siblings, 0 replies; 4+ messages in thread
From: Tomas Henzl @ 2011-04-01 16:31 UTC (permalink / raw)
  To: adam radford; +Cc: linux-scsi, Bo.Yang

On 03/31/2011 08:50 PM, adam radford wrote:
> On Wed, Mar 30, 2011 at 5:30 AM, Tomas Henzl <thenzl@redhat.com> wrote:
>
>   
>> Hi Adam,
>> sorry I'm late, but this is still not applied I think.
>>     
> Yes, it is here:
>
> http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=66192dfe1e74eae31a76cfc36092dabdba1324e6
>
>   
>> The above #define are already defined in msi.h and pci_regs.h
>> I'd prefer to include those files instead of define the values.
>>
>>     
> msi_control_reg() macro is defined in drivers/pci/msi.h _not_
> include/linux/msi.h.
>
> Are you suggesting I try to include drivers/pci/msi.h ?
>   
That doesn't look that good, probably better would be to put the definition
to some other place. The patch is already accepted and the priority for me low...

The PCI_MSIX_FLAGS_ENABLE is defined in pci_regs.h this is included in linux/pci.h and this is included 
in megaraid_sas_base.c - I think the definition could be simply removed from your patch, isn't it so?
Again this is low priority I expect no immediate action from you :)

Tomas

> -Adam
> --
> 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] 4+ messages in thread

end of thread, other threads:[~2011-04-01 16:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25  4:56 [PATCH 5/14] megaraid_sas: Fix probe_one to clear MSI-X flags in kdump adam radford
2011-03-30 12:30 ` Tomas Henzl
2011-03-31 18:50   ` adam radford
2011-04-01 16:31     ` Tomas Henzl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).