Commit Graph

33638 Commits

Author SHA1 Message Date
Oliver Smith-Denny bcbb709959 BaseTools: Add VS2022 XIPFLAGS
BaseTools has a limitation that modules in FVs that are force rebased
must have the same file and section alignment. This is intended for
XIP modules.

VS2019 and previous VS toolchains did not set 4k section alignment,
but VS2022 does, in order for memory protections to be applied to
images. This causes issues when building SEC and PEI modules on
VS2022 as the file alignment is 0x20 but the section alignment
is 0x1000, so BaseTools will fail to generate the FV. One option
is to set the file alignment to 0x1000 for all of these files, but
that is a large waste of space and is not feasible on some platforms
that have limited flash space. The other option is to selectively
set 0x20 as the section alignment for SEC and PEI modules, which is
the approach GCC ARM/AARCH64 took.

This is only an issue for building 64-bit PEI on x86 currently, as
other architectures are not supported by VS2022 in edk2 yet. For IA32,
the section alignment is set to 0x20 and so it matches the file
alignment, however x64 PEI uses the X64 DLINK flags which have 0x1000
set. For other architectures that don't have the PEI/DXE architecture
split, this is also an issue.

This commit is required to use VS2022 as the default CI in edk2, as
OvmfPkgX64.dsc will fail to build. Any platform with 64-bit PEI also
requires this.

This commit also updates CryptoPkg.dsc and SecurityPkg.dsc as they
are setting custom section alignments.

Continuous-integration-options: PatchCheck.ignore-multi-package

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2024-12-10 23:42:09 +00:00
Oliver Smith-Denny f1e014a5ca BaseTools: Add /WHOLEARCHIVE for VS2022 Builds
VS2022's DLINK2_FLAGS (containing only /WHOLEARCHIVE) was commented
out during upstreaming, due to some downstream platform issues
when /WHOLEARCHIVE was set. This does not prove an issue for edk2
and is what is used for earlier versions of VS, so is added here
for VS2022.

If platforms see issues, bugs should be filed on edk2 (or fixed in
the platform if applicable).

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2024-12-10 23:42:09 +00:00
Michael Kubacki 4c7c90254f Maintainers.txt: Add VS Code PR Dashboard maintainer
Adds Michael Kubacki as a maintainer of this newly added file.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-12-10 16:01:51 +00:00
Michael Kubacki 2941f4b57f PullRequests.github-issues: Add PR notebook
Adds a VS Code GitHub issue notebook that can be used with the VS
Code GitHub Issue Notebook Extension to view PR queries on
Tianocore repositories.

VS Code extension:
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-github-issue-notebooks

This is intended to provide a single real-time dashboard that
reflects PR status from all Tianocore repositories so users can
track their PRs and quickly find PRs that need their attention.

To use this, install the VS Code extension and open the file.
This can be done in a Web browser at vscode.dev or locally in
VS Code.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-12-10 16:01:51 +00:00
Ceping Sun d55d4e22f4 OvmfPkg: Update PlatformPei.inf with TdxHelperLib
Since TdxHelperLib was defined in LibraryClasses for OvmfPkgX64.dsc,
the extra definitions is removed.

And for other dsc, add the Null-TdxHelperLib to remove the extra
definitions.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun 1f55e175f4 OvmfPkg: Update OvmfPkgX64.dsc to support TdTcg2Pei
Add TdTcg2Pei in OvmfPkgX64.dsc in early PEI phase to
support CC measurement.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun 9f9657e7da OvmfPkg: Update OvmfTpmLibs.dsc.inc to add PeiTpmMeasurementLib.inf
Because PeiTpmMeasurementLib supports both TCG measurement and CC
measurement, it shall be controled by TPM2_ENABLE and
CC_MEASUREMENT_EANBLE.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun 7689c0d9fa OvmfPkg/TdTcg2Pei: Add TdTcg2Pei to install gEdkiiCcPpi
TdTcg2Pei is added to install the gEdkiiCcPpi for a TD-Guest.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun bdf3c917e3 OvmfPkg/TdTcg2Dxe: Update with TdxHelperLib
Since TdxHelperLib has the API(TdxHelperMapPcrToMrIndex)
to map PCR to MR index, the duplicate codes are removed.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun b6b1fdb073 OvmfPkg/TdxHelperLib: Refactor for new APIs
Add below APIs to support the implementation for CC measurement.
- TdxHelperMapPcrToMrIndex
- TdxHelperHashAndExtendToRtmr
- TdxHelperBuildTdxMeasurementGuidHob

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun cc0ec8ebae OvmfPkgX64: Add BaseCryptLib definition in PEIM
Since the TdxHelperLib is used for measurement
in PEI phase, it required TDVF to add the library.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun b2df9a89ba SecurityPkg/PeiTpmMeasurementLib: Support CC Measurement
PeiTpmMeasurementLib is updated to support both TCG measurement and
CC Measurement. gEfiPeiMasterBootModePpiGuid is removed from [Depex]
because it is not needed for the library.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
Ceping Sun 3b07a2fb52 SecurityPkg/Ppi: Add gEdkiiCcPpi for CC Measurement in PEI phase
gEdkiiCcPpi is designed to support CC measurement in PEI phase.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2024-12-10 02:09:29 +00:00
John Chung 481c43308b MdePkg: Add new PCDs for IPMI Serial
This change adds new PCDs for IPMI Serial.

