Skip to content

Commit 1af75b2

Browse files
quic-bjorandeandersson
authored andcommitted
firmware: qcom: scm: Introduce CP_SMMU_APERTURE_ID
The QCOM_SCM_SVC_MP service provides QCOM_SCM_MP_CP_SMMU_APERTURE_ID, which is used to trigger the mapping of register banks into the SMMU context for per-processes page tables to function (in case this isn't statically setup by firmware). This is necessary on e.g. QCS6490 Rb3Gen2, in order to avoid "CP | AHB bus error"-errors from the GPU. Introduce a function to allow the msm driver to invoke this call. Signed-off-by: Bjorn Andersson <[email protected]> Reviewed-by: Rob Clark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent a8fc655 commit 1af75b2

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

drivers/firmware/qcom/qcom_scm.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -903,6 +903,32 @@ int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare)
903903
}
904904
EXPORT_SYMBOL_GPL(qcom_scm_restore_sec_cfg);
905905

906+
#define QCOM_SCM_CP_APERTURE_CONTEXT_MASK GENMASK(7, 0)
907+
908+
bool qcom_scm_set_gpu_smmu_aperture_is_available(void)
909+
{
910+
return __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_MP,
911+
QCOM_SCM_MP_CP_SMMU_APERTURE_ID);
912+
}
913+
EXPORT_SYMBOL_GPL(qcom_scm_set_gpu_smmu_aperture_is_available);
914+
915+
int qcom_scm_set_gpu_smmu_aperture(unsigned int context_bank)
916+
{
917+
struct qcom_scm_desc desc = {
918+
.svc = QCOM_SCM_SVC_MP,
919+
.cmd = QCOM_SCM_MP_CP_SMMU_APERTURE_ID,
920+
.arginfo = QCOM_SCM_ARGS(4),
921+
.args[0] = 0xffff0000 | FIELD_PREP(QCOM_SCM_CP_APERTURE_CONTEXT_MASK, context_bank),
922+
.args[1] = 0xffffffff,
923+
.args[2] = 0xffffffff,
924+
.args[3] = 0xffffffff,
925+
.owner = ARM_SMCCC_OWNER_SIP
926+
};
927+
928+
return qcom_scm_call(__scm->dev, &desc, NULL);
929+
}
930+
EXPORT_SYMBOL_GPL(qcom_scm_set_gpu_smmu_aperture);
931+
906932
int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size)
907933
{
908934
struct qcom_scm_desc desc = {

drivers/firmware/qcom/qcom_scm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool(void);
116116
#define QCOM_SCM_MP_IOMMU_SET_CP_POOL_SIZE 0x05
117117
#define QCOM_SCM_MP_VIDEO_VAR 0x08
118118
#define QCOM_SCM_MP_ASSIGN 0x16
119+
#define QCOM_SCM_MP_CP_SMMU_APERTURE_ID 0x1b
119120
#define QCOM_SCM_MP_SHM_BRIDGE_ENABLE 0x1c
120121
#define QCOM_SCM_MP_SHM_BRIDGE_DELETE 0x1d
121122
#define QCOM_SCM_MP_SHM_BRIDGE_CREATE 0x1e

include/linux/firmware/qcom/qcom_scm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ int qcom_scm_io_writel(phys_addr_t addr, unsigned int val);
8585

8686
bool qcom_scm_restore_sec_cfg_available(void);
8787
int qcom_scm_restore_sec_cfg(u32 device_id, u32 spare);
88+
int qcom_scm_set_gpu_smmu_aperture(unsigned int context_bank);
89+
bool qcom_scm_set_gpu_smmu_aperture_is_available(void);
8890
int qcom_scm_iommu_secure_ptbl_size(u32 spare, size_t *size);
8991
int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare);
9092
int qcom_scm_iommu_set_cp_pool_size(u32 spare, u32 size);

0 commit comments

Comments
 (0)