All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Dave Martin <dave.martin@linaro.org>,
	Will Deacon <Will.Deacon@arm.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Jon Hunter <jon-hunter@ti.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] ARM: Fix errata 751472 handling on Cortex-A9 r1p*
Date: Thu, 15 Nov 2012 08:31:33 -0600	[thread overview]
Message-ID: <50A4FCC5.2080604@gmail.com> (raw)
In-Reply-To: <20121115110137.GA25985@arm.com>

On 11/15/2012 05:01 AM, Catalin Marinas wrote:
> On Thu, Nov 15, 2012 at 12:54:48AM +0000, Rob Herring wrote:
>> On 11/14/2012 04:21 PM, Tony Lindgren wrote:
>>> * Rob Herring <robherring2@gmail.com> [121114 13:59]:
>>>> On 11/14/2012 02:32 PM, Tony Lindgren wrote:
>>>>>
>>>>> Checking for the bit already set should work in this case, I'll post
>>>>> a patch for that shortly.
>>>>
>>>> Can you actually read the state of the diagnostic register in non-secure
>>>> mode? If you can on the A9, is the same true on A8 or others?
>>>
>>> Looks like it can be read on at least TI omap 4430 which is A9.
>>> But it reads as zero, so the below patch is what I came up with.
>>>
>>> No idea if assuming that zero value for the diagnostic register
>>> is safe.. What's the default value of the diagnostic register supposed
>>> to be?
>>
>> RTFM. Oh, wait it's a super secret, undocumented register. We shouldn't
>> even be talking about it.
>>
>> It could vary by rev, but I see 0 for the reset value, so this would not
>> work if the bootloader did not do any setup of the diagnostic register.
>>
>> One way to determine secure mode on the A9 would be seeing if you can
>> change the auxcr register. Something like this (untested):
>>
>> mrc	p15, 0, r0, c1, c0, 1; Read ACTLR
>> eor	r1, r0, #0x100		; Modify alloc in 1 way
>> mcr	p15, 0, r1, c1, c0, 1
>> mrc	p15, 0, r2, c1, c0, 1; Read ACTLR
>> mcr	p15, 0, r0, c1, c0, 1	; Restore original value
>> cmp	r1, r2
>> bne	skip_errata
> 
> This would fail on platforms where Linux runs in non-secure mode. What
> we do for some errata workarounds is to test whether the bit was already
> set and avoid writing the register. But this assumes that, for a given
> workaround in the kernel, there is a corresponding workaround in the
> code running before the kernel (boot-loader, firmware) which sets that
> bit.
> 
> Since the kernel will run more often in non-secure mode (on Cortex-A15
> you need this for the virtualisation extensions) I strongly suggest that
> the workaround (usually undocumented bit setting) is done before the
> kernel is started and we simply remove it from Linux (or add a clear
> comment that it only works if running in secure mode; if unsure say
> 'N').
> 
> I don't think it's worth the hassle detecting whether the kernel runs in
> secure or non-secure mode, just assume the latter and get SoC vendors to
> update the boot loaders or firmware (if possible) with any errata
> workarounds.

There's other places we need to know secure vs. non-secure mode like
whether we can do smc calls or not.

So we should make all these work-arounds depend on !MULTI_PLATFORM then.
Does that work for Versatile Express CA9? It needs ARM_ERRATA_751472.

Rob

> 
> Having a common SMC API for errata workarounds is not feasible since not
> all registers are public, most are implementation specific and it could
> have secure implications with exposing them.
> 


WARNING: multiple messages have this Message-ID (diff)
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Fix errata 751472 handling on Cortex-A9 r1p*
Date: Thu, 15 Nov 2012 08:31:33 -0600	[thread overview]
Message-ID: <50A4FCC5.2080604@gmail.com> (raw)
In-Reply-To: <20121115110137.GA25985@arm.com>

On 11/15/2012 05:01 AM, Catalin Marinas wrote:
> On Thu, Nov 15, 2012 at 12:54:48AM +0000, Rob Herring wrote:
>> On 11/14/2012 04:21 PM, Tony Lindgren wrote:
>>> * Rob Herring <robherring2@gmail.com> [121114 13:59]:
>>>> On 11/14/2012 02:32 PM, Tony Lindgren wrote:
>>>>>
>>>>> Checking for the bit already set should work in this case, I'll post
>>>>> a patch for that shortly.
>>>>
>>>> Can you actually read the state of the diagnostic register in non-secure
>>>> mode? If you can on the A9, is the same true on A8 or others?
>>>
>>> Looks like it can be read on at least TI omap 4430 which is A9.
>>> But it reads as zero, so the below patch is what I came up with.
>>>
>>> No idea if assuming that zero value for the diagnostic register
>>> is safe.. What's the default value of the diagnostic register supposed
>>> to be?
>>
>> RTFM. Oh, wait it's a super secret, undocumented register. We shouldn't
>> even be talking about it.
>>
>> It could vary by rev, but I see 0 for the reset value, so this would not
>> work if the bootloader did not do any setup of the diagnostic register.
>>
>> One way to determine secure mode on the A9 would be seeing if you can
>> change the auxcr register. Something like this (untested):
>>
>> mrc	p15, 0, r0, c1, c0, 1; Read ACTLR
>> eor	r1, r0, #0x100		; Modify alloc in 1 way
>> mcr	p15, 0, r1, c1, c0, 1
>> mrc	p15, 0, r2, c1, c0, 1; Read ACTLR
>> mcr	p15, 0, r0, c1, c0, 1	; Restore original value
>> cmp	r1, r2
>> bne	skip_errata
> 
> This would fail on platforms where Linux runs in non-secure mode. What
> we do for some errata workarounds is to test whether the bit was already
> set and avoid writing the register. But this assumes that, for a given
> workaround in the kernel, there is a corresponding workaround in the
> code running before the kernel (boot-loader, firmware) which sets that
> bit.
> 
> Since the kernel will run more often in non-secure mode (on Cortex-A15
> you need this for the virtualisation extensions) I strongly suggest that
> the workaround (usually undocumented bit setting) is done before the
> kernel is started and we simply remove it from Linux (or add a clear
> comment that it only works if running in secure mode; if unsure say
> 'N').
> 
> I don't think it's worth the hassle detecting whether the kernel runs in
> secure or non-secure mode, just assume the latter and get SoC vendors to
> update the boot loaders or firmware (if possible) with any errata
> workarounds.

