orgads / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
a8a466
From bd2314e40123381058f15b3ae49616d1cccb4f44 Mon Sep 17 00:00:00 2001
a8a466
From: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
a8a466
Date: Wed, 26 Oct 2016 13:34:38 +0530
a8a466
Subject: [PATCH 07/11] scsi: mpt3sas: Increased/Additional MSIX support for
a8a466
 SAS35 devices.
a8a466
a8a466
For SAS35 devices MSIX vectors are inceased to 128 from 96. To support this
a8a466
Reply post host index register count is increased to 16. Also variable
a8a466
msix96_vector is replaced with combined_reply_queue and variable
a8a466
combined_reply_index_count is added to set different values for SAS3 and
a8a466
SAS35 devices.
a8a466
a8a466
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
a8a466
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
a8a466
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
a8a466
Reviewed-by: Hannes Reinecke <hare@suse.com>
a8a466
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
a8a466
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
a8a466
---
a8a466
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 14 +++++++-------
a8a466
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  8 +++++---
a8a466
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 11 +++++++++--
a8a466
 3 files changed, 21 insertions(+), 12 deletions(-)
a8a466
a8a466
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
a8a466
index ac87e12..b26fa23 100644
a8a466
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
a8a466
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
a8a466
@@ -1079,7 +1079,7 @@ _base_interrupt(int irq, void *bus_id)
a8a466
 	 * new reply host index value in ReplyPostIndex Field and msix_index
a8a466
 	 * value in MSIxIndex field.
a8a466
 	 */
a8a466
-	if (ioc->msix96_vector)
a8a466
+	if (ioc->combined_reply_queue)
a8a466
 		writel(reply_q->reply_post_host_index | ((msix_index  & 7) <<
a8a466
 			MPI2_RPHI_MSIX_INDEX_SHIFT),
a8a466
 			ioc->replyPostRegisterIndex[msix_index/8]);
a8a466
@@ -2053,7 +2053,7 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
a8a466
 	_base_free_irq(ioc);
a8a466
 	_base_disable_msix(ioc);
a8a466
 
a8a466
-	if (ioc->msix96_vector) {
a8a466
+	if (ioc->combined_reply_queue) {
a8a466
 		kfree(ioc->replyPostRegisterIndex);
a8a466
 		ioc->replyPostRegisterIndex = NULL;
a8a466
 	}
a8a466
@@ -2163,7 +2163,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
a8a466
 	/* Use the Combined reply queue feature only for SAS3 C0 & higher
a8a466
 	 * revision HBAs and also only when reply queue count is greater than 8
a8a466
 	 */
a8a466
-	if (ioc->msix96_vector && ioc->reply_queue_count > 8) {
a8a466
+	if (ioc->combined_reply_queue && ioc->reply_queue_count > 8) {
a8a466
 		/* Determine the Supplemental Reply Post Host Index Registers
a8a466
 		 * Addresse. Supplemental Reply Post Host Index Registers
a8a466
 		 * starts at offset MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET and
a8a466
@@ -2171,7 +2171,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
a8a466
 		 * MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET from previous one.
a8a466
 		 */
a8a466
 		ioc->replyPostRegisterIndex = kcalloc(
a8a466
-		     MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT,
a8a466
+		     ioc->combined_reply_index_count,
a8a466
 		     sizeof(resource_size_t *), GFP_KERNEL);
a8a466
 		if (!ioc->replyPostRegisterIndex) {
a8a466
 			dfailprintk(ioc, printk(MPT3SAS_FMT
a8a466
@@ -2181,14 +2181,14 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
a8a466
 			goto out_fail;
a8a466
 		}
a8a466
 
a8a466
-		for (i = 0; i < MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT; i++) {
a8a466
+		for (i = 0; i < ioc->combined_reply_index_count; i++) {
a8a466
 			ioc->replyPostRegisterIndex[i] = (resource_size_t *)
a8a466
 			     ((u8 *)&ioc->chip->Doorbell +
a8a466
 			     MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET +
a8a466
 			     (i * MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET));
a8a466
 		}
a8a466
 	} else
a8a466
-		ioc->msix96_vector = 0;
a8a466
+		ioc->combined_reply_queue = 0;
a8a466
 
a8a466
 	list_for_each_entry(reply_q, &ioc->reply_queue_list, list)
a8a466
 		pr_info(MPT3SAS_FMT "%s: IRQ %d\n",
a8a466
@@ -5161,7 +5161,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
a8a466
 
a8a466
 	/* initialize reply post host index */
a8a466
 	list_for_each_entry(reply_q, &ioc->reply_queue_list, list) {
a8a466
-		if (ioc->msix96_vector)
a8a466
+		if (ioc->combined_reply_queue)
a8a466
 			writel((reply_q->msix_index & 7)<<
a8a466
 			   MPI2_RPHI_MSIX_INDEX_SHIFT,
a8a466
 			   ioc->replyPostRegisterIndex[reply_q->msix_index/8]);
a8a466
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
a8a466
index c3a39e8..240c360 100644
a8a466
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
a8a466
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
a8a466
@@ -304,8 +304,9 @@
a8a466
  * There are twelve Supplemental Reply Post Host Index Registers
a8a466
  * and each register is at offset 0x10 bytes from the previous one.
a8a466
  */
a8a466
-#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT 12
a8a466
-#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET (0x10)
a8a466
+#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3	12
a8a466
+#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G35	16
a8a466
+#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET	(0x10)
a8a466
 
a8a466
 /* OEM Identifiers */
a8a466
 #define MFG10_OEM_ID_INVALID                   (0x00000000)
a8a466
@@ -1172,7 +1173,8 @@ struct MPT3SAS_ADAPTER {
a8a466
 	u8		reply_queue_count;
a8a466
 	struct list_head reply_queue_list;
a8a466
 
a8a466
-	u8		msix96_vector;
a8a466
+	u8		combined_reply_queue;
a8a466
+	u8		combined_reply_index_count;
a8a466
 	/* reply post register index */
a8a466
 	resource_size_t	**replyPostRegisterIndex;
a8a466
 
a8a466
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
a8a466
index eaef45c..980c69d 100644
a8a466
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
a8a466
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
a8a466
@@ -8797,8 +8797,15 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
a8a466
 		}
a8a466
 		if ((ioc->hba_mpi_version_belonged == MPI25_VERSION &&
a8a466
 			pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION) ||
a8a466
-			(ioc->hba_mpi_version_belonged == MPI26_VERSION))
a8a466
-			ioc->msix96_vector = 1;
a8a466
+			(ioc->hba_mpi_version_belonged == MPI26_VERSION)) {
a8a466
+			ioc->combined_reply_queue = 1;
a8a466
+			if (ioc->is_gen35_ioc)
a8a466
+				ioc->combined_reply_index_count =
a8a466
+				 MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G35;
a8a466
+			else
a8a466
+				ioc->combined_reply_index_count =
a8a466
+				 MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3;
a8a466
+		}
a8a466
 		break;
a8a466
 	default:
a8a466
 		return -ENODEV;
a8a466
-- 
a8a466
1.8.3.1
a8a466