mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2]firmware: xilinx: Updates to FPGA configuration APIs
@ 2025-01-23 10:35 Nava kishore Manne
  2025-01-23 10:35 ` [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API Nava kishore Manne
  2025-01-23 10:35 ` [PATCH 2/2] firmware: xilinx: Dont send linux address to get fpga config get status Nava kishore Manne
  0 siblings, 2 replies; 5+ messages in thread
From: Nava kishore Manne @ 2025-01-23 10:35 UTC (permalink / raw)
  To: michal.simek, ronak.jain, nava.kishore.manne, gregkh,
	jay.buddhabhatti, praveen.teja.kundanala,
	siva.durga.prasad.paladugu, u.kleine-koenig, linux-arm-kernel,
	linux-kernel

This patch series includes updates to the Xilinx firmware driver to address
issues with FPGA configuration APIs.

Nava kishore Manne (1):
  firmware: xilinx: Update the zynqmp_pm_load_pdi() API

Siva Durga Prasad Paladugu (1):
  firmware: xilinx: Dont send linux address to get fpga config get
    status

 drivers/firmware/xilinx/zynqmp.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

-- 
2.25.1


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

* [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API
  2025-01-23 10:35 [PATCH 0/2]firmware: xilinx: Updates to FPGA configuration APIs Nava kishore Manne
@ 2025-01-23 10:35 ` Nava kishore Manne
  2025-01-24  6:00   ` Jie Gan
  2025-01-23 10:35 ` [PATCH 2/2] firmware: xilinx: Dont send linux address to get fpga config get status Nava kishore Manne
  1 sibling, 1 reply; 5+ messages in thread
From: Nava kishore Manne @ 2025-01-23 10:35 UTC (permalink / raw)
  To: michal.simek, ronak.jain, nava.kishore.manne, gregkh,
	jay.buddhabhatti, praveen.teja.kundanala,
	siva.durga.prasad.paladugu, u.kleine-koenig, linux-arm-kernel,
	linux-kernel

Update the zynqmp_pm_load_pdi() API to handle the firmware
error’s properly.

Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 720fa8b5d8e9..ea04a6ac402d 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -1483,8 +1483,16 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
  */
 int zynqmp_pm_load_pdi(const u32 src, const u64 address)
 {
-	return zynqmp_pm_invoke_fn(PM_LOAD_PDI, NULL, 3, src, lower_32_bits(address),
-				   upper_32_bits(address));
+	u32 ret_payload[PAYLOAD_ARG_CNT];
+	int ret;
+
+	ret = zynqmp_pm_invoke_fn(PM_LOAD_PDI, ret_payload, 3, src,
+				  lower_32_bits(address),
+				  upper_32_bits(address));
+	if (ret_payload[0])
+		return ret_payload[0];
+
+	return ret;
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_load_pdi);
 
-- 
2.25.1


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

* [PATCH 2/2] firmware: xilinx: Dont send linux address to get fpga config get status
  2025-01-23 10:35 [PATCH 0/2]firmware: xilinx: Updates to FPGA configuration APIs Nava kishore Manne
  2025-01-23 10:35 ` [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API Nava kishore Manne
@ 2025-01-23 10:35 ` Nava kishore Manne
  1 sibling, 0 replies; 5+ messages in thread
From: Nava kishore Manne @ 2025-01-23 10:35 UTC (permalink / raw)
  To: michal.simek, ronak.jain, nava.kishore.manne, gregkh,
	jay.buddhabhatti, praveen.teja.kundanala,
	siva.durga.prasad.paladugu, u.kleine-koenig, linux-arm-kernel,
	linux-kernel

From: Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>

Fpga get config status just returns status through ret_payload and there
is no need to allocate local buf and send its address through SMC args.
Moreover, the address that is being passed till now is linux virtual
address and is incorrect.
Corresponding modification has been done in the firmware to avoid using the
address sent by linux.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.prasad.paladugu@amd.com>
Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
---
 drivers/firmware/xilinx/zynqmp.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index ea04a6ac402d..406b4bd10894 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -1139,17 +1139,13 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_get_status);
 int zynqmp_pm_fpga_get_config_status(u32 *value)
 {
 	u32 ret_payload[PAYLOAD_ARG_CNT];
-	u32 buf, lower_addr, upper_addr;
 	int ret;
 
 	if (!value)
 		return -EINVAL;
 
-	lower_addr = lower_32_bits((u64)&buf);
-	upper_addr = upper_32_bits((u64)&buf);
-
 	ret = zynqmp_pm_invoke_fn(PM_FPGA_READ, ret_payload, 4,
-				  XILINX_ZYNQMP_PM_FPGA_CONFIG_STAT_OFFSET, lower_addr, upper_addr,
+				  XILINX_ZYNQMP_PM_FPGA_CONFIG_STAT_OFFSET, 0, 0,
 				  XILINX_ZYNQMP_PM_FPGA_READ_CONFIG_REG);
 
 	*value = ret_payload[1];
-- 
2.25.1


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

* Re: [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API
  2025-01-23 10:35 ` [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API Nava kishore Manne
@ 2025-01-24  6:00   ` Jie Gan
  2025-02-05 11:32     ` Manne, Nava kishore
  0 siblings, 1 reply; 5+ messages in thread
From: Jie Gan @ 2025-01-24  6:00 UTC (permalink / raw)
  To: Nava kishore Manne, michal.simek, ronak.jain, gregkh,
	jay.buddhabhatti, praveen.teja.kundanala,
	siva.durga.prasad.paladugu, u.kleine-koenig, linux-arm-kernel,
	linux-kernel



On 1/23/2025 6:35 PM, Nava kishore Manne wrote:
> Update the zynqmp_pm_load_pdi() API to handle the firmware
> error’s properly.
> 
> Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
> ---
>   drivers/firmware/xilinx/zynqmp.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
> index 720fa8b5d8e9..ea04a6ac402d 100644
> --- a/drivers/firmware/xilinx/zynqmp.c
> +++ b/drivers/firmware/xilinx/zynqmp.c
> @@ -1483,8 +1483,16 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
>    */
>   int zynqmp_pm_load_pdi(const u32 src, const u64 address)
>   {
> -	return zynqmp_pm_invoke_fn(PM_LOAD_PDI, NULL, 3, src, lower_32_bits(address),
> -				   upper_32_bits(address));
> +	u32 ret_payload[PAYLOAD_ARG_CNT];
> +	int ret;
> +
> +	ret = zynqmp_pm_invoke_fn(PM_LOAD_PDI, ret_payload, 3, src,
> +				  lower_32_bits(address),
> +				  upper_32_bits(address));
> +	if (ret_payload[0])
> +		return ret_payload[0];
Looks a little bit hacking. As the ret_payload is u32, return as int, it 
has possibility to overflow?

> +
> +	return ret;
>   }
>   EXPORT_SYMBOL_GPL(zynqmp_pm_load_pdi);
>   

Thanks,
Jie


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

* RE: [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API
  2025-01-24  6:00   ` Jie Gan
@ 2025-02-05 11:32     ` Manne, Nava kishore
  0 siblings, 0 replies; 5+ messages in thread
From: Manne, Nava kishore @ 2025-02-05 11:32 UTC (permalink / raw)
  To: Jie Gan, Simek, Michal, Jain, Ronak, gregkh, Buddhabhatti, Jay,
	praveen.teja.kundanala, Paladugu, Siva Durga Prasad,
	u.kleine-koenig, linux-arm-kernel, linux-kernel

Hi Jie,

	Thanks for providing the review comments.
Please find my response inline.

> -----Original Message-----
> From: Jie Gan <jie.gan@oss.qualcomm.com>
> Sent: Friday, January 24, 2025 11:30 AM
> To: Manne, Nava kishore <nava.kishore.manne@amd.com>; Simek, Michal
> <michal.simek@amd.com>; Jain, Ronak <ronak.jain@amd.com>;
> gregkh@linuxfoundation.org; Buddhabhatti, Jay <jay.buddhabhatti@amd.com>;
> praveen.teja.kundanala@amd.com; Paladugu, Siva Durga Prasad
> <siva.durga.prasad.paladugu@amd.com>; u.kleine-koenig@baylibre.com; linux-
> arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API
> 
> 
> 
> On 1/23/2025 6:35 PM, Nava kishore Manne wrote:
> > Update the zynqmp_pm_load_pdi() API to handle the firmware error’s
> > properly.
> >
> > Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
> > ---
> >   drivers/firmware/xilinx/zynqmp.c | 12 ++++++++++--
> >   1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/firmware/xilinx/zynqmp.c
> > b/drivers/firmware/xilinx/zynqmp.c
> > index 720fa8b5d8e9..ea04a6ac402d 100644
> > --- a/drivers/firmware/xilinx/zynqmp.c
> > +++ b/drivers/firmware/xilinx/zynqmp.c
> > @@ -1483,8 +1483,16 @@
> EXPORT_SYMBOL_GPL(zynqmp_pm_set_requirement);
> >    */
> >   int zynqmp_pm_load_pdi(const u32 src, const u64 address)
> >   {
> > -	return zynqmp_pm_invoke_fn(PM_LOAD_PDI, NULL, 3, src,
> lower_32_bits(address),
> > -				   upper_32_bits(address));
> > +	u32 ret_payload[PAYLOAD_ARG_CNT];
> > +	int ret;
> > +
> > +	ret = zynqmp_pm_invoke_fn(PM_LOAD_PDI, ret_payload, 3, src,
> > +				  lower_32_bits(address),
> > +				  upper_32_bits(address));
> > +	if (ret_payload[0])
> > +		return ret_payload[0];
> Looks a little bit hacking. As the ret_payload is u32, return as int, it has possibility to
> overflow?
> 
I agree with your concern.
I'll drop this patch and look into a proper solution to address the issue.

Regards,
Navakishore

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

end of thread, other threads:[~2025-02-05 11:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-23 10:35 [PATCH 0/2]firmware: xilinx: Updates to FPGA configuration APIs Nava kishore Manne
2025-01-23 10:35 ` [PATCH 1/2] firmware: xilinx: Update the zynqmp_pm_load_pdi() API Nava kishore Manne
2025-01-24  6:00   ` Jie Gan
2025-02-05 11:32     ` Manne, Nava kishore
2025-01-23 10:35 ` [PATCH 2/2] firmware: xilinx: Dont send linux address to get fpga config get status Nava kishore Manne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®