msm: Enable qseecom clocks when smcinvoke sends an invoke
If clock-support is enabled for smcinvoke, a notification will be sent to qseecom to enable/disable clocks when smcinvoke sends an invoke command. Change-Id: Ie36b43b009e9855785189272002f48fca719125d Signed-off-by: Amanpreet Kaur <quic_amankaur@quicinc.com> Signed-off-by: Ravi Kumar Bokka <quic_c_rbokka@quicinc.com>
This commit is contained in:
parent
ce329e7136
commit
bc7103485e
@ -1883,6 +1883,20 @@ static int qseecom_scale_bus_bandwidth_timer(uint32_t mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int qseecom_set_msm_bus_request_from_smcinvoke(enum qseecom_bandwidth_request_mode mode)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (mode > HIGH || mode < INACTIVE) {
|
||||
pr_err("Invalid mode %d for clock requested, setting clock to INACTIVE\n", mode);
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = qseecom_scale_bus_bandwidth_timer(mode);
|
||||
if (ret)
|
||||
pr_err("Failed (%d) to set bw for request_mode (%d)\n", ret, mode);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(qseecom_set_msm_bus_request_from_smcinvoke);
|
||||
|
||||
static int qseecom_unregister_bus_bandwidth_needs(
|
||||
struct qseecom_dev_handle *data)
|
||||
|
@ -172,6 +172,7 @@ static uint16_t g_last_mem_rgn_id, g_last_mem_map_obj_id;
|
||||
static size_t g_max_cb_buf_size = SMCINVOKE_TZ_MIN_BUF_SIZE;
|
||||
static unsigned int cb_reqs_inflight;
|
||||
static bool legacy_smc_call;
|
||||
static bool smc_clock_support;
|
||||
static int invoke_cmd;
|
||||
|
||||
static long smcinvoke_ioctl(struct file *, unsigned int, unsigned long);
|
||||
@ -1701,7 +1702,7 @@ static int prepare_send_scm_msg(const uint8_t *in_buf, phys_addr_t in_paddr,
|
||||
struct qtee_shm *in_shm, struct qtee_shm *out_shm,
|
||||
bool retry)
|
||||
{
|
||||
int ret = 0, cmd, retry_count = 0;
|
||||
int ret = 0, cmd, retry_count = 0, ret_smc_clk = 0;
|
||||
u64 response_type;
|
||||
unsigned int data;
|
||||
struct file *arr_filp[SMCI_OBJECT_COUNTS_MAX_OO] = {NULL};
|
||||
@ -1725,9 +1726,32 @@ static int prepare_send_scm_msg(const uint8_t *in_buf, phys_addr_t in_paddr,
|
||||
mutex_lock(&g_smcinvoke_lock);
|
||||
|
||||
do {
|
||||
/*
|
||||
* If clock-support is enabled for smcinvoke,
|
||||
* a notification will be sent to qseecom to enable/disable
|
||||
* clocks when smcinvoke sends an invoke command
|
||||
*/
|
||||
if (smc_clock_support) {
|
||||
ret_smc_clk = qseecom_set_msm_bus_request_from_smcinvoke(HIGH);
|
||||
if (ret_smc_clk) {
|
||||
pr_err("Clock enablement failed, ret: %d\n",
|
||||
ret_smc_clk);
|
||||
ret = -EPERM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret = invoke_cmd_handler(cmd, in_paddr, in_buf_len, out_buf,
|
||||
out_paddr, out_buf_len, &req->result,
|
||||
&response_type, &data, in_shm, out_shm);
|
||||
if (smc_clock_support) {
|
||||
ret_smc_clk = qseecom_set_msm_bus_request_from_smcinvoke(INACTIVE);
|
||||
if (ret_smc_clk) {
|
||||
pr_err("smc_clock enablement failed, ret: %d\n",
|
||||
ret_smc_clk);
|
||||
ret = -EPERM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == -EBUSY) {
|
||||
pr_err("Secure side is busy,will retry after 30 ms, retry_count = %d\n",
|
||||
@ -2872,6 +2896,8 @@ static int smcinvoke_probe(struct platform_device *pdev)
|
||||
goto exit_destroy_device;
|
||||
}
|
||||
smcinvoke_pdev = pdev;
|
||||
smc_clock_support = of_property_read_bool((&pdev->dev)->of_node,
|
||||
"qcom,clock-support");
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define __QSEECOM_KERNEL_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <linux/qseecom.h>
|
||||
|
||||
#define QSEECOM_ALIGN_SIZE 0x40
|
||||
#define QSEECOM_ALIGN_MASK (QSEECOM_ALIGN_SIZE - 1)
|
||||
@ -36,12 +36,23 @@ int qseecom_set_bandwidth(struct qseecom_handle *handle, bool high);
|
||||
#if IS_ENABLED(CONFIG_QSEECOM)
|
||||
int qseecom_process_listener_from_smcinvoke(uint32_t *result,
|
||||
u64 *response_type, unsigned int *data);
|
||||
/*
|
||||
* If clock-support is enabled for smcinvoke,
|
||||
* a notification will be sent to qseecom to enable/disable
|
||||
* clocks when smcinvoke sends an invoke command
|
||||
*/
|
||||
int qseecom_set_msm_bus_request_from_smcinvoke(enum qseecom_bandwidth_request_mode mode);
|
||||
#else
|
||||
static inline int qseecom_process_listener_from_smcinvoke(uint32_t *result,
|
||||
u64 *response_type, unsigned int *data)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
static inline int qseecom_set_msm_bus_request_from_smcinvoke(
|
||||
enum qseecom_bandwidth_request_mode mode)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user