linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	linux-arm-msm@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Lina Iyer <lina.iyer@linaro.org>
Subject: Re: [PATCH] ARM: Enter CPU in ARM state for cpu_resume
Date: Tue, 2 Jun 2015 09:34:19 +0100	[thread overview]
Message-ID: <20150602083419.GW2067@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAKv+Gu9m3id8QPxnuCuRmmwE7sPDqvtNiWQGr1OvnOpiOCS_xw@mail.gmail.com>

On Tue, Jun 02, 2015 at 08:18:18AM +0200, Ard Biesheuvel wrote:
> On 1 June 2015 at 23:45, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
> > Please do this differently.  The default should be (as we do with
> > the SMP secondary entry path) to assume that the firmware does the
> > right thing.
> >
> > So, if we want an ARM-mode entry point, please use:
> >
> > +               .arm
> > +ENTRY(cpu_resume_arm)
> > + THUMB(        badr    r9, 1f          )       @ Kernel is entered in ARM.
> > + THUMB(        bx      r9              )       @ If this is a Thumb-2 kernel,
> > + THUMB(        .thumb                  )       @ switch to Thumb now.
> > + THUMB(1:                      )
> >
> > Don't forget an ENDPROC() for the new symbol.  Buggy platforms then
> > use cpu_resume_arm instead of cpu_resume.
> >
> 
> OK, I think that was Stephen intention at first, but I suggested this instead.
> 
> The point is that it is safer and more tidy to make these entry points
> ARM only throughout, and switch to Thumb2 only if THUMB2_KERNEL. This
> way, since all firmwares (except ARMv7-M, but let's disregard that for
> now) are known to be able to enter/resume into the kernel in ARM mode,
> this is more robust in the face of new platforms and firmware
> revisions of existing platforms.

Stop creating random interfaces with differing ways to call them.
Consistency is one of the important things.

We have three interfaces to the kernel:

- Boot
- Secondary CPU
- Resume

Out of those three, boot is the special one, as we have no way to
communicate what mode it is required - so we specify a mode, which
is ARM mode, except for CPUs which have no ARM mode support.

Secondary CPU is not defined in the booting document because it's
not relevant, and it's not relevant for the same reason that the
resume entry point isn't.  These entry points are not at a fixed
location in the kernel image, and the kernel has to communicate that,
along with their entry mode to the firmware.

Therefore, firmware _does_ have the information to discover whether
the address should be called in ARM or Thumb mode, and what's more,
it should just work on those platforms which have no ARM mode support.

If we start forcing these interfaces to be ARM mode only, we then need
the same work-arounds for them as for the boot interface.

In other words, boot has a _valid_ reason to be different, the other
two are very similar in how they should be called.

Besides, I'm not pandering to broken firmware.  We should do the right
thing by default, which is to have sane interfaces, and only work around
stuff where needed.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

  reply	other threads:[~2015-06-02  8:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 20:22 [PATCH] ARM: Enter CPU in ARM state for cpu_resume Stephen Boyd
2015-06-01 21:45 ` Russell King - ARM Linux
2015-06-02  6:18   ` Ard Biesheuvel
2015-06-02  8:34     ` Russell King - ARM Linux [this message]
2015-06-02 10:34       ` Ard Biesheuvel

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=20150602083419.GW2067@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=ard.biesheuvel@linaro.org \
    --cc=lina.iyer@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@codeaurora.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).