Merge "ARM: dts: msm: Add kaslr offset IMEM entry for msm8998"
This commit is contained in:
commit
cc2de04539
3 changed files with 46 additions and 1 deletions
|
@ -63,6 +63,11 @@ Emergency Download Mode:
|
||||||
-compatible: "qcom,msm-imem-emergency_download_mode"
|
-compatible: "qcom,msm-imem-emergency_download_mode"
|
||||||
-reg: start address and size of emergency_download_mode region in imem
|
-reg: start address and size of emergency_download_mode region in imem
|
||||||
|
|
||||||
|
Kaslr Offset:
|
||||||
|
------------------------
|
||||||
|
-compatible: "qcom,msm-imem-kaslr_offset"
|
||||||
|
-reg: start address and size of kaslr_offset region in imem
|
||||||
|
|
||||||
USB Diag Cookies:
|
USB Diag Cookies:
|
||||||
-----------------
|
-----------------
|
||||||
Memory region used to store USB PID and serial numbers to be used by
|
Memory region used to store USB PID and serial numbers to be used by
|
||||||
|
@ -101,6 +106,12 @@ Example:
|
||||||
reg = <0x6b0 32>;
|
reg = <0x6b0 32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
kaslr_offset@6d0 {
|
||||||
|
compatible = "qcom,msm-imem-kaslr_offset";
|
||||||
|
reg = <0x6d0 12>;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
pil@94c {
|
pil@94c {
|
||||||
compatible = "qcom,msm-imem-pil";
|
compatible = "qcom,msm-imem-pil";
|
||||||
reg = <0x94c 200>;
|
reg = <0x94c 200>;
|
||||||
|
|
|
@ -2825,6 +2825,11 @@
|
||||||
reg = <0x6b0 32>;
|
reg = <0x6b0 32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
kaslr_offset@6d0 {
|
||||||
|
compatible = "qcom,msm-imem-kaslr_offset";
|
||||||
|
reg = <0x6d0 12>;
|
||||||
|
};
|
||||||
|
|
||||||
pil@94c {
|
pil@94c {
|
||||||
compatible = "qcom,msm-imem-pil";
|
compatible = "qcom,msm-imem-pil";
|
||||||
reg = <0x94c 200>;
|
reg = <0x94c 200>;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <asm/system_misc.h>
|
#include <asm/system_misc.h>
|
||||||
|
#include <asm/memory.h>
|
||||||
|
|
||||||
#include <soc/qcom/scm.h>
|
#include <soc/qcom/scm.h>
|
||||||
#include <soc/qcom/restart.h>
|
#include <soc/qcom/restart.h>
|
||||||
|
@ -65,11 +66,17 @@ static struct kobject dload_kobj;
|
||||||
#ifdef CONFIG_QCOM_DLOAD_MODE
|
#ifdef CONFIG_QCOM_DLOAD_MODE
|
||||||
#define EDL_MODE_PROP "qcom,msm-imem-emergency_download_mode"
|
#define EDL_MODE_PROP "qcom,msm-imem-emergency_download_mode"
|
||||||
#define DL_MODE_PROP "qcom,msm-imem-download_mode"
|
#define DL_MODE_PROP "qcom,msm-imem-download_mode"
|
||||||
|
#ifdef CONFIG_RANDOMIZE_BASE
|
||||||
|
#define KASLR_OFFSET_PROP "qcom,msm-imem-kaslr_offset"
|
||||||
|
#endif
|
||||||
|
|
||||||
static int in_panic;
|
static int in_panic;
|
||||||
static void *dload_mode_addr;
|
static void *dload_mode_addr;
|
||||||
static bool dload_mode_enabled;
|
static bool dload_mode_enabled;
|
||||||
static void *emergency_dload_mode_addr;
|
static void *emergency_dload_mode_addr;
|
||||||
|
#ifdef CONFIG_RANDOMIZE_BASE
|
||||||
|
static void *kaslr_imem_addr;
|
||||||
|
#endif
|
||||||
static bool scm_dload_supported;
|
static bool scm_dload_supported;
|
||||||
|
|
||||||
static int dload_set(const char *val, struct kernel_param *kp);
|
static int dload_set(const char *val, struct kernel_param *kp);
|
||||||
|
@ -510,6 +517,28 @@ static int msm_restart_probe(struct platform_device *pdev)
|
||||||
pr_err("unable to map imem EDLOAD mode offset\n");
|
pr_err("unable to map imem EDLOAD mode offset\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_RANDOMIZE_BASE
|
||||||
|
#define KASLR_OFFSET_BIT_MASK 0x00000000FFFFFFFF
|
||||||
|
np = of_find_compatible_node(NULL, NULL, KASLR_OFFSET_PROP);
|
||||||
|
if (!np) {
|
||||||
|
pr_err("unable to find DT imem KASLR_OFFSET node\n");
|
||||||
|
} else {
|
||||||
|
kaslr_imem_addr = of_iomap(np, 0);
|
||||||
|
if (!kaslr_imem_addr)
|
||||||
|
pr_err("unable to map imem KASLR offset\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kaslr_imem_addr && scm_is_secure_device()) {
|
||||||
|
__raw_writel(0xdead4ead, kaslr_imem_addr);
|
||||||
|
__raw_writel(KASLR_OFFSET_BIT_MASK &
|
||||||
|
(kimage_vaddr - KIMAGE_VADDR), kaslr_imem_addr + 4);
|
||||||
|
__raw_writel(KASLR_OFFSET_BIT_MASK &
|
||||||
|
((kimage_vaddr - KIMAGE_VADDR) >> 32),
|
||||||
|
kaslr_imem_addr + 8);
|
||||||
|
iounmap(kaslr_imem_addr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
np = of_find_compatible_node(NULL, NULL,
|
np = of_find_compatible_node(NULL, NULL,
|
||||||
"qcom,msm-imem-dload-type");
|
"qcom,msm-imem-dload-type");
|
||||||
if (!np) {
|
if (!np) {
|
||||||
|
@ -603,4 +632,4 @@ static int __init msm_restart_init(void)
|
||||||
{
|
{
|
||||||
return platform_driver_register(&msm_restart_driver);
|
return platform_driver_register(&msm_restart_driver);
|
||||||
}
|
}
|
||||||
device_initcall(msm_restart_init);
|
pure_initcall(msm_restart_init);
|
||||||
|
|
Loading…
Add table
Reference in a new issue