All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-omap@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 25/25] ARM: pm: omap34xx: convert to generic suspend/resume support
Date: Thu, 23 Jun 2011 11:47:11 +0100	[thread overview]
Message-ID: <20110623104711.GF9449@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4E027BD3.6030500@ti.com>

On Thu, Jun 23, 2011 at 05:03:39AM +0530, Santosh Shilimkar wrote:
> On 6/22/2011 9:40 PM, Russell King - ARM Linux wrote:
>> A couple of things to point out here:
>>
>> On Wed, Jun 22, 2011 at 04:16:58PM +0100, Russell King - ARM Linux wrote:
>>> -	mrc	p15, 0, r4, c13, c0, 1	@ Context ID
>>> -	mrc	p15, 0, r5, c13, c0, 2	@ User r/w thread and process ID
>>> -	mrc	p15, 0, r6, c12, c0, 0	@ Secure or NS vector base address
>>> -	mrs	r7, cpsr		@ Store current cpsr
>>> -	stmia	r8!, {r4-r7}
>>
>> 1. The User r/w thread and process ID is not saved/restored by Linux over
>> context switches, so it doesn't serve any useful purpose to save and
>> restore over resume.
>>
> It will be needed for CPUIDLE I guess.

No it isn't.  It is not used by Linux at all - the only thread register
which is used is the User r/o thread register, and I've patched the
proc-v7 code to preserve that register.

>> 2. Compare the instruction saving and restoring the vector base address
>> (see below for the restore code.)
>>
> That's typo. It should have been mcr. Actually VBAR isn't used on GP
> devices but might be used on secure devices. I know that common suspend
> code doesn't consider this register. It's fine to keep it that way
> and if OMAP needs it, it can save/restored outside common code.

The kernel doesn't use or initialize the register, so its not something
which the kernel should be concerned about.  Presumably secure devices
need to restore the secure-mode version of that register.

However, there's an extra twist here:
| On an implementation that does not include the Security Extensions all
| CP15 c12 encodings are UNDEFINED.

And a further twist is this:
| B3.12.40 c12, Vector Base Address Register (VBAR)
| When the Security Extensions are implemented and high exception vectors are
| not selected, the Vector Base Address Register, VBAR, provides the exception
| base address for exceptions that are not handled in Monitor mode, see
| Exception vectors and the exception base address on page B1-30. The high
| exception vectors always have the base address 0xFFFF0000 and are not
| affected by the value of VBAR.

Since we always select high exception vectors, VBAR is not used, so we have
no requirement to save and restore this register on any ARMv7 MMU platform.
Given that it would be dangerous to do so (due to not knowing whether
security stuff is implemented or not) ignoring the presence of this register
is for the best.

WARNING: multiple messages have this Message-ID (diff)
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 25/25] ARM: pm: omap34xx: convert to generic suspend/resume support
Date: Thu, 23 Jun 2011 11:47:11 +0100	[thread overview]
Message-ID: <20110623104711.GF9449@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4E027BD3.6030500@ti.com>

On Thu, Jun 23, 2011 at 05:03:39AM +0530, Santosh Shilimkar wrote:
> On 6/22/2011 9:40 PM, Russell King - ARM Linux wrote:
>> A couple of things to point out here:
>>
>> On Wed, Jun 22, 2011 at 04:16:58PM +0100, Russell King - ARM Linux wrote:
>>> -	mrc	p15, 0, r4, c13, c0, 1	@ Context ID
>>> -	mrc	p15, 0, r5, c13, c0, 2	@ User r/w thread and process ID
>>> -	mrc	p15, 0, r6, c12, c0, 0	@ Secure or NS vector base address
>>> -	mrs	r7, cpsr		@ Store current cpsr
>>> -	stmia	r8!, {r4-r7}
>>
>> 1. The User r/w thread and process ID is not saved/restored by Linux over
>> context switches, so it doesn't serve any useful purpose to save and
>> restore over resume.
>>
> It will be needed for CPUIDLE I guess.

No it isn't.  It is not used by Linux at all - the only thread register
which is used is the User r/o thread register, and I've patched the
proc-v7 code to preserve that register.

