All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4 v3] scsi:stex.c Add reboot support
@ 2014-12-16  6:13 Charles Chiou
  2014-12-17  9:30 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Charles Chiou @ 2014-12-16  6:13 UTC (permalink / raw)
  To: Charles Chiou, Christoph Hellwig, JBottomley, Oliver Neukum
  Cc: ed.lin, grace.chang, linus.chen, victor.p, linux-scsi, linux-kernel


 From 72f5b5cbda424a254b0e9672bd4d9d249728fcb9 Mon Sep 17 00:00:00 2001
From: Charles Chiou <charles.chiou@tw.promise.com>
Date: Wed, 5 Nov 2014 19:29:46 +0800
Subject: [PATCH 3/4] scsi:stex.c Add reboot support

1. Add reboot support, Pegasus devices should be notified that
    the host is going to shut down/reboot. I register reboot callback
    function to distinct host is going to shut down or to reboot.

2. Pegasus FW shutdown flow is sensitive to host behavior
    (host is going to S3/S4/shut down/reboot). To this end, I add one
    argument in stex_hba_stop to support various stop command.

Signed-off-by: charles.chiou@tw.promise.com
---
  drivers/scsi/stex.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
  1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 7dc6afe..a536cfb 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -24,6 +24,7 @@
  #include <linux/interrupt.h>
  #include <linux/types.h>
  #include <linux/module.h>
+#include <linux/reboot.h>
  #include <linux/spinlock.h>
  #include <asm/io.h>
  #include <asm/irq.h>
