All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
To: linux-scsi@vger.kernel.org, martin.petersen@oracle.com
Cc: Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com,
	Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Subject: [PATCH 7/8] mpt3sas: Handle trigger page support after reset.
Date: Tue, 24 Nov 2020 09:20:18 +0530	[thread overview]
Message-ID: <20201124035019.27975-8-suganath-prabu.subramani@broadcom.com> (raw)
In-Reply-To: <20201124035019.27975-1-suganath-prabu.subramani@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 4604 bytes --]

Description:
Handle trigger page support after reset.
Prior to IOC reset, if firmware is not supporting trigger pages
and after reset if driver sees the firmware started supporting
trigger pages. (In case of a reset after firmware
upgrade) then the driver should handle this by writing the
already available trigger data from the driver’s internal data
structure to the corresponding trigger pages NVRAM region and
also update Trigger flags in Trigger Page-0 NVRAM region
accordingly.

Implementation:
Add ioc->supports_trigger_pages, this feature supported flag is
used to determine whether the pages needs update or not. And also
this feature supporting flag needs to be updated for every reset as
it is possible that FW won’t support trigger pages before reset
and start supporting after reset or vice versa.
(In case of FW upgrade or downgrade)

Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 50 ++++++++++++++++++++++++++++-
 drivers/scsi/mpt3sas/mpt3sas_base.h | 12 +++++++
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index ee86124..655f277 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -5073,6 +5073,35 @@ _base_get_diag_triggers(struct MPT3SAS_ADAPTER *ioc)
 		_base_get_mpi_diag_triggers(ioc);
 }
 
+/**
+ * _base_update_diag_trigger_pages - Update the driver trigger pages after
+ *			online FW update, incase updated FW supports driver
+ *			trigger pages.
+ * @ioc : per adapter object
+ *
+ * Return nothing.
+ */
+static void
+_base_update_diag_trigger_pages(struct MPT3SAS_ADAPTER *ioc)
+{
+
+	if (ioc->diag_trigger_master.MasterData)
+		mpt3sas_config_update_driver_trigger_pg1(ioc,
+		    &ioc->diag_trigger_master, 1);
+
+	if (ioc->diag_trigger_event.ValidEntries)
+		mpt3sas_config_update_driver_trigger_pg2(ioc,
+		    &ioc->diag_trigger_event, 1);
+
+	if (ioc->diag_trigger_scsi.ValidEntries)
+		mpt3sas_config_update_driver_trigger_pg3(ioc,
+		    &ioc->diag_trigger_scsi, 1);
+
+	if (ioc->diag_trigger_mpi.ValidEntries)
+		mpt3sas_config_update_driver_trigger_pg4(ioc,
+		    &ioc->diag_trigger_mpi, 1);
+}
+
 /**
  * _base_static_config_pages - static start of day config pages
  * @ioc: per adapter object
@@ -5082,7 +5111,7 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)
 {
 	Mpi2ConfigReply_t mpi_reply;
 	u32 iounit_pg1_flags;
-
+	int tg_flags = 0;
 	ioc->nvme_abort_timeout = 30;
 	mpt3sas_config_get_manufacturing_pg0(ioc, &mpi_reply, &ioc->manu_pg0);
 	if (ioc->ir_firmware)
@@ -5162,6 +5191,25 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)
 	if (ioc->is_gen35_ioc) {
 		if (ioc->is_driver_loading)
 			_base_get_diag_triggers(ioc);
+		else {
+			/*
+			 * In case of online HBA FW update operation,
+			 * check whether updated FW supports the driver trigger
+			 * pages or not.
+			 * - If previous FW has not supported driver trigger
+			 *   pages and newer FW supports them then update these
+			 *   pages with current diag trigger values.
+			 * - If previous FW has supported driver trigger pages
+			 *   and new FW doesn't support them then disable
+			 *   support_trigger_pages flag.
+			 */
+			tg_flags = _base_check_for_trigger_pages_support(ioc);
+			if (!ioc->supports_trigger_pages && tg_flags != -EFAULT)
+				_base_update_diag_trigger_pages(ioc);
+			else if (ioc->supports_trigger_pages &&
+			    tg_flags == -EFAULT)
+				ioc->supports_trigger_pages = 0;
+		}
 	}
 }
 
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 6745d79..352e6cd 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -1834,6 +1834,18 @@ mpt3sas_config_get_driver_trigger_pg3(struct MPT3SAS_ADAPTER *ioc,
 int
 mpt3sas_config_get_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
 	Mpi2ConfigReply_t *mpi_reply, Mpi26DriverTriggerPage4_t *config_page);
