linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
To: Anshuman Khandual <khandual@linux.vnet.ibm.com>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] powerpc, powernv: Add OPAL platform event driver
Date: Tue, 30 Sep 2014 10:53:29 +0530	[thread overview]
Message-ID: <542A3E51.5030701@linux.vnet.ibm.com> (raw)
In-Reply-To: <1411986209-16800-1-git-send-email-khandual@linux.vnet.ibm.com>


On 09/29/2014 03:53 PM, Anshuman Khandual wrote:
> This patch creates a new OPAL platform event character driver
> which will give userspace clients the access to these events
> and process them effectively. Following platforms events are
> currently supported with this platform driver.
>
> 	(1) Environmental and Power Warning (EPOW)
> 	(2) Delayed Power Off (DPO)
>
> The user interface for this driver is /dev/opal_event character
> device file where the user space clients can poll and read for
> new opal platform events. The expected sequence of events driven
> from user space should be like the following.
>
> 	(1) Open the character device file
> 	(2) Poll on the file for POLLIN event
> 	(3) When unblocked, must attempt to read PLAT_EVENT_MAX_SIZE size
> 	(4) Kernel driver will pass at most one opal_plat_event structure
> 	(5) Poll again for more new events
>
> The driver registers for OPAL messages notifications corresponding to
> individual OPAL events. When any of those event messages arrive in the
> kernel, the callbacks are called to process them which in turn unblocks
> the polling thread on the character device file. The driver also registers
> a timer function which will be called after a threshold amount of time to
> shutdown the system. The user space client receives the timeout value for
> all individual OPAL platform events and hence must prepare the system and
> eventually shutdown. In case the user client does not shutdown the system,
> the timer function will be called after the threshold and shutdown the
> system explicitly.
>
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Reviewed-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>

- Neelesh

> ---
>   arch/powerpc/include/asm/opal.h                    |  45 +-
>   .../include/uapi/asm/opal_platform_events.h        |  90 +++
>   arch/powerpc/platforms/powernv/Makefile            |   2 +-
>   .../platforms/powernv/opal-platform-events.c       | 737 +++++++++++++++++++++
>   arch/powerpc/platforms/powernv/opal-wrappers.S     |   1 +
>   arch/powerpc/platforms/powernv/opal.c              |   8 +-
>   6 files changed, 880 insertions(+), 3 deletions(-)
>   create mode 100644 arch/powerpc/include/uapi/asm/opal_platform_events.h
>   create mode 100644 arch/powerpc/platforms/powernv/opal-platform-events.c
>
> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index 86055e5..c134137 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -151,6 +151,7 @@ struct opal_sg_list {
>   #define OPAL_HANDLE_HMI				98
>   #define OPAL_REGISTER_DUMP_REGION		101
>   #define OPAL_UNREGISTER_DUMP_REGION		102
> +#define OPAL_GET_DPO_STATUS			105
>   
>   #ifndef __ASSEMBLY__
>   
> @@ -249,6 +250,7 @@ enum OpalMessageType {
>   	OPAL_MSG_EPOW,
>   	OPAL_MSG_SHUTDOWN,
>   	OPAL_MSG_HMI_EVT,
> +	OPAL_MSG_DPO,
>   	OPAL_MSG_TYPE_MAX,
>   };
>   
> @@ -417,6 +419,46 @@ struct opal_msg {
>   	__be64 params[8];
>   };
>   
> +/*
> + * EPOW status sharing (OPAL and the host)
> + *
> + * The host will pass on OPAL, a buffer of length OPAL_SYSEPOW_MAX
> + * with individual elements being 16 bits wide to fetch the system
> + * wide EPOW status. Each element in the buffer will contain the
> + * EPOW status in it's bit representation for a particular EPOW sub
> + * class as defiend here. So multiple detailed EPOW status bits
> + * specific for any sub class can be represented in a single buffer
> + * element as it's bit representation.
> + */
> +
> +/* System EPOW type */
> +enum OpalSysEpow {
> +	OPAL_SYSEPOW_POWER	= 0,	/* Power EPOW */
> +	OPAL_SYSEPOW_TEMP	= 1,	/* Temperature EPOW */
> +	OPAL_SYSEPOW_COOLING	= 2,	/* Cooling EPOW */
> +	OPAL_SYSEPOW_MAX	= 3,	/* Max EPOW categories */
> +};
> +
> +/* Power EPOW */
> +enum OpalSysPower {
> +	OPAL_SYSPOWER_UPS	= 0x0001, /* System on UPS power */
> +	OPAL_SYSPOWER_CHNG	= 0x0002, /* System power config change */
> +	OPAL_SYSPOWER_FAIL	= 0x0004, /* System impending power failure */
> +	OPAL_SYSPOWER_INCL	= 0x0008, /* System incomplete power */
> +};
> +

  reply	other threads:[~2014-09-30  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 10:23 [PATCH] powerpc, powernv: Add OPAL platform event driver Anshuman Khandual
2014-09-30  5:23 ` Neelesh Gupta [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-09-29 10:12 Anshuman Khandual

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=542A3E51.5030701@linux.vnet.ibm.com \
    --to=neelegup@linux.vnet.ibm.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).