pgreco / rpms / kernel

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