summaryrefslogtreecommitdiffstats
path: root/OvmfPkg
Commit message (Collapse)AuthorAgeFilesLines
* OvmfPkg/RiscVVirt/Sec: clean up ProcessLibraryConstructorList() declLaszlo Ersek2024-03-083-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | <Library/PeimEntryPoint.h> declares a bogus ProcessLibraryConstructorList() for the OvmfPkg/RiscVVirt SEC module. Rely on AutoGen for (properly) declaring ProcessLibraryConstructorList(). Remove the correct, but superfluous, declaration as well. Build-tested with: build -a RISCV64 -b DEBUG -m OvmfPkg/RiscVVirt/Sec/SecMain.inf \ -p OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc -t GCC5 Cc: Andrei Warkentin <andrei.warkentin@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Sunil V L <sunilvl@ventanamicro.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=990 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240305113843.68812-5-lersek@redhat.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg/IntelTdx: auto-gen & fix SEC ProcessLibraryConstructorList() declLaszlo Ersek2024-03-082-3/+2
| | | | | | | | | | | | | | | | | | | | <Library/PeimEntryPoint.h> declares a bogus ProcessLibraryConstructorList() for IntelTdx's SEC module. Rely on AutoGen for (properly) declaring ProcessLibraryConstructorList(). Update the call. Build-tested with: build -a X64 -b DEBUG -m OvmfPkg/IntelTdx/Sec/SecMain.inf \ -p OvmfPkg/IntelTdx/IntelTdxX64.dsc -t GCC5 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=990 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240305113843.68812-4-lersek@redhat.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg: auto-generate (and fix) SEC ProcessLibraryConstructorList() declLaszlo Ersek2024-03-082-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | <Library/PeimEntryPoint.h> declares a bogus ProcessLibraryConstructorList() for OVMF's SEC module. Rely on AutoGen for (properly) declaring ProcessLibraryConstructorList(). Update the call. Build-tested with: build -a X64 -b DEBUG -m OvmfPkg/Sec/SecMain.inf \ -p OvmfPkg/OvmfPkgX64.dsc -t GCC5 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=990 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4643 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240305113843.68812-3-lersek@redhat.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg/SmbiosPlatformDxe: tweak fallback release date againLee, Chun-Yi2024-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case PcdFirmwareReleaseDateString is not set use a valid date as fallback. But the default valid date can _NOT_ pass the Microsoft SVVP test "Check SMBIOS Table Specific Requirements". The test emitted the error message: BIOS Release Date string is unexpected length: 8. This string must be in MM/DD/YYYY format. No other format is allowed and no additional information may be included. See field description in the SMBIOS specification. Base on SMBIOS spec v3.7.0: 08h 2.0+ BIOS Release Date BYTE STRING String number of the BIOS release date. The date string, if supplied, is in either mm/dd/yy or mm/dd/yyyy format. If the year portion of the string is two digits, the year is assumed to be 19yy. NOTE: The mm/dd/yyyy format is required for SMBIOS version 2.3 and later. So, let's tweek the fallback release date again. Fixes: a0f9628705e3 ("OvmfPkg/SmbiosPlatformDxe: tweak fallback release date") [edk2-stable202305~327] Signed-off-by: "Lee, Chun-Yi" <jlee@suse.com> Message-Id: <20240204092914.29813-1-jlee@suse.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Pawel Polawski <ppolawsk@redhat.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Ruifeng Gao <ruifeng.gao@intel.com> Cc: "Lee, Chun-Yi" <jlee@suse.com> [lersek@redhat.com: Turn the CC's from the list posting to commit message body tags, for placating "PatchCheck.py". Also work the "ruifeng.gao@intel.com" email address into a format that "PatchCheck.py" accepts.]
* OvmfPkg/ResetVector: wire up 5-level paging for TDXGerd Hoffmann2024-03-012-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | BSP workflow is quite simliar to the non-coco case. TDX_WORK_AREA_PGTBL_READY is used to record the paging mode: 1 == 4-level paging 2 == 5-level paging APs will look at TDX_WORK_AREA_PGTBL_READY to figure whenever they should enable 5-level paging or not. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240301074402.98625-9-kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: move "CheckForSev:" label into "%if PG_5_LEVEL" scope, as discussed with Gerd] Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: print post codes for 4/5 level pagingGerd Hoffmann2024-03-011-0/+8
| | | | | | | | | | | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240301074402.98625-8-kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: add 5-level paging supportGerd Hoffmann2024-03-013-0/+102
| | | | | | | | | | | | | | | | | | | Add macros to check for 5-level paging and gigabyte page support. Enable 5-level paging for the non-confidential-computing case. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240301074402.98625-7-kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: split SEV and non-CoCo workflowsGerd Hoffmann2024-03-012-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | Use separate control flows for SEV and non-CoCo cases. SevClearPageEncMaskForGhcbPage and GetSevCBitMaskAbove31 will now only be called when running in SEV mode, so the SEV check in these functions is not needed any more. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240301074402.98625-6-kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: split TDX BSP workflowGerd Hoffmann2024-03-012-9/+10
| | | | | | | | | | | | | | | | | | | | | | | Create a separate control flow for TDX BSP. TdxPostBuildPageTables will now only be called when running in TDX mode, so the TDX check in that function is not needed any more. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240301074402.98625-5-kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: add CreatePageTables4Level macroGerd Hoffmann2024-03-011-31/+39
| | | | | | | | | | | | | | | | | | | Move code to create 4-level page tables to a nasm macro. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240301074402.98625-4-kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: add ClearOvmfPageTables macroGerd Hoffmann2024-03-011-16/+19
| | | | | | | | | | | | | | | | | | | Move code to clear the page tables to a nasm macro. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240301074402.98625-3-kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/ResetVector: improve page table flag namesGerd Hoffmann2024-03-011-17/+22
| | | | | | | | | | | | | | | | | | | | Add comments, rename some of the PAGE_* flags and combined attributes. Specifically use "LARGEPAGE" instead of "2M" because that bit is used for both 2M and 1G large pages. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240301074402.98625-2-kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/PlatformInitLib: add 5-level paging supportGerd Hoffmann2024-02-291-19/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | Adjust physical address space logic for la57 mode (5-level paging). With a larger logical address space we can identity-map a larger physical address space. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Message-Id: <20240222105407.75735-4-kraxel@redhat.com> Cc: Michael Roth <michael.roth@amd.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Ard Biesheuvel <ardb@kernel.org> [lersek@redhat.com: turn the "Cc:" message headers from Gerd's on-list posting into "Cc:" tags in the commit message, in order to pacify "PatchCheck.py"]
* OvmfPkg/PlatformPei: log pei memory cap detailsGerd Hoffmann2024-02-271-0/+24
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240214104504.2931339-5-kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/PlatformPei: rewrite page table calculationGerd Hoffmann2024-02-271-22/+36
| | | | | | | | | Consider 5-level paging. Simplify calculation to make it easier to understand. Add some comments, improve ASSERTs. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240214104504.2931339-4-kraxel@redhat.com>
* OvmfPkg/PlatformPei: consider AP stacks for pei memory capGerd Hoffmann2024-02-271-3/+14
| | | | | | | | | Needed to avoid running out of memory when booting with a large (~2048) number of vcpus. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240214104504.2931339-3-kraxel@redhat.com>
* OvmfPkg/PlatformPei: log a warning when memory is tightGerd Hoffmann2024-02-271-0/+8
| | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240214104504.2931339-2-kraxel@redhat.com>
* OvmfPkg: only add shell to FV in case secure boot is disabledGerd Hoffmann2024-02-251-1/+1
| | | | | | | | | | | | | | | The EFI Shell allows to bypass secure boot, do not allow to include the shell in the firmware images of secure boot enabled builds. This prevents misconfigured downstream builds. Ref: https://bugs.launchpad.net/ubuntu/+source/edk2/+bug/2040137 Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4641 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-13-kraxel@redhat.com>
* OvmfPkg/CI: copy shell to virtual driveGerd Hoffmann2024-02-251-1/+11
| | | | | | | | | | | | | | Place the EFI shell as EFI/BOOT/BOOT{ARCH}.EFI on the virtual drive. This allows the "run to shell" CI test case to work even in case the shell is not included in the firmware image. This is needed because an followup patch will exclude the shell from secure boot enabled firmware images. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-12-kraxel@redhat.com>
* OvmfPkg: switch MicrovmX64 to new shell include filesGerd Hoffmann2024-02-252-48/+10
| | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-11-kraxel@redhat.com>
* OvmfPkg: switch IntelTdxX64 to new shell include filesGerd Hoffmann2024-02-252-36/+5
| | | | | | | | | | | Note that IntelTdxX64 is compiled without network support, so thanks to the network conditionals in the include files the build result (network shell commands excluded) should be identical before and after the patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-10-kraxel@redhat.com>
* OvmfPkg: switch AmdSevX64 to new shell include filesGerd Hoffmann2024-02-252-35/+5
| | | | | | | | | | | Note that AmdSevX64 is compiled without network support, so thanks to the network conditionals in the include files the build result (network shell commands excluded) should be identical before and after the patch. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-9-kraxel@redhat.com>
* OvmfPkg: switch OvmfPkgIa32X64 to new shell include filesGerd Hoffmann2024-02-252-54/+4
| | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-8-kraxel@redhat.com>
* OvmfPkg: switch OvmfPkgIa32 to new shell include filesGerd Hoffmann2024-02-252-54/+4
| | | | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-7-kraxel@redhat.com>
* OvmfPkg: ShellDxe.fdf.inc: add VariablePolicyDynamicCommand to FVGerd Hoffmann2024-02-251-0/+1
| | | | | | | | | | | Needed to make the new 'varpolicy' EFI shell command actually available in the OVMF firmware builds. Fixes: fe6cd1c18721 ("OvmfPkg: Add varpolicy shell command") Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-6-kraxel@redhat.com>
* OvmfPkg: Shell*.inc: allow building without network supportGerd Hoffmann2024-02-252-0/+8
| | | | | | | | | | Add NETWORK_ENABLE conditionals for the components which need network support. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-5-kraxel@redhat.com>
* OvmfPkg: add ShellDxe.fdf.incGerd Hoffmann2024-02-252-9/+16
| | | | | | | | | | Move EFI Shell firmware volume files to the new ShellDxe.fdf.inc file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-4-kraxel@redhat.com>
* OvmfPkg: add ShellLibs.dsc.incGerd Hoffmann2024-02-252-3/+11
| | | | | | | | | | Move EFI Shell libraries from OvmfPkgX64.dsc to the new ShellComponents.dsc.inc include file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-3-kraxel@redhat.com>
* OvmfPkg: add ShellComponents.dsc.incGerd Hoffmann2024-02-252-42/+50
| | | | | | | | | | Move EFI Shell components from OvmfPkgX64.dsc to the new ShellComponents.dsc.inc include file. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> Message-Id: <20240222101358.67818-2-kraxel@redhat.com>
* OvmfPkg: Align XenRealTimeClockLib function headers with return valuesSuqiang Ren2024-02-091-4/+18
| | | | | | | | | | | | | | | XenRealTimeClockLib is used to back the runtime services time functions, so align the description of the function return values with the defined values for these services as described in UEFI Spec 2.10. REF: UEFI spec 2.10 section 8 Services ? Runtime Services Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Suqiang Ren <suqiangx.ren@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* ArmVirtPkg: Move PlatformBootManagerLib to OvmfPkgChao Li2024-02-064-0/+1541
| | | | | | | | | | | | | | | | | | | Moved the PlatformBootManagerLib to OvmfPkg and renamed to PlatformBootManagerLibLight for easy use by other ARCH. Build-tested only (with "ArmVirtQemu.dsc and OvmfPkgX64.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4663 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Lazlo Ersek <lersek@redhat.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: Move two PCD variables into OvmfPkgChao Li2024-02-061-0/+13
| | | | | | | | | | | | | | | | | | Move the PcdTerminalTypeGuidBuffer and PcdUninstallMemAttrProtocol into OvmfPkg so other ARCH can easily use it. Build-tested only (with "ArmVirtQemu.dsc and OvmfPkgX64.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: Move the FdtSerialPortAddressLib to OvmfPkgChao Li2024-02-064-0/+370
| | | | | | | | | | | | | | | | | | Move the FdtSerialPortAddressLib to Ovmfpkg so that other ARCH can easily use it. Build-tested only (with "ArmVirtQemu.dsc and OvmfPkgX64.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/RiscVVirt: Remove PciCpuIo2Dxe from RiscVVirtChao Li2024-02-062-605/+0
| | | | | | | | | | | CpuIo2Dxe is already used by RiscVVirt, so remove it. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Andrei Warkentin <andrei.warkentin@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* OvmfPkg/RiscVVirt: Enable CpuMmio2DxeChao Li2024-02-062-2/+2
| | | | | | | | | | | | | CpuMmio2Dxe is supports MMIO, enable it. Build-tested only (with "RiscVVirtQemu.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Sunil V L <sunilvl@ventanamicro.com> Cc: Andrei Warkentin <andrei.warkentin@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* ArmVirtPkg: Move PCD of FDT base address and FDT padding to OvmfPkgChao Li2024-02-061-0/+15
| | | | | | | | | | | | | | | | | | | | | Moved PcdDeviceTreeInitialBaseAddress and PcdDeviceTreeAllocationPadding to OvmfPkg for easier use by other architectures. Build-tested only (with "ArmVirtQemu.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/ResetVector: Fix SNP CPUID table processing results for ECX/EDXTom Lendacky2024-02-031-2/+2
| | | | | | | | | | | | | | The current support within the boot SNP CPUID table processing mistakenly swaps the ECX and EDX results. It does not have an effect at this time because current CPUID results checking does not check ECX or EDX. However, any future CPUID checks that need to check ECX or EDX may have erroneous behavior. Fix the assembler code to save ECX and EDX to the proper locations. Fixes: 34819f2caccb ("OvmfPkg/ResetVector: use SEV-SNP-validated CPUID values") Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Michael Roth <michael.roth@amd.com>
* OvmfPkg/IoMmuDxe: Provide an implementation for SetAttributeTom Lendacky2024-01-311-2/+53
| | | | | | | | | | | | | | | | | A recent change to the PciIoMap() function now propagates the return code from the IoMmu protocol SetAttribute() operation. The implementation of this operation in OvmfPkg/IoMmuDxe/CcIoMmu.c returns EFI_UNSUPPORTED, resulting in a failure to boot the guest. Provide an implementation for SetAttribute() that validates the IoMmu access method being requested against the IoMmu mapping operation. Suggested-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Message-Id: <c0f9e95f557b601a045da015c1a97201e8aec2ab.1706634932.git.thomas.lendacky@amd.com> Tested-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Min Xu <min.m.xu@intel.com>
* OvmfPkg/ResetVector: send post codes to qemu debug consoleGerd Hoffmann2024-01-292-0/+40
| | | | | | | | | | | | Neat when doing ResetVector coding. Incompatible with TDX and SEV, therefore not enabled by default. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Erdem Aktas <erdemaktas@google.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240129122929.349726-1-kraxel@redhat.com> [lersek@redhat.com: replace "SEV" with "SEV-ES/SEV-SNP" in comment]
* OvmfPkg/VirtNorFlashDxe: move DoErase code block into new functionGerd Hoffmann2024-01-181-24/+52
| | | | | | | | | Move the DoErase code block into a separate function, call the function instead of jumping around with goto. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-Id: <20240116171105.37831-7-kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* OvmfPkg/VirtNorFlashDxe: ValidateFvHeader: unwritten state is EOL tooGerd Hoffmann2024-01-181-0/+5
| | | | | | | | | | | | | | It is possible to find variable entries with State being 0xff, i.e. not updated since flash block erase. This indicates the variable driver could not complete the header write while appending a new entry, and therefore State was not set to VAR_HEADER_VALID_ONLY. This can only happen at the end of the variable list, so treat this as additional "end of variable list" condition. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-6-kraxel@redhat.com>
* OvmfPkg/VirtNorFlashDxe: allow larger writes without block eraseGerd Hoffmann2024-01-181-8/+10
| | | | | | | | | | | | Raise the limit for writes without block erase from two to four P30_MAX_BUFFER_SIZE_IN_BYTES blocks. With this in place almost all efi variable updates are handled without block erase. With the old limit some variable updates (with device paths) took the block erase code path. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-5-kraxel@redhat.com>
* OvmfPkg/VirtNorFlashDxe: add a loop for NorFlashWriteBuffer calls.Gerd Hoffmann2024-01-181-13/+8
| | | | | | | | | | | | | Replace the two NorFlashWriteBuffer() calls with a loop containing a single NorFlashWriteBuffer() call. With the changes in place the code is able to handle updates larger than two P30_MAX_BUFFER_SIZE_IN_BYTES blocks, even though the patch does not actually change the size limit. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-4-kraxel@redhat.com>
* OvmfPkg/VirtNorFlashDxe: clarify block write logic & fix shadowbuffer readsGerd Hoffmann2024-01-181-8/+28
| | | | | | | | | | | | | | | | Introduce 'Start' and 'End' variables to make it easier to follow the logic and code flow. Also add a ascii art diagram (based on a suggestion by Laszlo). This also fixes the 'Size' calculation for the NorFlashRead() call. Without this patch the code will read only one instead of two P30_MAX_BUFFER_SIZE_IN_BYTES blocks in case '*NumBytes' is smaller than P30_MAX_BUFFER_SIZE_IN_BYTES but 'Offset + *NumBytes' is not, i.e. the update range crosses a P30_MAX_BUFFER_SIZE_IN_BYTES boundary. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-3-kraxel@redhat.com>
* OvmfPkg/VirtNorFlashDxe: add casts to UINTN and UINT32Gerd Hoffmann2024-01-182-2/+2
| | | | | | | | | This is needed to avoid bit operations being applied to signed integers. Suggested-by: László Érsek <lersek@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240116171105.37831-2-kraxel@redhat.com>
* OvmfPkg: CloudHv: Enable PcdUse1GPageTableThomas Barrett2024-01-151-0/+2
| | | | | | | | | Without enabling PcdUse1GPageTable, CloudHv guests are limited to a 40-bit address space, even if the hardware supports more. This limits the amount of RAM to 1TiB of CloudHv guests. Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg: Update PlatformAddressWidthInitialization for CloudHvThomas Barrett2024-01-151-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | In addition to initializing the PhysMemAddressWidth and FirstNonAddress fields in PlatformInfoHob, the PlatformAddressWidthInitialization function is responsible for initializing the PcdPciMmio64Base and PcdPciMmio64Size fields. Currently, for CloudHv guests, the PcdPciMmio64Base is placed immediately after either the 4G boundary or the last RAM region, whichever is greater. We do not change this behavior. Previously, when booting CloudHv guests with greater than 1TiB of high memory, the PlatformAddressWidthInitialization function incorrect calculates the amount of RAM using the overflowed 24-bit CMOS register. Now, we update the PlatformAddressWidthInitialization behavior on CloudHv to scan the E820 entries to detect the amount of RAM. This allows CloudHv guests to boot with greater than 1TiB of RAM Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg: Add CloudHv support to PlatformScanE820 utility function.Thomas Barrett2024-01-151-30/+65
| | | | | | | | | | The PlatformScanE820 utility function is not currently compatible with CloudHv since it relies on the prescence of the "etc/e820" QemuFwCfg file. Update the PlatformScanE820 to iterate through the PVH e820 entries when running on a CloudHv guest. Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg: RiscVVirt: Fix network drivers not be builtTuan Phan2024-01-151-14/+1
| | | | | | | | | Only need to include Network.dsc.inc to have all network drivers/components be built. Otherwise, there were missing definition that prevent them from be built for RiscVVirt platform. Signed-off-by: Tuan Phan <tphan@ventanamicro.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* OvmfPkg/RiscVVirt: Override Sstc extensionSunil V L2024-01-111-1/+1
| | | | | | | | | | | | | | Override Sstc extension and use SBI calls itself by default for RISC-V qemu virt platform. Cc: Andrei Warkentin <andrei.warkentin@intel.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>