linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 14/27] OMAP3: PM: save secure RAM only during init
Date: Wed, 14 Oct 2009 14:57:57 -0700	[thread overview]
Message-ID: <1255557490-16787-15-git-send-email-khilman@deeprootsystems.com> (raw)
In-Reply-To: <1255557490-16787-14-git-send-email-khilman@deeprootsystems.com>

From: Tero Kristo <tero.kristo@nokia.com>

The function omap3_save_secure_ram() 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.

There are both latency and reliability issues with saving secure RAM
context in the idle path. 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

Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.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 b8055f9..ab8f66a 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -113,6 +113,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;
@@ -338,7 +344,6 @@ static void omap_sram_idle(void)
 		if (core_next_state == PWRDM_POWER_OFF) {
 			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);
@@ -1002,6 +1007,18 @@ static 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.6.4.3

  reply	other threads:[~2009-10-14 21:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-14 21:57 [PATCH 00/27] OMAP3: PM: base off-mode support Kevin Hilman
2009-10-14 21:57 ` [PATCH 01/27] OMAP3: PM: GPMC context save/restore Kevin Hilman
2009-10-14 21:57   ` [PATCH 02/27] OMAP3: PM: GPIO " Kevin Hilman
2009-10-14 21:57     ` [PATCH 03/27] OMAP3: PM: INTC " Kevin Hilman
2009-10-14 21:57       ` [PATCH 04/27] OMAP3: PM: PRCM " Kevin Hilman
2009-10-14 21:57         ` [PATCH 05/27] OMAP3: PM: Populate scratchpad contents Kevin Hilman
2009-10-14 21:57           ` [PATCH 06/27] OMAP3: PM: SCM context save/restore Kevin Hilman
2009-10-14 21:57             ` [PATCH 07/27] OMAP3: PM: SRAM restore function Kevin Hilman
2009-10-14 21:57               ` [PATCH 08/27] OMAP3: PM: handle PER/NEON/CORE in idle Kevin Hilman
2009-10-14 21:57                 ` [PATCH 09/27] OMAP3: PM: Restore MMU table entry Kevin Hilman
2009-10-14 21:57                   ` [PATCH 10/27] OMAP3: PM: MPU off-mode support Kevin Hilman
2009-10-14 21:57                     ` [PATCH 11/27] OMAP3: PM: CORE domain " Kevin Hilman
2009-10-14 21:57                       ` [PATCH 12/27] OMAP: PM: DMA context save/restore for " Kevin Hilman
2009-10-14 21:57                         ` [PATCH 13/27] OMAP3 PM: off-mode support for HS/EMU devices Kevin Hilman
2009-10-14 21:57                           ` Kevin Hilman [this message]
2009-10-14 21:57                             ` [PATCH 15/27] OMAP3: PM: Enable SDRAM auto-refresh during sleep Kevin Hilman
2009-10-14 21:57                               ` [PATCH 16/27] OMAP3: PM: Save and restore also CM_CLKSEL1_PLL_IVA2 Kevin Hilman
2009-10-14 21:58                                 ` [PATCH 17/27] OMAP3: PM: Fix secure SRAM context save/restore Kevin Hilman
2009-10-14 21:58                                   ` [PATCH 18/27] ARM: OMAP: Add missing SMS_SYSCONFIG save/restore Kevin Hilman
2009-10-14 21:58                                     ` [PATCH 19/27] OMAP3: PM: Fix PLL_MOD CLKEN offset in scratchpad Kevin Hilman
2009-10-14 21:58                                       ` [PATCH 20/27] OMAP: PM: Clear DMA channel state after a wakeup Kevin Hilman
2009-10-14 21:58                                         ` [PATCH 21/27] OMAP: Store reboot mode in scratchpad on OMAP34xx Kevin Hilman
2009-10-14 21:58                                           ` [PATCH 22/27] OMAP3: PM: SDRC auto-refresh workaround for off-mode Kevin Hilman
2009-10-14 21:58                                             ` [PATCH 23/27] OMAP3: PM: Fix INTC context save/restore Kevin Hilman
2009-10-14 21:58                                               ` [PATCH 24/27] PM: Disable usb host HW save and restore Kevin Hilman
2009-10-14 21:58                                                 ` [PATCH 25/27] OMAP3: PM: Wait for SDRC ready iso a blind delay Kevin Hilman
2009-10-14 21:58                                                   ` [PATCH 26/27] OMAP3: PM debug: allow runtime toggle of PM features Kevin Hilman
2009-10-14 21:58                                                     ` [PATCH 27/27] PM debug: allow configurable wakeup from suspend on OMAP GPtimer Kevin Hilman
2009-10-14 22:18                 ` [PATCH 08/27] OMAP3: PM: handle PER/NEON/CORE in idle Tony Lindgren
2009-10-14 22:17               ` [PATCH 07/27] OMAP3: PM: SRAM restore function Tony Lindgren
2009-10-14 22:15       ` [PATCH 03/27] OMAP3: PM: INTC context save/restore Tony Lindgren
2009-10-14 22:13     ` [PATCH 02/27] OMAP3: PM: GPIO " Tony Lindgren

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=1255557490-16787-15-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --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 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).