diff --git a/drivers/firmware/qcom_scm-smc.c b/drivers/firmware/qcom_scm-smc.c index abd5ce130d61..416389de8294 100644 --- a/drivers/firmware/qcom_scm-smc.c +++ b/drivers/firmware/qcom_scm-smc.c @@ -1510,6 +1510,26 @@ int __qcom_scm_ice_restore_cfg(struct device *dev) return qcom_scm_call(dev, &desc); } +int __qcom_scm_register_qsee_log_buf(struct device *dev, phys_addr_t buf, + size_t len) +{ + int ret; + struct qcom_scm_desc desc = { + .svc = QCOM_SCM_SVC_QSEELOG, + .cmd = QCOM_SCM_QSEELOG_REGISTER, + .owner = ARM_SMCCC_OWNER_TRUSTED_OS + }; + + + desc.args[0] = buf; + desc.args[1] = len; + desc.arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_RW); + + ret = qcom_scm_call(dev, &desc); + + return ret ? : desc.res[0]; +} + void __qcom_scm_init(void) { __query_convention(); diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index f3b178e5f1a9..e199b75e550c 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -678,6 +678,19 @@ int qcom_scm_ice_restore_cfg(void) } EXPORT_SYMBOL(qcom_scm_ice_restore_cfg); +int qcom_scm_get_tz_log_feat_id(u64 *version) +{ + return __qcom_scm_get_feat_version(__scm->dev, QCOM_SCM_FEAT_LOG_ID, + version); +} +EXPORT_SYMBOL(qcom_scm_get_tz_log_feat_id); + +int qcom_scm_register_qsee_log_buf(phys_addr_t buf, size_t len) +{ + return __qcom_scm_register_qsee_log_buf(__scm->dev, buf, len); +} +EXPORT_SYMBOL(qcom_scm_register_qsee_log_buf); + /** * qcom_scm_is_available() - Checks if SCM is available */ diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 162759c34f3c..aba137729ebc 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -162,6 +162,12 @@ extern int __qcom_scm_qsmmu500_wait_safe_toggle(struct device *dev, #define QCOM_SCM_SMMU_CONFIG_ERRATA1_CLIENT_ALL 0x2 // TOS Services and Function IDs +#define QCOM_SCM_SVC_QSEELOG 0x01 +#define QCOM_SCM_QSEELOG_REGISTER 0x06 +extern int __qcom_scm_register_qsee_log_buf(struct device *dev, phys_addr_t buf, + size_t len); +#define QCOM_SCM_FEAT_LOG_ID 0x0a + #define QCOM_SCM_SVC_KEYSTORE 0x05 #define QCOM_SCM_ICE_RESTORE_KEY_ID 0x06 extern int __qcom_scm_ice_restore_cfg(struct device *dev); diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index 3d093dc8cc2d..8ca5fe630ef0 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -98,6 +98,8 @@ extern int qcom_scm_create_shm_bridge(u64 pfn_and_ns_perm_flags, extern int qcom_scm_smmu_change_pgtbl_format(u64 dev_id, int cbndx); extern int qcom_scm_qsmmu500_wait_safe_toggle(bool en); extern int qcom_scm_ice_restore_cfg(void); +extern int qcom_scm_get_tz_log_feat_id(u64 *version); +extern int qcom_scm_register_qsee_log_buf(phys_addr_t buf, size_t len); extern bool qcom_scm_is_available(void); #else @@ -188,6 +190,10 @@ static inline int qcom_scm_smmu_change_pgtbl_format(u64 dev_id, int cbndx) static inline int qcom_scm_qsmmu500_wait_safe_toggle(bool en) { return -ENODEV; } static inline int qcom_scm_ice_restore_cfg(void) { return -ENODEV; } +static inline int qcom_scm_get_tz_log_feat_id(u64 *version) + { return -ENODEV; } +static inline int qcom_scm_register_qsee_log_buf(phys_addr_t buf, size_t len) + { return -ENODEV; } static inline bool qcom_scm_is_available(void) { return false; } #endif #endif