* [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init
@ 2008-12-12 9:20 Tero Kristo
2008-12-15 22:19 ` Kevin Hilman
2009-08-13 14:16 ` Kevin Hilman
0 siblings, 2 replies; 5+ messages in thread
From: Tero Kristo @ 2008-12-12 9:20 UTC (permalink / raw)
To: linux-omap
This function is now called only once during the initialization of the device
and consequent sleep cycles will re-use the same saved contents for secure
RAM. Users who need secure services should do secure RAM saving before
entering off-mode, if a secure service has been accessed after last save.
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
arch/arm/mach-omap2/pm34xx.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 4223622..b8cf5f2 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -127,6 +127,12 @@ static void omap3_core_restore_context(void)
omap_dma_global_context_restore();
}
+/*
+ * FIXME: This function should be called before entering off-mode after
+ * OMAP3 secure services have been accessed. Currently it is only called
+ * once during boot sequence, but this works as we are not using secure
+ * services.
+ */
static void omap3_save_secure_ram_context(u32 target_mpu_state)
{
u32 ret;
@@ -349,7 +355,6 @@ void omap_sram_idle(void)
OMAP3_PRM_VOLTCTRL_OFFSET);
omap3_core_save_context();
omap3_prcm_save_context();
- omap3_save_secure_ram_context(mpu_next_state);
}
/* Enable IO-PAD wakeup */
prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
@@ -923,6 +928,18 @@ int __init omap3_pm_init(void)
}
omap3_save_scratchpad_contents();
+ if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
+ local_irq_disable();
+ local_fiq_disable();
+
+ omap_dma_global_context_save();
+ omap3_save_secure_ram_context(PWRDM_POWER_ON);
+ omap_dma_global_context_restore();
+
+ local_irq_enable();
+ local_fiq_enable();
+ }
+
err1:
return ret;
err2:
--
1.5.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init
2008-12-12 9:20 [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init Tero Kristo
@ 2008-12-15 22:19 ` Kevin Hilman
2009-08-13 14:16 ` Kevin Hilman
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2008-12-15 22:19 UTC (permalink / raw)
To: Tero Kristo; +Cc: linux-omap
Tero Kristo <tero.kristo@nokia.com> writes:
> This function is now called only once during the initialization of the device
> and consequent sleep cycles will re-use the same saved contents for secure
> RAM. Users who need secure services should do secure RAM saving before
> entering off-mode, if a secure service has been accessed after last save.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Thanks, applied to PM branch.
Kevin
> ---
> arch/arm/mach-omap2/pm34xx.c | 19 ++++++++++++++++++-
> 1 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 4223622..b8cf5f2 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -127,6 +127,12 @@ static void omap3_core_restore_context(void)
> omap_dma_global_context_restore();
> }
>
> +/*
> + * FIXME: This function should be called before entering off-mode after
> + * OMAP3 secure services have been accessed. Currently it is only called
> + * once during boot sequence, but this works as we are not using secure
> + * services.
> + */
> static void omap3_save_secure_ram_context(u32 target_mpu_state)
> {
> u32 ret;
> @@ -349,7 +355,6 @@ void omap_sram_idle(void)
> OMAP3_PRM_VOLTCTRL_OFFSET);
> omap3_core_save_context();
> omap3_prcm_save_context();
> - omap3_save_secure_ram_context(mpu_next_state);
> }
> /* Enable IO-PAD wakeup */
> prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
> @@ -923,6 +928,18 @@ int __init omap3_pm_init(void)
> }
> omap3_save_scratchpad_contents();
>
> + if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
> + local_irq_disable();
> + local_fiq_disable();
> +
> + omap_dma_global_context_save();
> + omap3_save_secure_ram_context(PWRDM_POWER_ON);
> + omap_dma_global_context_restore();
> +
> + local_irq_enable();
> + local_fiq_enable();
> + }
> +
> err1:
> return ret;
> err2:
> --
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init
2008-12-12 9:20 [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init Tero Kristo
2008-12-15 22:19 ` Kevin Hilman
@ 2009-08-13 14:16 ` Kevin Hilman
2009-08-13 15:06 ` Tero.Kristo
1 sibling, 1 reply; 5+ messages in thread
From: Kevin Hilman @ 2009-08-13 14:16 UTC (permalink / raw)
To: Tero Kristo; +Cc: linux-omap
Tero Kristo <tero.kristo@nokia.com> writes:
> This function is now called only once during the initialization of the device
> and consequent sleep cycles will re-use the same saved contents for secure
> RAM. Users who need secure services should do secure RAM saving before
> entering off-mode, if a secure service has been accessed after last save.
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
You explain what you're doing, but you don't explain why.
Is there a large latency involved in this save/restore that you're
trying to eliminate for the no-secure-services case?
Kevin
> ---
> arch/arm/mach-omap2/pm34xx.c | 19 ++++++++++++++++++-
> 1 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 4223622..b8cf5f2 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -127,6 +127,12 @@ static void omap3_core_restore_context(void)
> omap_dma_global_context_restore();
> }
>
> +/*
> + * FIXME: This function should be called before entering off-mode after
> + * OMAP3 secure services have been accessed. Currently it is only called
> + * once during boot sequence, but this works as we are not using secure
> + * services.
> + */
> static void omap3_save_secure_ram_context(u32 target_mpu_state)
> {
> u32 ret;
> @@ -349,7 +355,6 @@ void omap_sram_idle(void)
> OMAP3_PRM_VOLTCTRL_OFFSET);
> omap3_core_save_context();
> omap3_prcm_save_context();
> - omap3_save_secure_ram_context(mpu_next_state);
> }
> /* Enable IO-PAD wakeup */
> prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
> @@ -923,6 +928,18 @@ int __init omap3_pm_init(void)
> }
> omap3_save_scratchpad_contents();
>
> + if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
> + local_irq_disable();
> + local_fiq_disable();
> +
> + omap_dma_global_context_save();
> + omap3_save_secure_ram_context(PWRDM_POWER_ON);
> + omap_dma_global_context_restore();
> +
> + local_irq_enable();
> + local_fiq_enable();
> + }
> +
> err1:
> return ret;
> err2:
> --
> 1.5.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init
2009-08-13 14:16 ` Kevin Hilman
@ 2009-08-13 15:06 ` Tero.Kristo
2009-08-13 15:15 ` Kevin Hilman
0 siblings, 1 reply; 5+ messages in thread
From: Tero.Kristo @ 2009-08-13 15:06 UTC (permalink / raw)
To: khilman; +Cc: linux-omap
>-----Original Message-----
>From: ext Kevin Hilman [mailto:khilman@deeprootsystems.com]
>Sent: 13 August, 2009 17:17
>To: Kristo Tero (Nokia-D/Tampere)
>Cc: linux-omap@vger.kernel.org
>Subject: Re: [PATCH] PM OMAP3: Change omap3_save_secure_ram to
>be called only during init
>
>Tero Kristo <tero.kristo@nokia.com> writes:
>
>> This function is now called only once during the
>initialization of the device
>> and consequent sleep cycles will re-use the same saved
>contents for secure
>> RAM. Users who need secure services should do secure RAM
>saving before
>> entering off-mode, if a secure service has been accessed
>after last save.
>>
>> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>
>You explain what you're doing, but you don't explain why.
>
>Is there a large latency involved in this save/restore that you're
>trying to eliminate for the no-secure-services case?
There are both latency and reliability issues. The context save uses a hardware resource which takes an order of hundreds of milliseconds to initialize after a wake up from off-mode, and also there is no way of checking whether it is ready from kernel side or not. It just crashes if you use it too quickly.
>
>Kevin
>
>> ---
>> arch/arm/mach-omap2/pm34xx.c | 19 ++++++++++++++++++-
>> 1 files changed, 18 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/pm34xx.c
>b/arch/arm/mach-omap2/pm34xx.c
>> index 4223622..b8cf5f2 100644
>> --- a/arch/arm/mach-omap2/pm34xx.c
>> +++ b/arch/arm/mach-omap2/pm34xx.c
>> @@ -127,6 +127,12 @@ static void omap3_core_restore_context(void)
>> omap_dma_global_context_restore();
>> }
>>
>> +/*
>> + * FIXME: This function should be called before entering
>off-mode after
>> + * OMAP3 secure services have been accessed. Currently it
>is only called
>> + * once during boot sequence, but this works as we are not
>using secure
>> + * services.
>> + */
>> static void omap3_save_secure_ram_context(u32 target_mpu_state)
>> {
>> u32 ret;
>> @@ -349,7 +355,6 @@ void omap_sram_idle(void)
>> OMAP3_PRM_VOLTCTRL_OFFSET);
>> omap3_core_save_context();
>> omap3_prcm_save_context();
>> - omap3_save_secure_ram_context(mpu_next_state);
>> }
>> /* Enable IO-PAD wakeup */
>> prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
>> @@ -923,6 +928,18 @@ int __init omap3_pm_init(void)
>> }
>> omap3_save_scratchpad_contents();
>>
>> + if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
>> + local_irq_disable();
>> + local_fiq_disable();
>> +
>> + omap_dma_global_context_save();
>> + omap3_save_secure_ram_context(PWRDM_POWER_ON);
>> + omap_dma_global_context_restore();
>> +
>> + local_irq_enable();
>> + local_fiq_enable();
>> + }
>> +
>> err1:
>> return ret;
>> err2:
>> --
>> 1.5.4.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe
>linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init
2009-08-13 15:06 ` Tero.Kristo
@ 2009-08-13 15:15 ` Kevin Hilman
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Hilman @ 2009-08-13 15:15 UTC (permalink / raw)
To: Tero.Kristo; +Cc: linux-omap
<Tero.Kristo@nokia.com> writes:
>
>
>>-----Original Message-----
>>From: ext Kevin Hilman [mailto:khilman@deeprootsystems.com]
>>Sent: 13 August, 2009 17:17
>>To: Kristo Tero (Nokia-D/Tampere)
>>Cc: linux-omap@vger.kernel.org
>>Subject: Re: [PATCH] PM OMAP3: Change omap3_save_secure_ram to
>>be called only during init
>>
>>Tero Kristo <tero.kristo@nokia.com> writes:
>>
>>> This function is now called only once during the
>>initialization of the device
>>> and consequent sleep cycles will re-use the same saved
>>contents for secure
>>> RAM. Users who need secure services should do secure RAM
>>saving before
>>> entering off-mode, if a secure service has been accessed
>>after last save.
>>> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>>
>>You explain what you're doing, but you don't explain why.
>>
>>Is there a large latency involved in this save/restore that you're
>>trying to eliminate for the no-secure-services case?
>
> There are both latency and reliability issues. The context save uses a
> hardware resource which takes an order of hundreds of milliseconds to
> initialize after a wake up from off-mode, and also there is no way of
> checking whether it is ready from kernel side or not. It just crashes
> if you use it too quickly.
Tero,
OK, makes sense. Thanks or the clarification. I'll add this to the
changelog and push to PM branch.
Kevin
>>
>>Kevin
>>
>>> --- arch/arm/mach-omap2/pm34xx.c | 19 ++++++++++++++++++- 1 files
>>> changed, 18 insertions(+), 1 deletions(-)
>>> diff --git a/arch/arm/mach-omap2/pm34xx.c
>>b/arch/arm/mach-omap2/pm34xx.c
>>> index 4223622..b8cf5f2 100644 --- a/arch/arm/mach-omap2/pm34xx.c
>>> +++ b/arch/arm/mach-omap2/pm34xx.c
>>> @@ -127,6 +127,12 @@ static void omap3_core_restore_context(void)
>>> omap_dma_global_context_restore(); }
>>>
>>> +/* * FIXME: This function should be called before entering
>>off-mode after
>>> + * OMAP3 secure services have been accessed. Currently it
>>is only called
>>> + * once during boot sequence, but this works as we are not
>>using secure
>>> + * services. */
>>> static void omap3_save_secure_ram_context(u32 target_mpu_state) {
>>> u32 ret; @@ -349,7 +355,6 @@ void omap_sram_idle(void)
>>> OMAP3_PRM_VOLTCTRL_OFFSET); omap3_core_save_context();
>>> omap3_prcm_save_context(); -
>>> omap3_save_secure_ram_context(mpu_next_state); } /* Enable IO-PAD
>>> wakeup */ prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
>>> @@ -923,6 +928,18 @@ int __init omap3_pm_init(void) }
>>> omap3_save_scratchpad_contents();
>>>
>>> + if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
>>> + local_irq_disable();
>>> + local_fiq_disable();
>>> +
>>> + omap_dma_global_context_save();
>>> + omap3_save_secure_ram_context(PWRDM_POWER_ON);
>>> + omap_dma_global_context_restore();
>>> +
>>> + local_irq_enable();
>>> + local_fiq_enable();
>>> + }
>>> +
>>> err1: return ret; err2: -- 1.5.4.3
>>> -- To unsubscribe from this list: send the line "unsubscribe
>>linux-omap" in
>>> the body of a message to majordomo@vger.kernel.org More majordomo
>>> info at http://vger.kernel.org/majordomo-info.html
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-13 15:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-12 9:20 [PATCH] PM OMAP3: Change omap3_save_secure_ram to be called only during init Tero Kristo
2008-12-15 22:19 ` Kevin Hilman
2009-08-13 14:16 ` Kevin Hilman
2009-08-13 15:06 ` Tero.Kristo
2009-08-13 15:15 ` Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox