linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Anton Blanchard <anton@samba.org>
Cc: neelegup@linux.vnet.ibm.com, sbhat@linux.vnet.ibm.com,
	paulus@samba.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] powerpc/powernv: Fix endian issues with OPAL async code
Date: Fri, 28 Mar 2014 09:27:02 +1100	[thread overview]
Message-ID: <1395959222.5569.123.camel@pasglop> (raw)
In-Reply-To: <20140328091737.6cb02f7d@kryten>

On Fri, 2014-03-28 at 09:17 +1100, Anton Blanchard wrote:
> Byteswap struct opal_msg in one place instead of requiring all the
> callers to do it.

This will clash with us making opal.h something clean and identical
between OPAL and clients.

Can you rename the converted version instead ? (yeah I know, it suck
to find a good name ...)

Cheers,
Ben.

> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> 
> Index: b/arch/powerpc/include/asm/opal.h
> ===================================================================
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -421,6 +421,12 @@ enum OpalSysparamPerm {
>  	OPAL_SYSPARAM_RW        = (OPAL_SYSPARAM_READ | OPAL_SYSPARAM_WRITE),
>  };
>  
> +struct raw_opal_msg {
> +	__be32 msg_type;
> +	__be32 reserved;
> +	__be64 params[8];
> +};
> +
>  struct opal_msg {
>  	uint32_t msg_type;
>  	uint32_t reserved;
> Index: b/arch/powerpc/platforms/powernv/opal.c
> ===================================================================
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -288,9 +288,11 @@ static void opal_handle_message(void)
>  	 * TODO: pre-allocate a message buffer depending on opal-msg-size
>  	 * value in /proc/device-tree.
>  	 */
> +	static struct raw_opal_msg raw_msg;
>  	static struct opal_msg msg;
> +	int i;
>  
> -	ret = opal_get_msg(__pa(&msg), sizeof(msg));
> +	ret = opal_get_msg(__pa(&raw_msg), sizeof(raw_msg));
>  	/* No opal message pending. */
>  	if (ret == OPAL_RESOURCE)
>  		return;
> @@ -302,6 +304,11 @@ static void opal_handle_message(void)
>  		return;
>  	}
>  
> +	msg.msg_type = be32_to_cpu(raw_msg.msg_type);
> +	msg.reserved = be32_to_cpu(raw_msg.reserved);
> +	for (i = 0; i < ARRAY_SIZE(raw_msg.params); i++)
> +		msg.params[i] = be64_to_cpu(raw_msg.params[i]);
> +
>  	/* Sanity check */
>  	if (msg.msg_type > OPAL_MSG_TYPE_MAX) {
>  		pr_warning("%s: Unknown message type: %u\n",

  parent reply	other threads:[~2014-03-27 22:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 22:17 [PATCH 1/2] powerpc/powernv: Fix endian issues with OPAL async code Anton Blanchard
2014-03-27 22:18 ` [PATCH 2/2] powerpc/powernv: Fix endian issues with sensor code Anton Blanchard
2014-03-27 22:27 ` Benjamin Herrenschmidt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-03-28  5:33 [PATCH 1/2] powerpc/powernv: Fix endian issues with OPAL async code Anton Blanchard

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=1395959222.5569.123.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=neelegup@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=sbhat@linux.vnet.ibm.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 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).