All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>
To: Anton Blanchard <anton@samba.org>
Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/powernv: Fix endian issues in memory error handling code
Date: Fri, 6 Jun 2014 23:44:33 +0530	[thread overview]
Message-ID: <20140606181433.GA616@in.ibm.com> (raw)
In-Reply-To: <20140604144848.459a15e5@kryten>

On 2014-06-04 14:48:48 Wed, Anton Blanchard wrote:
> struct OpalMemoryErrorData is passed to us from firmware, so we
> have to byteswap it.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Tested-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

> ---
> 
> Having enums in a firmware interface concerns me, but that cleanup
> can be in a subsequent patch.
> 
> Mahesh, could you give this a test to see if it works?
> 
> Index: b/arch/powerpc/include/asm/opal.h
> ===================================================================
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -482,7 +482,7 @@ enum OpalMemErr_DynErrType {
>  struct OpalMemoryErrorData {
>  	enum OpalMemErr_Version	version:8;	/* 0x00 */
>  	enum OpalMemErrType	type:8;		/* 0x01 */
> -	uint16_t		flags;		/* 0x02 */
> +	__be16			flags;		/* 0x02 */
>  	uint8_t			reserved_1[4];	/* 0x04 */
> 
>  	union {
> @@ -490,15 +490,15 @@ struct OpalMemoryErrorData {
>  		struct {
>  			enum OpalMemErr_ResilErrType resil_err_type:8;
>  			uint8_t		reserved_1[7];
> -			uint64_t	physical_address_start;
> -			uint64_t	physical_address_end;
> +			__be64		physical_address_start;
> +			__be64		physical_address_end;
>  		} resilience;
>  		/* Dynamic memory deallocation error info */
>  		struct {
>  			enum OpalMemErr_DynErrType dyn_err_type:8;
>  			uint8_t		reserved_1[7];
> -			uint64_t	physical_address_start;
> -			uint64_t	physical_address_end;
> +			__be64		physical_address_start;
> +			__be64		physical_address_end;
>  		} dyn_dealloc;
>  	} u;
>  };
> Index: b/arch/powerpc/platforms/powernv/opal-memory-errors.c
> ===================================================================
> --- a/arch/powerpc/platforms/powernv/opal-memory-errors.c
> +++ b/arch/powerpc/platforms/powernv/opal-memory-errors.c
> @@ -47,12 +47,12 @@ static void handle_memory_error_event(st
>  		  __func__, merr_evt->type);
>  	switch (merr_evt->type) {
>  	case OPAL_MEM_ERR_TYPE_RESILIENCE:
> -		paddr_start = merr_evt->u.resilience.physical_address_start;
> -		paddr_end = merr_evt->u.resilience.physical_address_end;
> +		paddr_start = be64_to_cpu(merr_evt->u.resilience.physical_address_start);
> +		paddr_end = be64_to_cpu(merr_evt->u.resilience.physical_address_end);
>  		break;
>  	case OPAL_MEM_ERR_TYPE_DYN_DALLOC:
> -		paddr_start = merr_evt->u.dyn_dealloc.physical_address_start;
> -		paddr_end = merr_evt->u.dyn_dealloc.physical_address_end;
> +		paddr_start = be64_to_cpu(merr_evt->u.dyn_dealloc.physical_address_start);
> +		paddr_end = be64_to_cpu(merr_evt->u.dyn_dealloc.physical_address_end);
>  		break;
>  	default:
>  		return;
> 

-- 
Mahesh J Salgaonkar

      reply	other threads:[~2014-06-06 18:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-04  4:48 [PATCH] powerpc/powernv: Fix endian issues in memory error handling code Anton Blanchard
2014-06-06 18:14 ` Mahesh J Salgaonkar [this message]

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=20140606181433.GA616@in.ibm.com \
    --to=mahesh@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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 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.