All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>
Cc: Aneesh V <aneesh@ti.com>, Joe Woodward <jw@terrafix.co.uk>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	linux-arm <linux-arm-kernel@lists.infradead.org>
Subject: Re: OMAP3 L2/outer cache enabled in kernel (after being disabled by uBoot)?
Date: Tue, 17 Jan 2012 16:27:21 +0000	[thread overview]
Message-ID: <20120117162720.GG11475@arm.com> (raw)
In-Reply-To: <CAMQu2gwANxCe-ou_qv29ueLixodoHv9i6VyfvDi2rjEOvhttqA@mail.gmail.com>

On Tue, Jan 17, 2012 at 01:58:18PM +0000, Shilimkar, Santosh wrote:
> On Tue, Jan 17, 2012 at 2:39 PM, Catalin Marinas
> <catalin.marinas@arm.com> wrote:
> > On Tue, Jan 17, 2012 at 12:40:54PM +0000, Shilimkar, Santosh wrote:
> >> On A15 infact there are other CP15 registers which needs to be set
> >> before MMU is enabled to have best configuration.
> >
> > Yes, there are, and my view is that it is up to the platform firmware to
> > set things right.
>
> Firmware is ROM'ed in SOC's and can't be altered without a new silicon spin.
> Then we get into situations where Errata A will say turn OFF/ON x bit and
> so on. Most of these bits are secure write-only registers hence ROM
> code provides few API's to alter these registers in future if needed.

BTW, does the firmware make any checks on what bits it allows to be set?
Some of them may have security implications (and may not even be
documented).

