diff mbox series

[2/3] firmware: arm_ffa: Fix usage of partition info get count flag

Message ID 20230419-ffa_fixes_6-4-v1-2-1881ee6699f1@arm.com (mailing list archive)
State New, archived
Headers show
Series firmware: arm_ffa: Some fixes for v6.4 | expand

Commit Message

Sudeep Holla April 19, 2023, 9:54 a.m. UTC
Commit bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support")
adds support to discovery the UUIDs of the partitions or just fetch the
partition count using the PARTITION_INFO_GET_RETURN_COUNT_ONLY flag.

However the commit doesn't handle the fact that the older version doesn't
understand the flag and must be MBZ which results in firmware returning
invalid parameter error. That results in the failure of the driver probe
which is in correct.

Limit the usage of the PARTITION_INFO_GET_RETURN_COUNT_ONLY flag for the
versions above v1.0(i.e v1.1 and onwards) which fixes the issue.

Fixes: bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support")
Reported-by: Jens Wiklander <jens.wiklander@linaro.org>
Reported-by: Marc Bonnici <marc.bonnici@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jens Wiklander April 19, 2023, 11:23 a.m. UTC | #1
On Wed, Apr 19, 2023 at 11:54 AM Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> Commit bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support")
> adds support to discovery the UUIDs of the partitions or just fetch the
> partition count using the PARTITION_INFO_GET_RETURN_COUNT_ONLY flag.
>
> However the commit doesn't handle the fact that the older version doesn't
> understand the flag and must be MBZ which results in firmware returning
> invalid parameter error. That results in the failure of the driver probe
> which is in correct.
>
> Limit the usage of the PARTITION_INFO_GET_RETURN_COUNT_ONLY flag for the
> versions above v1.0(i.e v1.1 and onwards) which fixes the issue.
>
> Fixes: bb1be7498500 ("firmware: arm_ffa: Add v1.1 get_partition_info support")
> Reported-by: Jens Wiklander <jens.wiklander@linaro.org>
> Reported-by: Marc Bonnici <marc.bonnici@arm.com>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_ffa/driver.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Tested-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>

Thanks,
Jens

>
> diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
> index fa85c64d3ded..4aced2e5b772 100644
> --- a/drivers/firmware/arm_ffa/driver.c
> +++ b/drivers/firmware/arm_ffa/driver.c
> @@ -193,7 +193,8 @@ __ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3,
>         int idx, count, flags = 0, sz, buf_sz;
>         ffa_value_t partition_info;
>
> -       if (!buffer || !num_partitions) /* Just get the count for now */
> +       if (drv_info->version > FFA_VERSION_1_0 &&
> +           (!buffer || !num_partitions)) /* Just get the count for now */
>                 flags = PARTITION_INFO_GET_RETURN_COUNT_ONLY;
>
>         mutex_lock(&drv_info->rx_lock);
>
> --
> 2.40.0
>
diff mbox series

Patch

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index fa85c64d3ded..4aced2e5b772 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -193,7 +193,8 @@  __ffa_partition_info_get(u32 uuid0, u32 uuid1, u32 uuid2, u32 uuid3,
 	int idx, count, flags = 0, sz, buf_sz;
 	ffa_value_t partition_info;
 
-	if (!buffer || !num_partitions) /* Just get the count for now */
+	if (drv_info->version > FFA_VERSION_1_0 &&
+	    (!buffer || !num_partitions)) /* Just get the count for now */
 		flags = PARTITION_INFO_GET_RETURN_COUNT_ONLY;
 
 	mutex_lock(&drv_info->rx_lock);