Re: [PATCH v2 06/18] firmware: qcom_scm-64: Move svc/cmd/owner into qcom_scm_desc
From: Stephen Boyd
Date: Fri Nov 15 2019 - 18:40:34 EST
Quoting Elliot Berman (2019-11-12 13:22:42)
> diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c
> index 7de6022..e81fb6e 100644
> --- a/drivers/firmware/qcom_scm-64.c
> +++ b/drivers/firmware/qcom_scm-64.c
> @@ -46,8 +46,11 @@ enum qcom_scm_arg_types {
> * @res: The values returned by the secure syscall
> */
> struct qcom_scm_desc {
> + u32 svc;
> + u32 cmd;
> u32 arginfo;
> u64 args[MAX_QCOM_SCM_ARGS];
> + u32 owner;
Owner is always the same. Why move it to the qcom_scm_desc structure? I
can understand svc and cmd but there's no justification for this struct
member.
> };
>
> static u64 qcom_smccc_convention = -1;
[...]
> @@ -542,26 +584,32 @@ int __qcom_scm_io_readl(struct device *dev, phys_addr_t addr,
>
> int __qcom_scm_io_writel(struct device *dev, phys_addr_t addr, unsigned int val)
> {
> - struct qcom_scm_desc desc = {0};
> + struct qcom_scm_desc desc = {
> + .svc = QCOM_SCM_SVC_IO,
> + .cmd = QCOM_SCM_IO_WRITE,
> + .owner = ARM_SMCCC_OWNER_SIP,
> + };
> struct arm_smccc_res res;
>
> desc.args[0] = addr;
> desc.args[1] = val;
> desc.arginfo = QCOM_SCM_ARGS(2);
The style is weird here. Half of the struct is initialized during
declaration and the arguments are set here with individual statements.
Can we have one way or the other and not both?
>
> - return qcom_scm_call(dev, QCOM_SCM_SVC_IO, QCOM_SCM_IO_WRITE,
> - &desc, &res);
> + return qcom_scm_call(dev, &desc, &res);
> }
>