[RFC PATCH] ARM: Make a compile trustzone conditionally
Arnd Bergmann
arnd at arndb.de
Wed Jun 20 07:14:16 EDT 2012
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
More information about the linux-arm-kernel
mailing list