From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 13/22] imx8m: Fix MMU table issue for OPTEE memory
Date: Sun, 11 Aug 2019 23:59:20 +0200 [thread overview]
Message-ID: <20190811235920.71d648e0@jawa> (raw)
In-Reply-To: <20190809043014.32510-14-peng.fan@nxp.com>
On Fri, 9 Aug 2019 04:15:21 +0000
Peng Fan <peng.fan@nxp.com> wrote:
> When running with OPTEE, the MMU table in u-boot does not remove the
> OPTEE memory from its settings. So ARM speculative prefetch in u-boot
> may access that OPTEE memory. Due to trust zone is enabled by OPTEE
> and that memory is set to secure access, then the speculative
> prefetch will fail and cause various memory issue in u-boot.
> The fail address register and int_status register in trustzone has
> logged that speculative access from u-boot.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> arch/arm/mach-imx/imx8m/soc.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-imx/imx8m/soc.c
> b/arch/arm/mach-imx/imx8m/soc.c index 5115471eff..dd393b581b 100644
> --- a/arch/arm/mach-imx/imx8m/soc.c
> +++ b/arch/arm/mach-imx/imx8m/soc.c
> @@ -112,16 +112,18 @@ static struct mm_region imx8m_mem_map[] = {
> /* DRAM1 */
> .virt = 0x40000000UL,
> .phys = 0x40000000UL,
> - .size = 0xC0000000UL,
> + .size = PHYS_SDRAM_SIZE,
Wouldn't this change break other imx8m boards?
> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> PTE_BLOCK_OUTER_SHARE
> +#ifdef PHYS_SDRAM_2_SIZE
> }, {
> /* DRAM2 */
> .virt = 0x100000000UL,
> .phys = 0x100000000UL,
> - .size = 0x040000000UL,
> + .size = PHYS_SDRAM_2_SIZE,
The same here.
> .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
> PTE_BLOCK_OUTER_SHARE
> +#endif
> }, {
> /* List terminator */
> 0,
> @@ -130,6 +132,20 @@ static struct mm_region imx8m_mem_map[] = {
>
> struct mm_region *mem_map = imx8m_mem_map;
>
> +void enable_caches(void)
> +{
> + /*
> + * If OPTEE runs, remove OPTEE memory from MMU table to
> + * avoid speculative prefetch. OPTEE runs at the top of
> + * the first memory bank
> + */
> + if (rom_pointer[1])
> + imx8m_mem_map[5].size -= rom_pointer[1];
> +
> + icache_enable();
> + dcache_enable();
In the other patch (which adds board based on imx8mm - in this series
22/22) the D and I caches were disabled. Why you add code to enable
them and those are not enabled on imx8mm EVK board?
> +}
> +
> static u32 get_cpu_variant_type(u32 type)
> {
> struct ocotp_regs *ocotp = (struct ocotp_regs
> *)OCOTP_BASE_ADDR;
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190811/90b6c953/attachment.sig>
next prev parent reply other threads:[~2019-08-11 21:59 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-09 4:14 [U-Boot] [PATCH 00/22] i.MX8MM support Peng Fan
2019-08-09 4:14 ` [U-Boot] [PATCH 01/22] tools: imx8m_image: align spl bin image size Peng Fan
2019-08-11 22:11 ` Lukasz Majewski
2019-08-13 8:53 ` Peng Fan
2019-08-14 7:21 ` Schrempf Frieder
2019-08-14 8:29 ` Peng Fan
2019-08-09 4:14 ` [U-Boot] [PATCH 02/22] ddr: imx8m: fix ddr firmware location when enable SPL OF Peng Fan
2019-08-14 7:35 ` Schrempf Frieder
2019-08-14 7:59 ` Peng Fan
2019-08-14 8:04 ` Schrempf Frieder
2019-08-09 4:14 ` [U-Boot] [PATCH 03/22] imx8m: add image cfg for i.MX8MM lpddr4 Peng Fan
2019-08-14 7:59 ` Schrempf Frieder
2019-08-14 8:08 ` Peng Fan
2019-08-09 4:14 ` [U-Boot] [PATCH 04/22] imx: add IMX8MQ kconfig entry Peng Fan
2019-08-09 4:14 ` [U-Boot] [PATCH 05/22] imx: add IMX8MM " Peng Fan
2019-08-09 4:14 ` [U-Boot] [PATCH 06/22] imx: imx8mm: add clock bindings header Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 07/22] imx: add i.MX8MM cpu type Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 08/22] imx: spl: add spl_board_boot_device for i.MX8MM Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 09/22] imx8m: update imx-regs " Peng Fan
2019-08-14 15:03 ` Schrempf Frieder
2019-08-15 1:01 ` Peng Fan
2019-08-26 14:08 ` Schrempf Frieder
2019-08-09 4:15 ` [U-Boot] [PATCH 10/22] imx: add get_cpu_rev support " Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 11/22] imx8m: add pin header " Peng Fan
2019-08-11 21:56 ` Lukasz Majewski
2019-08-13 8:43 ` Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 12/22] imx: add i.MX8MM PE property Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 13/22] imx8m: Fix MMU table issue for OPTEE memory Peng Fan
2019-08-11 21:59 ` Lukasz Majewski [this message]
2019-08-13 8:46 ` Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 14/22] imx8m: set BYPASS ID SWAP to avoid AXI bus errors Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 15/22] imx8m: Configure trustzone region 0 for non-secure access Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 16/22] imx8m: soc: enable SCTR clock before timer init Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 17/22] imx8m: rename clock to clock_imx8mq Peng Fan
2019-08-11 22:01 ` Lukasz Majewski
2019-08-13 8:48 ` Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 18/22] imx8m: restructure clock.h Peng Fan
2019-08-11 22:02 ` Lukasz Majewski
2019-08-13 8:49 ` Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 19/22] imx8m: add clk support for i.MX8MM Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 20/22] arm: dts: import i.MX8MM dtsi Peng Fan
2019-08-14 10:21 ` Schrempf Frieder
2019-08-15 1:11 ` Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 21/22] arm: dts: add i.MX8MM pin func Peng Fan
2019-08-09 4:15 ` [U-Boot] [PATCH 22/22] imx: Add i.MX8MM EVK board support Peng Fan
2019-08-10 13:06 ` Lukasz Majewski
2019-08-14 16:32 ` Schrempf Frieder
2019-08-15 0:57 ` Peng Fan
2019-08-26 15:20 ` Schrempf Frieder
2019-08-27 1:09 ` Peng Fan
2019-08-27 3:25 ` Peng Fan
2019-08-14 16:34 ` [U-Boot] [PATCH 00/22] i.MX8MM support Schrempf Frieder
2019-08-15 0:58 ` Peng Fan
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=20190811235920.71d648e0@jawa \
--to=lukma@denx.de \
--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 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.