From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC, PATCH] omap: Invalidate first page to avoid speculation
Date: Fri, 16 Nov 2012 21:52:51 +0100 [thread overview]
Message-ID: <20121116215251.471c148a@lilith> (raw)
In-Reply-To: <1353072989-3192-1-git-send-email-v-stehle@ti.com>
Hi Vincent,
On Fri, 16 Nov 2012 14:36:29 +0100, Vincent Stehl? <v-stehle@ti.com>
wrote:
>
> Hello u-boot list,
>
> Here is a "request for comments" on the best way to solve a little
> "speculation" issue on recent OMAPs. Any guidance/feedback on the way to go
> would be greatly appreciated, please.
>
> I am using u-boot on an OMAP5 HS device (with security, that is), and I am
> experiencing "security violations" due to speculative accesses done by the
> Cortex-A15 processor to the region near address zero. This region is a secure
> region, where non-secure accesses are forbidden and reported by the security
> firmware on an OMAP HS device. On an OMAP GP device, those accesses may very
> well exist, but are silently ignored by the firmware. Note that the speculative
> accesses are not actual functional accesses, so their being aborted does not
> harm the functionality of u-boot as it is.
> A quick (and dirty) solution is to mark the region near address zero as being
> invalid, which prevents the processor from doing speculative accesses there
> (see patch).
> This patch as it is has a number of issues: it impacts all ARM devices and it
> unmaps too large a region. I am not sure how to cleanly rework the patch so
> that it would be made OMAP-only cleanly. Also, unmapping a smaller region to
> better fit the hardware characteristics would require using second level
> descriptors, and I do not know if this is recommended. To make this worse,
> chips in the OMAP family have differences in their secure rom boundaries.
>
> Does the u-boot community feels this issue needs to be addressed? What would be
> the best way to solve this?
>
> Best regards,
>
> V.
>
>
> Signed-off-by: Vincent Stehl? <v-stehle@ti.com>
> ---
> arch/arm/lib/cache-cp15.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
> index 939de10..57e1974 100644
> --- a/arch/arm/lib/cache-cp15.c
> +++ b/arch/arm/lib/cache-cp15.c
> @@ -72,8 +72,13 @@ static inline void mmu_setup(void)
> u32 reg;
>
> arm_init_before_mmu();
> +
> + /* First page (starting at 0x0) is made invalid to avoid
> + * speculative accesses in secure rom. */
> + page_table[0] = 0;
> +
> /* Set up an identity-mapping for all 4GB, rw for everyone */
> - for (i = 0; i < 4096; i++)
> + for (i = 1; i < 4096; i++)
> page_table[i] = i << 20 | (3 << 10) | 0x12;
>
> for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
To make this affect only some CPUs or even boards, you can define and
use a weak function which would handle filling the page-table; the weak,
default, function would fill table[0] like others, while OMAP5 would
have a strong version which would clear table[0].
Amicalement,
--
Albert.
next prev parent reply other threads:[~2012-11-16 20:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 13:36 [U-Boot] [RFC, PATCH] omap: Invalidate first page to avoid speculation Vincent Stehlé
2012-11-16 20:52 ` Albert ARIBAUD [this message]
2012-11-19 14:59 ` [U-Boot] [RFC, PATCH v2] " Vincent Stehlé
2012-11-19 14:59 ` [U-Boot] [PATCH 1/2] ARM: cache: introduce weak arm_setup_identity_mapping Vincent Stehlé
2012-11-19 20:48 ` Tom Rini
2012-11-19 14:59 ` [U-Boot] [PATCH 2/2] ARM: OMAP5: redefine arm_setup_identity_mapping Vincent Stehlé
2012-11-19 20:49 ` Tom Rini
2012-11-20 11:01 ` [U-Boot] [RFC, PATCH v3] omap: Invalidate first page to avoid speculation Vincent Stehlé
2012-11-20 11:01 ` [U-Boot] [PATCH 1/2] ARM: cache: introduce weak arm_setup_identity_mapping Vincent Stehlé
2012-11-20 11:01 ` [U-Boot] [PATCH 2/2] ARM: OMAP5: redefine arm_setup_identity_mapping Vincent Stehlé
2012-12-11 15:35 ` [U-Boot] [PATCH v2] " Vincent Stehlé
2012-12-11 15:43 ` Tom Rini
2012-12-11 16:06 ` Vincent Stehlé
2012-12-11 16:06 ` [U-Boot] [PATCH v3 1/2] ARM: cache: introduce weak arm_setup_identity_mapping Vincent Stehlé
2012-12-11 16:06 ` [U-Boot] [PATCH v3 2/2] ARM: OMAP5: redefine arm_setup_identity_mapping Vincent Stehlé
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=20121116215251.471c148a@lilith \
--to=albert.u.boot@aribaud.net \
--cc=u-boot@lists.denx.de \
/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