Specification reference:
https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html

Signed-off-by: John Chung <john.chung@arm.com>
2024-12-09 19:57:53 +00:00
John Chung 5b760ca087 MdePkg/IndustryStandard: Add definitions for IPMI Serial
Add IPMI Serial definitions

Specification reference:
https://www.intel.com/content/www/us/en/products/docs/servers/ipmi/ipmi-second-gen-interface-spec-v2-rev1-1.html

Signed-off-by: John Chung <john.chung@arm.com>
2024-12-09 19:57:53 +00:00
Pierre Gondois e53cf2412a ShellPkg/UefiShellLevel2CommandsLib: Add helper for reset -fwui option
Following the UEFI Shell Specification revision 2.2,
add helper for the '-fwui' option of the reset command.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2024-12-09 17:16:58 +00:00
Ajan Zhong 694cc9f100 UefiPayloadPkg: Update ReadUnaligned64 in ACPI parsing
According to ACPI Specification, 64 bit physical address of the XSDT
provides indentical functionality to the RSDT but accommodates physical
address of description headers that are larger than 32 bits.

In this case physical address of XSDT table is 64 bit aligned, however
size of ACPI description tabled header is not 64 bit aligned. It leads
to the entry of other description headers are not 64 bit aligned. In
AARCH64 architecture, deference non-aligned 64 bit address to fetch
64-bit data will trigger Alignment fault. Use ReadUnaligned64 method
to fix this unaligned data access issue.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-09 02:23:28 +00:00
Ajan Zhong ddb4ea681b UefiPayloadPkg: Update FDT parser logic for unaligned data access
If alignment check is enabled in AARCH64 platform, FDT parser might
dereference non-aligned 64-bit address to fetch 64-bit data.
Use unaligned data read to avoid triggering unaligned data access.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-09 02:23:28 +00:00
Ajan Zhong 2d6d03056a UefiPayloadPkg: Add AARCH64 support on FdtParserLib
Add AARCH64 support on FdtParserLib.

Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
2024-12-09 02:23:28 +00:00
Gerd Hoffmann f0424ec80e OvmfPkg: disable iscsi by default
While IScsiDxe certainly is a useful feature it is rarely used, and it
slows down firmware boot quite a bit.  So disable it by default and only
load it in case this is explicitly requested via fw_cfg.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Gerd Hoffmann 645988d9b3 OvmfPkg: add PcdEntryPointOverrideDefaultValue
UefiDriverEntryPointFwCfgOverrideLib will use
PcdEntryPointOverrideDefaultValue to decide what to do in case the
fw_cfg file specified via PcdEntryPointOverrideFwCfgVarName is not
present.  Default is "yes".

This allows to disable drivers by default and only enable them when
requested via fw_cfg.

Also log a message with the config option applied and whenever the
default value or a fw_cfg option was used.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Gerd Hoffmann 9ca29831f6 OvmfPkg: add fw_cfg option for usb storage
Use UefiDriverEntryPointFwCfgOverrideLib for UsbMassStorageDxe so
the driver can be enabled/disabled via fw_cfg option.

usage: qemu -fw_cfg name=opt/org.tianocore/UsbStorageSupport,string={yes,no}

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Gerd Hoffmann f9335bcb7c OvmfPkg: add fw_cfg option for iscsi support
Use UefiDriverEntryPointFwCfgOverrideLib for IScsiDxe so the driver
can be enabled/disabled via fw_cfg option.

