diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index da03fb12c036..6b4f7605b7e0 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1384,6 +1384,8 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain, */ #ifdef CONFIG_64BIT reg = CBA2R_RW64_64BIT; + if (!arm_smmu_has_secure_vmid(smmu_domain)) + msm_tz_set_cb_format(smmu->sec_id, cfg->cbndx); #else reg = CBA2R_RW64_32BIT; #endif diff --git a/drivers/soc/qcom/msm_tz_smmu.c b/drivers/soc/qcom/msm_tz_smmu.c index 7bf785460b0c..92b24585c5a3 100644 --- a/drivers/soc/qcom/msm_tz_smmu.c +++ b/drivers/soc/qcom/msm_tz_smmu.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-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 @@ -53,6 +53,8 @@ static const char * const device_id_mappings[] = { #define TZ_SMMU_ATOS_START 1 #define TZ_SMMU_ATOS_END 0 +#define SMMU_CHANGE_PAGETABLE_FORMAT 0X01 + enum tz_smmu_device_id msm_dev_to_device_id(struct device *dev) { const char *device_id; @@ -104,3 +106,27 @@ int msm_tz_smmu_atos_end(struct device *dev, int cb_num) { return __msm_tz_smmu_atos(dev, cb_num, TZ_SMMU_ATOS_END); } + +void msm_tz_set_cb_format(enum tz_smmu_device_id sec_id, int cbndx) +{ + struct scm_desc desc = {0}; + unsigned int ret = 0; + + desc.args[0] = sec_id; + desc.args[1] = cbndx; + desc.args[2] = 1; /* Enable */ + desc.arginfo = SCM_ARGS(3, SCM_VAL, SCM_VAL, SCM_VAL); + + ret = scm_call2(SCM_SIP_FNID(SCM_SVC_SMMU_PROGRAM, + SMMU_CHANGE_PAGETABLE_FORMAT), &desc); + + /* At this stage, we cannot afford to fail because we have + * committed to support V8L format to client and we can't + * fallback. + */ + if (ret) { + pr_err("Format change failed for CB %d with ret %d\n", + cbndx, ret); + BUG(); + } +} diff --git a/include/soc/qcom/msm_tz_smmu.h b/include/soc/qcom/msm_tz_smmu.h index 13657cd03f48..4f4a64c09a8e 100644 --- a/include/soc/qcom/msm_tz_smmu.h +++ b/include/soc/qcom/msm_tz_smmu.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2015, The Linux Foundation. All rights reserved. +/* Copyright (c) 2015-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 @@ -53,6 +53,7 @@ enum tz_smmu_device_id { int msm_tz_smmu_atos_start(struct device *dev, int cb_num); int msm_tz_smmu_atos_end(struct device *dev, int cb_num); enum tz_smmu_device_id msm_dev_to_device_id(struct device *dev); +void msm_tz_set_cb_format(enum tz_smmu_device_id sec_id, int cbndx); #else @@ -71,6 +72,11 @@ static inline enum tz_smmu_device_id msm_dev_to_device_id(struct device *dev) return -EINVAL; } +static inline void msm_tz_set_cb_format(enum tz_smmu_device_id sec_id, + int cbndx) +{ +} + #endif /* CONFIG_MSM_TZ_SMMU */ #endif /* __MSM_TZ_SMMU_H__ */