Anyway, the first step is this API provided by the secure firmware.
Since such API may need to be called before the MMU is initialised,
Linux would need to have knowledge of the platform type early on. Having
some platform hook (asm macro) to call early on wouldn't work with the
single zImage configuration. Stack space is not an issue as we already
have one for ARMv7 for D-cache flushing (XIP kernels would work but they
aren't that many).

> BTW, look at the processor setup functions where we are altering these
> bits in kernel today (Diagnostic, RR policy etc) and they work on
> ARM SoC's which either don't use trustzone or kernel is in secure mode.

What we did for many of them was to check whether the bits are already
set to avoid a fault when running in NS mode.

> Now same thing if needs to be done for SoC's like OMAP where
> these bits are under secure control, we need to use the ROM
> secure API's and kernel don't seems to give any flexibility
> to patch that.
> 
> I don't understand how __only__ these devices needs to be
> patches outside the kernel.

Because there isn't a standard API to set those registers. And such
generic API would not even be easily possible given that you can't tell
what auxiliary (or even undocumented) registers a new CPU may have in
the future (unless the API is part of the TRM).

> Firmware point is actually irrelevant for OMAP since it can't be
> changed once it is ROMed.
> 
> Patching in boot-loaders isn't an option either since every customers
> prefers to use there own boot-loader and then controlling this vital
> bits is impossible.
> 
> So I re-iterate that we need to have solution to this problem.

I don't disagree with this, a solution is needed. In the past I was for
having platform hooks in the early kernel code path but in the light of
latest kernel developments (FDT, single zImage), I no longer see this as
acceptable.

If you can't change the boot loader, an alternative could be for the SoC
vendor to provide an additional binary that is executed by the boot
loader before Linux is started. Such binary could either live in some
flash or it could be wrapped around the Linux kernel image before the
kernel is stored into flash.

-- 
Catalin

WARNING: multiple messages have this Message-ID (diff)
From: catalin.marinas@arm.com (Catalin Marinas)
To: linux-arm-kernel@lists.infradead.org
Subject: OMAP3 L2/outer cache enabled in kernel (after being disabled by uBoot)?
Date: Tue, 17 Jan 2012 16:27:21 +0000	[thread overview]
Message-ID: <20120117162720.GG11475@arm.com> (raw)
In-Reply-To: <CAMQu2gwANxCe-ou_qv29ueLixodoHv9i6VyfvDi2rjEOvhttqA@mail.gmail.com>

On Tue, Jan 17, 2012 at 01:58:18PM +0000, Shilimkar, Santosh wrote:
> On Tue, Jan 17, 2012 at 2:39 PM, Catalin Marinas
> <catalin.marinas@arm.com> wrote:
> > On Tue, Jan 17, 2012 at 12:40:54PM +0000, Shilimkar, Santosh wrote:
> >> On A15 infact there are other CP15 registers which needs to be set
> >> before MMU is enabled to have best configuration.
> >
> > Yes, there are, and my view is that it is up to the platform firmware to
> > set things right.
>
> Firmware is ROM'ed in SOC's and can't be altered without a new silicon spin.
> Then we get into situations where Errata A will say turn OFF/ON x bit and
> so on. Most of these bits are secure write-only registers hence ROM
> code provides few API's to alter these registers in future if needed.

BTW, does the firmware make any checks on what bits it allows to be set?
Some of them may have security implications (and may not even be
documented).

Anyway, the first step is this API provided by the secure firmware.
Since such API may need to be called before the MMU is initialised,
Linux would need to have knowledge of the platform type early on. Having
some platform hook (asm macro) to call early on wouldn't work with the
single zImage configuration. Stack space is not an issue as we already
have one for ARMv7 for D-cache flushing (XIP kernels would work but they
aren't that many).

> BTW, look at the processor setup functions where we are altering these
> bits in kernel today (Diagnostic, RR policy etc) and they work on
> ARM SoC's which either don't use trustzone or kernel is in secure mode.

What we did for many of them was to check whether the bits are already
set to avoid a fault when running in NS mode.

> Now same thing if needs to be done for SoC's like OMAP where
> these bits are under secure control, we need to use the ROM
> secure API's and kernel don't seems to give any flexibility
> to patch that.
> 
> I don't understand how __only__ these devices needs to be
> patches outside the kernel.

Because there isn't a standard API to set those registers. And such
generic API would not even be easily possible given that you can't tell
what auxiliary (or even undocumented) registers a new CPU may have in
the future (unless the API is part of the TRM).

> Firmware point is actually irrelevant for OMAP since it can't be
> changed once it is ROMed.
> 
> Patching in boot-loaders isn't an option either since every customers
> prefers to use there own boot-loader and then controlling this vital
> bits is impossible.
> 
> So I re-iterate that we need to have solution to this problem.

I don't disagree with this, a solution is needed. In the past I was for
having platform hooks in the early kernel code path but in the light of
latest kernel developments (FDT, single zImage), I no longer see this as
acceptable.

If you can't change the boot loader, an alternative could be for the SoC
vendor to provide an additional binary that is executed by the boot
loader before Linux is started. Such binary could either live in some
flash or it could be wrapped around the Linux kernel image before the
kernel is stored into flash.

-- 
Catalin

  reply	other threads:[~2012-01-17 16:29 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 10:03 OMAP3 L2/outer cache enabled in kernel (after being disabled by uBoot)? Joe Woodward
2012-01-16 10:18 ` Shilimkar, Santosh
2012-01-16 10:18   ` Shilimkar, Santosh
2012-01-16 10:59   ` Russell King - ARM Linux
2012-01-16 10:59     ` Russell King - ARM Linux
2012-01-16 12:43     ` Shilimkar, Santosh
2012-01-16 12:43       ` Shilimkar, Santosh
2012-01-16 13:13       ` Russell King - ARM Linux
2012-01-16 13:13         ` Russell King - ARM Linux
2012-01-16 13:22         ` Shilimkar, Santosh
2012-01-16 13:22           ` Shilimkar, Santosh
2012-01-17  8:54           ` Joe Woodward
2012-01-17 12:11             ` Catalin Marinas
2012-01-17 12:11               ` Catalin Marinas
2012-01-17 12:27               ` Aneesh V
2012-01-17 12:27                 ` Aneesh V
2012-01-17 12:40                 ` Shilimkar, Santosh
2012-01-17 13:39                   ` Catalin Marinas
2012-01-17 13:39                     ` Catalin Marinas
2012-01-17 13:58                     ` Shilimkar, Santosh
2012-01-17 13:58                       ` Shilimkar, Santosh
2012-01-17 16:27                       ` Catalin Marinas [this message]
2012-01-17 16:27                         ` Catalin Marinas
2012-01-17 17:27                         ` Shilimkar, Santosh
2012-01-17 17:27                           ` Shilimkar, Santosh
2012-01-17 19:39                           ` Nicolas Pitre
2012-01-17 19:39                             ` Nicolas Pitre
2012-01-17 20:27                             ` Shilimkar, Santosh
2012-01-17 20:27                               ` Shilimkar, Santosh
2012-01-17 20:45                               ` Nicolas Pitre
2012-01-17 20:45                                 ` Nicolas Pitre
2012-01-17 20:57                                 ` Nicolas Pitre
2012-01-17 20:57                                   ` Nicolas Pitre
2012-01-17 20:58                                 ` Shilimkar, Santosh
2012-01-17 20:58                                   ` Shilimkar, Santosh
2012-01-17 21:02                                   ` Nicolas Pitre
2012-01-17 21:02                                     ` Nicolas Pitre
2012-01-18  8:43                                     ` Shilimkar, Santosh
2012-01-18  8:43                                       ` Shilimkar, Santosh
2012-01-17 21:15                               ` Russell King - ARM Linux
2012-01-17 21:15                                 ` Russell King - ARM Linux
2012-01-17 19:47                         ` Russell King - ARM Linux
2012-01-17 19:47                           ` Russell King - ARM Linux
2012-01-17 20:11                           ` Shilimkar, Santosh
2012-01-17 20:11                             ` Shilimkar, Santosh
2012-01-17 20:48                             ` Russell King - ARM Linux
2012-01-17 20:48                               ` Russell King - ARM Linux
2012-01-17 19:43                       ` Russell King - ARM Linux
2012-01-17 19:43                         ` Russell King - ARM Linux
2012-01-20  8:57                       ` Joe Woodward
2012-01-27 11:45                         ` Joe Woodward
2012-01-27 17:30                         ` Catalin Marinas
2012-01-27 17:30                           ` Catalin Marinas
2012-01-31  5:21                           ` Aneesh V
2012-01-31  5:21                             ` Aneesh V
2012-01-31  7:31                             ` Catalin Marinas
2012-01-31  7:31                               ` Catalin Marinas
2012-01-31  7:38                               ` Shilimkar, Santosh
2012-01-31  7:38                                 ` Shilimkar, Santosh
2012-01-31  8:54                                 ` Catalin Marinas
2012-01-31  8:54                                   ` Catalin Marinas
2012-01-31  9:05                                   ` Shilimkar, Santosh
2012-01-31  9:05                                     ` Shilimkar, Santosh
2012-01-31  9:53                                     ` Catalin Marinas
2012-01-31  9:53                                       ` Catalin Marinas
2012-01-31 10:10                                       ` Russell King - ARM Linux
2012-01-31 10:10                                         ` Russell King - ARM Linux
2012-01-31 12:10                                         ` Catalin Marinas
2012-01-31 12:10                                           ` Catalin Marinas
2012-01-31 18:09                                       ` Nicolas Pitre
2012-01-31 18:09                                         ` Nicolas Pitre
2012-02-02 14:32                                         ` Catalin Marinas
2012-02-02 14:32                                           ` Catalin Marinas
2012-02-02 14:49                                           ` Russell King - ARM Linux
2012-02-02 14:49                                             ` Russell King - ARM Linux
2012-02-02 15:10                                             ` Catalin Marinas
2012-02-02 15:10                                               ` Catalin Marinas
2012-01-31  9:56                                     ` Russell King - ARM Linux
2012-01-31  9:56                                       ` Russell King - ARM Linux
2012-01-31 10:51                                       ` Shilimkar, Santosh
2012-01-31 10:51                                         ` Shilimkar, Santosh
2012-01-31 18:27                                         ` Nicolas Pitre
2012-01-31 18:27                                           ` Nicolas Pitre
2012-02-01  7:12                                           ` Shilimkar, Santosh
2012-02-01  7:12                                             ` Shilimkar, Santosh
2012-01-17 14:18                     ` Grazvydas Ignotas
2012-01-17 14:18                       ` Grazvydas Ignotas
2012-01-17 13:41                 ` Catalin Marinas
2012-01-17 13:41                   ` Catalin Marinas
2012-01-17 13:54                   ` Aneesh V
2012-01-17 13:54                     ` Aneesh V
2012-01-17 14:23                   ` Måns Rullgård
2012-01-17 14:23                     ` Måns Rullgård
2012-01-17 12:01           ` Aneesh V
2012-01-17 12:01             ` Aneesh V

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=20120117162720.GG11475@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=aneesh@ti.com \
    --cc=jw@terrafix.co.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --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.