public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH V1 1/1] Platform/ARM/N1Sdp: Fix RemoteDdrSize cast
@ 2023-01-06  6:07 sahil
  2023-01-25 19:18 ` [edk2-devel] " Thomas Abraham
  0 siblings, 1 reply; 3+ messages in thread
From: sahil @ 2023-01-06  6:07 UTC (permalink / raw)
  To: devel; +Cc: Ard Biesheuvel, Leif Lindholm, Sami Mujawar, Sahil

RemoteDdrSize calculation wraps around when booting N1Sdp in
multichip mode. Casting it to UINT64 to fix the issue.

Signed-off-by: sahil <sahil@arm.com>
---
 Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 2 +-
 Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c                         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index c15020f595c3..b11c0425fe25 100644
--- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1254,7 +1254,7 @@ InitializePlatformRepository (
   PlatRepoInfo->MemAffInfo[LOCAL_DDR_REGION2].Length = Dram2Size;
 
   if (PlatInfo->MultichipMode == 1) {
-    RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
+    RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
 
     // Update Remote DDR Region1
     PlatRepoInfo->MemAffInfo[REMOTE_DDR_REGION1].ProximityDomain = 1;
diff --git a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
index 1d53ec75aa49..5cacd437474b 100644
--- a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
+++ b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
@@ -157,7 +157,7 @@ ArmPlatformGetVirtualMemoryMap (
     DramBlock2Size);
 
   if (PlatInfo->MultichipMode == 1) {
-    RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
+    RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
 
     BuildResourceDescriptorHob (
       EFI_RESOURCE_SYSTEM_MEMORY,
-- 
2.25.1


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

* Re: [edk2-devel] [edk2-platforms][PATCH V1 1/1] Platform/ARM/N1Sdp: Fix RemoteDdrSize cast
  2023-01-06  6:07 [edk2-platforms][PATCH V1 1/1] Platform/ARM/N1Sdp: Fix RemoteDdrSize cast sahil
@ 2023-01-25 19:18 ` Thomas Abraham
  2023-02-08  5:34   ` sahil
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Abraham @ 2023-01-25 19:18 UTC (permalink / raw)
  To: devel, sahil; +Cc: Ard Biesheuvel, Leif Lindholm, Sami Mujawar


Hi Sahil,

On 06/01/2023 06:07, sahil via groups.io wrote:
> RemoteDdrSize calculation wraps around when booting N1Sdp in
> multichip mode. Casting it to UINT64 to fix the issue.

The change looks okay but can the commit message be expanded to explain 
how this issue surfaced. RemoteDdrSize was probably added to support 
multi-chip. So what changed since then for this issue to show up?

Thanks,
Thomas.

> 
> Signed-off-by: sahil <sahil@arm.com>
> ---
>   Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 2 +-
>   Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c                         | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> index c15020f595c3..b11c0425fe25 100644
> --- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> +++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> @@ -1254,7 +1254,7 @@ InitializePlatformRepository (
>     PlatRepoInfo->MemAffInfo[LOCAL_DDR_REGION2].Length = Dram2Size;
> 
>   
> 
>     if (PlatInfo->MultichipMode == 1) {
> 
> -    RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> 
> +    RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> 
>   
> 
>       // Update Remote DDR Region1
> 
>       PlatRepoInfo->MemAffInfo[REMOTE_DDR_REGION1].ProximityDomain = 1;
> 
> diff --git a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
> index 1d53ec75aa49..5cacd437474b 100644
> --- a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
> +++ b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
> @@ -157,7 +157,7 @@ ArmPlatformGetVirtualMemoryMap (
>       DramBlock2Size);
> 
>   
> 
>     if (PlatInfo->MultichipMode == 1) {
> 
> -    RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> 
> +    RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> 
>   
> 
>       BuildResourceDescriptorHob (
> 
>         EFI_RESOURCE_SYSTEM_MEMORY,
> 

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

* Re: [edk2-devel] [edk2-platforms][PATCH V1 1/1] Platform/ARM/N1Sdp: Fix RemoteDdrSize cast
  2023-01-25 19:18 ` [edk2-devel] " Thomas Abraham
@ 2023-02-08  5:34   ` sahil
  0 siblings, 0 replies; 3+ messages in thread
From: sahil @ 2023-02-08  5:34 UTC (permalink / raw)
  To: devel, thomas.abraham, sami.mujawar; +Cc: Ard Biesheuvel, Leif Lindholm

Hi Thomas/Sami,

This issue arose while fixing comments during upstreaming the
following patch - https://edk2.groups.io/g/devel/topic/83261392#76845
and was observed while we were testing the platform with upstream code.

Thanks,
Sahil

On Thu, 26 Jan 2023 at 00:48, Thomas Abraham <thomas.abraham@arm.com> wrote:
>
>
> Hi Sahil,
>
> On 06/01/2023 06:07, sahil via groups.io wrote:
> > RemoteDdrSize calculation wraps around when booting N1Sdp in
> > multichip mode. Casting it to UINT64 to fix the issue.
>
> The change looks okay but can the commit message be expanded to explain
> how this issue surfaced. RemoteDdrSize was probably added to support
> multi-chip. So what changed since then for this issue to show up?
>
> Thanks,
> Thomas.
>
> >
> > Signed-off-by: sahil <sahil@arm.com>
> > ---
> >   Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 2 +-
> >   Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c                         | 2 +-
> >   2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > index c15020f595c3..b11c0425fe25 100644
> > --- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > +++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
> > @@ -1254,7 +1254,7 @@ InitializePlatformRepository (
> >     PlatRepoInfo->MemAffInfo[LOCAL_DDR_REGION2].Length = Dram2Size;
> >
> >
> >
> >     if (PlatInfo->MultichipMode == 1) {
> >
> > -    RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> >
> > +    RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> >
> >
> >
> >       // Update Remote DDR Region1
> >
> >       PlatRepoInfo->MemAffInfo[REMOTE_DDR_REGION1].ProximityDomain = 1;
> >
> > diff --git a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
> > index 1d53ec75aa49..5cacd437474b 100644
> > --- a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
> > +++ b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c
> > @@ -157,7 +157,7 @@ ArmPlatformGetVirtualMemoryMap (
> >       DramBlock2Size);
> >
> >
> >
> >     if (PlatInfo->MultichipMode == 1) {
> >
> > -    RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> >
> > +    RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);
> >
> >
> >
> >       BuildResourceDescriptorHob (
> >
> >         EFI_RESOURCE_SYSTEM_MEMORY,
> >
>
>
> 
>
>

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

end of thread, other threads:[~2023-02-08  5:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06  6:07 [edk2-platforms][PATCH V1 1/1] Platform/ARM/N1Sdp: Fix RemoteDdrSize cast sahil
2023-01-25 19:18 ` [edk2-devel] " Thomas Abraham
2023-02-08  5:34   ` sahil

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