soc: qcom: scm: Restructure Milestone call

Moving milestone to soc specific early initcall. This change
is to enable kernel memory protection before multi-core bring
up, to avoid a race condition between cores.

Change-Id: Iaeb6620ed1f5bb89265a2529d15cfbde50a829ee
Acked-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Signed-off-by: Preeti Nagar <pnagar@codeaurora.org>
This commit is contained in:
Preeti Nagar 2020-02-25 12:34:18 +05:30
parent 52c9eb469d
commit ceaed0c809
3 changed files with 9 additions and 16 deletions

View file

@ -62,7 +62,6 @@
#include <asm/system_misc.h>
#include <soc/qcom/minidump.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/lpm_levels.h>
#define CREATE_TRACE_POINTS
@ -413,7 +412,6 @@ void __init smp_cpus_done(unsigned int max_cpus)
setup_cpu_features();
hyp_mode_check();
apply_alternatives_all();
scm_enable_mem_protection();
mark_linear_text_alias_ro();
}

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
*/
#include <linux/slab.h>
@ -660,6 +660,8 @@ bool scm_is_secure_device(void)
}
EXPORT_SYMBOL(scm_is_secure_device);
#ifdef CONFIG_ARM64
/*
* SCM call command ID to protect kernel memory
* in Hyp Stage 2 page tables.
@ -668,7 +670,7 @@ EXPORT_SYMBOL(scm_is_secure_device);
*/
#define TZ_RTIC_ENABLE_MEM_PROTECTION 0x4
#if IS_ENABLED(CONFIG_QCOM_QHEE_ENABLE_MEM_PROTECTION)
int scm_enable_mem_protection(void)
static int __init scm_mem_protection_init(void)
{
struct scm_desc desc = {0};
int ret = 0, resp;
@ -693,10 +695,8 @@ int scm_enable_mem_protection(void)
return resp;
}
#else
inline int scm_enable_mem_protection(void)
{
return 0;
}
early_initcall(scm_mem_protection_init);
#endif
#endif
EXPORT_SYMBOL(scm_enable_mem_protection);

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2010-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
*/
#ifndef __MACH_SCM_H
@ -104,7 +104,6 @@ extern int scm_restore_sec_cfg(u32 device_id, u32 spare, int *scm_ret);
extern u32 scm_io_read(phys_addr_t address);
extern int scm_io_write(phys_addr_t address, u32 val);
extern bool scm_is_secure_device(void);
extern int scm_enable_mem_protection(void);
extern int scm_get_feat_version(u32 feat);
extern bool is_scm_armv8(void);
@ -167,9 +166,5 @@ static inline bool scm_is_secure_device(void)
return false;
}
static inline int scm_enable_mem_protection(void)
{
return 0;
}
#endif
#endif