Commit Graph

15 Commits

Author SHA1 Message Date
Brijesh Singh e60af8a1eb OvmfPkg/ResetVector: Set C-bit when building initial page table
SEV guest VMs have the concept of private and shared memory. Private
memory is encrypted with the guest-specific key, while shared memory
may be encrypted with hypervisor key. Certain types of memory (namely
instruction pages and guest page tables) are always treated as private
memory by the hardware. The C-bit in PTE indicate whether the page is
private or shared. The C-bit position for the PTE can be obtained from
CPUID Fn8000_001F[EBX].

When SEV is active, the BIOS is encrypted by the Qemu launch sequence,
we must set the C-bit when building the page table.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2017-07-10 21:17:27 -07:00
Marvin Häuser 73d66c5871 OvmfPkg/ResetVector: Depend on PCD values of the page tables.
Currently, the value of the page tables' address is hard-coded in the
ResetVector. This patch replaces these values with a PCD dependency.

A check for the size has been added to alert the developer to rewrite
the ASM according to the new size, if it has been changed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2016-11-04 23:47:07 +01:00
Marvin Häuser 5f609eb837 OvmfPkg/ResetVector: Remove the unused ASM ResetVector.
Remove the ResetVector.asm file as it is no longer referenced since
the switch to ResetVector.nasmb.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2016-11-03 18:06:36 -07:00
Jordan Justen 70e46f44cd OvmfPkg/ResetVector: Remove pre-built binaries
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15825 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-18 23:04:12 +00:00
Jordan Justen 9b9fdbfa70 OvmfPkg: Support building OVMF's ResetVector during the EDK II build
Using NASM we build OVMF's ResetVector as part of the EDK II build
process.

v2:
 * Use EDK II extension of .nasmb rather than .nasmbin

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15823 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-18 23:03:53 +00:00
Jordan Justen b382ede386 OvmfPkg X64 ResetVector: Move page tables from 512KB to 8MB
To help consolidate OVMF fixed memory uses, we declare this
range in MEMFD and thereby move it to 8MB.

We also now declare the table range in the FDF to set
PCDs. This allows us to ASSERT that CR3 is set as expected
in OVMF SEC.

OvmfPkgIa32.fdf and OvmfPkgIa32X64.fdf are updated simply
for consistency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15146 6f19259b-4bc3-4df7-8a09-765794883524
2014-01-21 19:38:34 +00:00
Laszlo Ersek 98f378a7be OvmfPkg/ResetVector: enable caching in initial page tables
In UEFI X64 we use other mechanisms to disable caching.
(CD/NW in CR0 and MTRRs.)

This fixes a slow boot issue with SVM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14716 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-24 18:23:26 +00:00
Jordan Justen c90e37b503 OvmfPkg: Add platform specific reset vector code for X64
KVM has a bug that prevents using page tables in the ROM if the ROM
region utilizes the KVM READONLY memory feature. Therefore, we
avoid using page tables stored in the ROM.

Since OVMF doesn't require memory initialization, we just build
page table entries in RAM at 0x80000 very early in the OVMF boot
process. This address is just after the 'temp RAM' which is set
up by the SEC module.

Currently we only set up 4GB of page tables for OVMF's PEI,
but DxeIpl will build identity mapped page tables that cover all
of the available processor physical address space.

Reported-by: Gary Ching-Pang Lin <glin@suse.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14715 6f19259b-4bc3-4df7-8a09-765794883524
2013-09-24 18:23:20 +00:00
geekboy15a d79d2cd2ce Updated OvmfPkg to use the reset vector binary from the UefiCpuPkg. Removing local reset vector files.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9912 6f19259b-4bc3-4df7-8a09-765794883524
2010-02-02 18:05:03 +00:00
geekboy15a 28319270fb Fixed GDT load issue in some cases after a reset. Only CS should be used to access flash prior to entering protected mode.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9839 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-27 22:45:14 +00:00
jljusten 141815f3c7 OVMF VTF0 Reset Vector: Cleanup Global Descriptor Table (GDT)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9676 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-04 16:18:09 +00:00
jljusten d22d1f535b OVMF VTF0 Reset Vector: Set 'accessed' bit in GDT descriptors
In some environments, the accessed bit should be set to allow the
global descriptor table (GDT) to reside in unmodifiable flash
memory.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9675 6f19259b-4bc3-4df7-8a09-765794883524
2010-01-04 16:18:06 +00:00
jljusten 7a55c43b07 OVMF ResetVector: Modify interface with SEC module
Previously it was:
  ESI/RSI - SEC Core entry point
  EDI/RDI - PEI Core entry point
  EBP/RBP - Start of BFV

Now it is:
  RAX/EAX  Initial value of the EAX register
           (BIST: Built-in Self Test)
  DI       'BP': boot-strap processor, or
           'AP': application processor
  RBP/EBP  Address of Boot Firmware Volume (BFV)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9571 6f19259b-4bc3-4df7-8a09-765794883524
2009-12-16 23:29:15 +00:00
jljusten 9337cf8c99 OVMF SEC: Modify to search sections of FFS file for PE32 image.
Previously the code would expect that the PE32 image was in the
first section of the FFS file.  This might not be the case if the
PE32 section is forced to be aligned.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9331 6f19259b-4bc3-4df7-8a09-765794883524
2009-10-07 16:01:06 +00:00
jljusten 49ba9447c9 Add initial version of Open Virtual Machine Firmware (OVMF) platform.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8398 6f19259b-4bc3-4df7-8a09-765794883524
2009-05-27 21:10:18 +00:00