summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorMatt Wagantall <mattw@codeaurora.org>2015-08-24 19:49:26 -0700
committerRohit Vaswani <rvaswani@codeaurora.org>2016-03-01 12:22:20 -0800
commit1106cef201cc59479dd5d64f4f63fcf2daf1ecd6 (patch)
tree987bb3cb106e14459ea893245544669772f27dba /drivers/soc
parentb8708eb232bb113886252295a4b833c4d989ffbd (diff)
soc: qcom: Add snapshot of scm-xpu driver from msm-3.10
This snapshot is taken as of msm-3.10 commit: e3a3f66e47 ("Merge "soc: qcom: pil-q6v5-mss: Do not free memory allocated to modem pil") When compiled, the scm-xpu driver makes a single scm call at boot to enable treatment of XPU errors as fatal. Change-Id: Id33c2b73f4ed7ba8a07c5affebbe66eb5eba7951 Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/Kconfig5
-rw-r--r--drivers/soc/qcom/Makefile1
-rw-r--r--drivers/soc/qcom/scm-xpu.c50
3 files changed, 56 insertions, 0 deletions
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig
index dfd540deacf8..986edf1cc245 100644
--- a/drivers/soc/qcom/Kconfig
+++ b/drivers/soc/qcom/Kconfig
@@ -53,3 +53,8 @@ config QCOM_SMD_RPM
config QCOM_SCM
bool "Secure Channel Manager (SCM) support"
default n
+
+config QCOM_XPU_ERR_FATAL
+ bool "Configure XPU violations as fatal errors"
+ help
+ Select if XPU violations have to be configured as fatal errors.
diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index cf6ba6d36f4f..6778d3cc28c5 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_QCOM_SMEM) += smem.o
CFLAGS_scm.o :=$(call as-instr,.arch_extension sec,-DREQUIRES_SEC=1)
obj-$(CONFIG_QCOM_SCM) += scm.o scm-boot.o
+obj-$(CONFIG_QCOM_XPU_ERR_FATAL) += scm-xpu.o
diff --git a/drivers/soc/qcom/scm-xpu.c b/drivers/soc/qcom/scm-xpu.c
new file mode 100644
index 000000000000..182af2b5e971
--- /dev/null
+++ b/drivers/soc/qcom/scm-xpu.c
@@ -0,0 +1,50 @@
+/* Copyright (c) 2013-2014, 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
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <soc/qcom/scm.h>
+
+
+#define ERR_FATAL_ENABLE 0x0
+#define ERR_FATAL_DISABLE 0x1
+#define ERR_FATAL_READ 0x2
+#define XPU_ERR_FATAL 0xe
+
+static int __init xpu_err_fatal_init(void)
+{
+ int ret, response;
+ struct {
+ unsigned int config;
+ unsigned int spare;
+ } cmd;
+ struct scm_desc desc = {0};
+
+ desc.arginfo = SCM_ARGS(2);
+ desc.args[0] = cmd.config = ERR_FATAL_ENABLE;
+ desc.args[1] = cmd.spare = 0;
+
+ if (!is_scm_armv8())
+ ret = scm_call(SCM_SVC_MP, XPU_ERR_FATAL, &cmd, sizeof(cmd),
+ &response, sizeof(response));
+ else
+ ret = scm_call2(SCM_SIP_FNID(SCM_SVC_MP, XPU_ERR_FATAL), &desc);
+
+ if (ret != 0)
+ pr_warn("Failed to set XPU violations as fatal errors: %d\n",
+ ret);
+ else
+ pr_info("Configuring XPU violations to be fatal errors\n");
+
+ return ret;
+}
+early_initcall(xpu_err_fatal_init);