iommu/arm-smmu: Request TZ to change page table format to V8L

For targets where we have slave side protection,
global register programming is handled by TZ. And
since it supports V7S page table format only, by
default TZ programs all context bank to permit
V7S format by programming VA64 bit of CBA2R register
as 0.

But if context bank itself is non secure then its
page tables are managed by HLOS where we can
support V8L page table format. So, provide a way
to request TZ to change page table format to V8L
for non secure context banks.

CRs-Fixed: 959535
Change-Id: I1f4d4b98c4f240a8351f791901abdfa78b829973
Signed-off-by: Susheel Khiani <skhiani@codeaurora.org>
This commit is contained in:
Susheel Khiani 2016-02-05 14:26:04 +05:30 committed by David Keitel
parent 8b39a23e0c
commit 20a5dc1e2f
3 changed files with 36 additions and 2 deletions

View file

@ -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

View file

@ -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();
}
}

View file

@ -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__ */