diff mbox series

[U-Boot] driver: net: fsl-mc: Memset MC reserve red memory before usage

Message ID 20180816064830.6277-1-prabhakar.kushwaha@nxp.com
State Superseded
Delegated to: York Sun
Headers show
Series [U-Boot] driver: net: fsl-mc: Memset MC reserve red memory before usage | expand

Commit Message

Prabhakar Kushwaha Aug. 16, 2018, 6:48 a.m. UTC
It is not necessary for MC memory to be always clean. It may have
garbage
value causing indeterministic behavior during MC initialization and run.

So memset memory reserved for MC before any usage.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
---
 drivers/net/fsl-mc/mc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

York Sun Aug. 23, 2018, 3:11 p.m. UTC | #1
On 08/15/2018 11:49 PM, Prabhakar Kushwaha wrote:
> It is not necessary for MC memory to be always clean. It may have
> garbage
> value causing indeterministic behavior during MC initialization and run.
> 
> So memset memory reserved for MC before any usage.

Your commit message seems wrong. If it is not necessary to be clean, why
it causes problems? I guess you mean the memory needs to be clean.

York
Prabhakar Kushwaha Aug. 24, 2018, 3:13 a.m. UTC | #2
Hi York

> -----Original Message-----
> From: York Sun
> Sent: Thursday, August 23, 2018 8:41 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; u-
> boot@lists.denx.de
> Cc: joe.hershberger@ni.com; Ashish Kumar <ashish.kumar@nxp.com>;
> cristian.sovaiala@nxp.co
> Subject: Re: [PATCH] driver: net: fsl-mc: Memset MC reserve red memory
> before usage
> 
> On 08/15/2018 11:49 PM, Prabhakar Kushwaha wrote:
> > It is not necessary for MC memory to be always clean. It may have
> > garbage value causing indeterministic behavior during MC
> > initialization and run.
> >
> > So memset memory reserved for MC before any usage.
> 
> Your commit message seems wrong. If it is not necessary to be clean, why it
> causes problems? I guess you mean the memory needs to be clean.
> 

Yes. You are right. 
Commit message should be memory needs to be clean before passing to management complex.

May I send v2 version for the same.

--pk
York Sun Aug. 24, 2018, 2:53 p.m. UTC | #3
On 08/23/2018 08:13 PM, Prabhakar Kushwaha wrote:
> Hi York
> 
>> -----Original Message-----
>> From: York Sun
>> Sent: Thursday, August 23, 2018 8:41 PM
>> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; u-
>> boot@lists.denx.de
>> Cc: joe.hershberger@ni.com; Ashish Kumar <ashish.kumar@nxp.com>;
>> cristian.sovaiala@nxp.co
>> Subject: Re: [PATCH] driver: net: fsl-mc: Memset MC reserve red memory
>> before usage
>>
>> On 08/15/2018 11:49 PM, Prabhakar Kushwaha wrote:
>>> It is not necessary for MC memory to be always clean. It may have
>>> garbage value causing indeterministic behavior during MC
>>> initialization and run.
>>>
>>> So memset memory reserved for MC before any usage.
>>
>> Your commit message seems wrong. If it is not necessary to be clean, why it
>> causes problems? I guess you mean the memory needs to be clean.
>>
> 
> Yes. You are right. 
> Commit message should be memory needs to be clean before passing to management complex.
> 
> May I send v2 version for the same.
> 

You can either send v2 patch. Or if you don't have other update, I can
fix the commit message when merging.

York
Prabhakar Kushwaha Aug. 25, 2018, 12:53 a.m. UTC | #4
Thanks York,

> -----Original Message-----
> From: York Sun
> Sent: Friday, August 24, 2018 8:24 PM
> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; u-
> boot@lists.denx.de
> Cc: joe.hershberger@ni.com; Ashish Kumar <ashish.kumar@nxp.com>;
> cristian.sovaiala@nxp.co
> Subject: Re: [PATCH] driver: net: fsl-mc: Memset MC reserve red memory before
> usage
> 
> On 08/23/2018 08:13 PM, Prabhakar Kushwaha wrote:
> > Hi York
> >
> >> -----Original Message-----
> >> From: York Sun
> >> Sent: Thursday, August 23, 2018 8:41 PM
> >> To: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; u-
> >> boot@lists.denx.de
> >> Cc: joe.hershberger@ni.com; Ashish Kumar <ashish.kumar@nxp.com>;
> >> cristian.sovaiala@nxp.co
> >> Subject: Re: [PATCH] driver: net: fsl-mc: Memset MC reserve red
> >> memory before usage
> >>
> >> On 08/15/2018 11:49 PM, Prabhakar Kushwaha wrote:
> >>> It is not necessary for MC memory to be always clean. It may have
> >>> garbage value causing indeterministic behavior during MC
> >>> initialization and run.
> >>>
> >>> So memset memory reserved for MC before any usage.
> >>
> >> Your commit message seems wrong. If it is not necessary to be clean,
> >> why it causes problems? I guess you mean the memory needs to be clean.
> >>
> >
> > Yes. You are right.
> > Commit message should be memory needs to be clean before passing to
> management complex.
> >
> > May I send v2 version for the same.
> >
> 
> You can either send v2 patch. Or if you don't have other update, I can fix the
> commit message when merging.
> 

I will send v2 of this patch as I recently found one issue after applying this patch.

--pk
diff mbox series

Patch

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 940025a467..38afcf9222 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -1,7 +1,7 @@ 
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2014 Freescale Semiconductor, Inc.
- * Copyright 2017 NXP
+ * Copyright 2017-2018 NXP
  */
 #include <common.h>
 #include <errno.h>
@@ -810,6 +810,8 @@  u64 mc_get_dram_addr(void)
 {
 	size_t mc_ram_size = mc_get_dram_block_size();
 
+	memset((void *)gd->arch.resv_ram, 0, mc_ram_size);
+
 	return (gd->arch.resv_ram + mc_ram_size - 1) &
 		MC_RAM_BASE_ADDR_ALIGNMENT_MASK;
 }