linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: Tony Lindgren <tony@atomide.com>,
	Matthijs van Duin <matthijsvanduin@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: ARM errata 430973 on multi platform kernels
Date: Mon, 06 Apr 2015 20:14:23 +0300	[thread overview]
Message-ID: <5522BEEF.2000405@gmail.com> (raw)
In-Reply-To: <20150406154037.GI18048@atomide.com>



On  6.04.2015 18:40, Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [150406 08:24]:
>> * Matthijs van Duin <matthijsvanduin@gmail.com> [150405 16:53]:
>>> Cortex-A8 errata doc states in its workaround for erratum 430973:
>>>
>>>> By default, the BTB Invalidate instruction is treated as a NOP on Cortex-A8.
>>>> However, it is possible to enable the BTB Invalidate instruction such that it
>>>> actually does a full invalidate of the BTB by setting the IBE bit (bit 6) in
>>>> the CP15 Auxiliary Control Register. As a consequence of erratum 687067, the
>>>> L1 System Array Debug Register should be cleared to 0 before the IBE bit is
>>>> set using the following code sequence:
>>>> MOV r1, #0
>>>> MCR p15, 0, r1, c15, c1, 0            ; write instruction data 0 register
>>>> MRC p15, 0, R1, c1, c0, 1             ; read Aux Ctl Register
>>>> ORR R1, R1 #(1 << 6)                  ; set IBE to 1
>>>> MCR p15, 0, R1, c1, c0, 1             ; write Aux Ctl Register
>>>> The above code needs to be executed in Secure state. ARM Limited recommends
>>>> that this code is added to the boot monitor.
>>>
>>> The 430973 workaround code in proc-v7.S will do absolutely nothing if
>>> executed in non-secure state. Ditto for the 458693 workaround, and the
>>> 460075 workaround should trigger an undefined instruction exception.
>>> Maybe linux is started in secure mode on some targets and this code
>>> was written for one of those?
>>
>> That's only for HS omaps, for those we currently only do it in the
>> nokia_n900_legacy_init that calls rx51_secure_update_aux_cr.
>>
>>> I scanned DM814x secure ROM for any (ARM or Thumb) write to
>>> Instruction L1 System Array Debug Register 0, but I found none, hence
>>> my warning to watch out for erratum 687067.
>>
>> OK
>>
>>> Adding the full set of BTB invalidates while making sure IBE is
>>> disabled on sufficiently recent Cortex-A8 revisions would be optimal
>>> for the Cortex-A8. But, apparently (based on the description of the
>>> ARMv7 CPUID registers) there are also processors which only require
>>> BTB invalidates when code is modified, but not when context-switching,
>>> so there may be performance considerations there...
>>
>> Attempting to summarize all that's been discussed.. It sounds like we
>> need the following implemented:
>>
>> 1. For cortex-a8 revisions affected by 458693, we can do a custom
>>     cpu_v7_switch_mm function that always does flush BTAC/BTB.
>>
>> 2. For HS cortex-a8 processors other than n900 affected by 458693,
>>     we need to implement functions similar to rx51_secure_update_aux_cr,
>>     the bootrom on n900 is different from TI HS omaps so the SMC call
>>     numbering may be different.
>>
>> 3. For later cortex-a8 processors not affected by 458693, we need
>>     to clear IBE bit to avoid erratum 687067.
>
> Oops sorry, wrong numbers for errata above.. s/458693/430973/, here's
> a better version:
>
> 1. For cortex-a8 revisions affected by 430973, we can do a custom
>     cpu_v7_switch_mm function that always does flush BTAC/BTB.
>

Why custom function, if IBE bit is zero, BTB invalidate instruction is a 
NOP. Do you think that "mcr p15, 0, r2, c7, c5, 6" executed as a NOP 
will put so much overhead, that it deserves a custom function?

> 2. For HS cortex-a8 processors other than n900 affected by 430973,
>     we need to implement functions similar to rx51_secure_update_aux_cr,
>     the bootrom on n900 is different from TI HS omaps so the SMC call
>     numbering may be different.
>
> 3. For later cortex-a8 processors not affected by 430973, we need
>     to clear IBE bit to avoid erratum 687067.
>

Maybe it should be implemented something like:

1. if Cortex-A8, always execute invalidate BTB instruction in
    cpu_v7_switch_mm

2. For Cortex-A8 revisions affected by 430973, set IBE bit to 1, set it
    to 0 for all others. That should happen as soon as possible,
    otherwise kernel may crash on affected revisions if thumb-
    compiled.

> Regards,
>
> Tony
>

Regards,

