mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sreekanth Reddy <sreekanth.reddy@avagotech.com>
To: jejb@kernel.org, hch@infradead.org
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	JBottomley@Parallels.com, Sathya.Prakash@avagotech.com,
	chaitra.basappa@avagotech.com,
	suganath-prabu.subramani@avagotech.com,
	linux-kernel@vger.kernel.org,
	Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Subject: [PATCH 10/18] mpt3sas: Manage MSIX vectors according to HBA device type
Date: Wed, 30 Sep 2015 21:17:10 +0530	[thread overview]
Message-ID: <1443628038-13552-11-git-send-email-Sreekanth.Reddy@avagotech.com> (raw)
In-Reply-To: <1443628038-13552-1-git-send-email-Sreekanth.Reddy@avagotech.com>

1. Don't enable MSI-X vector for SAS2008 B0 controller,
2. Enable only single MSI-X vectors for below HBA's
   a. SAS2004
   b. SAS2008
   c. SAS2008_1
   d. SAS2008_2
   e. SAS2008_3
   f. SAS2116_1
   g. SAS2116_2
3. Enable Combined Reply Post Queue Support (i.e. 96 MSI-X vector)
   for only Gen3 Invader/Fury C0 and above revision HBA's
4. Enable Combined Reply Post Queue Support (i.e. 96 MSI-X vector)
   for all Intruder and Cutlass HBA's

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 39 +++++++++++++++++++-----------------
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  3 +++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |  7 +++++++
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 62dc312..2b33e48 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1712,6 +1712,14 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
 	int base;
 	u16 message_control;
 
+	/* Check whether controller SAS2008 B0 controller,
+	 * if it is SAS2008 B0 controller use IO-APIC instead of MSIX
+	 */
+	if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 &&
+	    ioc->pdev->revision == SAS2_PCI_DEVICE_B0_REVISION) {
+		return -EINVAL;
+	}
+
 	base = pci_find_capability(ioc->pdev, PCI_CAP_ID_MSIX);
 	if (!base) {
 		dfailprintk(ioc, pr_info(MPT3SAS_FMT "msix not supported\n",
@@ -1720,9 +1728,19 @@ _base_check_enable_msix(struct MPT3SAS_ADAPTER *ioc)
 	}
 
 	/* get msix vector count */
-
-	pci_read_config_word(ioc->pdev, base + 2, &message_control);
-	ioc->msix_vector_count = (message_control & 0x3FF) + 1;
+	/* NUMA_IO not supported for older controllers */
+	if (ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2004 ||
+	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2008 ||
+	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_1 ||
+	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_2 ||
+	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2108_3 ||
+	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_1 ||
+	    ioc->pdev->device == MPI2_MFGPAGE_DEVID_SAS2116_2)
+		ioc->msix_vector_count = 1;
+	else {
+		pci_read_config_word(ioc->pdev, base + 2, &message_control);
+		ioc->msix_vector_count = (message_control & 0x3FF) + 1;
+	}
 	dinitprintk(ioc, pr_info(MPT3SAS_FMT
 		"msix is supported, vector_count(%d)\n",
 		ioc->name, ioc->msix_vector_count));
@@ -4979,7 +4997,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
 {
 	int r, i;
 	int cpu_id, last_cpu_id = 0;
-	u8 revision;
 
 	dinitprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
 	    __func__));
@@ -4999,20 +5016,6 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
 		goto out_free_resources;
 	}
 
-	/* Check whether the controller revision is C0 or above.
-	 * only C0 and above revision controllers support 96 MSI-X vectors.
-	 */
-	revision = ioc->pdev->revision;
-
-	if ((ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3004 ||
-	     ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3008 ||
-	     ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_1 ||
-	     ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_2 ||
-	     ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_5 ||
-	     ioc->pdev->device == MPI25_MFGPAGE_DEVID_SAS3108_6) &&
-	     (revision >= 0x02))
-		ioc->msix96_vector = 1;
-
 	ioc->rdpq_array_enable_assigned = 0;
 	ioc->dma_mask = 0;
 	r = mpt3sas_base_map_resources(ioc);
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 4c9a154..08f46a7 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -142,6 +142,9 @@
 #define MPT_TARGET_FLAGS_DELETED	0x04
 #define MPT_TARGET_FASTPATH_IO		0x08
 
