diff mbox

[Utopic,SRU] powernv: Use _GLOBAL_TOC for opal wrappers

Message ID 1426541038-5569-1-git-send-email-chris.j.arges@canonical.com
State New
Headers show

Commit Message

Chris J Arges March 16, 2015, 9:23 p.m. UTC
From: Jeremy Kerr <jk@ozlabs.org>

BugLink: http://bugs.launchpad.net/bugs/1431196

Currently, we can't call opal wrappers from modules when using the LE
ABIv2, which requires a TOC init. If we do we'll try and load the opal
entry point using the wrong toc and probably explode or worse jump to
the wrong address.

Nothing in upstream is making opal calls from a module, but we do export
one of the wrappers so we should fix this anyway.

This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the
opal wrappers, so that we can do non-local calls to them.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 19d36c2152aaf093c97431b5b4d13d29305a63a3)
Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
---
 arch/powerpc/platforms/powernv/opal-wrappers.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Brad Figg March 16, 2015, 9:28 p.m. UTC | #1
On Mon, Mar 16, 2015 at 04:23:58PM -0500, Chris J Arges wrote:
> From: Jeremy Kerr <jk@ozlabs.org>
> 
> BugLink: http://bugs.launchpad.net/bugs/1431196
> 
> Currently, we can't call opal wrappers from modules when using the LE
> ABIv2, which requires a TOC init. If we do we'll try and load the opal
> entry point using the wrong toc and probably explode or worse jump to
> the wrong address.
> 
> Nothing in upstream is making opal calls from a module, but we do export
> one of the wrappers so we should fix this anyway.
> 
> This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the
> opal wrappers, so that we can do non-local calls to them.
> 
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> (cherry picked from commit 19d36c2152aaf093c97431b5b4d13d29305a63a3)
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
>  arch/powerpc/platforms/powernv/opal-wrappers.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
> index 3711ba6..67c4709 100644
> --- a/arch/powerpc/platforms/powernv/opal-wrappers.S
> +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
> @@ -20,7 +20,7 @@
>   * - Get r11 feed up by Dave so I can have better register usage
>   */
>  #define OPAL_CALL(name, token)		\
> - _GLOBAL(name);				\
> + _GLOBAL_TOC(name);			\
>  	mflr	r0;			\
>  	mfcr	r12;			\
>  	std	r0,16(r1);		\
> -- 
> 1.9.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Makes sense.
Andy Whitcroft March 17, 2015, 1:35 p.m. UTC | #2
On Mon, Mar 16, 2015 at 04:23:58PM -0500, Chris J Arges wrote:
> From: Jeremy Kerr <jk@ozlabs.org>
> 
> BugLink: http://bugs.launchpad.net/bugs/1431196
> 
> Currently, we can't call opal wrappers from modules when using the LE
> ABIv2, which requires a TOC init. If we do we'll try and load the opal
> entry point using the wrong toc and probably explode or worse jump to
> the wrong address.
> 
> Nothing in upstream is making opal calls from a module, but we do export
> one of the wrappers so we should fix this anyway.
> 
> This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the
> opal wrappers, so that we can do non-local calls to them.
> 
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> (cherry picked from commit 19d36c2152aaf093c97431b5b4d13d29305a63a3)
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> ---
>  arch/powerpc/platforms/powernv/opal-wrappers.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
> index 3711ba6..67c4709 100644
> --- a/arch/powerpc/platforms/powernv/opal-wrappers.S
> +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
> @@ -20,7 +20,7 @@
>   * - Get r11 feed up by Dave so I can have better register usage
>   */
>  #define OPAL_CALL(name, token)		\
> - _GLOBAL(name);				\
> + _GLOBAL_TOC(name);			\
>  	mflr	r0;			\
>  	mfcr	r12;			\
>  	std	r0,16(r1);		\
> -- 

This appears to do what is claimed.

Acked-by: Andy Whitcroft <apw@canonical.com>

-apw
Andy Whitcroft March 18, 2015, 9:21 a.m. UTC | #3
Applied to utopic.

-apw
diff mbox

Patch

diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
index 3711ba6..67c4709 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -20,7 +20,7 @@ 
  * - Get r11 feed up by Dave so I can have better register usage
  */
 #define OPAL_CALL(name, token)		\
- _GLOBAL(name);				\
+ _GLOBAL_TOC(name);			\
 	mflr	r0;			\
 	mfcr	r12;			\
 	std	r0,16(r1);		\