@@ -166,6 +167,13 @@ enum {

  	ST_ADDITIONAL_MEM			= 0x200000,
  	ST_ADDITIONAL_MEM_MIN			= 0x80000,
+	PMIC_SHUTDOWN				= 0x0D,
+	PMIC_REUMSE					= 0x10,
+	ST_IGNORED					= -1,
+	ST_S3						= 3,
+	ST_S4						= 4,
+	ST_S5						= 5,
+	ST_S6						= 6,
  };

  struct st_sgitem {
@@ -344,6 +352,7 @@ struct st_card_info {
  	u16 sts_count;
  };

+static int reboot;
  static int msi;
  module_param(msi, int, 0);
  MODULE_PARM_DESC(msi, "Enable Message Signaled Interrupts(0=off, 1=on)");
@@ -364,6 +373,14 @@ MODULE_AUTHOR("Ed Lin");
  MODULE_DESCRIPTION("Promise Technology SuperTrak EX Controllers");
  MODULE_LICENSE("GPL");
  MODULE_VERSION(ST_DRIVER_VERSION);
+static int stex_reboot_callback(struct notifier_block *self,
+							  unsigned long val,
+							  void *data)
+{
+	if (val == SYS_RESTART)
+		reboot = 1;
+	return NOTIFY_OK;
+}

  static void stex_gettime(__le64 *time)
  {
@@ -1562,6 +1579,7 @@ static int stex_probe(struct pci_dev *pdev, const 
struct pci_device_id *id)
  	u32 sts_offset, cp_offset, scratch_offset;
  	int err;

+	reboot = 0;
  	err = pci_enable_device(pdev);
  	if (err)
  		return err;
@@ -1755,7 +1773,7 @@ out_disable:
  	return err;
  }

-static void stex_hba_stop(struct st_hba *hba)
+static void stex_hba_stop(struct st_hba *hba, int st_sleep_mic)
  {
  	struct req_msg *req;
  	struct st_msg_header *msg_h;
@@ -1771,11 +1789,18 @@ static void stex_hba_stop(struct st_hba *hba)
  	} else
  		memset(req, 0, hba->rq_size);

-	if (hba->cardtype == st_yosemite || hba->cardtype == st_yel) {
+	if ((hba->cardtype == st_yosemite || hba->cardtype == st_yel)
+		&& st_sleep_mic == ST_IGNORED) {
  		req->cdb[0] = MGT_CMD;
  		req->cdb[1] = MGT_CMD_SIGNATURE;
  		req->cdb[2] = CTLR_CONFIG_CMD;
  		req->cdb[3] = CTLR_SHUTDOWN;
+	} else if (hba->cardtype == st_yel && st_sleep_mic != ST_IGNORED) {
+		req->cdb[0] = MGT_CMD;
+		req->cdb[1] = MGT_CMD_SIGNATURE;
+		req->cdb[2] = CTLR_CONFIG_CMD;
+		req->cdb[3] = PMIC_SHUTDOWN;
+		req->cdb[4] = st_sleep_mic;
  	} else {
  		req->cdb[0] = CONTROLLER_CMD;
  		req->cdb[1] = CTLR_POWER_STATE_CHANGE;
@@ -1795,10 +1820,12 @@ static void stex_hba_stop(struct st_hba *hba)
  	while (hba->ccb[tag].req_type & PASSTHRU_REQ_TYPE) {
  		if (time_after(jiffies, before + ST_INTERNAL_TIMEOUT * HZ)) {
  			hba->ccb[tag].req_type = 0;
+			hba->mu_status = MU_STATE_STOP;
  			return;
  		}
  		msleep(1);
  	}
+	hba->mu_status = MU_STATE_STOP;
  }

  static void stex_hba_free(struct st_hba *hba)
@@ -1838,7 +1865,14 @@ static void stex_shutdown(struct pci_dev *pdev)
  {
  	struct st_hba *hba = pci_get_drvdata(pdev);

-	stex_hba_stop(hba);
+	if (hba->supports_pm == 0)
+		stex_hba_stop(hba, ST_IGNORED);
+	else {
+		if (reboot)
+			stex_hba_stop(hba, ST_S6);
+		else
+			stex_hba_stop(hba, ST_S5);
+	}
  }

  MODULE_DEVICE_TABLE(pci, stex_pci_tbl);
@@ -1851,18 +1885,22 @@ static struct pci_driver stex_pci_driver = {
  	.shutdown	= stex_shutdown,
  };

+static struct notifier_block stex_reboot_notifier = {
+	stex_reboot_callback, NULL, 0
+};
  static int __init stex_init(void)
  {
  	printk(KERN_INFO DRV_NAME
  		": Promise SuperTrak EX Driver version: %s\n",
  		 ST_DRIVER_VERSION);
-
+	register_reboot_notifier(&stex_reboot_notifier);
  	return pci_register_driver(&stex_pci_driver);
  }

  static void __exit stex_exit(void)
  {
  	pci_unregister_driver(&stex_pci_driver);
+	unregister_reboot_notifier(&stex_reboot_notifier);
  }

  module_init(stex_init);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4 v3] scsi:stex.c Add reboot support
  2014-12-16  6:13 [PATCH 3/4 v3] scsi:stex.c Add reboot support Charles Chiou
@ 2014-12-17  9:30 ` Christoph Hellwig
  2014-12-18  3:41   ` Charles Chiou
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2014-12-17  9:30 UTC (permalink / raw)
  To: Charles Chiou
  Cc: Christoph Hellwig, JBottomley, Oliver Neukum, ed.lin,
	grace.chang, linus.chen, victor.p, linux-scsi, linux-kernel

I'm not going to add a new reboot notifier for a driver.  If you can
convince the driver model / PM people to pass this information to
->shutdown we can add support for this difference, but not in this way.

Can you send me a series that just adds the hardware support for now, so
we can dash this PM issue out separately?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4 v3] scsi:stex.c Add reboot support
  2014-12-17  9:30 ` Christoph Hellwig
@ 2014-12-18  3:41   ` Charles Chiou
  2014-12-23  2:58     ` Charles Chiou
  2014-12-30 12:18     ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Charles Chiou @ 2014-12-18  3:41 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: JBottomley, Oliver Neukum, ed.lin, grace.chang, linus.chen,
	victor.p, linux-scsi, linux-kernel



On 12/17/2014 05:30 PM, Christoph Hellwig wrote:
> I'm not going to add a new reboot notifier for a driver.  If you can
> convince the driver model / PM people to pass this information to
> ->shutdown we can add support for this difference, but not in this way.
>
> Can you send me a series that just adds the hardware support for now, so
> we can dash this PM issue out separately?
>

Hi, we need to provide this information to our device.
We face the HW signal issue on various motherboards.
We experiment on many motherboards, and we observe that the restart 
signal is different on different motherboard. If device misses the 
signal, PCI loss or volume disappearance might happen.


To make power management easier, driver provide the shutdown or reboot 
information to the device.

Sorry, I'm not understand what is meaning of "series".
Could you specify what you what me to send you?
Thank you

BRS
Charles




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4 v3] scsi:stex.c Add reboot support
  2014-12-18  3:41   ` Charles Chiou
