imperfectism / rpms / kernel

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