From 1f6c26741a30af8515c958a48abe448f312e1079 Mon Sep 17 00:00:00 2001 From: Jiamin Ma Date: Sat, 12 Aug 2017 17:26:05 +0800 Subject: [PATCH] secure_monitor: use reserve mem from secure os PD#148390: add nandkey and secure storage the reserve mem used by secure monitor comes form secure os. we should not redefine it in DTS Change-Id: If42f2410474e090ed5b2bca143d5a9d16260f49c Signed-off-by: Jiamin Ma --- arch/arm/boot/dts/amlogic/meson8b_m400.dts | 7 ------- drivers/amlogic/secure_monitor/flash_secure.c | 22 +++++++++------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/arch/arm/boot/dts/amlogic/meson8b_m400.dts b/arch/arm/boot/dts/amlogic/meson8b_m400.dts index 14d9077e..42f0b4c 100644 --- a/arch/arm/boot/dts/amlogic/meson8b_m400.dts +++ b/arch/arm/boot/dts/amlogic/meson8b_m400.dts @@ -36,13 +36,6 @@ #size-cells = <1>; ranges; - sm_reserved:linux,sm { - compatible = "amlogic, aml_secure_monitor_memory"; - reg = <0x61dfc00 0x20400>; - no-map; - }; - - pm_reserved:linux,pm { compatible = "amlogic, pm-m8b-reserve"; reg = <0x04f00000 0x100000>; diff --git a/drivers/amlogic/secure_monitor/flash_secure.c b/drivers/amlogic/secure_monitor/flash_secure.c index 3bb42d0..f9cfdcea 100644 --- a/drivers/amlogic/secure_monitor/flash_secure.c +++ b/drivers/amlogic/secure_monitor/flash_secure.c @@ -52,8 +52,8 @@ #define SECURE_MONITOR_CLASS_NAME "secure_monitor" -static ulong sm_share_mem_addr; -static ulong sm_share_mem_size; +static uint32_t sm_share_mem_addr; +static uint32_t sm_share_mem_size; /* * SHARE MEM: @@ -93,7 +93,12 @@ static int secure_monitor_start(void) { int ret = 0; + sm_share_mem_addr = meson_secure_mem_flash_start(); + sm_share_mem_size = meson_secure_mem_flash_size(); + pr_info("%s:%d\n", __func__, __LINE__); + pr_info("sm share mem start: 0x%x, size: 0x%x\r\n", + sm_share_mem_addr, sm_share_mem_size); secure_monitor_buf.pfbuf = kmalloc(FLASH_BUF_SIZE, GFP_KERNEL); if (!secure_monitor_buf.pfbuf) { pr_err("nandbuf create fail!\n"); @@ -101,8 +106,8 @@ static int secure_monitor_start(void) goto flash_monitor_probe_exit; } secure_monitor_buf.psbuf = ioremap_cached( - (unsigned int)sm_share_mem_addr, - (unsigned int)sm_share_mem_size); + sm_share_mem_addr, + sm_share_mem_size); if (!secure_monitor_buf.psbuf) { pr_err("ioremap share memory fail\n"); ret = -ENOMEM; @@ -244,15 +249,6 @@ static void __exit secure_monitor_exit(void) pr_info("**************flash_secure_remove end!\n"); } -static int __init rmem_sm_setup(struct reserved_mem *rmem) -{ - sm_share_mem_addr = (ulong)rmem->base; - sm_share_mem_size = (ulong)rmem->size; - return 0; -} -RESERVEDMEM_OF_DECLARE(sm_meson, -"amlogic, aml_secure_monitor_memory", rmem_sm_setup); - module_init(secure_monitor_init); module_exit(secure_monitor_exit); -- 2.7.4