From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"kraxel@redhat.com" <kraxel@redhat.com>
Subject: Re: [edk2-devel] [PATCH 2/2] OvmfPkg/PlatformPei: prefer etc/e820 for memory detection
Date: Wed, 25 Aug 2021 09:24:43 +0000 [thread overview]
Message-ID: <PH0PR11MB4885417D5C6607F1E19028888CC69@PH0PR11MB4885.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210819081110.1612205-3-kraxel@redhat.com>
Hi
Would you please follow EDKII process?
1) File an EDKII Bugzilla.
2) CC all reviewers in OVMF package.
Please also describe what the reason of change, what is the benefit we can get from the change?
I just feel it is confusing. Previously, the data is consistent from CMOS. Now, we have two ways to get one data from different sources.
Please help me understand:
A) What if the data are different from different source?
B) Why we choose to trust E820 at first, the CMOS? Not verse versa.
C) If we trust E820 (in B), then why we need go back to CMOS, if LowMemorySize is 0?
Thank you
Yao Jiewen
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd
> Hoffmann
> Sent: Thursday, August 19, 2021 4:11 PM
> To: devel@edk2.groups.io
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Subject: [edk2-devel] [PATCH 2/2] OvmfPkg/PlatformPei: prefer etc/e820 for
> memory detection
>
> Prefer the e820 map provided via qemu firmware config interface
> for memory detection. Use rtc cmos only as fallback, which should
> be rarely needed these days as qemu supports etc/e820 since 2013.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> OvmfPkg/PlatformPei/MemDetect.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/OvmfPkg/PlatformPei/MemDetect.c
> b/OvmfPkg/PlatformPei/MemDetect.c
> index d7fb3e742be3..71bd28bd1d2b 100644
> --- a/OvmfPkg/PlatformPei/MemDetect.c
> +++ b/OvmfPkg/PlatformPei/MemDetect.c
> @@ -293,9 +293,16 @@ GetSystemMemorySizeBelow4gb (
> VOID
> )
> {
> + EFI_STATUS Status;
> + UINT64 LowerMemorySize;
> UINT8 Cmos0x34;
> UINT8 Cmos0x35;
>
> + Status = ScanOrAdd64BitE820Ram (FALSE, &LowerMemorySize, NULL);
> + if (Status == EFI_SUCCESS || LowerMemorySize > 0) {
> + return LowerMemorySize;
> + }
> +
> //
> // CMOS 0x34/0x35 specifies the system memory above 16 MB.
> // * CMOS(0x35) is the high byte
> @@ -722,7 +729,6 @@ QemuInitializeRam (
> // Determine total memory size available
> //
> LowerMemorySize = GetSystemMemorySizeBelow4gb ();
> - UpperMemorySize = GetSystemMemorySizeAbove4gb ();
>
> if (mBootMode == BOOT_ON_S3_RESUME) {
> //
> @@ -769,8 +775,11 @@ QemuInitializeRam (
> // memory size read from the CMOS.
> //
> Status = ScanOrAdd64BitE820Ram (TRUE, NULL, NULL);
> - if (EFI_ERROR (Status) && UpperMemorySize != 0) {
> - AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
> + if (EFI_ERROR (Status)) {
> + UpperMemorySize = GetSystemMemorySizeAbove4gb ();
> + if (UpperMemorySize != 0) {
> + AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
> + }
> }
> }
>
> --
> 2.31.1
>
>
>
>
>
next prev parent reply other threads:[~2021-08-25 9:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-19 8:11 [PATCH 0/2] OvmfPkg/PlatformPei: prefer etc/e820 for memory detection Gerd Hoffmann
2021-08-19 8:11 ` [PATCH 1/2] OvmfPkg/PlatformPei: ScanOrAdd64BitE820Ram improvements Gerd Hoffmann
2021-08-25 5:22 ` [edk2-devel] " Philippe Mathieu-Daudé
2021-08-19 8:11 ` [PATCH 2/2] OvmfPkg/PlatformPei: prefer etc/e820 for memory detection Gerd Hoffmann
2021-08-19 9:28 ` [edk2-devel] " Philippe Mathieu-Daudé
2021-08-25 9:24 ` Yao, Jiewen [this message]
2021-08-25 13:13 ` Gerd Hoffmann
2021-08-25 15:15 ` Yao, Jiewen
2021-08-26 7:12 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH0PR11MB4885417D5C6607F1E19028888CC69@PH0PR11MB4885.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox