All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12 v2] staging: mei: adding new watchdog core support
@ 2011-09-07  6:03 Oren Weil
  2011-09-07  6:03 ` [PATCH 01/12 v2] staging: mei: removing dependency between WD and AMTHI init function Oren Weil
                   ` (11 more replies)
  0 siblings, 12 replies; 15+ messages in thread
From: Oren Weil @ 2011-09-07  6:03 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-kernel, linux-watchdog, alan, wim, tomas.winkler, Oren Weil

In this patches set we are adding the new watchdog core to the mei driver.
Until now the mei driver manage by itself the Intel(R) Active Management Technology 
(Intel(R) AMT) watchdog, the driver send the heartbeat by a 
internal timer and the internal was defined by module parameter.

for more information about the Intel(R) AMT watchdog read
drivers/staging/mei/mei.txt

Version 2 - Removed two tab indent in patch 05

Oren Weil (12):
  staging: mei: removing dependency between WD and AMTHI init function.
  staging: mei: fix register access function comments
  staging: mei: registering the MEI driver with the kernel watchdog
    core interface
  staging: mei: adding watchdog ops
  staging: mei: adding watchdog ping
  staging: mei: adding set_timeout watchdog function
  staging: mei: renaming delayed work field and function to a
    meaningful name.
  staging: mei: resuming timer regardless of the watchdog timeout
    value.
  stagign: mei: client init code cleanup
  staging: mei: removing wd module parameters
  staging: mei: adding mei_wd_stop function comment
  staging: mei: adding watchdog core dependency to kconfig

 drivers/staging/mei/Kconfig     |    2 +-
 drivers/staging/mei/init.c      |    9 ++-
 drivers/staging/mei/interface.h |    8 +-
 drivers/staging/mei/interrupt.c |   45 +++-----
 drivers/staging/mei/main.c      |   19 ++--
 drivers/staging/mei/mei_dev.h   |   22 +++-
 drivers/staging/mei/wd.c        |  242 +++++++++++++++++++++++++++++++++------
 7 files changed, 261 insertions(+), 86 deletions(-)

