nxt5656 / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
a8a466
From 13ac44ddfb8f0cfc407bb91713384e9961f6e762 Mon Sep 17 00:00:00 2001
a8a466
From: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
a8a466
Date: Tue, 10 Jan 2017 18:20:44 -0500
a8a466
Subject: [PATCH 02/11] scsi: megaraid_sas: 128 MSIX Support
a8a466
a8a466
SAS3.5 Generic Megaraid based Controllers will have the support for 128 MSI-X vectors,
a8a466
resulting in the need to support 128 reply queues
a8a466
a8a466
Signed-off-by: Sasikumar Chandrasekaran <sasikumar.pc@broadcom.com>
a8a466
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
a8a466
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
a8a466
---
a8a466
 drivers/scsi/megaraid/megaraid_sas.h        |  1 +
a8a466
 drivers/scsi/megaraid/megaraid_sas_base.c   | 24 +++++++++++++++++-------
a8a466
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  4 ++--
a8a466
 3 files changed, 20 insertions(+), 9 deletions(-)
a8a466
a8a466
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
a8a466
index e5ac6b1..ccef47b 100644
a8a466
--- a/drivers/scsi/megaraid/megaraid_sas.h
a8a466
+++ b/drivers/scsi/megaraid/megaraid_sas.h
a8a466
@@ -2149,6 +2149,7 @@ struct megasas_instance {
a8a466
 	bool dev_handle;
a8a466
 	bool fw_sync_cache_support;
a8a466
 	bool is_ventura;
a8a466
+	bool msix_combined;
a8a466
 };
a8a466
 struct MR_LD_VF_MAP {
a8a466
 	u32 size;
a8a466
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
a8a466
index a73e6f6..c78d7ee 100644
a8a466
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
a8a466
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
a8a466
@@ -5119,13 +5119,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
a8a466
 			goto fail_ready_state;
a8a466
 	}
a8a466
 
a8a466
-	/*
a8a466
-	 * MSI-X host index 0 is common for all adapter.
a8a466
-	 * It is used for all MPT based Adapters.
a8a466
-	 */
a8a466
-	instance->reply_post_host_index_addr[0] =
a8a466
-		(u32 __iomem *)((u8 __iomem *)instance->reg_set +
a8a466
-		MPI2_REPLY_POST_HOST_INDEX_OFFSET);
a8a466
+
a8a466
 
a8a466
 	/* Check if MSI-X is supported while in ready state */
a8a466
 	msix_enable = (instance->instancet->read_fw_status_reg(reg_set) &
a8a466
@@ -5143,6 +5137,9 @@ static int megasas_init_fw(struct megasas_instance *instance)
a8a466
 				instance->msix_vectors = ((scratch_pad_2
a8a466
 					& MR_MAX_REPLY_QUEUES_EXT_OFFSET)
a8a466
 					>> MR_MAX_REPLY_QUEUES_EXT_OFFSET_SHIFT) + 1;
a8a466
+				if (instance->msix_vectors > 16)
a8a466
+					instance->msix_combined = true;
a8a466
+
a8a466
 				if (rdpq_enable)
a8a466
 					instance->is_rdpq = (scratch_pad_2 & MR_RDPQ_MODE_OFFSET) ?
a8a466
 								1 : 0;
a8a466
@@ -5176,6 +5173,19 @@ static int megasas_init_fw(struct megasas_instance *instance)
a8a466
 		else
a8a466
 			instance->msix_vectors = 0;
a8a466
 	}
a8a466
+	/*
a8a466
+	 * MSI-X host index 0 is common for all adapter.
a8a466
+	 * It is used for all MPT based Adapters.
a8a466
+	 */
a8a466
+	if (instance->msix_combined) {
a8a466
+		instance->reply_post_host_index_addr[0] =
a8a466
+				(u32 *)((u8 *)instance->reg_set +
a8a466
+				MPI2_SUP_REPLY_POST_HOST_INDEX_OFFSET);
a8a466
+	} else {
a8a466
+		instance->reply_post_host_index_addr[0] =
a8a466
+			(u32 *)((u8 *)instance->reg_set +
a8a466
+			MPI2_REPLY_POST_HOST_INDEX_OFFSET);
a8a466
+	}
a8a466
 
a8a466
 	dev_info(&instance->pdev->dev,
a8a466
 		"firmware supports msix\t: (%d)", fw_msix_count);
a8a466
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
a8a466
index 5ad8a07..c64b85a 100644
a8a466
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
a8a466
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
a8a466
@@ -2391,7 +2391,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex)
a8a466
 		 * pending to be completed
a8a466
 		 */
a8a466
 		if (threshold_reply_count >= THRESHOLD_REPLY_COUNT) {
a8a466
-			if (fusion->adapter_type == INVADER_SERIES)
a8a466
+			if (instance->msix_combined)
a8a466
 				writel(((MSIxIndex & 0x7) << 24) |
a8a466
 					fusion->last_reply_idx[MSIxIndex],
a8a466
 					instance->reply_post_host_index_addr[MSIxIndex/8]);
a8a466
@@ -2407,7 +2407,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex)
a8a466
 		return IRQ_NONE;
a8a466
 
a8a466
 	wmb();
a8a466
-	if (fusion->adapter_type == INVADER_SERIES)
a8a466
+	if (instance->msix_combined)
a8a466
 		writel(((MSIxIndex & 0x7) << 24) |
a8a466
 			fusion->last_reply_idx[MSIxIndex],
a8a466
 			instance->reply_post_host_index_addr[MSIxIndex/8]);
a8a466
-- 
a8a466
1.8.3.1
a8a466