+int
+mpt3sas_config_update_driver_trigger_pg1(struct MPT3SAS_ADAPTER *ioc,
+	struct SL_WH_MASTER_TRIGGER_T *master_tg, bool set);
+int
+mpt3sas_config_update_driver_trigger_pg2(struct MPT3SAS_ADAPTER *ioc,
+	struct SL_WH_EVENT_TRIGGERS_T *event_tg, bool set);
+int
+mpt3sas_config_update_driver_trigger_pg3(struct MPT3SAS_ADAPTER *ioc,
+	struct SL_WH_SCSI_TRIGGERS_T *scsi_tg, bool set);
+int
+mpt3sas_config_update_driver_trigger_pg4(struct MPT3SAS_ADAPTER *ioc,
+	struct SL_WH_MPI_TRIGGERS_T *mpi_tg, bool set);
 
 /* ctl shared API */
 extern struct device_attribute *mpt3sas_host_attrs[];
-- 
2.18.4


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4202 bytes --]

  parent reply	other threads:[~2020-11-24  3:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24  3:50 [PATCH 0/8] mpt3sas: Features to enhance driver debugging Suganath Prabu S
2020-11-24  3:50 ` [PATCH 1/8] mpt3sas: Sync time stamp periodically between Driver and FW Suganath Prabu S
2020-11-24  7:46   ` kernel test robot
2020-11-24  7:46     ` kernel test robot
2020-11-24  3:50 ` [PATCH 2/8] mpt3sas: Add persistent trigger pages support Suganath Prabu S
2020-11-24  6:34   ` kernel test robot
2020-11-24  6:34     ` kernel test robot
2020-11-24  8:41   ` kernel test robot
2020-11-24  8:41     ` kernel test robot
2020-11-24  8:41   ` [RFC PATCH] mpt3sas: _config_set_driver_trigger_pg0 can be static kernel test robot
2020-11-24  8:41     ` kernel test robot
2020-11-24  3:50 ` [PATCH 3/8] mpt3sas: Add master triggers persistent Trigger Page Suganath Prabu S
2020-11-24  7:48   ` kernel test robot
2020-11-24  7:48     ` kernel test robot
2020-11-24  9:25   ` kernel test robot
2020-11-24  9:25     ` kernel test robot
2020-11-24  9:25   ` [RFC PATCH] mpt3sas: _config_set_driver_trigger_pg1 can be static kernel test robot
2020-11-24  9:25     ` kernel test robot
2020-11-24  3:50 ` [PATCH 4/8] mpt3sas: Add Event triggers persistent Trigger Page2 Suganath Prabu S
2020-11-24  8:40   ` kernel test robot
2020-11-24  8:40     ` kernel test robot
2020-11-24 10:24   ` kernel test robot
2020-11-24 10:24     ` kernel test robot
2020-11-24 10:24   ` [RFC PATCH] mpt3sas: _config_set_driver_trigger_pg2 can be static kernel test robot
2020-11-24 10:24     ` kernel test robot
2020-11-24  3:50 ` [PATCH 5/8] mpt3sas: Add SCSI sense triggers persistent Trigger Page3 Suganath Prabu S
2020-11-24  9:52   ` kernel test robot
2020-11-24  9:52     ` kernel test robot
2020-11-24 11:09   ` kernel test robot
2020-11-24 11:09     ` kernel test robot
2020-11-24 11:09   ` [RFC PATCH] mpt3sas: _config_set_driver_trigger_pg3 can be static kernel test robot
2020-11-24 11:09     ` kernel test robot
2020-11-24  3:50 ` [PATCH 6/8] mpt3sas: Add MPI triggers persistent Trigger Page4 Suganath Prabu S
2020-11-24 11:03   ` kernel test robot
2020-11-24 11:03     ` kernel test robot
2020-11-24 12:05   ` kernel test robot
2020-11-24 12:05     ` kernel test robot
2020-11-24 12:05   ` [RFC PATCH] mpt3sas: _config_set_driver_trigger_pg4 can be static kernel test robot
2020-11-24 12:05     ` kernel test robot
2020-11-24  3:50 ` Suganath Prabu S [this message]
2020-11-24  3:50 ` [PATCH 8/8] mpt3sas: Update driver version to 36.100.00.00 Suganath Prabu S

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=20201124035019.27975-8-suganath-prabu.subramani@broadcom.com \
    --to=suganath-prabu.subramani@broadcom.com \
    --cc=Sathya.Prakash@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sreekanth.reddy@broadcom.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.