All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@mips.com>
To: Paul Burton <paul.burton@mips.com>
Cc: <linux-mips@linux-mips.org>,
	Matt Redfearn <matt.redfearn@mips.com>,
	Ralf Baechle <ralf@linux-mips.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH] MIPS: Fix CM region target definitions
Date: Tue, 31 Oct 2017 23:52:19 +0000	[thread overview]
Message-ID: <20171031235219.GE15260@jhogan-linux> (raw)
In-Reply-To: <20171031220922.14931-1-paul.burton@mips.com>

[-- Attachment #1: Type: text/plain, Size: 2146 bytes --]

On Tue, Oct 31, 2017 at 03:09:22PM -0700, Paul Burton wrote:
> The default CM target field in the GCR_BASE register is encoded with 0
> meaning memory & 1 being reserved. However the definitions we use for
> those bits effectively get these two values backwards - likely because
> they were copied from the definitions for the CM regions where the
> target is encoded differently. This results in use setting up GCR_BASE
> with the reserved target value by default, rather than targeting memory
> as intended. Although we currently seem to get away with this it's not a
> great idea to rely upon.
> 
> Fix this by changing our macros to match the documentated target values.
> 
> The incorrect encoding became used as of commit 9f98f3dd0c51 ("MIPS: Add
> generic CM probe & access code") in the Linux v3.15 cycle, and was
> likely carried forwards from older but unused code introduced by
> commit 39b8d5254246 ("[MIPS] Add support for MIPS CMP platform.") in the
> v2.6.26 cycle.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Reported-by: Matt Redfearn <matt.redfearn@mips.com>
> Cc: Matt Redfearn <matt.redfearn@mips.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # v3.15+

Reviewed-by: James Hogan <jhogan@kernel.org>

Cheers
James

> ---
> 
>  arch/mips/include/asm/mips-cm.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
> index f6231b91b724..c6aaabd7cfd1 100644
> --- a/arch/mips/include/asm/mips-cm.h
> +++ b/arch/mips/include/asm/mips-cm.h
> @@ -142,8 +142,8 @@ GCR_ACCESSOR_RO(64, 0x000, config)
>  GCR_ACCESSOR_RW(64, 0x008, base)
>  #define CM_GCR_BASE_GCRBASE			GENMASK_ULL(47, 15)
>  #define CM_GCR_BASE_CMDEFTGT			GENMASK(1, 0)
> -#define  CM_GCR_BASE_CMDEFTGT_DISABLED		0
> -#define  CM_GCR_BASE_CMDEFTGT_MEM		1
> +#define  CM_GCR_BASE_CMDEFTGT_MEM		0
> +#define  CM_GCR_BASE_CMDEFTGT_RESERVED		1
>  #define  CM_GCR_BASE_CMDEFTGT_IOCU0		2
>  #define  CM_GCR_BASE_CMDEFTGT_IOCU1		3
>  
> -- 
> 2.15.0
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@mips.com>
To: Paul Burton <paul.burton@mips.com>
Cc: linux-mips@linux-mips.org, Matt Redfearn <matt.redfearn@mips.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: Fix CM region target definitions
Date: Tue, 31 Oct 2017 23:52:19 +0000	[thread overview]
Message-ID: <20171031235219.GE15260@jhogan-linux> (raw)
Message-ID: <20171031235219.5O6cTlXLYG3X9XsAScwCIVK38wKhl1-s6-zA53gC_oE@z> (raw)
In-Reply-To: <20171031220922.14931-1-paul.burton@mips.com>

[-- Attachment #1: Type: text/plain, Size: 2146 bytes --]

On Tue, Oct 31, 2017 at 03:09:22PM -0700, Paul Burton wrote:
> The default CM target field in the GCR_BASE register is encoded with 0
> meaning memory & 1 being reserved. However the definitions we use for
> those bits effectively get these two values backwards - likely because
> they were copied from the definitions for the CM regions where the
> target is encoded differently. This results in use setting up GCR_BASE
> with the reserved target value by default, rather than targeting memory
> as intended. Although we currently seem to get away with this it's not a
> great idea to rely upon.
> 
> Fix this by changing our macros to match the documentated target values.
> 
> The incorrect encoding became used as of commit 9f98f3dd0c51 ("MIPS: Add
> generic CM probe & access code") in the Linux v3.15 cycle, and was
> likely carried forwards from older but unused code introduced by
> commit 39b8d5254246 ("[MIPS] Add support for MIPS CMP platform.") in the
> v2.6.26 cycle.
> 
> Signed-off-by: Paul Burton <paul.burton@mips.com>
> Reported-by: Matt Redfearn <matt.redfearn@mips.com>
> Cc: Matt Redfearn <matt.redfearn@mips.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: linux-mips@linux-mips.org
> Cc: <stable@vger.kernel.org> # v3.15+

Reviewed-by: James Hogan <jhogan@kernel.org>

Cheers
James

> ---
> 
>  arch/mips/include/asm/mips-cm.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/mips/include/asm/mips-cm.h b/arch/mips/include/asm/mips-cm.h
> index f6231b91b724..c6aaabd7cfd1 100644
> --- a/arch/mips/include/asm/mips-cm.h
> +++ b/arch/mips/include/asm/mips-cm.h
> @@ -142,8 +142,8 @@ GCR_ACCESSOR_RO(64, 0x000, config)
>  GCR_ACCESSOR_RW(64, 0x008, base)
>  #define CM_GCR_BASE_GCRBASE			GENMASK_ULL(47, 15)
>  #define CM_GCR_BASE_CMDEFTGT			GENMASK(1, 0)
> -#define  CM_GCR_BASE_CMDEFTGT_DISABLED		0
> -#define  CM_GCR_BASE_CMDEFTGT_MEM		1
> +#define  CM_GCR_BASE_CMDEFTGT_MEM		0
> +#define  CM_GCR_BASE_CMDEFTGT_RESERVED		1
>  #define  CM_GCR_BASE_CMDEFTGT_IOCU0		2
>  #define  CM_GCR_BASE_CMDEFTGT_IOCU1		3
>  
> -- 
> 2.15.0
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-10-31 23:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 22:09 [PATCH] MIPS: Fix CM region target definitions Paul Burton
2017-10-31 22:09 ` Paul Burton
2017-10-31 23:52 ` James Hogan [this message]
2017-10-31 23:52   ` James Hogan

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=20171031235219.GE15260@jhogan-linux \
    --to=james.hogan@mips.com \
    --cc=linux-mips@linux-mips.org \
    --cc=matt.redfearn@mips.com \
    --cc=paul.burton@mips.com \
    --cc=ralf@linux-mips.org \
    --cc=stable@vger.kernel.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.