mbox series

[0/2] Fix qcom,vmid handling in rmtfs_mem

Message ID 20230305-rmtfs-vmid-fix-v1-0-6a7206081602@z3ntu.xyz
Headers show
Series Fix qcom,vmid handling in rmtfs_mem | expand

Message

Luca Weiss March 5, 2023, 10:32 a.m. UTC
The commit e656cd0bcf3d ("soc: qcom: rmtfs: Optionally map RMTFS to
more VMs") which landed for v6.3-rc1 caused some issues on platforms
such as msm8974. Fix both the error handling and behavior when qcom,vmid
property is missing.

Please include this (or another fix) in 6.3 still.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
Luca Weiss (2):
      soc: qcom: rmtfs: fix error handling reading qcom,vmid
      soc: qcom: rmtfs: handle optional qcom,vmid correctly

 drivers/soc/qcom/rmtfs_mem.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
base-commit: 388bd72dfdc05abb319d86109a6edc9be5e0581d
change-id: 20230305-rmtfs-vmid-fix-0ec352b05040

Best regards,

Comments

Konrad Dybcio March 6, 2023, 10:19 a.m. UTC | #1
On 5.03.2023 11:32, Luca Weiss wrote:
> Older platforms don't have qcom,vmid set
Ugh, "evolution" :P

, handle -EINVAL return value
> correctly. And since num_vmids is passed to of_property_read_u32_array
> later we should make sure it has a sane value before continuing.
> 
> Fixes: e656cd0bcf3d ("soc: qcom: rmtfs: Optionally map RMTFS to more VMs")
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
This needs to be sanctioned by bindings, (i.e. if !oldplatform
require qcom,vmid), as without this property new ones will simply
lock up..

But this change is correct on its own

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/soc/qcom/rmtfs_mem.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c
> index 218397ab0c36f..fb6e4def8c78b 100644
> --- a/drivers/soc/qcom/rmtfs_mem.c
> +++ b/drivers/soc/qcom/rmtfs_mem.c
> @@ -229,7 +229,10 @@ static int qcom_rmtfs_mem_probe(struct platform_device *pdev)
>  	}
>  
>  	num_vmids = of_property_count_u32_elems(node, "qcom,vmid");
> -	if (num_vmids < 0) {
> +	if (num_vmids == -EINVAL) {
> +		/* qcom,vmid is optional */
> +		num_vmids = 0;
> +	} else if (num_vmids < 0) {
>  		dev_err(&pdev->dev, "failed to count qcom,vmid elements: %d\n", num_vmids);
>  		goto remove_cdev;
>  	} else if (num_vmids > NUM_MAX_VMIDS) {
>
Bjorn Andersson March 7, 2023, 4:20 a.m. UTC | #2
On Sun, 05 Mar 2023 11:32:32 +0100, Luca Weiss wrote:
> The commit e656cd0bcf3d ("soc: qcom: rmtfs: Optionally map RMTFS to
> more VMs") which landed for v6.3-rc1 caused some issues on platforms
> such as msm8974. Fix both the error handling and behavior when qcom,vmid
> property is missing.
> 
> Please include this (or another fix) in 6.3 still.
> 
> [...]

Applied, thanks!

[1/2] soc: qcom: rmtfs: fix error handling reading qcom,vmid
      commit: 947007419b60d5e06aa54b0f411c123db7f45a44
[2/2] soc: qcom: rmtfs: handle optional qcom,vmid correctly
      commit: 749d56bd5cf311dd9b50cfc092d7a39309454077

Best regards,