-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH 05/12 v2] staging: mei: adding watchdog ping
@ 2011-09-01 14:08 Oren Weil
  2011-09-06 23:52 ` Greg KH
  0 siblings, 1 reply; 15+ messages in thread
From: Oren Weil @ 2011-09-01 14:08 UTC (permalink / raw)
  To: gregkh
  Cc: devel, linux-kernel, linux-watchdog, alan, wim, tomas.winkler, Oren Weil

adding watchdog ping to send ping/heartbeat to the the AMT watchdog client.
in addition removing the heartbeat sending from the driver timers function.

Version 2 - Removed two tab indent

Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/staging/mei/interrupt.c |   27 -------------------
 drivers/staging/mei/wd.c        |   54 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/mei/interrupt.c b/drivers/staging/mei/interrupt.c
index 958a7e2..62b8001 100644
--- a/drivers/staging/mei/interrupt.c
+++ b/drivers/staging/mei/interrupt.c
@@ -1430,33 +1430,6 @@ void mei_wd_timer(struct work_struct *work)
 		}
 	}
 
-	if (dev->wd_cl.state != MEI_FILE_CONNECTED)
-		goto out;
-
-	/* Watchdog */
-	if (dev->wd_due_counter && !dev->wd_bypass) {
-		if (--dev->wd_due_counter == 0) {
-			if (dev->mei_host_buffer_is_empty &&
-			    mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) {
-				dev->mei_host_buffer_is_empty = false;
-				dev_dbg(&dev->pdev->dev, "send watchdog.\n");
-
-				if (mei_wd_send(dev))
-					dev_dbg(&dev->pdev->dev, "wd send failed.\n");
-				else
-					if (mei_flow_ctrl_reduce(dev, &dev->wd_cl))
-						goto out;
-
-				if (dev->wd_timeout)
-					dev->wd_due_counter = 2;
-				else
-					dev->wd_due_counter = 0;
-
-			} else
-				dev->wd_pending = true;
-
-		}
-	}
 	if (dev->iamthif_stall_timer) {
 		if (--dev->iamthif_stall_timer == 0) {
 			dev_dbg(&dev->pdev->dev, "reseting because of hang to amthi.\n");
diff --git a/drivers/staging/mei/wd.c b/drivers/staging/mei/wd.c
index fb2bd3d..9338394 100644
--- a/drivers/staging/mei/wd.c
+++ b/drivers/staging/mei/wd.c
@@ -255,15 +255,69 @@ static int mei_wd_ops_stop(struct watchdog_device *wd_dev)
 }
 
 /*
+ * mei_wd_ops_ping - wd ping command from the watchdog core.
+ *
+ * @wd_dev - watchdog device struct
+ *
+ * returns 0 if success, negative errno code for failure
+ */
+static int mei_wd_ops_ping(struct watchdog_device *wd_dev)
+{
+	int ret = 0;
+	struct mei_device *dev;
+	dev = pci_get_drvdata(mei_device);
+
+	if (!dev)
+		return -ENODEV;
+
+	mutex_lock(&dev->device_lock);
+
+	if (dev->wd_cl.state != MEI_FILE_CONNECTED) {
+		dev_dbg(&dev->pdev->dev, "wd is not connected.\n");
+		ret = -ENODEV;
+		goto end;
+	}
+
+	/* Check if we can send the ping to HW*/
+	if (dev->mei_host_buffer_is_empty &&
+		mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) {
+
+		dev->mei_host_buffer_is_empty = false;
+		dev_dbg(&dev->pdev->dev, "sending watchdog ping\n");
+
+		if (mei_wd_send(dev)) {
+			dev_dbg(&dev->pdev->dev, "wd send failed.\n");
+			ret = -EIO;
+			goto end;
+		}
+
+		if (mei_flow_ctrl_reduce(dev, &dev->wd_cl)) {
+			dev_dbg(&dev->pdev->dev, "mei_flow_ctrl_reduce() failed.\n");
+			ret = -EIO;
+			goto end;
+		}
+
+	} else {
+		dev->wd_pending = true;
+	}
+
+end:
+	mutex_unlock(&dev->device_lock);
+	return ret;
+}
+
+/*
  * Watchdog Device structs
  */
 const struct watchdog_ops wd_ops = {
 		.owner = THIS_MODULE,
 		.start = mei_wd_ops_start,
 		.stop = mei_wd_ops_stop,
+		.ping = mei_wd_ops_ping,
 };
 const struct watchdog_info wd_info = {
 		.identity = INTEL_AMT_WATCHDOG_ID,
+		.options = WDIOF_KEEPALIVEPING,
 };
 
 struct watchdog_device amt_wd_dev = {
-- 
1.7.4.1


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

end of thread, other threads:[~2011-09-07  6:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-07  6:03 [PATCH 00/12 v2] staging: mei: adding new watchdog core support Oren Weil
2011-09-07  6:03 ` [PATCH 01/12 v2] staging: mei: removing dependency between WD and AMTHI init function Oren Weil
2011-09-07  6:03 ` [PATCH 02/12 v2] staging: mei: fix register access function comments Oren Weil
2011-09-07  6:03 ` [PATCH 03/12 v2] staging: mei: registering the MEI driver with the kernel watchdog core interface Oren Weil
2011-09-07  6:03 ` [PATCH 04/12 v2] staging: mei: adding watchdog ops Oren Weil
2011-09-07  6:03 ` [PATCH 05/12 v2] staging: mei: adding watchdog ping Oren Weil
2011-09-07  6:03 ` [PATCH 06/12 v2] staging: mei: adding set_timeout watchdog function Oren Weil
2011-09-07  6:03 ` [PATCH 07/12 v2] staging: mei: renaming delayed work field and function to a meaningful name Oren Weil
2011-09-07  6:03 ` [PATCH 08/12 v2] staging: mei: resuming timer regardless of the watchdog timeout value Oren Weil
2011-09-07  6:03 ` [PATCH 09/12 v2] stagign: mei: client init code cleanup Oren Weil
2011-09-07  6:03 ` [PATCH 10/12 v2] staging: mei: removing wd module parameters Oren Weil
2011-09-07  6:03 ` [PATCH 11/12 v2] staging: mei: adding mei_wd_stop function comment Oren Weil
2011-09-07  6:03 ` Oren Weil
  -- strict thread matches above, loose matches on Subject: below --
2011-09-01 14:08 [PATCH 05/12 v2] staging: mei: adding watchdog ping Oren Weil
2011-09-06 23:52 ` Greg KH

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.