Ivo

  reply	other threads:[~2015-04-06 17:14 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-01 19:07 [PATCH RESEND] ARM: dts: OMAP3-N900: Add microphone bias voltages Jarkko Nikula
2015-03-30 16:30 ` Jarkko Nikula
     [not found]   ` <55197A12.1050009-FVTvWyuFUl3QT0dZR+AlfA@public.gmane.org>
2015-03-30 16:42     ` Tony Lindgren
2015-03-30 17:45       ` Jarkko Nikula
     [not found]         ` <55198BA4.5010207-FVTvWyuFUl3QT0dZR+AlfA@public.gmane.org>
2015-03-30 17:50           ` Tony Lindgren
2015-03-31 12:32             ` Sebastian Reichel
2015-04-01 19:47               ` Tony Lindgren
2015-04-03 16:35                 ` ARM errata 430973 on multi platform kernels (was: OMAP3-N900: Add microphone bias voltages) Sebastian Reichel
2015-04-03 18:39                   ` Tony Lindgren
2015-04-03 19:21                     ` Robert Nelson
2015-04-05 13:00                       ` Sebastian Reichel
2015-04-05 13:26                         ` Pali Rohár
2015-04-05 13:45                           ` Sebastian Reichel
2015-04-05 13:52                             ` Pali Rohár
2015-04-06 17:38                               ` Sebastian Reichel
2015-04-03 20:42                   ` Pavel Machek
2015-04-03 22:08                   ` ARM errata 430973 on multi platform kernels Ivaylo Dimitrov
2015-04-03 22:15                     ` Tony Lindgren
2015-04-03 22:47                       ` Ivaylo Dimitrov
2015-04-03 22:52                         ` Tony Lindgren
2015-04-05  4:13                           ` Matthijs van Duin
2015-04-05  7:23                             ` Ivaylo Dimitrov
2015-04-05 16:50                               ` Matthijs van Duin
2015-04-05 16:52                                 ` Matthijs van Duin
2015-04-05 21:08                                 ` Ivaylo Dimitrov
2015-04-05 23:52                                   ` Matthijs van Duin
2015-04-06 15:19                                     ` Tony Lindgren
2015-04-06 15:40                                       ` Tony Lindgren
2015-04-06 17:14                                         ` Ivaylo Dimitrov [this message]
2015-04-06 17:42                                           ` Tony Lindgren
2015-04-06 18:14                                             ` Matthijs van Duin
2015-04-07  2:23                                               ` Tony Lindgren
2015-04-07  3:12                                                 ` Sebastian Reichel
2015-04-07  3:49                                                   ` Matthijs van Duin
2015-04-07 14:48                                                     ` Tony Lindgren
2015-04-09 22:37                                                 ` Grazvydas Ignotas
2015-04-09 22:44                                                   ` Tony Lindgren
2015-04-09 23:44                                                     ` Nishanth Menon
2015-04-10 22:05                                                     ` Grazvydas Ignotas
2015-04-10 23:08                                                       ` Tony Lindgren
2015-04-16 16:53                                                   ` Matthijs van Duin
2015-04-07 13:58                                               ` Russell King - ARM Linux
2015-04-07 13:57                                             ` Russell King - ARM Linux
2015-04-07 15:22                                               ` Tony Lindgren
2015-04-07 15:44                                                 ` Tony Lindgren
2015-04-08 23:08                                                   ` Russell King - ARM Linux
2015-04-08 23:15                                                     ` Tony Lindgren
2015-04-08 23:06                                                 ` Russell King - ARM Linux
2015-04-09 13:48                                                   ` Russell King - ARM Linux
2015-04-09 15:09                                                     ` Tony Lindgren
2015-04-09 15:30                                                       ` Russell King - ARM Linux
2015-04-15 16:31                                                     ` Sebastian Reichel
2015-04-16 16:08                                                       ` Tony Lindgren
2015-04-17 18:41                                                         ` Sebastian Reichel
2015-04-20 23:40                                                           ` Tony Lindgren
2015-04-23 10:25                                                             ` Russell King - ARM Linux
2015-04-23 14:17                                                               ` Tony Lindgren
2015-04-28 18:13                                                                 ` Russell King - ARM Linux
2015-04-29 14:40                                                                   ` Tony Lindgren
2015-05-04 14:24                                                                     ` Tony Lindgren
2015-04-24  8:54                                                               ` Matthijs van Duin
2015-04-28 18:11                                                                 ` Russell King - ARM Linux
2015-05-02  6:51                                                                   ` Matthijs van Duin
2015-04-05 13:39                             ` Sebastian Reichel
2015-04-06 15:24                               ` Tony Lindgren
2015-05-04 16:07               ` [PATCH RESEND] ARM: dts: OMAP3-N900: Add microphone bias voltages 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=5522BEEF.2000405@gmail.com \
    --to=ivo.g.dimitrov.75@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=matthijsvanduin@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=sre@kernel.org \
    --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 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).