From: "Gerd Hoffmann" <kraxel@redhat.com>
To: devel@edk2.groups.io
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Pawel Polawski <ppolawsk@redhat.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Oliver Steffen <osteffen@redhat.com>,
Ard Biesheuvel <ardb+tianocore@kernel.org>
Subject: [PATCH v2 2/4] OvmfPkg/PlatformInitLib: detect physical address space
Date: Tue, 4 Oct 2022 15:47:26 +0200 [thread overview]
Message-ID: <20221004134728.55499-3-kraxel@redhat.com> (raw)
In-Reply-To: <20221004134728.55499-1-kraxel@redhat.com>
Try detect physical address space, when successful use it.
Otherwise go continue using the current guesswork code path.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
OvmfPkg/Library/PlatformInitLib/MemDetect.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index 143a01ceb01e..16ecbfadc30c 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -761,6 +761,19 @@ PlatformAddressWidthInitialization (
FirstNonAddress = PlatformGetFirstNonAddress (PlatformInfoHob);
}
+ PlatformAddressWidthFromCpuid (PlatformInfoHob, TRUE);
+ if (PlatformInfoHob->PhysMemAddressWidth != 0) {
+ // physical address width is known
+ PlatformInfoHob->FirstNonAddress = FirstNonAddress;
+ return;
+ }
+
+ //
+ // physical address width is NOT known
+ // -> do some guess work, mostly based on installed memory
+ // -> try be conservstibe to stay below the guaranteed minimum of
+ // 36 phys bits (aka 64 GB).
+ //
PhysMemAddressWidth = (UINT8)HighBitSet64 (FirstNonAddress);
//
--
2.37.3
next prev parent reply other threads:[~2022-10-04 13:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 13:47 [PATCH v2 0/4] OvmfPkg: make better use of physical address space Gerd Hoffmann
2022-10-04 13:47 ` [PATCH v2 1/4] OvmfPkg/PlatformInitLib: qemu cpuid physbits detection Gerd Hoffmann
2022-10-04 13:47 ` Gerd Hoffmann [this message]
2023-03-16 13:58 ` [PATCH v2 2/4] OvmfPkg/PlatformInitLib: detect physical address space f.ebner
2023-03-16 14:37 ` Gerd Hoffmann
2023-03-17 11:34 ` [edk2-devel] " Fiona Ebner
2023-03-17 14:01 ` Gerd Hoffmann
2023-03-20 14:20 ` Fiona Ebner
2023-03-20 15:58 ` Gerd Hoffmann
2022-10-04 13:47 ` [PATCH v2 3/4] OvmfPkg/PlatformInitLib: dynamic mmio window size Gerd Hoffmann
2023-03-15 8:54 ` [edk2-devel] " joeyli
2023-03-15 9:28 ` Gerd Hoffmann
2023-05-16 14:00 ` Fiona Ebner
2023-05-17 5:59 ` [edk2-devel] " Gerd Hoffmann
2023-05-17 13:38 ` Fiona Ebner
2023-05-22 11:12 ` Gerd Hoffmann
2023-05-22 13:36 ` Fiona Ebner
2022-10-04 13:47 ` [PATCH v2 4/4] OvmfPkg/PciHotPlugInitDxe: reserve more mmio space Gerd Hoffmann
2022-10-04 15:57 ` Laszlo Ersek
2022-10-05 5:01 ` Gerd Hoffmann
2022-10-06 8:50 ` Laszlo Ersek
2022-10-07 21:49 ` [edk2-devel] [PATCH v2 0/4] OvmfPkg: make better use of physical address space Ard Biesheuvel
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=20221004134728.55499-3-kraxel@redhat.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