All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-omap@vger.kernel.org, khilman@deeprootsystems.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 11/15] ARM: OMAP5: PM: Add L2 memory power down support
Date: Mon, 4 Mar 2013 12:41:52 -0600	[thread overview]
Message-ID: <20130304184152.GC14958@kahuna> (raw)
In-Reply-To: <51319B32.3070106@ti.com>

On 11:54-20130302, Santosh Shilimkar wrote:
> On Saturday 02 March 2013 05:13 AM, Nishanth Menon wrote:
> > On 17:41-20130301, Santosh Shilimkar wrote:
> >> When the entire MPUSS cluster is powered down in device off state, L2 cache
> >> memory looses it's content and hence while targetting such a state,
> >> l2 cache needs to be flushed to main memory.
> >>
> >> Add the necessary low power code support for the same.
> >>
> >> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >> ---
> >>  arch/arm/mach-omap2/omap-secure.h     |    1 +
> >>  arch/arm/mach-omap2/sleep_omap4plus.S |   30 ++++++++++++++++++++++++++++++
> >>  2 files changed, 31 insertions(+)
> >>
> >> diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
> >> index 1739468..a171a5a 100644
> >> --- a/arch/arm/mach-omap2/omap-secure.h
> >> +++ b/arch/arm/mach-omap2/omap-secure.h
> >> @@ -47,6 +47,7 @@
> >>  #define OMAP4_MON_L2X0_PREFETCH_INDEX	0x113
> >>  #define OMAP5_MON_CACHES_CLEAN_INDEX	0x103
> >>  #define OMAP5_MON_AUX_CTRL_INDEX	0x107
> >> +#define OMAP5_MON_L2AUX_CTRL_INDEX	0x104
> >>  
> >>  #define OMAP5_MON_AMBA_IF_INDEX		0x108
> >>  
> >> diff --git a/arch/arm/mach-omap2/sleep_omap4plus.S b/arch/arm/mach-omap2/sleep_omap4plus.S
> >> index f4874e5..ea318be 100644
> >> --- a/arch/arm/mach-omap2/sleep_omap4plus.S
> >> +++ b/arch/arm/mach-omap2/sleep_omap4plus.S
> >> @@ -386,6 +386,27 @@ skip_secure_l1_clean_op:
> >>  	isb
> >>  	dsb
> >>  
> >> +	bl	omap4_get_sar_ram_base
> >> +	mov	r8, r0
> >> +	mrc	p15, 0, r5, c0, c0, 5		@ Read MPIDR
> >> +	ands	r5, r5, #0x0f
> >> +	ldreq	r0, [r8, #L2X0_SAVE_OFFSET0]	@ Retrieve L2 state
> >> +	ldrne	r0, [r8, #L2X0_SAVE_OFFSET1]
> >> +	cmp	r0, #3
> > umm, we store l2x0_pwrst_prepare(cpu, save_state);
> > which in turn stores into L2X0_SAVE_OFFSET - I am with you so far
> > save_state in omap4_enter_lowpower is:
> > PWRDM_POWER_INACTIVE: 0
> > PWRDM_POWER_OFF: 1
> > or 2 in the case of OSWR
> > what is 3? ref:
> > https://github.com/SantoshShilimkar/linux/blob/testing/3.10/omap5-int-rebuild/arch/arm/mach-omap2/omap-mpuss-lowpower.c#L298
> This was obviosly for the case where L2 can be destroyed. As I said it can happen
> with MPU OSWR + L2 OFF setting or device OFF. 
Then please use macros for this.
> 
> >> +	bne	do_wfi
> >> +	bl	omap4_get_sar_ram_base
> >> +	ldr	r9, [r0, #OMAP_TYPE_OFFSET]
> >> +	cmp	r9, #0x1			@ Check for HS device
> > my 2c:
> > off topic: somewhere down the line, I think we need to clear up these
> > into macros so that as in this case, omap4_mpuss_init populated value
> > should be the same as here with usage of same macro without reviewer
> > needing to track down where it was set with what.
> >
> Patches welcome :)
Sure as long as we don't add even more "magic handshakes to the code" it
makes sense to cleanup older code.
> 
>  
> >> +	bne	skip_secure_l2_clean_op
> >> +	mov	r0, #1				@ Clean secure L2
> >> +	stmfd   r13!, {r4-r12, r14}
> >> +	ldr	r12, =OMAP5_MON_CACHES_CLEAN_INDEX
> >> +	DO_SMC
> >> +	ldmfd   r13!, {r4-r12, r14}
> >> +skip_secure_l2_clean_op:
> >> +	mov	r0, #2				@ Flush L2
> > v7_flush_dcache_all does not take parameters, right?
> >> +	bl	v7_flush_dcache_all
> >> +
> >>  do_wfi:
> >>  	bl	omap_do_wfi
> >>  
> >> @@ -427,6 +448,15 @@ ENTRY(omap5_cpu_resume)
> >>  	dsb
> >>  1:
> >>  #endif
> >> +	mrc	p15, 1, r0, c15, c0, 0		@ Read L2 ACTLR
> >> +	cmp	r0, #0x118			@ Check if it is already set
> > 
> >> 	beq	skip_sec_l2
> >> +	ldr	r0, =0x118			@ Setup L2 ACTLR = 0x118
> >> +	ldr	r12, =OMAP5_MON_L2AUX_CTRL_INDEX
> > I hope I am looking at the right place:
> > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0438g/BABIAICD.html
> It is correct.
> 
> > 
> > Is'nt it better to configure on boot, save it into SAR memory and restore it
> > from SAR using monitor call? I mean it is possible that we start boot
> > with L2 ACTLR != 0x118 and then hit off and come out of OFF mode with
> > 0x118.
> No need because it is more of re-initing the value rather than save/restore.
> I should have used macro instead of value though.
> 
> btw. I might drop this special setting based on some experiments am doing
> with benchmarks. Either case, if I keep the L2AUX code, I will use
> a macro.
Thanks. As long as it remains constant at boot and across OFF, it is
fine with me.

-- 
Regards,
Nishanth Menon

WARNING: multiple messages have this Message-ID (diff)
From: nm@ti.com (Nishanth Menon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/15] ARM: OMAP5: PM: Add L2 memory power down support
Date: Mon, 4 Mar 2013 12:41:52 -0600	[thread overview]
Message-ID: <20130304184152.GC14958@kahuna> (raw)
In-Reply-To: <51319B32.3070106@ti.com>

On 11:54-20130302, Santosh Shilimkar wrote:
> On Saturday 02 March 2013 05:13 AM, Nishanth Menon wrote:
> > On 17:41-20130301, Santosh Shilimkar wrote:
> >> When the entire MPUSS cluster is powered down in device off state, L2 cache
> >> memory looses it's content and hence while targetting such a state,
> >> l2 cache needs to be flushed to main memory.
> >>
> >> Add the necessary low power code support for the same.
> >>
> >> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >> ---
> >>  arch/arm/mach-omap2/omap-secure.h     |    1 +
> >>  arch/arm/mach-omap2/sleep_omap4plus.S |   30 ++++++++++++++++++++++++++++++
> >>  2 files changed, 31 insertions(+)
> >>
> >> diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
> >> index 1739468..a171a5a 100644
> >> --- a/arch/arm/mach-omap2/omap-secure.h
> >> +++ b/arch/arm/mach-omap2/omap-secure.h
> >> @@ -47,6 +47,7 @@
> >>  #define OMAP4_MON_L2X0_PREFETCH_INDEX	0x113
> >>  #define OMAP5_MON_CACHES_CLEAN_INDEX	0x103
> >>  #define OMAP5_MON_AUX_CTRL_INDEX	0x107
> >> +#define OMAP5_MON_L2AUX_CTRL_INDEX	0x104
> >>  
> >>  #define OMAP5_MON_AMBA_IF_INDEX		0x108
> >>  
> >> diff --git a/arch/arm/mach-omap2/sleep_omap4plus.S b/arch/arm/mach-omap2/sleep_omap4plus.S
> >> index f4874e5..ea318be 100644
> >> --- a/arch/arm/mach-omap2/sleep_omap4plus.S
> >> +++ b/arch/arm/mach-omap2/sleep_omap4plus.S
> >> @@ -386,6 +386,27 @@ skip_secure_l1_clean_op:
> >>  	isb
> >>  	dsb
> >>  
> >> +	bl	omap4_get_sar_ram_base
> >> +	mov	r8, r0
> >> +	mrc	p15, 0, r5, c0, c0, 5		@ Read MPIDR
> >> +	ands	r5, r5, #0x0f
> >> +	ldreq	r0, [r8, #L2X0_SAVE_OFFSET0]	@ Retrieve L2 state
> >> +	ldrne	r0, [r8, #L2X0_SAVE_OFFSET1]
> >> +	cmp	r0, #3
> > umm, we store l2x0_pwrst_prepare(cpu, save_state);
> > which in turn stores into L2X0_SAVE_OFFSET - I am with you so far
> > save_state in omap4_enter_lowpower is:
> > PWRDM_POWER_INACTIVE: 0
> > PWRDM_POWER_OFF: 1
> > or 2 in the case of OSWR
> > what is 3? ref:
> > https://github.com/SantoshShilimkar/linux/blob/testing/3.10/omap5-int-rebuild/arch/arm/mach-omap2/omap-mpuss-lowpower.c#L298
> This was obviosly for the case where L2 can be destroyed. As I said it can happen
> with MPU OSWR + L2 OFF setting or device OFF. 
Then please use macros for this.
> 
> >> +	bne	do_wfi
> >> +	bl	omap4_get_sar_ram_base
> >> +	ldr	r9, [r0, #OMAP_TYPE_OFFSET]
> >> +	cmp	r9, #0x1			@ Check for HS device
> > my 2c:
> > off topic: somewhere down the line, I think we need to clear up these
> > into macros so that as in this case, omap4_mpuss_init populated value
> > should be the same as here with usage of same macro without reviewer
> > needing to track down where it was set with what.
> >
> Patches welcome :)
Sure as long as we don't add even more "magic handshakes to the code" it
makes sense to cleanup older code.
> 
>  
> >> +	bne	skip_secure_l2_clean_op
> >> +	mov	r0, #1				@ Clean secure L2
> >> +	stmfd   r13!, {r4-r12, r14}
> >> +	ldr	r12, =OMAP5_MON_CACHES_CLEAN_INDEX
> >> +	DO_SMC
> >> +	ldmfd   r13!, {r4-r12, r14}
> >> +skip_secure_l2_clean_op:
> >> +	mov	r0, #2				@ Flush L2
> > v7_flush_dcache_all does not take parameters, right?
> >> +	bl	v7_flush_dcache_all
> >> +
> >>  do_wfi:
> >>  	bl	omap_do_wfi
> >>  
> >> @@ -427,6 +448,15 @@ ENTRY(omap5_cpu_resume)
> >>  	dsb
> >>  1:
> >>  #endif
> >> +	mrc	p15, 1, r0, c15, c0, 0		@ Read L2 ACTLR
> >> +	cmp	r0, #0x118			@ Check if it is already set
> > 
> >> 	beq	skip_sec_l2
> >> +	ldr	r0, =0x118			@ Setup L2 ACTLR = 0x118
> >> +	ldr	r12, =OMAP5_MON_L2AUX_CTRL_INDEX
> > I hope I am looking at the right place:
> > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0438g/BABIAICD.html
> It is correct.
> 
> > 
> > Is'nt it better to configure on boot, save it into SAR memory and restore it
> > from SAR using monitor call? I mean it is possible that we start boot
> > with L2 ACTLR != 0x118 and then hit off and come out of OFF mode with
> > 0x118.
> No need because it is more of re-initing the value rather than save/restore.
> I should have used macro instead of value though.
> 
> btw. I might drop this special setting based on some experiments am doing
> with benchmarks. Either case, if I keep the L2AUX code, I will use
> a macro.
Thanks. As long as it remains constant at boot and across OFF, it is
fine with me.

-- 
Regards,
Nishanth Menon

  reply	other threads:[~2013-03-04 18:41 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 12:10 [PATCH 00/15] ARM: OMAP5: PM: Add MPUSS suspend and CPUidle support Santosh Shilimkar
2013-03-01 12:10 ` Santosh Shilimkar
2013-03-01 12:10 ` [PATCH 01/15] ARM: OMAP4+: PM: Consolidate MPU subsystem PM code for re-use Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 13:50   ` Nishanth Menon
2013-03-01 13:50     ` Nishanth Menon
2013-03-01 12:10 ` [PATCH 02/15] ARM: OMAP5: PM: Update CPU context register offset Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 17:34   ` Nishanth Menon
2013-03-01 17:34     ` Nishanth Menon
2013-03-01 12:10 ` [PATCH 03/15] ARM: OMAP4+: PM: Consolidate and use OMAP4 PM code for OMAP5 Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 17:43   ` Nishanth Menon
2013-03-01 17:43     ` Nishanth Menon
2013-03-02  5:43     ` Santosh Shilimkar
2013-03-02  5:43       ` Santosh Shilimkar
2013-03-04 18:21       ` Nishanth Menon
2013-03-04 18:21         ` Nishanth Menon
2013-03-01 12:10 ` [PATCH 04/15] ARM: OMAP5: PM: Set MPUSS-EMIF clock-domain static dependency Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 12:10 ` [PATCH 05/15] ARM: OMAP5: PM: Enables ES2 PM mode by default Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 19:37   ` Nishanth Menon
2013-03-01 19:37     ` Nishanth Menon
2013-03-02  5:47     ` Santosh Shilimkar
2013-03-02  5:47       ` Santosh Shilimkar
2013-03-04 18:29       ` Nishanth Menon
2013-03-04 18:29         ` Nishanth Menon
2013-03-10 18:07         ` Santosh Shilimkar
2013-03-10 18:07           ` Santosh Shilimkar
2013-03-01 12:10 ` [PATCH 06/15] ARM: OMAP5: PM: Enable Mercury retention mode on CPUx powerdomains Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 19:42   ` Nishanth Menon
2013-03-01 19:42     ` Nishanth Menon
2013-03-02  5:52     ` Santosh Shilimkar
2013-03-02  5:52       ` Santosh Shilimkar
2013-03-04 18:33       ` Nishanth Menon
2013-03-04 18:33         ` Nishanth Menon
2013-03-01 12:10 ` [PATCH 07/15] ARM: OMAP5: Add init_late() hook to enable pm initialization Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 20:12   ` Nishanth Menon
2013-03-01 20:12     ` Nishanth Menon
2013-03-02  6:00     ` Santosh Shilimkar
2013-03-02  6:00       ` Santosh Shilimkar
2013-03-04 18:35       ` Nishanth Menon
2013-03-04 18:35         ` Nishanth Menon
2013-03-01 12:10 ` [PATCH 08/15] ARM: OMAP5: PM: Add CPU power off mode support Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 21:36   ` Nishanth Menon
2013-03-01 21:36     ` Nishanth Menon
2013-03-02  6:14     ` Santosh Shilimkar
2013-03-02  6:14       ` Santosh Shilimkar
2013-03-04 18:38       ` Nishanth Menon
2013-03-04 18:38         ` Nishanth Menon
2013-03-01 12:10 ` [PATCH 09/15] ARM: OMAP4+: PM: Restore CPU power state to ON with clockdomain force wakeup method Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 21:53   ` Nishanth Menon
2013-03-01 21:53     ` Nishanth Menon
2013-03-02  6:16     ` Santosh Shilimkar
2013-03-02  6:16       ` Santosh Shilimkar
2013-03-01 12:10 ` [PATCH 10/15] ARM: OMAP5: PM: Add MPU Open Switch Retention support Santosh Shilimkar
2013-03-01 12:10   ` Santosh Shilimkar
2013-03-01 22:05   ` Nishanth Menon
2013-03-01 22:05     ` Nishanth Menon
2013-03-01 12:11 ` [PATCH 11/15] ARM: OMAP5: PM: Add L2 memory power down support Santosh Shilimkar
2013-03-01 12:11   ` Santosh Shilimkar
2013-03-01 23:43   ` Nishanth Menon
2013-03-01 23:43     ` Nishanth Menon
2013-03-02  6:24     ` Santosh Shilimkar
2013-03-02  6:24       ` Santosh Shilimkar
2013-03-04 18:41       ` Nishanth Menon [this message]
2013-03-04 18:41         ` Nishanth Menon
2013-03-01 12:11 ` [PATCH 12/15] ARM: OMAP4+: CPUidle: Cleanup idle driver for OMAP5 support Santosh Shilimkar
2013-03-01 12:11   ` Santosh Shilimkar
2013-03-01 23:56   ` Nishanth Menon
2013-03-01 23:56     ` Nishanth Menon
2013-03-02  6:25     ` Santosh Shilimkar
2013-03-02  6:25       ` Santosh Shilimkar
2013-03-01 12:11 ` [PATCH 13/15] ARM: OMAP4+: CPUidle: Deprecate use of omap4_mpuss_read_prev_context_state() Santosh Shilimkar
2013-03-01 12:11   ` Santosh Shilimkar
2013-03-02  0:03   ` Nishanth Menon
2013-03-02  0:03     ` Nishanth Menon
2013-03-01 12:11 ` [PATCH 14/15] ARM: OMAP4+: CPUidle: Add OMAP5 idle driver support Santosh Shilimkar
2013-03-01 12:11   ` Santosh Shilimkar
2013-03-02  0:25   ` Nishanth Menon
2013-03-02  0:25     ` Nishanth Menon
2013-03-02  6:47     ` Santosh Shilimkar
2013-03-02  6:47       ` Santosh Shilimkar
2013-03-04 18:48       ` Nishanth Menon
2013-03-04 18:48         ` Nishanth Menon
2013-03-01 12:11 ` [PATCH 15/15] ARM: OMAP5: PM: handle device instance for for coldreset Santosh Shilimkar
2013-03-01 12:11   ` Santosh Shilimkar
2013-03-01 13:04   ` Nishanth Menon
2013-03-01 13:04     ` Nishanth Menon
2013-03-01 13:09     ` Santosh Shilimkar
2013-03-01 13:09       ` Santosh Shilimkar
2013-03-01 13:13       ` Nishanth Menon
2013-03-01 13:13         ` Nishanth Menon
2013-03-01 13:16         ` Santosh Shilimkar
2013-03-01 13:16           ` Santosh Shilimkar

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=20130304184152.GC14958@kahuna \
    --to=nm@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=santosh.shilimkar@ti.com \
    /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.