All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH] ARM: Make a compile trustzone conditionally
Date: Wed, 20 Jun 2012 11:14:16 +0000	[thread overview]
Message-ID: <201206201114.17033.arnd@arndb.de> (raw)
In-Reply-To: <CAH9JG2UwwvZTK+RptKQ+fmfAMHeqyXG=eo9bJN+JogGBDTgqNQ@mail.gmail.com>

On Tuesday 19 June 2012, Kyungmin Park wrote:
> > Would it help to have a trustzone_ops structure with pointers to
> > functions if needed, similar to but separate from smp_ops?
> Here's real usages. I'm not sure it's possible since smc call is
> vendor specific.

I would hope that there is at last some overlap, as well as only a
limited number of things that you might want to do with smc.

> static int exynos4_cpu_suspend(unsigned long arg)
> {
>         outer_flush_all();
> 
>         /* issue the standby signal into the pm unit. */
>         if (trustzone_enabled())
>                 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
>         else
>                 cpu_do_idle();
> 
>         /* we should never get past here */
>         panic("sleep resumed to originator?");
> }

This looks straightforward to implement as an indirect call just for
cpu_do_idle. We already have an indirection layer for cpu-specific
do_idle functions. It would be ideal to have only one level of
indirection, but the extra level would work as well.

> static int exynos4_cpu_suspend(unsigned long arg)
> {
>         outer_flush_all();
> 
>         /* issue the standby signal into the pm unit. */
>         cpu_do_idle();
> 
>         /* we should never get past here */
>         panic("sleep resumed to originator?");
> }
> 
> static int exynos4_cpu_smc_suspend(unsigned long arg)
> {
>         outer_flush_all();
> 
>         exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
> 
>         /* we should never get past here */
>         panic("sleep resumed to originator?");
> }
> 
> but still we should check it's trustzone is enabled or not to assign
> proper function into pm_cpu_suspend
> 
> I think it's different from smp_ops.

This is a different method from what I had in mind, but it would
work too. It's not platform independent though.

What I was thinking of is something along the lines of

static void nosmc_cpu_do_idle(void)
{
	cpu_do_idle();
}

struct smc_ops {
	void (*do_idle)(void);
	...
};

struct smc_ops default_smc_ops = {
	.do_idle = nosmc_cpu_do_idle,
	...
};

So the exynos4_cpu_suspend() function would just do an indirect call to
smc->do_idle(), which is either nosmc_cpu_do_idle or a function specific
to the smc firmware.

	Arnd

  reply	other threads:[~2012-06-20 11:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11  5:15 [RFC PATCH] ARM: Make a compile trustzone conditionally Kyungmin Park
2012-06-18  0:58 ` Kyungmin Park
2012-06-18  1:10 ` Olof Johansson
2012-06-18  4:37   ` Kyungmin Park
2012-06-18 14:10     ` Arnd Bergmann
2012-06-19  6:50       ` Kyungmin Park
2012-06-20 11:14         ` Arnd Bergmann [this message]
2012-06-20 14:41           ` Dave Martin
2012-06-20 16:01             ` Arnd Bergmann
2012-06-20  1:22       ` Stephen Boyd
2012-06-20  9:43         ` Will Deacon
2012-06-20 10:51           ` Bindings for SMC/HVC firmware interfaces on ARM (Re: [RFC PATCH] ARM: Make a compile trustzone conditionally) Dave Martin
2012-06-20 10:51             ` Dave Martin
2012-06-20 15:14             ` Rob Herring
2012-06-20 15:14               ` Rob Herring
2012-06-20 15:34               ` Dave Martin
2012-06-20 15:34                 ` Dave Martin

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=201206201114.17033.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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.