summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun KS <arunks@codeaurora.org>2016-01-21 13:57:23 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-25 16:03:30 -0700
commitdb599a70cb5bcbab7db755a09c926057f0591ca8 (patch)
tree9eaf6b4c631a82b42658b58f095b4d93ebf4cc60
parentbe106d01b6bdd00d69f59cb45085691381dca495 (diff)
soc: qcom: pil-mss: Add scm call to inform TZ of modem area
Add support to make scm_calls to TZ to inform modem start address and size so that TZ can unmap this range to avoid speculative access. Change-Id: I4640ddab56991522870e9879d17fe5732dc40223 Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org> Signed-off-by: Arun KS <arunks@codeaurora.org>
-rw-r--r--Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt2
-rw-r--r--drivers/soc/qcom/pil-msa.c42
-rw-r--r--drivers/soc/qcom/pil-msa.h3
-rw-r--r--drivers/soc/qcom/pil-q6v5-mss.c10
-rw-r--r--include/soc/qcom/subsystem_restart.h3
5 files changed, 57 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt b/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt
index 5b10a4369986..a3dc40936e8e 100644
--- a/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt
+++ b/Documentation/devicetree/bindings/pil/pil-q6v5-mss.txt
@@ -72,6 +72,8 @@ Optional properties:
- qcom,edge: GLINK logical name of the remote subsystem
- qcom,pil-force-shutdown: Boolean. If set, the SSR framework will not trigger graceful shutdown
on behalf of the subsystem driver.
+- qcom,pil-mss-memsetup: Boolean - True if TZ need to be informed of modem start address and size.
+- qcom,pas-id: pas_id of the subsystem.
- qcom,qdsp6v56-1-8: Boolean- Present if the qdsp version is v56 1.8
- qcom,qdsp6v56-1-8-inrush-current: Boolean- Present if the qdsp version is V56 1.8 and has in-rush
current issue.
diff --git a/drivers/soc/qcom/pil-msa.c b/drivers/soc/qcom/pil-msa.c
index c72cf3a21004..94cc9fe7e99d 100644
--- a/drivers/soc/qcom/pil-msa.c
+++ b/drivers/soc/qcom/pil-msa.c
@@ -75,6 +75,9 @@
#define MSS_RESTART_ID 0xA
#define MSS_MAGIC 0XAABADEAD
+enum scm_cmd {
+ PAS_MEM_SETUP_CMD = 2,
+};
static int pbl_mba_boot_timeout_ms = 1000;
module_param(pbl_mba_boot_timeout_ms, int, S_IRUGO | S_IWUSR);
@@ -395,6 +398,44 @@ void pil_mss_remove_proxy_votes(struct pil_desc *pil)
regulator_set_voltage(drv->vreg_mx, 0, INT_MAX);
}
+static int pil_mss_mem_setup(struct pil_desc *pil,
+ phys_addr_t addr, size_t size)
+{
+ struct modem_data *md = dev_get_drvdata(pil->dev);
+
+ struct pas_init_image_req {
+ u32 proc;
+ u32 start_addr;
+ u32 len;
+ } request;
+ u32 scm_ret = 0;
+ int ret;
+ struct scm_desc desc = {0};
+
+ if (!md->subsys_desc.pil_mss_memsetup)
+ return 0;
+
+ request.proc = md->pas_id;
+ request.start_addr = addr;
+ request.len = size;
+
+ if (!is_scm_armv8()) {
+ ret = scm_call(SCM_SVC_PIL, PAS_MEM_SETUP_CMD, &request,
+ sizeof(request), &scm_ret, sizeof(scm_ret));
+ } else {
+ desc.args[0] = md->pas_id;
+ desc.args[1] = addr;
+ desc.args[2] = size;
+ desc.arginfo = SCM_ARGS(3);
+ ret = scm_call2(SCM_SIP_FNID(SCM_SVC_PIL, PAS_MEM_SETUP_CMD),
+ &desc);
+ scm_ret = desc.ret[0];
+ }
+ if (ret)
+ return ret;
+ return scm_ret;
+}
+
static int pil_mss_reset(struct pil_desc *pil)
{
struct q6v5_data *drv = container_of(pil, struct q6v5_data, desc);
@@ -774,6 +815,7 @@ struct pil_reset_ops pil_msa_mss_ops_selfauth = {
.init_image = pil_msa_mss_reset_mba_load_auth_mdt,
.proxy_vote = pil_mss_make_proxy_votes,
.proxy_unvote = pil_mss_remove_proxy_votes,
+ .mem_setup = pil_mss_mem_setup,
.verify_blob = pil_msa_mba_verify_blob,
.auth_and_reset = pil_msa_mba_auth,
.deinit_image = pil_mss_deinit_image,
diff --git a/drivers/soc/qcom/pil-msa.h b/drivers/soc/qcom/pil-msa.h
index 7c0cf3e5c06f..fea8e1f9db37 100644
--- a/drivers/soc/qcom/pil-msa.h
+++ b/drivers/soc/qcom/pil-msa.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -25,6 +25,7 @@ struct modem_data {
struct subsys_desc subsys_desc;
void *ramdump_dev;
bool crash_shutdown;
+ u32 pas_id;
bool ignore_errors;
struct completion stop_ack;
void __iomem *rmb_base;
diff --git a/drivers/soc/qcom/pil-q6v5-mss.c b/drivers/soc/qcom/pil-q6v5-mss.c
index 45f24801b6b0..5c0c1ffa8951 100644
--- a/drivers/soc/qcom/pil-q6v5-mss.c
+++ b/drivers/soc/qcom/pil-q6v5-mss.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -327,6 +327,14 @@ static int pil_mss_loadable_init(struct modem_data *drv,
if (IS_ERR(q6->rom_clk))
return PTR_ERR(q6->rom_clk);
+ ret = of_property_read_u32(pdev->dev.of_node,
+ "qcom,pas-id", &drv->pas_id);
+ if (ret)
+ dev_warn(&pdev->dev, "Failed to find the pas_id.\n");
+
+ drv->subsys_desc.pil_mss_memsetup =
+ of_property_read_bool(pdev->dev.of_node, "qcom,pil-mss-memsetup");
+
/* Optional. */
if (of_property_match_string(pdev->dev.of_node,
"qcom,active-clock-names", "gpll0_mss_clk") >= 0)
diff --git a/include/soc/qcom/subsystem_restart.h b/include/soc/qcom/subsystem_restart.h
index 0331c10f958e..3a5f6e678b4f 100644
--- a/include/soc/qcom/subsystem_restart.h
+++ b/include/soc/qcom/subsystem_restart.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -79,6 +79,7 @@ struct subsys_desc {
int shutdown_ack_gpio;
int ramdump_disable;
bool no_auth;
+ bool pil_mss_memsetup;
int ssctl_instance_id;
u32 sysmon_pid;
int sysmon_shutdown_ret;