* [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
@ 2018-05-02 18:01 Roman Bacik
2018-05-03 1:34 ` Zeng, Star
0 siblings, 1 reply; 5+ messages in thread
From: Roman Bacik @ 2018-05-02 18:01 UTC (permalink / raw)
To: edk2-devel; +Cc: Ruiyu Ni, Vladimir Olovyannikov
When BottomUp search is used the MaxAddress is incorrectly chosen to
be the BaseAddress instead of the EndAddress.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index e17e98230b79..9eeb2bd74599 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -1170,8 +1170,8 @@ CoreAllocateSpace (
//
// Compute the maximum address to use in the search algorithm
//
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
- GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
+ if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
+ GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
MaxAddress = *BaseAddress;
} else {
MaxAddress = Entry->EndAddress;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
2018-05-02 18:01 [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd Roman Bacik
@ 2018-05-03 1:34 ` Zeng, Star
2018-05-03 14:46 ` Roman Bacik
2018-05-03 16:11 ` Roman Bacik
0 siblings, 2 replies; 5+ messages in thread
From: Zeng, Star @ 2018-05-03 1:34 UTC (permalink / raw)
To: Roman Bacik, edk2-devel@lists.01.org
Cc: Ni, Ruiyu, Vladimir Olovyannikov, Zeng, Star
The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress comes from input BaseAddress parameter.
The original code logic is correct according to PI spec.
PI Spec:
If GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp, then the GCD
memory space map is searched from the lowest address up to BaseAddress looking for
unallocated memory ranges of Length bytes beginning on a boundary specified by Alignment
that matches GcdMemoryType.
If GcdAllocateType is EfiGcdAllocateMaxAddressSearchTopDown, then the GCD
memory space map is searched from BaseAddress down to the lowest address looking for
unallocated memory ranges of Length bytes beginning on a boundary specified by Alignment
that matches GcdMemoryType.
Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Roman Bacik
Sent: Thursday, May 3, 2018 2:01 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
When BottomUp search is used the MaxAddress is incorrectly chosen to
be the BaseAddress instead of the EndAddress.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index e17e98230b79..9eeb2bd74599 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -1170,8 +1170,8 @@ CoreAllocateSpace (
//
// Compute the maximum address to use in the search algorithm
//
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
- GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
+ if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
+ GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
MaxAddress = *BaseAddress;
} else {
MaxAddress = Entry->EndAddress;
--
1.9.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
2018-05-03 1:34 ` Zeng, Star
@ 2018-05-03 14:46 ` Roman Bacik
2018-05-03 16:11 ` Roman Bacik
1 sibling, 0 replies; 5+ messages in thread
From: Roman Bacik @ 2018-05-03 14:46 UTC (permalink / raw)
To: Zeng, Star, edk2-devel; +Cc: Ni, Ruiyu, Vladimir Olovyannikov
Hi Star,
Thank you very much for your reply. Since the BaseAddress is the lowest
address in our case we thought this is a bug and the bottom up search
starts at BaseAddress and ends at BaseAddress+length-1. What would be the
best way to do a search starting from the BaseAddress as the lowest? Do we
need to add another search type?
Thanks,
Roman
-----Original Message-----
From: Zeng, Star [mailto:star.zeng@intel.com]
Sent: Wednesday, May 2, 2018 6:35 PM
To: Roman Bacik; edk2-devel@lists.01.org
Cc: Ni, Ruiyu; Vladimir Olovyannikov; Zeng, Star
Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress comes
from input BaseAddress parameter.
The original code logic is correct according to PI spec.
PI Spec:
If GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp, then the GCD
memory space map is searched from the lowest address up to BaseAddress
looking for unallocated memory ranges of Length bytes beginning on a
boundary specified by Alignment that matches GcdMemoryType.
If GcdAllocateType is EfiGcdAllocateMaxAddressSearchTopDown, then the GCD
memory space map is searched from BaseAddress down to the lowest address
looking for unallocated memory ranges of Length bytes beginning on a
boundary specified by Alignment that matches GcdMemoryType.
Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
Roman Bacik
Sent: Thursday, May 3, 2018 2:01 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Vladimir Olovyannikov
<vladimir.olovyannikov@broadcom.com>
Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
When BottomUp search is used the MaxAddress is incorrectly chosen to be
the BaseAddress instead of the EndAddress.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
---
MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index e17e98230b79..9eeb2bd74599 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -1170,8 +1170,8 @@ CoreAllocateSpace ( // // Compute the maximum
address to use in the search algorithm //
- if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
- GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
+ if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
+ GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
MaxAddress = *BaseAddress;
} else {
MaxAddress = Entry->EndAddress;
--
1.9.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
2018-05-03 1:34 ` Zeng, Star
2018-05-03 14:46 ` Roman Bacik
@ 2018-05-03 16:11 ` Roman Bacik
2018-05-04 2:14 ` Zeng, Star
1 sibling, 1 reply; 5+ messages in thread
From: Roman Bacik @ 2018-05-03 16:11 UTC (permalink / raw)
To: Zeng, Star, edk2-devel; +Cc: Ni, Ruiyu, Vladimir Olovyannikov
Hi Star,
It turns out we can use EfiGcdAllocateAnySearchBottomUp instead of
EfiGcdAllocateMaxAddressSearchBottomUp after few changes to our code.
Thank you very much for clarification of our misunderstanding. We withdraw
the patch and will close the associated bug ticket.
Thanks,
Roman
> -----Original Message-----
> From: Roman Bacik [mailto:roman.bacik@broadcom.com]
> Sent: Thursday, May 3, 2018 7:47 AM
> To: 'Zeng, Star'; 'edk2-devel@lists.01.org'
> Cc: 'Ni, Ruiyu'; Vladimir Olovyannikov
> Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
>
> Hi Star,
>
> Thank you very much for your reply. Since the BaseAddress is the lowest
> address in our case we thought this is a bug and the bottom up search
starts
> at BaseAddress and ends at BaseAddress+length-1. What would be the best
> way to do a search starting from the BaseAddress as the lowest? Do we
need
> to add another search type?
> Thanks,
>
> Roman
>
> -----Original Message-----
> From: Zeng, Star [mailto:star.zeng@intel.com]
> Sent: Wednesday, May 2, 2018 6:35 PM
> To: Roman Bacik; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu; Vladimir Olovyannikov; Zeng, Star
> Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
>
> The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress
> comes from input BaseAddress parameter.
>
> The original code logic is correct according to PI spec.
>
> PI Spec:
> If GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp, then the
> GCD memory space map is searched from the lowest address up to
> BaseAddress looking for unallocated memory ranges of Length bytes
> beginning on a boundary specified by Alignment that matches
> GcdMemoryType.
> If GcdAllocateType is EfiGcdAllocateMaxAddressSearchTopDown, then the
> GCD memory space map is searched from BaseAddress down to the lowest
> address looking for unallocated memory ranges of Length bytes beginning
on
> a boundary specified by Alignment that matches GcdMemoryType.
>
>
> Thanks,
> Star
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Roman Bacik
> Sent: Thursday, May 3, 2018 2:01 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>
> Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
>
> When BottomUp search is used the MaxAddress is incorrectly chosen to be
> the BaseAddress instead of the EndAddress.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
> ---
> MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index
> e17e98230b79..9eeb2bd74599 100644
> --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> @@ -1170,8 +1170,8 @@ CoreAllocateSpace ( // // Compute the maximum
> address to use in the search algorithm //
> - if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
> - GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
> + if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
> + GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
> MaxAddress = *BaseAddress;
> } else {
> MaxAddress = Entry->EndAddress;
> --
> 1.9.1
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
2018-05-03 16:11 ` Roman Bacik
@ 2018-05-04 2:14 ` Zeng, Star
0 siblings, 0 replies; 5+ messages in thread
From: Zeng, Star @ 2018-05-04 2:14 UTC (permalink / raw)
To: Roman Bacik, edk2-devel@lists.01.org
Cc: Ni, Ruiyu, Vladimir Olovyannikov, Zeng, Star
Glad to know you found the way. :)
Thanks,
Star
-----Original Message-----
From: Roman Bacik [mailto:roman.bacik@broadcom.com]
Sent: Friday, May 4, 2018 12:12 AM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
Hi Star,
It turns out we can use EfiGcdAllocateAnySearchBottomUp instead of EfiGcdAllocateMaxAddressSearchBottomUp after few changes to our code.
Thank you very much for clarification of our misunderstanding. We withdraw the patch and will close the associated bug ticket.
Thanks,
Roman
> -----Original Message-----
> From: Roman Bacik [mailto:roman.bacik@broadcom.com]
> Sent: Thursday, May 3, 2018 7:47 AM
> To: 'Zeng, Star'; 'edk2-devel@lists.01.org'
> Cc: 'Ni, Ruiyu'; Vladimir Olovyannikov
> Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in
> Gcd
>
> Hi Star,
>
> Thank you very much for your reply. Since the BaseAddress is the
> lowest address in our case we thought this is a bug and the bottom up
> search
starts
> at BaseAddress and ends at BaseAddress+length-1. What would be the
> best way to do a search starting from the BaseAddress as the lowest?
> Do we
need
> to add another search type?
> Thanks,
>
> Roman
>
> -----Original Message-----
> From: Zeng, Star [mailto:star.zeng@intel.com]
> Sent: Wednesday, May 2, 2018 6:35 PM
> To: Roman Bacik; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu; Vladimir Olovyannikov; Zeng, Star
> Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in
> Gcd
>
> The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress
> comes from input BaseAddress parameter.
>
> The original code logic is correct according to PI spec.
>
> PI Spec:
> If GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp, then the
> GCD memory space map is searched from the lowest address up to
> BaseAddress looking for unallocated memory ranges of Length bytes
> beginning on a boundary specified by Alignment that matches
> GcdMemoryType.
> If GcdAllocateType is EfiGcdAllocateMaxAddressSearchTopDown, then the
> GCD memory space map is searched from BaseAddress down to the lowest
> address looking for unallocated memory ranges of Length bytes
> beginning
on
> a boundary specified by Alignment that matches GcdMemoryType.
>
>
> Thanks,
> Star
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Roman Bacik
> Sent: Thursday, May 3, 2018 2:01 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>
> Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
>
> When BottomUp search is used the MaxAddress is incorrectly chosen to
> be the BaseAddress instead of the EndAddress.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
> ---
> MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index
> e17e98230b79..9eeb2bd74599 100644
> --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
> @@ -1170,8 +1170,8 @@ CoreAllocateSpace ( // // Compute the maximum
> address to use in the search algorithm //
> - if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchBottomUp ||
> - GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
> + if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
> + GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
> MaxAddress = *BaseAddress;
> } else {
> MaxAddress = Entry->EndAddress;
> --
> 1.9.1
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-05-04 2:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-02 18:01 [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd Roman Bacik
2018-05-03 1:34 ` Zeng, Star
2018-05-03 14:46 ` Roman Bacik
2018-05-03 16:11 ` Roman Bacik
2018-05-04 2:14 ` Zeng, Star
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox