Re: [U-Boot] [PATCH 3/3] fpga: zynqmp: Fix the nonsecure bitstream loading issue

2018-05-13 Thread Marek Vasut
On 03/28/2018 04:30 PM, Michal Simek wrote:
> From: Siva Durga Prasad Paladugu 
> 
> Xilfpga library expects the size of bitstream in a pointer
> but currenly we are passing the size as a value. This patch
> fixes this issue.

This breaks fpga loadb on zynqmp with FSBL 0.3 for me, so please revert.
The commit message is not clear on what the "issue" is or whether the
FSBL version has any relevance or whether the ABI changed somewhere in
the xilinx blobs, but it is clear reverting this patch fixes an issue
for me.

> Signed-off-by: Siva Durga Prasad Paladugu 
> Signed-off-by: Nava kishore Manne 
> Signed-off-by: Michal Simek 
> ---
> 
>  drivers/fpga/zynqmppl.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
> index aae0efc7348e..43e8b2520e35 100644
> --- a/drivers/fpga/zynqmppl.c
> +++ b/drivers/fpga/zynqmppl.c
> @@ -11,6 +11,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #define DUMMY_WORD   0x
>  
> @@ -195,6 +196,7 @@ static int zynqmp_validate_bitstream(xilinx_desc *desc, 
> const void *buf,
>  static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
>bitstream_type bstype)
>  {
> + ALLOC_CACHE_ALIGN_BUFFER(u32, bsizeptr, 1);
>   u32 swap;
>   ulong bin_buf;
>   int ret;
> @@ -205,15 +207,17 @@ static int zynqmp_load(xilinx_desc *desc, const void 
> *buf, size_t bsize,
>   return FPGA_FAIL;
>  
>   bin_buf = zynqmp_align_dma_buffer((u32 *)buf, bsize, swap);
> + bsizeptr = (u32 *)
>  
>   debug("%s called!\n", __func__);
>   flush_dcache_range(bin_buf, bin_buf + bsize);
> + flush_dcache_range((ulong)bsizeptr, (ulong)bsizeptr + sizeof(size_t));

This will trigger unaligned cache flush warning, FYI. And the buffer is
u32, while here you use size_t.

>   buf_lo = (u32)bin_buf;
>   buf_hi = upper_32_bits(bin_buf);
>   bstype |= BIT(ZYNQMP_FPGA_BIT_NS);
> - ret = invoke_smc(ZYNQMP_SIP_SVC_PM_FPGA_LOAD, buf_lo, buf_hi, bsize,
> -  bstype, ret_payload);
> + ret = invoke_smc(ZYNQMP_SIP_SVC_PM_FPGA_LOAD, buf_lo, buf_hi,
> +  (u32)(uintptr_t)bsizeptr, bstype, ret_payload);
>   if (ret)
>   debug("PL FPGA LOAD fail\n");
>  
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/3] fpga: zynqmp: Fix the nonsecure bitstream loading issue

2018-03-28 Thread Michal Simek
From: Siva Durga Prasad Paladugu 

Xilfpga library expects the size of bitstream in a pointer
but currenly we are passing the size as a value. This patch
fixes this issue.

Signed-off-by: Siva Durga Prasad Paladugu 
Signed-off-by: Nava kishore Manne 
Signed-off-by: Michal Simek 
---

 drivers/fpga/zynqmppl.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
index aae0efc7348e..43e8b2520e35 100644
--- a/drivers/fpga/zynqmppl.c
+++ b/drivers/fpga/zynqmppl.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define DUMMY_WORD 0x
 
@@ -195,6 +196,7 @@ static int zynqmp_validate_bitstream(xilinx_desc *desc, 
const void *buf,
 static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
 bitstream_type bstype)
 {
+   ALLOC_CACHE_ALIGN_BUFFER(u32, bsizeptr, 1);
u32 swap;
ulong bin_buf;
int ret;
@@ -205,15 +207,17 @@ static int zynqmp_load(xilinx_desc *desc, const void 
*buf, size_t bsize,
return FPGA_FAIL;
 
bin_buf = zynqmp_align_dma_buffer((u32 *)buf, bsize, swap);
+   bsizeptr = (u32 *)
 
debug("%s called!\n", __func__);
flush_dcache_range(bin_buf, bin_buf + bsize);
+   flush_dcache_range((ulong)bsizeptr, (ulong)bsizeptr + sizeof(size_t));
 
buf_lo = (u32)bin_buf;
buf_hi = upper_32_bits(bin_buf);
bstype |= BIT(ZYNQMP_FPGA_BIT_NS);
-   ret = invoke_smc(ZYNQMP_SIP_SVC_PM_FPGA_LOAD, buf_lo, buf_hi, bsize,
-bstype, ret_payload);
+   ret = invoke_smc(ZYNQMP_SIP_SVC_PM_FPGA_LOAD, buf_lo, buf_hi,
+(u32)(uintptr_t)bsizeptr, bstype, ret_payload);
if (ret)
debug("PL FPGA LOAD fail\n");
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot