From: "Zeng, Star" <star.zeng@intel.com>
To: "Wang, Jian J" <jian.j.wang@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH] UefiCpuPkg/CpuDxe: Fix assert issue on IA32 platform
Date: Fri, 29 Sep 2017 06:04:44 +0000 [thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103B97CD2D@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20170929054014.6136-1-jian.j.wang@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J Wang
Sent: Friday, September 29, 2017 1:40 PM
To: edk2-devel@lists.01.org
Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
Subject: [edk2] [PATCH] UefiCpuPkg/CpuDxe: Fix assert issue on IA32 platform
This patch is to fix an assert issue during booting IA32 platforms such as OvmfIa32 or Quark. This issue is caused by trying to access page table on a platform without page table. A check is added to avoid the assert.
Bug tracker: https://bugzilla.tianocore.org/show_bug.cgi?id=724
c: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
UefiCpuPkg/CpuDxe/CpuDxe.c | 48 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 38 insertions(+), 10 deletions(-)
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c index 4e8fa100e0..85a520079f 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -683,7 +683,7 @@ SetGcdMemorySpaceAttributes (
**/
VOID
-RefreshGcdMemoryAttributes (
+RefreshMemoryAttributesFromMtrr (
VOID
)
{
@@ -704,14 +704,9 @@ RefreshGcdMemoryAttributes (
UINT32 FirmwareVariableMtrrCount;
UINT8 DefaultMemoryType;
- if (!IsMtrrSupported ()) {
- return;
- }
-
FirmwareVariableMtrrCount = GetFirmwareVariableMtrrCount ();
ASSERT (FirmwareVariableMtrrCount <= MTRR_NUMBER_OF_VARIABLE_MTRR);
- mIsFlushingGCD = TRUE;
MemorySpaceMap = NULL;
//
@@ -862,11 +857,44 @@ RefreshGcdMemoryAttributes (
if (MemorySpaceMap != NULL) {
FreePool (MemorySpaceMap);
}
+}
- //
- // Update page attributes
- //
- RefreshGcdMemoryAttributesFromPaging();
+/**
+ Check if paging is enabled or not.
+**/
+BOOLEAN
+IsPagingSupported (
+ VOID
+ )
+{
+ return (
+ (AsmReadCr0 () & BIT31) != 0
+ &&
+ (AsmReadCr4 () & BIT5) != 0
+ );
+}
+
+/**
+ Refreshes the GCD Memory Space attributes according to MTRRs and Paging.
+
+ This function refreshes the GCD Memory Space attributes according to
+ MTRRs and page tables.
+
+**/
+VOID
+RefreshGcdMemoryAttributes (
+ VOID
+ )
+{
+ mIsFlushingGCD = TRUE;
+
+ if (IsMtrrSupported ()) {
+ RefreshMemoryAttributesFromMtrr (); }
+
+ if (IsPagingSupported ()) {
+ RefreshGcdMemoryAttributesFromPaging (); }
mIsFlushingGCD = FALSE;
}
--
2.14.1.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
next prev parent reply other threads:[~2017-09-29 6:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 5:40 [PATCH] UefiCpuPkg/CpuDxe: Fix assert issue on IA32 platform Jian J Wang
2017-09-29 6:04 ` Zeng, Star [this message]
2017-09-29 16:27 ` Kinney, Michael D
2017-09-30 0:09 ` Wang, Jian J
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=0C09AFA07DD0434D9E2A0C6AEB0483103B97CD2D@shsmsx102.ccr.corp.intel.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