[PATCH char-misc-next] misc: mic: Enable OSPM suspend and resume support.

2013-10-03 Thread Dasaratharaman Chandramouli
This patch enables support for OSPM suspend and resume in the MIC
driver. During a host suspend event, the driver performs an
orderly shutdown of the cards if they are online. Upon resume, any
cards that were previously online before suspend are rebooted.
The driver performs an orderly shutdown of the card primarily to
ensure that applications in the card are terminated and mounted
devices are safely un-mounted before the card is powered down in
the event of an OSPM suspend.

The driver makes use of the MIC daemon to accomplish OSPM suspend
and resume. The driver registers a PM notifier per MIC device.
The devices get notified synchronously during PM_SUSPEND_PREPARE and
PM_POST_SUSPEND phases.

During the PM_SUSPEND_PREPARE phase, the driver performs one of the
following three tasks.
1) If the card is 'offline', the driver sets the card to a
   'suspended' state and returns.
2) If the card is 'online', the driver initiates card shutdown by
   setting the card state to suspending. This notifies the MIC
   daemon which invokes shutdown and sets card state to 'suspended'.
   The driver returns after the shutdown is complete.
3) If the card is already being shutdown, possibly by a host user
   space application, the driver sets the card state to 'suspended'
   and returns after the shutdown is complete.

During the PM_POST_SUSPEND phase, the driver simply notifies the
daemon and returns. The daemon boots those cards that were previously
online during the suspend phase.

Signed-off-by: Ashutosh Dixit 
Signed-off-by: Nikhil Rao 
Signed-off-by: Harshavardhan R Kharche 
Signed-off-by: Sudeep Dutt 
Signed-off-by: Dasaratharaman Chandramouli 

---
 Documentation/ABI/testing/sysfs-class-mic.txt |  60 +++--
 Documentation/mic/mic_overview.txt|   4 +-
 Documentation/mic/mpssd/mpssd.c   |  27 +-
 Documentation/mic/mpssd/mpssd.h   |   1 +
 drivers/misc/mic/host/mic_boot.c  | 120 +-
 drivers/misc/mic/host/mic_device.h|   8 ++
 drivers/misc/mic/host/mic_main.c  |  63 +-
 drivers/misc/mic/host/mic_sysfs.c |   7 ++
 include/uapi/linux/mic_common.h   |   2 +
 9 files changed, 257 insertions(+), 35 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-class-mic.txt 
b/Documentation/ABI/testing/sysfs-class-mic.txt
index 82cdad3..13f48af 100644
--- a/Documentation/ABI/testing/sysfs-class-mic.txt
+++ b/Documentation/ABI/testing/sysfs-class-mic.txt
@@ -1,6 +1,6 @@
 What:  /sys/class/mic/
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt 
 Description:
The mic class directory belongs to Intel MIC devices and
@@ -9,8 +9,8 @@ Description:
Integrated Core (MIC) architecture that runs a Linux OS.
 
 What:  /sys/class/mic/mic(x)
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt 
 Description:
The directories /sys/class/mic/mic0, /sys/class/mic/mic1 etc.,
@@ -18,33 +18,41 @@ Description:
information specific to that MIC device.
 
 What:  /sys/class/mic/mic(x)/family
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt 
 Description:
Provides information about the Coprocessor family for an Intel
MIC device. For example - "x100"
 
 What:  /sys/class/mic/mic(x)/stepping
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt 
 Description:
Provides information about the silicon stepping for an Intel
MIC device. For example - "A0" or "B0"
 
 What:  /sys/class/mic/mic(x)/state
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt 
 Description:
When read, this entry provides the current state of an Intel
MIC device in the context of the card OS. Possible values that
will be read are:
-   "offline" - The MIC device is ready to boot the card OS.
+   "offline" - The MIC device is ready to boot the card OS. On
+   reading this entry after an OSPM resume, a "boot" has to be
+   written to this entry if the card was previously shutdown
+   during OSPM suspend.
"online" - The MIC device has initiated booting a card OS.
"shutting_down" - The card OS is shutting down.
"reset_failed" - The MIC device has failed to reset.
+   "suspending" - The MIC device is currently being prepared for
+   suspend. On reading this entry, a "suspend" has to be written
+   to the state sysfs entry to 

[PATCH char-misc-next] misc: mic: Enable OSPM suspend and resume support.