+#define SAS2_PCI_DEVICE_B0_REVISION	(0x01)
+#define SAS3_PCI_DEVICE_C0_REVISION	(0x02)
+
 /*
  * Intel HBA branding
  */
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 80469d0..2b51a41 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7938,6 +7938,13 @@ _scsih_determine_hba_mpi_version(struct MPT3SAS_ADAPTER *ioc) {
 	case MPI25_MFGPAGE_DEVID_SAS3108_5:
 	case MPI25_MFGPAGE_DEVID_SAS3108_6:
 		ioc->hba_mpi_version_belonged = MPI25_VERSION;
+
+		/* Check whether the controller revision is C0 or above.
+		 * only C0 and above revision controllers support 96 MSI-X
+		 * vectors.
+		 */
+		if (ioc->pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION)
+			ioc->msix96_vector = 1;
 		break;
 	}
 }
-- 
2.0.2


  parent reply	other threads:[~2015-09-30 15:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 15:47 [PATCH 00/18] mpt2sas, mpt3sas: Combine mpt2sas and mpt3sas driver code base Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 01/18] mpt2sas: Use mpi headers from mpt3sas Sreekanth Reddy
2015-10-04  7:51   ` Christoph Hellwig
2015-09-30 15:47 ` [PATCH 02/18] mpt3sas : Added mpt2sas driver definitions Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 03/18] mpt3sas: Move Gen3 HBA's device registration with PCI, SML and IOCTL related API's to a separate file Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 04/18] mpt2sas: Created mpt2sas_module.c file in which Gen2 HBA's are registers with PCI, SML and IOCTLs Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 06/18] mpt3sas: Define 'hba_mpi_version_belonged' IOC variable Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 07/18] mpt2sas, mpt3sas : Removed SCSI_MPTXSAS_LOGGING entry from Kconfig Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 08/18] mpt3sas: For an IO, build MPI SGL LIST on GEN2 HBA's and build IEEE SGL LIST on GEN3 HBA's Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 09/18] mpt3as: Don't send PHYDISK_HIDDEN Raid Action request on SAS2 HBA's Sreekanth Reddy
2015-09-30 15:47 ` Sreekanth Reddy [this message]
2015-09-30 15:47 ` [PATCH 11/18] mpt3sas: fix for driver fails EEH, recovery from injected pci bus error Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 12/18] mpt3sas : Ported WarpDrive product SSS6200 support Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 13/18] mpt3sas: Ported the providing sysfs attribute to report Backup Rail Monitor Status Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 14/18] mpt3sas: Refcount sas_device objects and fix unsafe list usage Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 15/18] mpt3sas: Refcount fw_events " Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 16/18] mpt3sas: Added OEMs Gen2 PnP ID Branding names Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 17/18] mpt3sas: setpci reset kernel oops fix Sreekanth Reddy
2015-09-30 15:47 ` [PATCH 18/18] mpt2sas, mpt3sas: Update the driver versions Sreekanth Reddy
2015-10-06  9:46 ` [PATCH 00/18] mpt2sas, mpt3sas: Combine mpt2sas and mpt3sas driver code base Christoph Hellwig
2015-10-06 10:29   ` Sreekanth Reddy
2015-10-06 17:13     ` James Bottomley
2015-10-07  9:18       ` Sreekanth Reddy
2015-10-08 14:00         ` Sreekanth Reddy

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=1443628038-13552-11-git-send-email-Sreekanth.Reddy@avagotech.com \
    --to=sreekanth.reddy@avagotech.com \
    --cc=JBottomley@Parallels.com \
    --cc=Sathya.Prakash@avagotech.com \
    --cc=chaitra.basappa@avagotech.com \
    --cc=hch@infradead.org \
    --cc=jejb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=suganath-prabu.subramani@avagotech.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

all inboxes | Powered by JetHome®