From 99a2064db2ed708f6d88e34ef410b2a804f5bcb3 Mon Sep 17 00:00:00 2001 From: Matt Wagantall Date: Mon, 24 Aug 2015 20:00:56 -0700 Subject: [PATCH] soc: qcom: scm-xpu: add support for XPU errors that are fatal by default The existing scm-xpu implementation makes an unconditional scm call at boot. The assumption was that such errors would be non- fatal by default, and so a desired behavior could be achieved by controlling whether the driver was compiled. On recent targets like msm8996, XPU errors are treated as fatal by default. To support cases where it may be desirable to treat them as non-fatal, the driver must be changed to make the appropriate scm call based on a new Kconfig choice. Change-Id: Ibb55c062937f130c13538f049582575d9a6f52ad Signed-off-by: Matt Wagantall --- drivers/soc/qcom/Kconfig | 19 +++++++++++++++++++ drivers/soc/qcom/Makefile | 2 +- drivers/soc/qcom/scm-xpu.c | 12 +++++++----- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 986edf1cc245..964ace9f3a92 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -54,7 +54,26 @@ config QCOM_SCM bool "Secure Channel Manager (SCM) support" default n +menuconfig QCOM_SCM_XPU + bool "Qualcomm XPU configuration driver" + depends on QCOM_SCM + +if QCOM_SCM_XPU + +choice + prompt "XPU Violation Behavior" + default QCOM_XPU_ERR_FATAL + config QCOM_XPU_ERR_FATAL bool "Configure XPU violations as fatal errors" help Select if XPU violations have to be configured as fatal errors. + +config QCOM_XPU_ERR_NONFATAL + bool "Configure XPU violations as non-fatal errors" + help + Select if XPU violations have to be configured as non-fatal errors. + +endchoice + +endif diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 6778d3cc28c5..9b9a31d44dee 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -6,4 +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 +obj-$(CONFIG_QCOM_SCM_XPU) += scm-xpu.o diff --git a/drivers/soc/qcom/scm-xpu.c b/drivers/soc/qcom/scm-xpu.c index 182af2b5e971..200b313610e7 100644 --- a/drivers/soc/qcom/scm-xpu.c +++ b/drivers/soc/qcom/scm-xpu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-2015, 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 @@ -14,10 +14,12 @@ #include #include +#if defined(CONFIG_QCOM_XPU_ERR_FATAL) +#define ERR_FATAL_VAL 0x0 +#elif defined(CONFIG_QCOM_XPU_ERR_NONFATAL) +#define ERR_FATAL_VAL 0x1 +#endif -#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) @@ -30,7 +32,7 @@ static int __init xpu_err_fatal_init(void) struct scm_desc desc = {0}; desc.arginfo = SCM_ARGS(2); - desc.args[0] = cmd.config = ERR_FATAL_ENABLE; + desc.args[0] = cmd.config = ERR_FATAL_VAL; desc.args[1] = cmd.spare = 0; if (!is_scm_armv8())