linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
@ 2014-10-22  3:32 Jeremy Kerr
  2014-10-22  5:31 ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Kerr @ 2014-10-22  3:32 UTC (permalink / raw)
  To: linuxppc-dev

Currently, we can't call opal wrappers from modules when using the LE
ABIv2, which requires a TOC init.

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>

---
 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 e9e2450..845a5c5 100644
--- a/arch/powerpc/platforms/powernv/opal-wrappers.S
+++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
@@ -58,7 +58,7 @@ END_FTR_SECTION(0, 1);						\
  */
 
 #define OPAL_CALL(name, token)		\
- _GLOBAL(name);				\
+ _GLOBAL_TOC(name);				\
 	mflr	r0;			\
 	std	r0,16(r1);		\
 	li	r0,token;		\

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
  2014-10-22  3:32 [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers Jeremy Kerr
@ 2014-10-22  5:31 ` Michael Ellerman
  2014-10-22  6:10   ` Benjamin Herrenschmidt
  2014-10-22 11:12   ` Jeremy Kerr
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Ellerman @ 2014-10-22  5:31 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: linuxppc-dev

On Wed, 2014-10-22 at 11:32 +0800, Jeremy Kerr wrote:
> Currently, we can't call opal wrappers from modules when using the LE
> ABIv2, which requires a TOC init.

What happens if we try? Build failure or run time bug?

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

Are we doing that now, or we would like to?

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
  2014-10-22  5:31 ` Michael Ellerman
@ 2014-10-22  6:10   ` Benjamin Herrenschmidt
  2014-10-22 11:12   ` Jeremy Kerr
  1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2014-10-22  6:10 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Jeremy Kerr

On Wed, 2014-10-22 at 16:31 +1100, Michael Ellerman wrote:
> On Wed, 2014-10-22 at 11:32 +0800, Jeremy Kerr wrote:
> > Currently, we can't call opal wrappers from modules when using the LE
> > ABIv2, which requires a TOC init.
> 
> What happens if we try? Build failure or run time bug?

Kaboom.

> > This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the
> > opal wrappers, so that we can do non-local calls to them.
> 
> Are we doing that now, or we would like to?

We do now for a test module (the one that test using the invalid
OPAL call), but we would like to use it for real for the new IPMI
driver among others.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
  2014-10-22  5:31 ` Michael Ellerman
  2014-10-22  6:10   ` Benjamin Herrenschmidt
@ 2014-10-22 11:12   ` Jeremy Kerr
  1 sibling, 0 replies; 4+ messages in thread
From: Jeremy Kerr @ 2014-10-22 11:12 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

Hi Michael,

>> Currently, we can't call opal wrappers from modules when using the LE
>> ABIv2, which requires a TOC init.
> 
> What happens if we try? Build failure or run time bug?

We'll get an arbitrary memory dereference (two, actually) in the opal
wrappers, when we try to load the opal entry point & return address from
the TOC, as r2 may not point to a valid TOC for the kernel.

>> This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the
>> opal wrappers, so that we can do non-local calls to them.
> 
> Are we doing that now, or we would like to?

We'd like to; although we do EXPORT_SYMBOL on another wrapper
(opal_invalid_call()) already. From the call name though, I figure it's
not in any mission-critical usage :)

Cheers,


Jeremy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-22 11:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-22  3:32 [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers Jeremy Kerr
2014-10-22  5:31 ` Michael Ellerman
2014-10-22  6:10   ` Benjamin Herrenschmidt
2014-10-22 11:12   ` Jeremy Kerr

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).