linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region"
@ 2025-07-03 18:34 Rob Herring (Arm)
  2025-07-03 19:45 ` Dmitry Baryshkov
  2025-07-12 18:27 ` Srinivas Kandagatla
  0 siblings, 2 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2025-07-03 18:34 UTC (permalink / raw)
  To: Srinivas Kandagatla, Amol Maheshwari, Arnd Bergmann,
	Greg Kroah-Hartman
  Cc: linux-arm-msm, dri-devel, linux-kernel

Use the newly added of_reserved_mem_region_to_resource() function to
handle "memory-region" properties.

The error handling is a bit different. "memory-region" is optional, so
failed lookup is not an error. But then an error in
of_reserved_mem_lookup() is treated as an error. However, that
distinction is not really important. Either the region is available
and usable or it is not. So now, it is just
of_reserved_mem_region_to_resource() which is checked for an error.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/misc/fastrpc.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 378923594f02..53e88a1bc430 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -2262,8 +2262,6 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
 	int i, err, domain_id = -1, vmcount;
 	const char *domain;
 	bool secure_dsp;
-	struct device_node *rmem_node;
-	struct reserved_mem *rmem;
 	unsigned int vmids[FASTRPC_MAX_VMIDS];
 
 	err = of_property_read_string(rdev->of_node, "label", &domain);
@@ -2306,20 +2304,17 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
 		}
 	}
 
-	rmem_node = of_parse_phandle(rdev->of_node, "memory-region", 0);
-	if (domain_id == SDSP_DOMAIN_ID && rmem_node) {
+	if (domain_id == SDSP_DOMAIN_ID) {
+		struct resource res;
 		u64 src_perms;
 
-		rmem = of_reserved_mem_lookup(rmem_node);
-		if (!rmem) {
-			err = -EINVAL;
-			goto err_free_data;
-		}
+		err = of_reserved_mem_region_to_resource(rdev->of_node, 0, &res);
+		if (!err) {
+			src_perms = BIT(QCOM_SCM_VMID_HLOS);
 
-		src_perms = BIT(QCOM_SCM_VMID_HLOS);
-
-		qcom_scm_assign_mem(rmem->base, rmem->size, &src_perms,
+			qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
 				    data->vmperms, data->vmcount);
+		}
 
 	}
 
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-03 18:34 [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
@ 2025-07-03 19:45 ` Dmitry Baryshkov
  2025-07-12 18:27 ` Srinivas Kandagatla
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2025-07-03 19:45 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Srinivas Kandagatla, Amol Maheshwari, Arnd Bergmann,
	Greg Kroah-Hartman, linux-arm-msm, dri-devel, linux-kernel

On Thu, Jul 03, 2025 at 01:34:54PM -0500, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
> 
> The error handling is a bit different. "memory-region" is optional, so
> failed lookup is not an error. But then an error in
> of_reserved_mem_lookup() is treated as an error. However, that
> distinction is not really important. Either the region is available
> and usable or it is not. So now, it is just
> of_reserved_mem_region_to_resource() which is checked for an error.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>  drivers/misc/fastrpc.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

> 

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-03 18:34 [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
  2025-07-03 19:45 ` Dmitry Baryshkov
@ 2025-07-12 18:27 ` Srinivas Kandagatla
  2025-07-16 12:16   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 4+ messages in thread
From: Srinivas Kandagatla @ 2025-07-12 18:27 UTC (permalink / raw)
  To: Rob Herring (Arm), Srinivas Kandagatla, Amol Maheshwari,
	Arnd Bergmann, Greg Kroah-Hartman
  Cc: linux-arm-msm, dri-devel, linux-kernel



On 7/3/25 7:34 PM, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
> 
> The error handling is a bit different. "memory-region" is optional, so
> failed lookup is not an error. But then an error in
> of_reserved_mem_lookup() is treated as an error. However, that
> distinction is not really important. Either the region is available
> and usable or it is not. So now, it is just
> of_reserved_mem_region_to_resource() which is checked for an error.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---

Reviewed-by: Srinivas Kandagatla <srini@kernel.org>


Greg, there are no more patches for fastrpc for this cycle, can you
please pick this up via char-misc tree?


thanks,
Srini



>  drivers/misc/fastrpc.c | 19 +++++++------------
>  1 file changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 378923594f02..53e88a1bc430 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -2262,8 +2262,6 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
>  	int i, err, domain_id = -1, vmcount;
>  	const char *domain;
>  	bool secure_dsp;
> -	struct device_node *rmem_node;
> -	struct reserved_mem *rmem;
>  	unsigned int vmids[FASTRPC_MAX_VMIDS];
>  
>  	err = of_property_read_string(rdev->of_node, "label", &domain);
> @@ -2306,20 +2304,17 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
>  		}
>  	}
>  
> -	rmem_node = of_parse_phandle(rdev->of_node, "memory-region", 0);
> -	if (domain_id == SDSP_DOMAIN_ID && rmem_node) {
> +	if (domain_id == SDSP_DOMAIN_ID) {
> +		struct resource res;
>  		u64 src_perms;
>  
> -		rmem = of_reserved_mem_lookup(rmem_node);
> -		if (!rmem) {
> -			err = -EINVAL;
> -			goto err_free_data;
> -		}
> +		err = of_reserved_mem_region_to_resource(rdev->of_node, 0, &res);
> +		if (!err) {
> +			src_perms = BIT(QCOM_SCM_VMID_HLOS);
>  
> -		src_perms = BIT(QCOM_SCM_VMID_HLOS);
> -
> -		qcom_scm_assign_mem(rmem->base, rmem->size, &src_perms,
> +			qcom_scm_assign_mem(res.start, resource_size(&res), &src_perms,
>  				    data->vmperms, data->vmcount);
> +		}
>  
>  	}
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region"
  2025-07-12 18:27 ` Srinivas Kandagatla
@ 2025-07-16 12:16   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2025-07-16 12:16 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Rob Herring (Arm), Amol Maheshwari, Arnd Bergmann, linux-arm-msm,
	dri-devel, linux-kernel

On Sat, Jul 12, 2025 at 07:27:42PM +0100, Srinivas Kandagatla wrote:
> 
> 
> On 7/3/25 7:34 PM, Rob Herring (Arm) wrote:
> > Use the newly added of_reserved_mem_region_to_resource() function to
> > handle "memory-region" properties.
> > 
> > The error handling is a bit different. "memory-region" is optional, so
> > failed lookup is not an error. But then an error in
> > of_reserved_mem_lookup() is treated as an error. However, that
> > distinction is not really important. Either the region is available
> > and usable or it is not. So now, it is just
> > of_reserved_mem_region_to_resource() which is checked for an error.
> > 
> > Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> > ---
> 
> Reviewed-by: Srinivas Kandagatla <srini@kernel.org>
> 
> 
> Greg, there are no more patches for fastrpc for this cycle, can you
> please pick this up via char-misc tree?

Will do, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-16 12:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 18:34 [PATCH] misc: fastrpc: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
2025-07-03 19:45 ` Dmitry Baryshkov
2025-07-12 18:27 ` Srinivas Kandagatla
2025-07-16 12:16   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).