@ 2014-12-23  2:58     ` Charles Chiou
  2014-12-30 12:19       ` Christoph Hellwig
  2014-12-30 12:18     ` Christoph Hellwig
  1 sibling, 1 reply; 6+ messages in thread
From: Charles Chiou @ 2014-12-23  2:58 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: JBottomley, Oliver Neukum, ed.lin, grace.chang, linus.chen,
	victor.p, linux-scsi, linux-kernel



On 12/18/2014 11:41 AM, Charles Chiou wrote:
>
>
> On 12/17/2014 05:30 PM, Christoph Hellwig wrote:
>> I'm not going to add a new reboot notifier for a driver.  If you can
>> convince the driver model / PM people to pass this information to
>> ->shutdown we can add support for this difference, but not in this way.
>>
>> Can you send me a series that just adds the hardware support for now, so
>> we can dash this PM issue out separately?
>>
>
> Hi, we need to provide this information to our device.
> We face the HW signal issue on various motherboards.
> We experiment on many motherboards, and we observe that the restart
> signal is different on different motherboard. If device misses the
> signal, PCI loss or volume disappearance might happen.
>
>
> To make power management easier, driver provide the shutdown or reboot
> information to the device.
>
> Sorry, I'm not understand what is meaning of "series".
> Could you specify what you what me to send you?
> Thank you
>
> BRS
> Charles
>


Hi, after our internal discussion, we can use shutdown flow for reboot 
temporarily. Some signal issue will happen (depend on MB), and it can be 
fixed by plug in and plug out manually. We will add reboot feature after 
PM can pass reboot information to ->shutdown.

BRS
Charles

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4 v3] scsi:stex.c Add reboot support
  2014-12-18  3:41   ` Charles Chiou
  2014-12-23  2:58     ` Charles Chiou
@ 2014-12-30 12:18     ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2014-12-30 12:18 UTC (permalink / raw)
  To: Charles Chiou
  Cc: Christoph Hellwig, JBottomley, Oliver Neukum, ed.lin,
	grace.chang, linus.chen, victor.p, linux-scsi, linux-kernel

On Thu, Dec 18, 2014 at 11:41:30AM +0800, Charles Chiou wrote:
> Sorry, I'm not understand what is meaning of "series".
> Could you specify what you what me to send you?

Series means a set of patches, e.g. all the ones you send.

Talking about patches series it would be very helpful if you send the
actual patches as replies to the [PATCH 0/n] introduction mail.  The
git-send-email tool is a great way to do this automatically.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/4 v3] scsi:stex.c Add reboot support
  2014-12-23  2:58     ` Charles Chiou
@ 2014-12-30 12:19       ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2014-12-30 12:19 UTC (permalink / raw)
  To: Charles Chiou
  Cc: Christoph Hellwig, JBottomley, Oliver Neukum, ed.lin,
	grace.chang, linus.chen, victor.p, linux-scsi, linux-kernel

On Tue, Dec 23, 2014 at 10:58:25AM +0800, Charles Chiou wrote:
> Hi, after our internal discussion, we can use shutdown flow for reboot
> temporarily. Some signal issue will happen (depend on MB), and it can be
> fixed by plug in and plug out manually. We will add reboot feature after PM
> can pass reboot information to ->shutdown.

Thanks.  Please send the updated patch series to the list.

Note that you should also try to pass the information you need through
proper channels, e.g. adding an argument to the ->shutdown method.
Please send this to the linux-pm ad linux-kernel lists.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-12-30 12:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-16  6:13 [PATCH 3/4 v3] scsi:stex.c Add reboot support Charles Chiou
2014-12-17  9:30 ` Christoph Hellwig
2014-12-18  3:41   ` Charles Chiou
2014-12-23  2:58     ` Charles Chiou
2014-12-30 12:19       ` Christoph Hellwig
2014-12-30 12:18     ` Christoph Hellwig

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.