From: Jordan Justen <jordan.l.justen@intel.com>
To: edk2-devel@lists.01.org
Cc: Jordan Justen <jordan.l.justen@intel.com>,
Peter Fang <peter.fang@intel.com>,
Maurice Ma <maurice.ma@intel.com>,
Laszlo Ersek <lersek@redhat.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Anthony Perard <anthony.perard@citrix.com>,
Julien Grall <julien.grall@linaro.org>
Subject: [PATCH] OvmfPkg/Sec: Clear the Cache Disable flag in the CR0 register
Date: Mon, 18 Feb 2019 02:10:15 -0800 [thread overview]
Message-ID: <20190218101015.23399-1-jordan.l.justen@intel.com> (raw)
Clear the CD (Cache Disable) flag in the CR0 register. When the VM
implements the CD flag, this can substantially decrease the time it
takes to decompress the firmware volumes.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Peter Fang <peter.fang@intel.com>
Cc: Peter Fang <peter.fang@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien.grall@linaro.org>
---
OvmfPkg/Sec/Ia32/SecEntry.nasm | 8 +++++++-
OvmfPkg/Sec/X64/SecEntry.nasm | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/OvmfPkg/Sec/Ia32/SecEntry.nasm b/OvmfPkg/Sec/Ia32/SecEntry.nasm
index 03501969eb..fc7f47385a 100644
--- a/OvmfPkg/Sec/Ia32/SecEntry.nasm
+++ b/OvmfPkg/Sec/Ia32/SecEntry.nasm
@@ -40,6 +40,13 @@ extern ASM_PFX(SecCoreStartupWithStack)
global ASM_PFX(_ModuleEntryPoint)
ASM_PFX(_ModuleEntryPoint):
+ ;
+ ; Clear the CD (Cache Disable) flag in the CR0 register.
+ ;
+ mov eax, cr0
+ and eax, ~(1 << 30)
+ mov cr0, eax
+
;
; Fill the temporary RAM with the initial stack value.
; The loop below will seed the heap as well, but that's harmless.
@@ -71,4 +78,3 @@ ASM_PFX(_ModuleEntryPoint):
push eax
push ebp
call ASM_PFX(SecCoreStartupWithStack)
-
diff --git a/OvmfPkg/Sec/X64/SecEntry.nasm b/OvmfPkg/Sec/X64/SecEntry.nasm
index d76adcffd8..7471b3a3e3 100644
--- a/OvmfPkg/Sec/X64/SecEntry.nasm
+++ b/OvmfPkg/Sec/X64/SecEntry.nasm
@@ -41,6 +41,13 @@ extern ASM_PFX(SecCoreStartupWithStack)
global ASM_PFX(_ModuleEntryPoint)
ASM_PFX(_ModuleEntryPoint):
+ ;
+ ; Clear the CD (Cache Disable) flag in the CR0 register.
+ ;
+ mov rax, cr0
+ and eax, ~(1 << 30)
+ mov cr0, rax
+
;
; Fill the temporary RAM with the initial stack value.
; The loop below will seed the heap as well, but that's harmless.
@@ -72,4 +79,3 @@ ASM_PFX(_ModuleEntryPoint):
mov rdx, rsp
sub rsp, 0x20
call ASM_PFX(SecCoreStartupWithStack)
-
--
2.20.1
next reply other threads:[~2019-02-18 10:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 10:10 Jordan Justen [this message]
2019-02-18 12:17 ` [PATCH] OvmfPkg/Sec: Clear the Cache Disable flag in the CR0 register Laszlo Ersek
2019-02-19 19:45 ` Jordan Justen
[not found] ` <A8BCA9AAD7459841B9233774078C8C06020CEBFF@ORSMSX112.amr.corp.intel.com>
2019-02-20 9:37 ` Laszlo Ersek
2019-02-18 13:23 ` Laszlo Ersek
2019-02-19 19:51 ` Andrew Fish
2019-02-20 9:46 ` Laszlo Ersek
2019-02-19 19:59 ` Jordan Justen
2019-02-20 9:44 ` Laszlo Ersek
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=20190218101015.23399-1-jordan.l.justen@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