>> 2. Compare the instruction saving and restoring the vector base address
>> (see below for the restore code.)
>>
> That's typo. It should have been mcr. Actually VBAR isn't used on GP
> devices but might be used on secure devices. I know that common suspend
> code doesn't consider this register. It's fine to keep it that way
> and if OMAP needs it, it can save/restored outside common code.

The kernel doesn't use or initialize the register, so its not something
which the kernel should be concerned about.  Presumably secure devices
need to restore the secure-mode version of that register.

However, there's an extra twist here:
| On an implementation that does not include the Security Extensions all
| CP15 c12 encodings are UNDEFINED.

And a further twist is this:
| B3.12.40 c12, Vector Base Address Register (VBAR)
| When the Security Extensions are implemented and high exception vectors are
| not selected, the Vector Base Address Register, VBAR, provides the exception
| base address for exceptions that are not handled in Monitor mode, see
| Exception vectors and the exception base address on page B1-30. The high
| exception vectors always have the base address 0xFFFF0000 and are not
| affected by the value of VBAR.

Since we always select high exception vectors, VBAR is not used, so we have
no requirement to save and restore this register on any ARMv7 MMU platform.
Given that it would be dangerous to do so (due to not knowing whether
security stuff is implemented or not) ignoring the presence of this register
is for the best.

  reply	other threads:[~2011-06-23 10:47 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-22 15:08 [PATCH 00/25 v2] Re-jig cpu_suspend for a saner calling convention Russell King - ARM Linux
2011-06-22 15:08 ` Russell King - ARM Linux
2011-06-22 15:08 ` [PATCH 01/25] ARM: pm: make MULTI_CPU and !MULTI_CPU resume paths the same Russell King - ARM Linux
2011-06-22 15:08   ` Russell King - ARM Linux
2011-06-22 15:09 ` [PATCH 02/25] ARM: pm: move return address (for cpu_resume) to top of stack Russell King - ARM Linux
2011-06-22 15:09   ` Russell King - ARM Linux
2011-06-22 15:09 ` [PATCH 03/25] ARM: pm: extract common code from MULTI_CPU/!MULTI_CPU paths Russell King - ARM Linux
2011-06-22 15:09   ` Russell King - ARM Linux
2011-06-22 15:09 ` [PATCH 04/25] ARM: pm: preserve r4 - r11 across a suspend Russell King - ARM Linux
2011-06-22 15:09   ` Russell King - ARM Linux
2011-06-22 15:10 ` [PATCH 05/25] ARM: pm: reallocate registers to avoid r2, r3 Russell King - ARM Linux
2011-06-22 15:10   ` Russell King - ARM Linux
2011-06-22 15:10 ` [PATCH 06/25] ARM: pm: rejig suspend follow-on function calling convention Russell King - ARM Linux
2011-06-22 15:10   ` Russell King - ARM Linux
2011-06-22 15:10 ` [PATCH 07/25] ARM: pm: move sa1100 to use proper suspend func arg0 Russell King - ARM Linux
2011-06-22 15:10   ` Russell King - ARM Linux
2011-06-22 15:11 ` [PATCH 08/25] ARM: pm: convert cpu_suspend() to a normal function Russell King - ARM Linux
2011-06-22 15:11   ` Russell King - ARM Linux
2011-06-22 15:11 ` [PATCH 09/25] ARM: pm: plat-s3c24xx: cleanup s3c_cpu_save Russell King - ARM Linux
2011-06-22 15:11   ` Russell King - ARM Linux
2011-06-22 15:11 ` [PATCH 10/25] ARM: pm: sa1100: cleanup sa1100_cpu_suspend Russell King - ARM Linux
2011-06-22 15:11   ` Russell King - ARM Linux
2011-06-22 15:12 ` [PATCH 11/25] ARM: pm: mach-s5pv210: cleanup s3c_cpu_save Russell King - ARM Linux
2011-06-22 15:12   ` Russell King - ARM Linux
2011-06-22 15:12 ` [PATCH 12/25] ARM: pm: mach-exynos4: " Russell King - ARM Linux
2011-06-22 15:12   ` Russell King - ARM Linux
2011-06-22 15:12 ` [PATCH 13/25] ARM: pm: mach-s3c64xx: " Russell King - ARM Linux
2011-06-22 15:12   ` Russell King - ARM Linux
2011-06-22 15:13 ` [PATCH 14/25] ARM: pm: pxa: cleanup PXA suspend code Russell King - ARM Linux
2011-06-22 15:13   ` Russell King - ARM Linux
2011-06-22 15:13 ` [PATCH 15/25] ARM: pm: sa1100: move cpu_suspend into C code Russell King - ARM Linux
2011-06-22 15:13   ` Russell King - ARM Linux
2011-06-22 15:13 ` [PATCH 16/25] ARM: pm: pxa: " Russell King - ARM Linux
2011-06-22 15:13   ` Russell King - ARM Linux
2011-06-22 15:14 ` [PATCH 17/25] ARM: pm: move cpu_init() call into core code Russell King - ARM Linux
2011-06-22 15:14   ` Russell King - ARM Linux
2011-06-22 15:14 ` [PATCH 18/25] ARM: pm: arrange for cpu_proc_init() to be called on resume Russell King - ARM Linux
2011-06-22 15:14   ` Russell King - ARM Linux
2011-06-22 15:14 ` [PATCH 19/25] ARM: pm: sa1100: no need to re-enable clock switching Russell King - ARM Linux
2011-06-22 15:14   ` Russell King - ARM Linux
2011-06-22 15:15 ` [PATCH 20/25] ARM: pm: samsung: move cpu_suspend into C code Russell King - ARM Linux
2011-06-22 15:15   ` Russell King - ARM Linux
2011-06-22 15:15 ` [PATCH 21/25] ARM: pm: samsung: no need to call flush_cache_all() Russell King - ARM Linux
2011-06-22 15:15   ` Russell King - ARM Linux
2011-06-22 15:15 ` [PATCH 22/25] ARM: pm: omap: no need to save all registers in sleep34xx.S Russell King - ARM Linux
2011-06-22 15:15   ` Russell King - ARM Linux
2011-06-22 15:16 ` [PATCH 23/25] ARM: pm: omap34xx: remove misleading comment and use of r9 Russell King - ARM Linux
2011-06-22 15:16   ` Russell King - ARM Linux
2011-06-22 15:16 ` [PATCH 24/25] ARM: pm: ensure ARMv7 CPUs save and restore the TLS register Russell King - ARM Linux
2011-06-22 15:16   ` Russell King - ARM Linux
2011-06-22 15:16 ` [PATCH 25/25] ARM: pm: omap34xx: convert to generic suspend/resume support Russell King - ARM Linux
2011-06-22 15:16   ` Russell King - ARM Linux
2011-06-22 16:10   ` Russell King - ARM Linux
2011-06-22 16:10     ` Russell King - ARM Linux
2011-06-22 23:33     ` Santosh Shilimkar
2011-06-22 23:33       ` Santosh Shilimkar
2011-06-23 10:47       ` Russell King - ARM Linux [this message]
2011-06-23 10:47         ` Russell King - ARM Linux
2011-06-23  6:33   ` Tony Lindgren
2011-06-23  6:33     ` Tony Lindgren
2011-06-23 10:06   ` Russell King - ARM Linux
2011-06-23 10:06     ` Russell King - ARM Linux
2011-06-23 10:21     ` Russell King - ARM Linux
2011-06-23 10:21       ` Russell King - ARM Linux
2011-06-23 19:05   ` Kevin Hilman
2011-06-23 19:05     ` Kevin Hilman
2011-06-23 20:37     ` Kevin Hilman
2011-06-23 20:37       ` Kevin Hilman
2011-06-23 21:57     ` Kevin Hilman
2011-06-23 21:57       ` Kevin Hilman
2011-06-22 21:01 ` [PATCH 00/25 v2] Re-jig cpu_suspend for a saner calling convention Russell King - ARM Linux
2011-06-22 21:01   ` Russell King - ARM Linux
2011-06-22 23:26   ` Santosh Shilimkar
2011-06-22 23:26     ` 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=20110623104711.GF9449@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@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.