There's other places we need to know secure vs. non-secure mode like
whether we can do smc calls or not.

So we should make all these work-arounds depend on !MULTI_PLATFORM then.
Does that work for Versatile Express CA9? It needs ARM_ERRATA_751472.

Rob

> 
> Having a common SMC API for errata workarounds is not feasible since not
> all registers are public, most are implementation specific and it could
> have secure implications with exposing them.
> 

  parent reply	other threads:[~2012-11-15 14:31 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 18:53 [PATCH] ARM: Fix errata 751472 handling on Cortex-A9 r1p* Tony Lindgren
2012-11-14 18:53 ` Tony Lindgren
2012-11-14 19:01 ` Russell King - ARM Linux
2012-11-14 19:01   ` Russell King - ARM Linux
2012-11-14 19:19   ` Tony Lindgren
2012-11-14 19:19     ` Tony Lindgren
2012-11-14 19:06 ` Jon Hunter
2012-11-14 19:06   ` Jon Hunter
2012-11-14 19:21   ` Tony Lindgren
2012-11-14 19:21     ` Tony Lindgren
2012-11-14 20:22   ` Russell King - ARM Linux
2012-11-14 20:22     ` Russell King - ARM Linux
2012-11-14 20:32     ` Tony Lindgren
2012-11-14 20:32       ` Tony Lindgren
2012-11-14 21:57       ` Rob Herring
2012-11-14 21:57         ` Rob Herring
2012-11-14 22:21         ` Tony Lindgren
2012-11-14 22:21           ` Tony Lindgren
2012-11-15  0:54           ` Rob Herring
2012-11-15  0:54             ` Rob Herring
2012-11-15  2:08             ` Tony Lindgren
2012-11-15  2:08               ` Tony Lindgren
2012-11-15 11:01             ` Catalin Marinas
2012-11-15 11:01               ` Catalin Marinas
2012-11-15 12:41               ` Siarhei Siamashka
2012-11-15 12:41                 ` Siarhei Siamashka
2012-11-15 13:36                 ` Russell King - ARM Linux
2012-11-15 13:36                   ` Russell King - ARM Linux
2012-11-15 13:52                 ` Catalin Marinas
2012-11-15 13:52                   ` Catalin Marinas
2012-11-15 15:14                   ` Måns Rullgård
2012-11-15 15:14                     ` Måns Rullgård
2012-11-15 14:31               ` Rob Herring [this message]
2012-11-15 14:31                 ` Rob Herring
2012-11-15 14:37                 ` Catalin Marinas
2012-11-15 14:37                   ` Catalin Marinas
2012-11-15 15:37                   ` Rob Herring
2012-11-15 15:37                     ` Rob Herring
2012-11-15 16:06                     ` Catalin Marinas
2012-11-15 16:06                       ` Catalin Marinas
2012-11-16 10:05                     ` Russell King - ARM Linux
2012-11-16 10:05                       ` Russell King - ARM Linux
2012-11-16 17:13                       ` Tony Lindgren
2012-11-16 17:13                         ` Tony Lindgren
2012-11-16 18:41                         ` Russell King - ARM Linux
2012-11-16 18:41                           ` Russell King - ARM Linux
2012-11-16  9:59                 ` Russell King - ARM Linux
2012-11-16  9:59                   ` Russell King - ARM Linux
2012-11-16 18:09                   ` Catalin Marinas
2012-11-16 18:09                     ` Catalin Marinas
2012-11-16 18:39                     ` Russell King - ARM Linux
2012-11-16 18:39                       ` Russell King - ARM Linux
2012-11-17 10:46                       ` Catalin Marinas
2012-11-17 10:46                         ` Catalin Marinas
2012-11-15  9:22           ` Russell King - ARM Linux
2012-11-15  9:22             ` Russell King - ARM Linux
2012-12-12  0:46         ` Jon Masters

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=50A4FCC5.2080604@gmail.com \
    --to=robherring2@gmail.com \
    --cc=Will.Deacon@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=dave.martin@linaro.org \
    --cc=jon-hunter@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.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.