usage: qemu -fw_cfg name=opt/org.tianocore/ISCSISupport,string={yes,no}

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Gerd Hoffmann b9cb18206a OvmfPkg: add fw_cfg option for virtio-net support
Use UefiDriverEntryPointFwCfgOverrideLib for VirtioNetDxe so the driver
can be enabled/disabled via fw_cfg option.

usage: qemu -fw_cfg name=opt/org.tianocore/VirtioNetSupport,string={yes,no}

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Gerd Hoffmann 5be587067a OvmfPkg: move USB drivers to new UsbComponents.dsc.inc
Allows to update USB driver configuration without
touching all *.dsc files.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Gerd Hoffmann b3b3cfab7e OvmfPkg: move VirtioNet to NetworkComponents.dsc.inc
Allows to update VirtioNet driver configuration without
touching all *.dsc files.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 20:45:29 +00:00
Alexander Gryanko 35706d43c5 NetworkPkg: PXE boot option build flag
Currently, the only way to disable PXE boot options is to change the PCD
variables PcdIPv4PXESupport and PcdIPv6PXESupport in the source code or
use the "--pcd" option in the build script. Other boot options such
as HTTP or iSCSI can be disabled using the -D<option> flag.
NETWORK_PXE_BOOT_ENABLE will add a consistent way to disable PXE booting.
This is the third and final part of a series of patches to enable the
NETWORK_PXE_BOOT_ENABLE build flag. At this point, the flag will be able
to disable PXE functionality.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2024-12-06 18:26:01 +00:00
Alexander Gryanko 087a47688c OvmfPkg: PXE boot option build flag
The second step is to add an option to the OvmfPkg module to disable
PXE booting using the NETWORK_PXE_BOOT_ENABLE flag. The patch is divided
into 3 parts. At the current stage the flag is not functional.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2024-12-06 18:26:01 +00:00
Alexander Gryanko 9e0c46efb0 ArmVirtPkg: PXE boot option build flag
The first step is to add an option to disable PXE loading. The patch is
divided into 3 parts. This part adds the NETWORK_PXE_BOOT_ENABLE flag
to the ArmVirtPkg module. At the current stage the flag is not functional.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2024-12-06 18:26:01 +00:00
Mike Maslenkin f6422011e5 MdeModulePkg/PlatformDriOverrideDxe: fix HiiOpCodeHandle leak
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-12-06 17:13:17 +00:00
Mike Maslenkin 1b283cf437 MdeModulePkg/UiApp: fix HiiOpCodeHandle leak
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-12-06 17:13:17 +00:00
Mike Maslenkin e8cfc7beba NetworkPkg/IScsiDxe: fix HiiOpCodeHandle leak
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-12-06 17:13:17 +00:00
Mike Maslenkin b1cdfc556f SecurityPkg/OpalPassword: fix HiiOpCodeHandle leak on error path
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-12-06 17:13:17 +00:00
Doug Cook (WINDOWS) fd9501f582 DxeRngLib: GetRandomNumber spurious success
The GetRandomNumber functions in DxeRngLib can return success without
actually generating a random number. This occurs because there are code
paths through `GenerateRandomNumberViaNist800Algorithm` that do not
initialize the `Status` variable.

- Assume mFirstAlgo == MAX_UINTN (no secure algorithms available)
- Assume none of the secure algorithms have `Available` set.
- Assume PcdEnforceSecureRngAlgorithms is TRUE.

In this condition, the `Status` variable is never initialized, `Buffer`
data is never touched. It is fairly likely that Status is 0, so we can
return EFI_SUCCESS without writing anything to Buffer.

Fix is to set `Status = error_code` in this code path.
`EFI_SECURITY_VIOLATION` seems appropriate.

Signed-off-by: Doug Cook <idigdoug@gmail.com>
2024-12-06 15:55:55 +00:00
Doug Cook (WINDOWS) bbcdc0b7d9 MdePkg: Improve comments on DebugLib PCDs
DebugLib PCDs are very important, but they're confusing and not
well-explained anywhere. Improve the documentation comments for them to
explain how they work and how they relate to each other.

