public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <york.sun@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCHv4 3/7] ARMv8/layerscape: Add FSL PPA support
Date: Fri, 27 May 2016 11:06:19 -0700	[thread overview]
Message-ID: <57488C9B.5020004@nxp.com> (raw)
In-Reply-To: <1464003511-19262-3-git-send-email-Zhiqiang.Hou@nxp.com>

On 05/23/2016 04:48 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> 
> The FSL Primary Protected Application (PPA) is a software component
> loaded during boot which runs in TrustZone and remains resident
> after boot.
> 
> Signed-off-by: Hou Zhiqiang <Zhiqiag.Hou@nxp.com>
> ---
> V4:
>  - Moved secure firmware validation API to this patch.
>  - Moved secure firmware getting supported PSCI version API to this patch.
> 
> V3:
>  - Refactor the code.
>  - Add PPA firmware version info output.
> 
<snip>

> +int sec_firmware_validate(void)
> +{
> +	void *ppa_addr;
> +
> +#ifdef CONFIG_SYS_LS_PPA_FW_IN_NOR
> +	ppa_addr = (void *)CONFIG_SYS_LS_PPA_FW_ADDR;
> +#else
> +#error "No CONFIG_SYS_LS_PPA_FW_IN_xxx defined"
> +#endif
> +
> +	return ppa_firmware_validate(ppa_addr);
> +}

You are returning 0 when the image is valid. This function name is confusing.
How about declare it as bool, and change the name to is_sec_firmware_valid()?

> +
> +#ifdef CONFIG_ARMV8_PSCI
> +unsigned int sec_firmware_support_psci_version(void)
> +{
> +	unsigned int psci_ver = 0;
> +
> +	if (!sec_firmware_validate())
> +		psci_ver = ppa_support_psci_version();
> +
> +	return psci_ver;
> +}
> +#endif
> +
> +int ppa_init_pre(u64 *entry)
> +{
> +	u64 ppa_ram_addr;
> +	const void *raw_image_addr;
> +	size_t raw_image_size = 0;
> +	size_t ppa_ram_size = ppa_get_dram_block_size();
> +	int ret;
> +
> +	debug("fsl-ppa: ppa size(0x%lx)\n", ppa_ram_size);
> +
> +	/*
> +	 * The PPA must be stored in secure memory.
> +	 * Append PPA to secure mmu table.
> +	 */
> +	ppa_ram_addr = (gd->secure_ram & MEM_RESERVE_SECURE_ADDR_MASK) +
> +			gd->arch.tlb_size;
> +

Should we check "if (gd->secure_ram & MEM_RESERVE_SECURE_SECURED)" before using
the secure memory?

York

  reply	other threads:[~2016-05-27 18:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 11:38 [U-Boot] [PATCHv4 1/7] armv8: fsl-layerscape: add i/d-cache enable function to enable_caches Zhiqiang Hou
2016-05-23 11:38 ` [U-Boot] [PATCHv4 2/7] ARMv8: add the sec_firmware header file Zhiqiang Hou
2016-05-23 11:38 ` [U-Boot] [PATCHv4 3/7] ARMv8/layerscape: Add FSL PPA support Zhiqiang Hou
2016-05-27 18:06   ` York Sun [this message]
2016-05-30  2:56     ` Zhiqiang Hou
2016-05-27 19:58   ` York Sun
2016-05-30  2:58     ` Zhiqiang Hou
2016-05-23 11:38 ` [U-Boot] [PATCHv4 4/7] ARMv8/Layerscape: switch SMP method to spin-table when the PSCI isn't available Zhiqiang Hou
2016-05-27 18:06   ` York Sun
2016-05-30  2:53     ` Zhiqiang Hou
2016-05-23 11:38 ` [U-Boot] [PATCHv4 5/7] ARMv8/PSCI: Fixup the device tree for PSCI Zhiqiang Hou
2016-05-23 11:38 ` [U-Boot] [PATCHv4 6/7] ARMv8/ls1043ardb: Integrate FSL PPA Zhiqiang Hou
2016-05-23 11:38 ` [U-Boot] [PATCHv4 7/7] ARMv8/ls1043ardb: add the CONFIG_ARMV8_PSCI when PPA is enabled Zhiqiang Hou

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=57488C9B.5020004@nxp.com \
    --to=york.sun@nxp.com \
    --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