2013-10-03 Thread Dasaratharaman Chandramouli
This patch enables support for OSPM suspend and resume in the MIC
driver. During a host suspend event, the driver performs an
orderly shutdown of the cards if they are online. Upon resume, any
cards that were previously online before suspend are rebooted.
The driver performs an orderly shutdown of the card primarily to
ensure that applications in the card are terminated and mounted
devices are safely un-mounted before the card is powered down in
the event of an OSPM suspend.

The driver makes use of the MIC daemon to accomplish OSPM suspend
and resume. The driver registers a PM notifier per MIC device.
The devices get notified synchronously during PM_SUSPEND_PREPARE and
PM_POST_SUSPEND phases.

During the PM_SUSPEND_PREPARE phase, the driver performs one of the
following three tasks.
1) If the card is 'offline', the driver sets the card to a
   'suspended' state and returns.
2) If the card is 'online', the driver initiates card shutdown by
   setting the card state to suspending. This notifies the MIC
   daemon which invokes shutdown and sets card state to 'suspended'.
   The driver returns after the shutdown is complete.
3) If the card is already being shutdown, possibly by a host user
   space application, the driver sets the card state to 'suspended'
   and returns after the shutdown is complete.

During the PM_POST_SUSPEND phase, the driver simply notifies the
daemon and returns. The daemon boots those cards that were previously
online during the suspend phase.

Signed-off-by: Ashutosh Dixit ashutosh.di...@intel.com
Signed-off-by: Nikhil Rao nikhil@intel.com
Signed-off-by: Harshavardhan R Kharche harshavardhan.r.khar...@intel.com
Signed-off-by: Sudeep Dutt sudeep.d...@intel.com
Signed-off-by: Dasaratharaman Chandramouli 
dasaratharaman.chandramo...@intel.com
---
 Documentation/ABI/testing/sysfs-class-mic.txt |  60 +++--
 Documentation/mic/mic_overview.txt|   4 +-
 Documentation/mic/mpssd/mpssd.c   |  27 +-
 Documentation/mic/mpssd/mpssd.h   |   1 +
 drivers/misc/mic/host/mic_boot.c  | 120 +-
 drivers/misc/mic/host/mic_device.h|   8 ++
 drivers/misc/mic/host/mic_main.c  |  63 +-
 drivers/misc/mic/host/mic_sysfs.c |   7 ++
 include/uapi/linux/mic_common.h   |   2 +
 9 files changed, 257 insertions(+), 35 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-class-mic.txt 
b/Documentation/ABI/testing/sysfs-class-mic.txt
index 82cdad3..13f48af 100644
--- a/Documentation/ABI/testing/sysfs-class-mic.txt
+++ b/Documentation/ABI/testing/sysfs-class-mic.txt
@@ -1,6 +1,6 @@
 What:  /sys/class/mic/
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt sudeep.d...@intel.com
 Description:
The mic class directory belongs to Intel MIC devices and
@@ -9,8 +9,8 @@ Description:
Integrated Core (MIC) architecture that runs a Linux OS.
 
 What:  /sys/class/mic/mic(x)
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt sudeep.d...@intel.com
 Description:
The directories /sys/class/mic/mic0, /sys/class/mic/mic1 etc.,
@@ -18,33 +18,41 @@ Description:
information specific to that MIC device.
 
 What:  /sys/class/mic/mic(x)/family
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt sudeep.d...@intel.com
 Description:
Provides information about the Coprocessor family for an Intel
MIC device. For example - x100
 
 What:  /sys/class/mic/mic(x)/stepping
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt sudeep.d...@intel.com
 Description:
Provides information about the silicon stepping for an Intel
MIC device. For example - A0 or B0
 
 What:  /sys/class/mic/mic(x)/state
-Date:  August 2013
-KernelVersion: 3.11
+Date:  October 2013
+KernelVersion: 3.13
 Contact:   Sudeep Dutt sudeep.d...@intel.com
 Description:
When read, this entry provides the current state of an Intel
MIC device in the context of the card OS. Possible values that
will be read are:
-   offline - The MIC device is ready to boot the card OS.
+   offline - The MIC device is ready to boot the card OS. On
+   reading this entry after an OSPM resume, a boot has to be
+   written to this entry if the card was previously shutdown
+   during OSPM suspend.
online - The MIC device has initiated booting a card OS.
shutting_down - The card OS is shutting down.
reset_failed - The MIC device has