Signed-off-by: Doug Cook <idigdoug@gmail.com>
2024-12-06 14:34:18 +00:00
Rebecca Cran 5b2d55533b BaseTools: Improve error messages from UefiCapsuleHeader.py
Instead of throwing ValueErrors with no explanation, add a message
explaining what went wrong.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-12-06 13:02:18 +00:00
Phil Noh e508c6c08a MdeModulePkg/DxeIplPeim: Free scratch buffer after FV extraction
The scratch buffer (EfiBootServicesData) is assigned to extract DXE FVs
that are compressed. The matching decompression library returns the buffer
size as below. The buffer is no longer used after completing extraction.
Need to free the buffer to optimize memory allocation and usage.

BaseUefiDecompressLib : sizeof (SCRATCH_DATA)
LzmaCustomDecompressLib : SCRATCH_BUFFER_REQUEST_SIZE (64KB)
BrotliCustomDecompressLib : From EncodeData header (usually, xxMB checked)

In case of Brotli decompression, it is found that a big chunk of memory is
required, based on EncodeData header. (e.g. a 4MB compressed FV reports
about 39MB scratch size)

Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2024-12-06 10:17:16 +00:00
Gerd Hoffmann 73570d8ab6 openssl: disable visual studio warning #4189
4189 is "local variable is initialized but not referenced"

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann 99e18f2327 CryptoPkg: CI: update OpensslGen file list
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann 8c5dcecd24 CryptoPkg: gcc needs 4k section alignment too
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann 9895fe25ac CryptoPkg/BaseCryptLib: add next parameter to SHA3_squeeze
Needed for openssl 3.3.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann a801363249 CryptoPkg: add openssl/providers/fips/include to includes
Needed for openssl 3.4.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann 005f4c6b5e openssl: add more stubs for openssl 3.2.x
openssl-3.2.2 got a few more tls config hooks, add stubs for them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann 53cea8efd1 openssl: adapt stubs to openssl 3.2.x
Function declarations have changed in openssl-3.2.x, adapt the stubs.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann 8f6c2ccc45 openssl: update generated files
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Gerd Hoffmann e584e865f8 openssl: update submodule to 3.4.0
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-12-06 08:01:25 +00:00
Aniket_Surekar 333e9638ad MdeModulePkg/Bus/Pci: Fix Descriptor Misalignment in USB Config Handling
The issue with locating the expected interface and endpoint descriptors
arises because `configDesc` (USB_CONFIG_DESCRIPTOR) and `IfDesc`
(USB_INTERFACE_DESCRIPTOR) are incremented by structure size rather than
by actual descriptor length.

Specifically:
  - `configDesc` should be incremented by its actual length.
  - `IfDesc` should be incremented by its actual length.

This incorrect increment causes misalignment, preventing access to the
subsequent interface and endpoint descriptors.

[Suggested Solution]
Update the code to increment the pointers by the actual descriptor lengths,
ensuring proper access to all descriptors in the USB configuration.

Signed-off-by: Aniket Surekar <Aniket.Surekar@Dell.com>
2024-12-06 01:45:22 +00:00
Ard Biesheuvel e8668d2dee MdeModulePkg/DxeCore: Call BeforeExitBootServices event group only once
According to UEFI spec 2.10 errata A section 7.4.6

  "All events from the EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES and
  EFI_EVENT_GROUP_EXIT_BOOT_SERVICES event notification groups as well
  as events of type EVT_SIGNAL_EXIT_BOOT_SERVICES must be signaled
  before ExitBootServices() returns EFI_SUCCESS. The events are only
  signaled once even if ExitBootServices() is called multiple times."

So keep track of whether ExitBootServices() has been called, and signal
the event group EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES only the first
time around.

EFI_EVENT_GROUP_EXIT_BOOT_SERVICES will only be signalled if
ExitBootServices() is going to run to [successful] completion, after
which calling it a second time is not possible anyway. So for this case,
no special handling is needed.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-12-06 08:33:53 +08:00
Ard Biesheuvel 47e28a6d44 ArmVirtPkg/ArmPlatformLibQemu: Enable early ID map on EL2+VHE
When booting at EL2, enable VHE if available so that the early ID map
can be enabled as well. This gets rid of any memory accesses (reads or
writes) before the MMU and caches are enabled.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-12-05 10:50:48 +00:00
Chao Li 793f4d2662 Maintainers.txt: Add a new R for LoongArch64
Added Xiangdong Meng as a new reviewer for LoongArch64 ARCH.

Signed-off-by: Chao Li <lichao@loongson.cn>
2024-12-05 03:10:43 +00:00