Message ID | 20230728063412.1641856-8-quic_mmanikan@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Add multipd remoteproc support | expand |
On Jul 28 2023 12:04, Manikanta Mylavarapu wrote: > IPQ5332 user pd remoteproc firmwares need to be locked > with MSA(modem secure access) features. This patch add > support to lock/unlock MSA features. > > Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com> > --- > Changes in v4: > - Rebased on linux-next > > drivers/firmware/qcom_scm.c | 78 ++++++++++++++++++++++++++ > drivers/firmware/qcom_scm.h | 2 + > include/linux/firmware/qcom/qcom_scm.h | 2 + > 3 files changed, 82 insertions(+) > > diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c > index 3bc8c63a997f..2275cf7bc887 100644 > --- a/drivers/firmware/qcom_scm.c > +++ b/drivers/firmware/qcom_scm.c > @@ -676,6 +676,84 @@ bool qcom_scm_pas_supported(u32 peripheral) > } > EXPORT_SYMBOL(qcom_scm_pas_supported); > > +/** > + * qcom_scm_msa_lock() - Lock given peripheral firmware region as MSA > + * > + * @peripheral: peripheral id > + * > + * Return 0 on success. > + */ > +int qcom_scm_msa_lock(u32 peripheral) > +{ > + int ret; > + struct qcom_scm_desc desc = { > + .svc = QCOM_SCM_SVC_PIL, > + .cmd = QCOM_SCM_MSA_LOCK, > + .arginfo = QCOM_SCM_ARGS(1), > + .args[0] = peripheral, > + .owner = ARM_SMCCC_OWNER_SIP, > + }; > + struct qcom_scm_res res; > + > + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, > + QCOM_SCM_MSA_LOCK)) > + return 0; > + > + ret = qcom_scm_clk_enable(); > + if (ret) > + return ret; > + > + ret = qcom_scm_bw_enable(); > + if (ret) > + return ret; > + > + ret = qcom_scm_call(__scm->dev, &desc, &res); > + qcom_scm_bw_disable(); > + qcom_scm_clk_disable(); > + > + return ret ? : res.result[0]; > +} > +EXPORT_SYMBOL(qcom_scm_msa_lock); Could you please convert this to EXPORT_SYMBOL_GPL? > + > +/** > + * qcom_scm_msa_unlock() - Unlock given peripheral MSA firmware region > + * > + * @peripheral: peripheral id > + * > + * Return 0 on success. > + */ > +int qcom_scm_msa_unlock(u32 peripheral) > +{ > + int ret; > + struct qcom_scm_desc desc = { > + .svc = QCOM_SCM_SVC_PIL, > + .cmd = QCOM_SCM_MSA_UNLOCK, > + .arginfo = QCOM_SCM_ARGS(1), > + .args[0] = peripheral, > + .owner = ARM_SMCCC_OWNER_SIP, > + }; > + struct qcom_scm_res res; > + > + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, > + QCOM_SCM_MSA_UNLOCK)) > + return 0; > + > + ret = qcom_scm_clk_enable(); > + if (ret) > + return ret; > + > + ret = qcom_scm_bw_enable(); > + if (ret) > + return ret; > + > + ret = qcom_scm_call(__scm->dev, &desc, &res); > + qcom_scm_bw_disable(); > + qcom_scm_clk_disable(); > + > + return ret ? : res.result[0]; > +} > +EXPORT_SYMBOL(qcom_scm_msa_unlock); This one too? Reference: [1] The whole driver has now moved to using EXPORT_SYMBOL_GPL() now. [1] https://lore.kernel.org/lkml/19d9ac0bf79f957574ef9b3b73246ea0113cc0fd.1690503893.git.quic_gurus@quicinc.com/ Thank you. Guru Das.
On 7/29/2023 6:00 AM, Guru Das Srinagesh wrote: > On Jul 28 2023 12:04, Manikanta Mylavarapu wrote: >> IPQ5332 user pd remoteproc firmwares need to be locked >> with MSA(modem secure access) features. This patch add >> support to lock/unlock MSA features. >> >> Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com> >> --- >> Changes in v4: >> - Rebased on linux-next >> >> drivers/firmware/qcom_scm.c | 78 ++++++++++++++++++++++++++ >> drivers/firmware/qcom_scm.h | 2 + >> include/linux/firmware/qcom/qcom_scm.h | 2 + >> 3 files changed, 82 insertions(+) >> >> diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c >> index 3bc8c63a997f..2275cf7bc887 100644 >> --- a/drivers/firmware/qcom_scm.c >> +++ b/drivers/firmware/qcom_scm.c >> @@ -676,6 +676,84 @@ bool qcom_scm_pas_supported(u32 peripheral) >> } >> EXPORT_SYMBOL(qcom_scm_pas_supported); >> >> +/** >> + * qcom_scm_msa_lock() - Lock given peripheral firmware region as MSA >> + * >> + * @peripheral: peripheral id >> + * >> + * Return 0 on success. >> + */ >> +int qcom_scm_msa_lock(u32 peripheral) >> +{ >> + int ret; >> + struct qcom_scm_desc desc = { >> + .svc = QCOM_SCM_SVC_PIL, >> + .cmd = QCOM_SCM_MSA_LOCK, >> + .arginfo = QCOM_SCM_ARGS(1), >> + .args[0] = peripheral, >> + .owner = ARM_SMCCC_OWNER_SIP, >> + }; >> + struct qcom_scm_res res; >> + >> + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, >> + QCOM_SCM_MSA_LOCK)) >> + return 0; >> + >> + ret = qcom_scm_clk_enable(); >> + if (ret) >> + return ret; >> + >> + ret = qcom_scm_bw_enable(); >> + if (ret) >> + return ret; >> + >> + ret = qcom_scm_call(__scm->dev, &desc, &res); >> + qcom_scm_bw_disable(); >> + qcom_scm_clk_disable(); >> + >> + return ret ? : res.result[0]; >> +} >> +EXPORT_SYMBOL(qcom_scm_msa_lock); > > Could you please convert this to EXPORT_SYMBOL_GPL? > Ok, sure. >> + >> +/** >> + * qcom_scm_msa_unlock() - Unlock given peripheral MSA firmware region >> + * >> + * @peripheral: peripheral id >> + * >> + * Return 0 on success. >> + */ >> +int qcom_scm_msa_unlock(u32 peripheral) >> +{ >> + int ret; >> + struct qcom_scm_desc desc = { >> + .svc = QCOM_SCM_SVC_PIL, >> + .cmd = QCOM_SCM_MSA_UNLOCK, >> + .arginfo = QCOM_SCM_ARGS(1), >> + .args[0] = peripheral, >> + .owner = ARM_SMCCC_OWNER_SIP, >> + }; >> + struct qcom_scm_res res; >> + >> + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, >> + QCOM_SCM_MSA_UNLOCK)) >> + return 0; >> + >> + ret = qcom_scm_clk_enable(); >> + if (ret) >> + return ret; >> + >> + ret = qcom_scm_bw_enable(); >> + if (ret) >> + return ret; >> + >> + ret = qcom_scm_call(__scm->dev, &desc, &res); >> + qcom_scm_bw_disable(); >> + qcom_scm_clk_disable(); >> + >> + return ret ? : res.result[0]; >> +} >> +EXPORT_SYMBOL(qcom_scm_msa_unlock); > > This one too? > Ok, sure. > Reference: [1] > The whole driver has now moved to using EXPORT_SYMBOL_GPL() now. > > [1] https://lore.kernel.org/lkml/19d9ac0bf79f957574ef9b3b73246ea0113cc0fd.1690503893.git.quic_gurus@quicinc.com/ > > Thank you. > > Guru Das. Thanks & Regards, Manikanta.
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 3bc8c63a997f..2275cf7bc887 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -676,6 +676,84 @@ bool qcom_scm_pas_supported(u32 peripheral) } EXPORT_SYMBOL(qcom_scm_pas_supported); +/** + * qcom_scm_msa_lock() - Lock given peripheral firmware region as MSA + * + * @peripheral: peripheral id + * + * Return 0 on success. + */ +int qcom_scm_msa_lock(u32 peripheral) +{ + int ret; + struct qcom_scm_desc desc = { + .svc = QCOM_SCM_SVC_PIL, + .cmd = QCOM_SCM_MSA_LOCK, + .arginfo = QCOM_SCM_ARGS(1), + .args[0] = peripheral, + .owner = ARM_SMCCC_OWNER_SIP, + }; + struct qcom_scm_res res; + + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, + QCOM_SCM_MSA_LOCK)) + return 0; + + ret = qcom_scm_clk_enable(); + if (ret) + return ret; + + ret = qcom_scm_bw_enable(); + if (ret) + return ret; + + ret = qcom_scm_call(__scm->dev, &desc, &res); + qcom_scm_bw_disable(); + qcom_scm_clk_disable(); + + return ret ? : res.result[0]; +} +EXPORT_SYMBOL(qcom_scm_msa_lock); + +/** + * qcom_scm_msa_unlock() - Unlock given peripheral MSA firmware region + * + * @peripheral: peripheral id + * + * Return 0 on success. + */ +int qcom_scm_msa_unlock(u32 peripheral) +{ + int ret; + struct qcom_scm_desc desc = { + .svc = QCOM_SCM_SVC_PIL, + .cmd = QCOM_SCM_MSA_UNLOCK, + .arginfo = QCOM_SCM_ARGS(1), + .args[0] = peripheral, + .owner = ARM_SMCCC_OWNER_SIP, + }; + struct qcom_scm_res res; + + if (!__qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, + QCOM_SCM_MSA_UNLOCK)) + return 0; + + ret = qcom_scm_clk_enable(); + if (ret) + return ret; + + ret = qcom_scm_bw_enable(); + if (ret) + return ret; + + ret = qcom_scm_call(__scm->dev, &desc, &res); + qcom_scm_bw_disable(); + qcom_scm_clk_disable(); + + return ret ? : res.result[0]; +} +EXPORT_SYMBOL(qcom_scm_msa_unlock); + static int __qcom_scm_pas_mss_reset(struct device *dev, bool reset) { struct qcom_scm_desc desc = { diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 6ab5e7c77e8d..9480b0b57c3d 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -97,6 +97,8 @@ extern int scm_legacy_call(struct device *dev, const struct qcom_scm_desc *desc, #define QCOM_SCM_PIL_PAS_SHUTDOWN 0x06 #define QCOM_SCM_PIL_PAS_IS_SUPPORTED 0x07 #define QCOM_SCM_PIL_PAS_MSS_RESET 0x0a +#define QCOM_SCM_MSA_LOCK 0x24 +#define QCOM_SCM_MSA_UNLOCK 0x25 #define QCOM_SCM_SVC_IO 0x05 #define QCOM_SCM_IO_READ 0x01 diff --git a/include/linux/firmware/qcom/qcom_scm.h b/include/linux/firmware/qcom/qcom_scm.h index 250ea4efb7cb..a150e2914483 100644 --- a/include/linux/firmware/qcom/qcom_scm.h +++ b/include/linux/firmware/qcom/qcom_scm.h @@ -81,6 +81,8 @@ extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, extern int qcom_scm_pas_auth_and_reset(u32 peripheral); extern int qcom_scm_pas_shutdown(u32 peripheral); extern bool qcom_scm_pas_supported(u32 peripheral); +extern int qcom_scm_msa_lock(u32 peripheral); +extern int qcom_scm_msa_unlock(u32 peripheral); extern int qcom_scm_io_readl(phys_addr_t addr, unsigned int *val); extern int qcom_scm_io_writel(phys_addr_t addr, unsigned int val);
IPQ5332 user pd remoteproc firmwares need to be locked with MSA(modem secure access) features. This patch add support to lock/unlock MSA features. Signed-off-by: Manikanta Mylavarapu <quic_mmanikan@quicinc.com> --- Changes in v4: - Rebased on linux-next drivers/firmware/qcom_scm.c | 78 ++++++++++++++++++++++++++ drivers/firmware/qcom_scm.h | 2 + include/linux/firmware/qcom/qcom_scm.h | 2 + 3 files changed, 82 insertions(+)