summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* pip: bump edk2-pytool-library from 0.12.1 to 0.13.1dependabot/pip/edk2-pytool-library-0.13.1dependabot[bot]2023-02-031-1/+1
| | | | | | | | | | | | | | Bumps [edk2-pytool-library](https://github.com/tianocore/edk2-pytool-library) from 0.12.1 to 0.13.1. - [Release notes](https://github.com/tianocore/edk2-pytool-library/releases) - [Commits](https://github.com/tianocore/edk2-pytool-library/compare/v0.12.1...v0.13.1) --- updated-dependencies: - dependency-name: edk2-pytool-library dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
* UefiCpuPkg: Fix SMM code hangs when InitPagingZhiguang Liu2023-02-031-4/+9
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4246 In function InitPaging, NumberOfPml5Entries is calculated by below code NumberOfPml5Entries = (UINTN)LShiftU64 (1, SizeOfMemorySpace - 48); If the SizeOfMemorySpace is larger than 48, NumberOfPml5Entries will be larger than 1. However, this doesn't make sense if the hardware doesn't support 5 level page table. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Eric Dong <eric.dong@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdePkg: Label CreateEvent NotifyFunction and NotifyContext optionalRebecca Cran2023-02-031-2/+2
| | | | | | | | | | | | | | | | | | | | | According to the UEFI 2.10 Specification, the EFI_BOOT_SERVICES_TABLE CreateEvent function has the following signature: typedef EFI_STATUS (EFIAPI *EFI_CREATE_EVENT) ( IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL IN VOID *NotifyContext, OPTIONAL OUT EFI_EVENT *Event ); Fix the prototype in UefiSpec.h to match, by labeling the NotifyFunction and NotifyContext parameters as OPTIONAL. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Bus/Ata/AhciPei: Fix DEADCODE Coverity issueRanbir Singh2023-02-021-4/+0
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4201 The code can reach line 69 only through the else path above at line 57. The else path already has the same NULL check at line 59 and hence the duplicate code lines are totally redundant which can be deleted. Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* ShellPkg/AcpiView: ERST ParserJeshua Smith2023-02-024-0/+304
| | | | | | | | | Add a new parser for the Error Record Serialization Table. The ERST table describes how an OS can save and retrieve hardware error information to and from a persistent store. Signed-off-by: Jeshua Smith <jeshuas@nvidia.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* MdeModulePkg: ScsiBusDxe: Refactor DiscoverScsiDevice()Yuan Yu2023-02-022-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently DiscoverScsiDevice() returns a boolean which cannot distinguish a "not found" situation from a real problem like memory allocation failures. This patch changes the return value to an EFI_STATUS so that when memory allocation fails, it will return EFI_OUT_OF_RESOURCES. Without this change, any FALSE returned by DiscoverScsiDevice() will result in EFI_OUT_OF_RESOURCES being returned by ScsiScanCreateDevice(), which will cause a while loop in SCSIBusDriverBindingStart() to abort before other possible Puns in the SCSI channel are scanned, which means good devices may not have a chance to be discovered. If this good device is the boot device, boot will fail. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Sivaparvathi chellaiah <sivaparvathic@ami.com> Signed-off-by: Yuan Yu <yuanyu@google.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdePkg: Fix UINT64 and INT64 word length for LoongArch64Chao Li2023-02-011-11/+11
| | | | | | | | | | | | | | The UINT64 and INT64 should be defined as unsigned long long and long long in the linux64 bit environment, but now defined as unsigned long and long, so fix it. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4330 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* UefiPayloadPkg: Set RTC dynamic PCD to PeiPCDdatabaseKasimX Liu2023-01-311-0/+5
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4193 In order to remove RTC_INDEX/RTC_TARGET from the UplBuild macro list,change the RTC_INDEX /RTC_TARGET type from PcdsFixedAtBuild to PcdsDynamicEx Reviewed-by: Guo Dong <guo.dong@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: James Lu <james.lu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
* MdePkg: Added serveral tables to MATD used by LoongArch64Chao Li2023-01-311-1/+94
| | | | | | | | | | | | | Add CORE_PIC, LIO_PIC, HT_PIC, EIO_PIC, MSI_PIC, BIO_PIC and LPC_PIC tables for LoongArch64 as defined in ACPI SPEC 6.5. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4306 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg: Add ACPI 6.5 headerChao Li2023-01-312-1/+3165
| | | | | | | | | | | | | | | | | Create Acpi65.h, which is copied from Acpi64.h, and make the following changes: 1. Replace all occurences of "6.4/6_4" with "6.5/6_5". 2. Incremented FADT minor revision. 3. Make Acpi65.h the latest ACPI definitions that Acpi.h contains. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4306 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdePkg: Add Acpi65.h to IgnoreFiles areaChao Li2023-01-311-0/+2
| | | | | | | | | | | | | Acpi65.h will causes ECC errors when CI uses Ubuntu GCC5 PR, add it to MdePkg.ci.yaml in "IgnreFiles" area to fix the ECC errors. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4306 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* ArmVirtPkg: Remove RealView Debugger lines from ArmVirtPkg.dsc.incRebecca Cran2023-01-301-7/+0
| | | | | | | | | | Since RvdPeCoffExtraActionLib has been deleted, remove lines referencing it and the RealView Debugger from ArmVirtPkg.dsc.inc. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Bob Feng <bob.c.feng@intel.com>
* ArmPkg: Remove RealView Debugger supportRebecca Cran2023-01-304-188/+0
| | | | | | | | | | | | The RealView Debugger is related to RVCT, which is no longer supported. Given that, remove RvdPeCoffExtraActionLib and code from RvdPeCoffExtraActionLib which prints lines for use with the RealView Debugger. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Remove CYGWIN_NT-5.1-i686 ref from Scripts/PatchCheck.pyRebecca Cran2023-01-301-1/+0
| | | | | | | | | | | With the removal of RVCT support and the related Bin/CYGWIN_NT-5.1-i686 and Darwin-i386 directories, remove a leftover reference to CYGWIN_NT-5.1-i686 from Scripts/PatchCheck.py. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Delete Bin/{CYGWIN_NT-5.1-i686,Darwin-i386} directoriesRebecca Cran2023-01-3031-691/+0
| | | | | | | | | | | | The Bin/CYGWIN_NT-5.1-i686 and Bin/Darwin-i386 directories contained files needed for RVCT support. Since EDK2 no longer supports RVCT, delete those directories. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Bob Feng <bob.c.feng@intel.com>
* MdeModulePkg: Correct memory type in PrePiDxeCis.hDionna Glaze via groups.io2023-01-302-2/+2
| | | | | | | | | | | | | | The enumeration in MdePkg/Include/Pi/PiDxeCis.h has a duplicated entry, so the 8th position in the list doesn't count as index 7. The value EfiGcdMemoryTypeUnaccepted will have when added before EfiGcdMemoryTypeMaximum will be 6. Cc: Min M Xu <min.m.xu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Dionna Glaze <dionnaglaze@google.com> Reviewed-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* tools_def: Remove duplicated -OsPierre Gondois2023-01-301-12/+12
| | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2928 commit 17bd834eb5fd ("BaseTools: Factorize GCC flags") makes GCC48_ALL_CC_FLAGS inherit from GCC_ALL_CC_FLAGS. GCC_ALL_CC_FLAGS contains the '-Os' flag. The latest flag in a command line overrides the previous optimization option. This allows more specific build configuration to override the inherited '-Os' flag. If a build configuration includes GCC48_ALL_CC_FLAGS, hard-coded '-Os' options are not necessary anymore. Remove them. Reported-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* ArmPkg: implement EFI_MP_SERVICES_PROTOCOL based on PSCI callsRebecca Cran2023-01-275-0/+2335
| | | | | | | | | | | | | | Add support for EFI_MP_SERVICES_PROTOCOL during the DXE phase under AArch64. PSCI_CPU_ON is called to power on the core, the supplied procedure is executed and PSCI_CPU_OFF is called to power off the core. Fixes contributed by Ard Biesheuvel. Signed-off-by: Rebecca Cran <rebecca@quicinc.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Kun Qin <kun.qin@microsoft.com>
* ArmPkg: Add GET_MPIDR_AFFINITY_BITS and MPIDR_MT_BIT to ArmLib.hRebecca Cran2023-01-271-7/+9
| | | | | Signed-off-by: Rebecca Cran <rebecca@quicinc.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg/PlatformPei: SEV-SNP make >=4GB unacceptedDionna Glaze2023-01-261-0/+6
| | | | | | | | | | | | | | | | | | | | | | Instead of eagerly accepting all memory in PEI, only accept memory under the 4GB address. This allows a loaded image to use the MEMORY_ACCEPTANCE_PROTOCOL to disable the accept behavior and indicate that it can interpret the memory type accordingly. This classification is safe since ExitBootServices will accept and reclassify the memory as conventional if the disable protocol is not used. Cc: Ard Biescheuvel <ardb@kernel.org> Cc: "Min M. Xu" <min.m.xu@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Tom Lendacky <Thomas.Lendacky@amd.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Erdem Aktas <erdemaktas@google.com> Signed-off-by: Dionna Glaze <dionnaglaze@google.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg: Implement AcceptAllUnacceptedMemory in AmdSevDxeDionna Glaze2023-01-262-3/+22
| | | | | | | | | | | | | | | | | This protocol implementation disables the accept-all-memory behavior of the BeforeExitBootServices event this driver adds. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: "Min M. Xu" <min.m.xu@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: "Michael D. Kinney" <michael.d.kinney@intel.com> Signed-off-by: Dionna Glaze <dionnaglaze@google.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg: Introduce the OvmfSevMemoryAcceptance protocolDionna Glaze2023-01-262-0/+44
| | | | | | | | | | | | | | | | | | | | The default behavior for unaccepted memory in SEV-SNP is to accept all memory when ExitBootServices is called. An OS loader can use this protocol to disable this behavior to assume responsibility for memory acceptance and to affirm that the OS can handle the unaccepted memory type. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: "Min M. Xu" <min.m.xu@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: "Michael D. Kinney" <michael.d.kinney@intel.com> Signed-off-by: Dionna Glaze <dionnaglaze@google.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* OvmfPkg: Add memory acceptance event in AmdSevDxeDionna Glaze2023-01-262-0/+98
| | | | | | | | | | | | | | | | | | | The added behavior is to accept all unaccepted memory at ExitBootServices if the behavior is not disabled. This allows safe upgrades for OS loaders to affirm their support for the unaccepted memory type. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: "Min M. Xu" <min.m.xu@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: "Michael D. Kinney" <michael.d.kinney@intel.com> Signed-off-by: Dionna Glaze <dionnaglaze@google.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg/PlatformCI: Perform build test of ArmVirtKvmToolArd Biesheuvel2023-01-262-0/+57
| | | | | | Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
* ArmVirtPkg/PlatformCI: Add CI coverage for ArmVirtQemuKernelArd Biesheuvel2023-01-264-2/+83
| | | | | | | | | | | | | | ArmVirtQemuKernel.dsc describes a firmware build that is loadable at arbitrary address and can be invoked using the Linux/arm64 kernel boot protocol. The early code deviates significantly from ArmVirtQemu, and so it makes sense to cover this platform in CI even if it is not widely used. This ensures that the relocatable PrePi and other components in EmbeddedPkg don't regress on ARM as they are being updated for use on TDVF. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
* ArmVirtPkg/PlatformCI: Enable optional features on Qemu AARCH64 buildsArd Biesheuvel2023-01-261-3/+3
| | | | | | | | | To increase the CI coverage, enable secure boot, TPM2 support and HTTPS boot on ArmVirtQemu builds used in CI. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
* ArmVirtPkg/PlatformCI: factor out reusable PlatformBuildLib.pyArd Biesheuvel2023-01-263-23/+39
| | | | | | | | | | | | In order to reduce the amount of code duplication, refactor the PlatformBuild.py script that builds ArmVirtQemu.dsc into a reusable PlatformBuildLib.py containing most of the bits and pieces, and a small QemuBuild.py which is specific to the DSC in question. Suggested-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
* ArmVirtPkg/ArmVirtQemu: enlarge initial flash mappingArd Biesheuvel2023-01-261-1/+3
| | | | | | | | | | | The initial ID map used by ArmVirtQemu only covers 2 MiB of NOR flash, while the NOOPT build can be up to 3 MiB in size, resulting in a crash if the unmapped 1 MiB is accessed before the real page tables are up. So increate the initial flash mapping to 4 MiB. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* ArmVirtPkg/PrePi: Ensure timely execution of library constructorsArd Biesheuvel2023-01-261-3/+3
| | | | | | | | | | | | | PrePi has a bare metal entry point, and so it is in charge of calling the library constructors once the C runtime has been initialized sufficiently. However, we are now relying on a HOB to have been constructed by the time the MMU code runs, and so the constructors should be run before that. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* CryptoPkg/Library: Reinstate ARM/AARCH64 sections in SmmCryptLib.infJake Garver2023-01-261-0/+6
| | | | | | | | | These sections were removed mistakenly. SmmCryptLib.inf supports these architectures. Signed-off-by: Jake Garver <jake@nvidia.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* OvmfPkg: fix BuildResourceDescriptorHob call in PlatformAddHobCB()Gerd Hoffmann2023-01-261-1/+1
| | | | | | | | | | | BuildResourceDescriptorHob() expects the third parameter be the Length, not the End address. Fixes: 328076cfdf45 ("OvmfPkg/PlatformInitLib: Add PlatformAddHobCB") Reported-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Tested-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* SecurityPkg/AuthVariableLib: Check SHA-256 OID with ContentInfo presentJan Bobek2023-01-231-8/+42
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4305 Based on whether the DER-encoded ContentInfo structure is present in authenticated SetVariable payload or not, the SHA-256 OID can be located at different places. UEFI specification explicitly states the driver shall support both cases, but the old code assumed ContentInfo was not present and incorrectly rejected authenticated variable updates when it were present. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Min Xu <min.m.xu@intel.com> Signed-off-by: Jan Bobek <jbobek@nvidia.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg: remove garbage pixels in LaffStd glyphsdevel@edk2.groups.io2023-01-201-5/+5
| | | | | Signed-off-by: Jan Engelhardt <jengelh@inai.de> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* ShellPkg: Export default shell delay as PCDTomas Pilar2023-01-203-1/+6
| | | | | | | | | | | | | | | | | | | | | Create PcdShellDefaultDelay to configure the default delay the shell provides for the user at the start time if the user wishes to cancel the execution of a potential startup script. The shell application already allows the user to override the delay default value by specifying the -delay cmdline argument. This however cannot be used when loading the shell application using direct boot or when integrating the shell into the platform firmware build. Thus, a PCD can be easily configured by the developer either at build time, or even at runtime. Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Tomas Pilar <tomas@quicinc.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* OvmfPkg/PlatformInitLib: catch QEMU's CPU hotplug reg block regressionLaszlo Ersek2023-01-201-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QEMU v5.1.0, the CPU hotplug register block misbehaves: the negotiation protocol is (effectively) broken such that it suggests that switching from the legacy interface to the modern interface works, but in reality the switch never happens. The symptom has been witnessed when using TCG acceleration; KVM seems to mask the issue. The issue persists with the following (latest) stable QEMU releases: v5.2.0, v6.2.0, v7.2.0. Currently there is no stable release that addresses the problem. The QEMU bug confuses the Present and Possible counting in function PlatformMaxCpuCountInitialization(), in "OvmfPkg/Library/PlatformInitLib/Platform.c". OVMF ends up with Present=0 Possible=1. This in turn further confuses MpInitLib in UefiCpuPkg (hence firmware-time multiprocessing will be broken). Worse, CPU hot(un)plug with SMI will be summarily broken in OvmfPkg/CpuHotplugSmm, which (considering the privilege level of SMM) is not that great. Detect the issue in PlatformCpuCountBugCheck(), and print an error message and *hang* if the issue is present. Users willing to take risks can override the hang with the experimental QEMU command line option -fw_cfg name=opt/org.tianocore/X-Cpuhp-Bugcheck-Override,string=yes (The "-fw_cfg" QEMU option itself is not experimental; its above argument, as far it concerns the firmware, is experimental.) The problem was originally reported by Ard [0]. We analyzed it at [1] and [2]. A QEMU patch was sent at [3]; now merged as commit dab30fbef389 ("acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block", 2023-01-08), to be included in QEMU v8.0.0. [0] https://bugzilla.tianocore.org/show_bug.cgi?id=4234#c2 [1] https://bugzilla.tianocore.org/show_bug.cgi?id=4234#c3 [2] IO port write width clamping differs between TCG and KVM http://mid.mail-archive.com/aaedee84-d3ed-a4f9-21e7-d221a28d1683@redhat.com https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg00199.html [3] acpi: cpuhp: fix guest-visible maximum access size to the legacy reg block http://mid.mail-archive.com/20230104090138.214862-1-lersek@redhat.com https://lists.gnu.org/archive/html/qemu-devel/2023-01/msg00278.html NOTE: PlatformInitLib is used in the following platform DSCs: OvmfPkg/AmdSev/AmdSevX64.dsc OvmfPkg/CloudHv/CloudHvX64.dsc OvmfPkg/IntelTdx/IntelTdxX64.dsc OvmfPkg/Microvm/MicrovmX64.dsc OvmfPkg/OvmfPkgIa32.dsc OvmfPkg/OvmfPkgIa32X64.dsc OvmfPkg/OvmfPkgX64.dsc but I can only test this change with the last three platforms, running on QEMU. Test results: TCG QEMU OVMF override result patched patched --- ------- ------- -------- -------------------------------------- 0 0 0 0 CPU counts OK (KVM masks the QEMU bug) 0 0 1 0 CPU counts OK (KVM masks the QEMU bug) 0 1 0 0 CPU counts OK (QEMU fix, but KVM masks the QEMU bug anyway) 0 1 1 0 CPU counts OK (QEMU fix, but KVM masks the QEMU bug anyway) 1 0 0 0 boot with broken CPU counts (original QEMU bug) 1 0 1 0 broken CPU count caught (boot hangs) 1 0 1 1 broken CPU count caught, bug check overridden, boot continues 1 1 0 0 CPU counts OK (QEMU fix) 1 1 1 0 CPU counts OK (QEMU fix) Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Michael Brown <mcb30@ipxe.org> Cc: Min Xu <min.m.xu@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Sebastien Boeuf <sebastien.boeuf@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4250 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20230119110131.91923-3-lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Hugely-appreciated-by: Michael Brown <mcb30@ipxe.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg/PlatformInitLib: factor out PlatformCpuCountBugCheck()Laszlo Ersek2023-01-201-23/+58
| | | | | | | | | | | | | | | | | | | | | | | | Move the QEMU v2.7 reset bug check/workaround to a separate function, as we'll need to detect further issues. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Michael Brown <mcb30@ipxe.org> Cc: Min Xu <min.m.xu@intel.com> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Sebastien Boeuf <sebastien.boeuf@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4250 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20230119110131.91923-2-lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Hugely-appreciated-by: Michael Brown <mcb30@ipxe.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg/PlatformCI VS2019: Enable temporary workaround for cpuhp bugfixArd Biesheuvel2023-01-202-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QEMU for x86 has a nasty CPU hotplug bug of which the ramifications are difficult to oversee, even though KVM acceleration seems to be unaffected. This has been addressed in QEMU mainline, and will percolate through the ecosystem at its usual pace. In the mean time, due to the potential impact on production workloads, we will be updating OVMF to abort the boot when it detects a QEMU build that is affected. Tiancore's platform CI uses QEMU in TCG mode, and is therefore impacted by this mitigation, unless its QEMU builds are updated. This has been done for Ubuntu-GCC5, but Windows-VS2019 still uses a QEMU build that is affected. Aborting the boot upon detecting the QEMU issue will render all boot tests carried out on Windows-VS2019 broken unless we implement the 'escape hatch' that enables proceed-at-your-own-risk mode, and permits the boot to proceed even if the QEMU issue is detected. So let's enable this for Windows-VS2019, and remove it again once it is no longer needed. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael Brown <mcb30@ipxe.org> Cc: Oliver Steffen <osteffen@redhat.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4250 Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Message-Id: <20230119134302.1524569-1-ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Jiewen Yao <Jiewen.yao@Intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* EmbeddedPkg: Add back FfsFindSectionDataMin M Xu2023-01-192-0/+43
| | | | | | | | | | | In commit c673216f53 a new input parameter is added in FfsFindSectionData. That change breaks the build of ArmVirtPkg. In this patch FfsFindSectionData is added back. It calls FfsFindSectionDataWithHook with a NULL hook. Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* EmbeddedPkg: Rename FfsFindSectionData as FfsFindSectionDataWithHookMin M Xu2023-01-194-8/+10
| | | | | | | | | | | | | | | | Commit c673216f53 introduces FFS_CHECK_SECTION_HOOK and add it as the second input parameter in FfsFindSectionData. This change breaks the build of ArmVirtPkg. To fix this issue, the new version of FfsFindSectionData is renamed as FfsFindSectionDataWithHook in this patch. In the following patch the original FfsFindSectionData will be added back. FfsFindSectionData is renamed as FfsFindSectionDataWithHook. Accordingly PeilessStartupLib in OvmfPkg should be updated as well. To prevent the build from being broken, the changes in OvmfPkg are in this patch. Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* MdeModulePkg: Add IpmiCommandLibAbner Chang2023-01-192-0/+8
| | | | | | | | | | | | | | | | Add IpmiCommandLib to MdeModulePkg DEC/DSC files. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Isaac Oram <isaac.w.oram@intel.com> Reviewed-by: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/IpmiCommandLib: Add NULL instance libraryAbner Chang2023-01-195-0/+757
| | | | | | | | | | | | | | | | | The NULL instance of IpmiCommandLib library under MdeModulePkg as the default IpmiCommandLib instance used by the modules under edk2. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Isaac Oram <isaac.w.oram@intel.com> Reviewed-by: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Include: Add IpmiCommandLib header fileAbner Chang2023-01-191-0/+683
| | | | | | | | | | | | | | | | | | | | | | | | Add IpmiCommandLib to MdeModulePkg. This header file is copied from edk2-platforms/Features/Intel/OutOfBandManagement/ IpmiFeaturePkg\Include\Library. Having this header file in edk2 to avoid the dependence of edk2 module with edk2-platfrom. The NULL instance of IpmiCommandLib under MdeModulePkg has to be implemented for the same reason. IpmiCommandLib.h in edk2-platforms should be removed once this patch set is merged. Expect no impacts on edk2-platforms because MdeModulePkg is referred in INF file by all edk2 modules under edk2-platforms that use IpmiCommandLib. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Isaac Oram <isaac.w.oram@intel.com> Reviewed-by: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* RedfishPkg/Include: Redfish USB Interface V2 updateAbner Chang2023-01-191-1/+24
| | | | | | | | | | | Support USB_INTERFACE_DEVICE_DESCRIPTOR_V2 which is updated in Redfish Host Interface spec v1.3. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Nickle Wang <nicklew@nvidia.com>
* RedfishPkg/Include: Add Redfish IPMI definitionsAbner Chang2023-01-191-0/+51
| | | | | | | | | | | Add the definitions of Redfish Host Interface credential bootstrapping IPMI commands. Signed-off-by: Nickle Wang <nicklew@nvidia.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Igor Kulchytskyy<igork@ami.com> Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
* MdePkg/IndustryStandard: Update IPMI definitionsAbner Chang2023-01-193-4/+82
| | | | | | | | | | | | | | | | | | | | | This change updates IPMI header files to support build up SMBIOS 42 Redfish Host Interface record using the information retrieved via IPMI App/Net Function. In IpmiNetFnApp.h, we also remove the duplicate definition of IPMI_APP_GET_CHANNEL_INFO. Signed-off-by: Abner Chang <abner.chang@amd.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Nickle Wang <nicklew@nvidia.com> Cc: Igor Kulchytskyy <igork@ami.com> Cc: Isaac Oram <isaac.w.oram@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Reviewed-by: Isaac Oram <isaac.w.oram@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* OvmfPkg/CcExitLib: Initialize Status in IoExitMin M Xu2023-01-181-4/+5
| | | | | | | | | | | | | Status should be initialized otherwise it may return unexpected value. Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Michael Roth <michael.roth@amd.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
* OvmfPkg/BaseMemEncryptTdxLib: Refactor error handle of SetOrClearSharedBitMin M Xu2023-01-181-8/+40
| | | | | | | | | | | | | | | The previous implementation of SetOrClearSharedBit doesn't handle the error correctly. In this patch SetOrClearSharedBit is changed to return error code so that the caller can handle it. Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Michael Roth <michael.roth@amd.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
* SecurityPkg/TdTcg2Dxe: Extend EFI boot variable to PCR[1]Min M Xu2023-01-181-5/+1
| | | | | | | | | | | According to TCG PC Client PFP spec 0021 Section 2.4.4.2 EFI boot variable should be measured and extended to PCR[1], not PCR[5]. This patch is proposed to fix this error. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
* OvmfPkg/CcExitLib: Refactor TDX MmioExitMin M Xu2023-01-181-163/+381
| | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4169 The previous TDX MmioExit doesn't handle the Mmio instructions correctly in some scenarios. This patch refactors the implementation to fix the issues. Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Ryan Afranji <afranji@google.com> Reported-by: Ryan Afranji <afranji@google.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* OvmfPkg/CcExitLib: Move common X86 instruction code to separate fileMin M Xu2023-01-185-615/+735
| | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=4169 Move common X86 instruction codes from CcExitVcHandler.c to separate files (CcInstruction.h / CcInstruction.c) so that these codes can be re-used in TDX. Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>