Commit Graph

33200 Commits

Author SHA1 Message Date
Joey Vagedes 7c10472983 SourceLevelDebugPkg/SourceLevelDebugPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes abf21d76e7 SignedCapsulePkg/SignedCapsulePkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes 0cfed09674 ShellPkg/ShellPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes 6ead9a8b80 SecurityPkg/SecurityPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes 89bad0726c PcAtChipsetPkg/PcAtChipsetPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes ea5581186e NetworkPkg/NetworkPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes c79487605a EmulatorPkg/EmulatorPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes 2ccf94d37b ArmPlatformPkg/ArmPlatformPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Joey Vagedes 715200ea60 ArmPkg/ArmPkg.ci.yaml: Add PrEval CI config
Adds an entry to the package's CI configuration file that enable policy
5 for stuart_pr_eval. With this Policy, all INFs used by the package are
extracted from the provided DSC file and compared against the list of
changed *.inf (INF) files in the PR. If there is a match, stuart_pr_eval
will specify that this package is affected by the PR and needs to be
tested.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-09-02 23:20:35 +00:00
Nickle Wang 814470b834 NetworkPkg/SnpDxe: return error for unsupported parameter
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4729

From SCT testing report, Reset() does not support the case when
ExtendedVerification is set to FALSE. So, we should return
EFI_INVALID_PARAMETER in this case. For details, please refer to
Bug 4729.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
2024-09-02 22:17:12 +00:00
Ken Lautner 82c5cacd13 NetworkPkg: DxeHttpLib: Use HTTP error 429
Include a mapping for HTTP error 429 to return the correct
status code. Additionally include a link to the official
HTTP status codes in the HttpMappingToStatusCode function header.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-02 21:17:25 +00:00
Ken Lautner 829f773e5c MdePkg: Add HTTP error 429
Add support for HTTP error 429 in the protocol .h file.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-02 21:17:25 +00:00
xieyuanh eaf78e43f2 MdeModulePkg: Enable VarCheckHiiLibStandaloneMm.
Enable VarCheckHiiLibStandaloneMm.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh df58def118 MdeModulePkg: Add VarCheckHiiLibStandaloneMm.
This library is designed for handling variable HII checks within the
Standalone MMm environment. It includes the functions
dedicated to registering handlers that process information received
from VarCheckHiiLibMmDependency.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh 02f6774803 MdeModulePkg: Move DUMP_VAR_CHECK_HII in common file
No functional changes.
Move DUMP_VAR_CHECK_HII in common file

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh 45cf57ce79 MdeModulePkg: Relocate VarCheckHiiInternalDumpHex, VarCheckHiiQuestion
Move VarCheckHiiInternalDumpHex and VarCheckHiiQuestion to the common
file.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh 3956f4e392 MdeModulePkg: Wrap SetVariableCheckHandlerHii as a common API
Rename SetVariableCheckHandlerHii and wrap it as a common API to
facilitate the usage in the following patches.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh db43a80c10 MdeModulePkg: Rename VarCheckHiiLibNullClass as VarCheckHiiLib.
No functional changes.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh 5718c9b06f MdeModulePkg: Modified BuildVarCheckHiiBin parameter to IN OUT.
Change the Size parameter of BuildVarCheckHiiBin from OUT to an
input-output parameter.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh ee1e163a2f MdeModulePkg: Enable VarCheckHiiLibMmDependency
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh 6b3ac9cbf8 MdeModulePkg: Add VarCheckHiiLibMmDependency library.
VarCheckHiiLibMmDependency retrieve data (mVarCheckHiiBin) at the end
of the DXE phase, and pass the acquired data to the
VarCheckHiiLibStandaloneMm through a communication protocol.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
xieyuanh 4aea90ea53 MdeModulePkg: Relocation of mVarCheckHiiBin declaration
Relocate the declaration of mVarCheckHiiBin to support for standalone
MM modules utilizing the same mVarCheckHiiBin.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
2024-09-02 17:26:58 +00:00
Abdul Lateef Attar 238ccc5944 DynamicTablesPkg: Adds generic ACPI Creator ID
Adds generic creator id as DYNT.
Updates the common ACPI tables with generic CreatorId.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-09-02 16:34:00 +00:00
Abdul Lateef Attar 5dafa13d62 DynamicTablesPkg: Adds WSMT generator for X64
Adds ACPI WSMT table generator library.
Updates acpi standard table enum with wsmt.
Updates X64 namespace object.
Updates the object parser.
Updates the Readme.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-09-02 14:23:41 +00:00
zodf0055980 a5f5432728 SecurityPkg: Fix break missing at TPM_ALG_KEYEDHASH case
According issue #5509, case TPM_ALG_KEYEDHASH is missing the break statement.

Signed-off-by: zodf0055980 <zodf0055980@gmail.com>
2024-09-02 12:17:33 +00:00
Ken Lautner 50871ee0ec BaseTools: GenMake: FIx missing logs from GenMake.py
EdkLogger logs were not showing up as part of the build log output.
Adding the EdkLogger import to GenMake.py fixes the missing log prints.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-02 06:32:06 +00:00
Wei6 Xu 91853ca6a5 MdeModulePkg/VariableStandaloneMm: Notify variable write ready in MM
In Standalone MM, there is no notification to MM drivers that variable
write is ready. Install gSmmVariableWriteGuid into MM handle database
for the notification.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2024-09-02 12:43:49 +08:00
Carsten Haitzler af15e4535d ArmPkg: Fix timer wrap-around
The timer counter register can wrap around and when this happens,
we'll get misbehavior for any MicroSecondDelay() calls. This adds
handling for that.

Signed-off-by: Carsten Haitzler <carsten.haitzler@foss.arm.com>
2024-09-01 09:55:01 +00:00
Saloni Kasbekar 4ef87f455b MdePkg: Add Reset Reason definitions
Add Reset Reason definitions defined in ACPI 6.5

Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2024-08-31 18:19:17 +00:00
zodf0055980 f7abf6af2d SecurityPkg: Fix exponent unmarshaled as 16 bits
According issue #5536, exponent is 32 bits but is unmarshaled as 16 bits.

Signed-off-by: zodf0055980 <zodf0055980@gmail.com>
2024-08-31 16:43:28 +00:00
Matthew Carlson 96b90e150c SecurityPkg: Measure Invoke EBS even in failure case
This patch measures the ExitBootServices invocation to the
TPM even in the case of ExitBootServices failing, per TCG
PC Client Platform Firmware Profile Version 1.06 Revision
52 Family 2.0 section 8.2.4(i).

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-08-31 09:17:27 +00:00
Ashraf Ali baecba68a3 MdePkg: Remove duplicate source from BaseMemoryLib INF files
Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
2024-08-31 06:00:04 +00:00
Joey Vagedes 95ee7f3ef7 BaseTools: Trim: Add header/footer for ASL include
When including one ASL file in another, add a header / footer to the
included file to easily tell where the included file starts and ends.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2024-08-31 04:58:54 +00:00
Ard Biesheuvel 90d861f63d CryptoPkg/BaseCryptLibMbedTls: Fix uninitialized variable errors
Clang complains about a couple of variables potentially being
uninitialized, and those complaints seem to be valid.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-08-31 02:46:51 +00:00
Ard Biesheuvel 468a36b22f CryptoPkg/OpensslLib CLANGDWARF: Use gnu99 C dialect for asm() support
'asm' is not a keyword in C99, but GCC supports it nonetheless as a GNU
extension. So when using Clang, we must specify the gnu99 dialect
explicitly, or inline asm blocks using asm() rather than __asm__() will
be rejected by the compiler.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-08-31 01:30:23 +00:00
Dionna Glaze 5c63e22a9f OvmfPkg: Move kernel hashes section to end
When launching a SEV-SNP VM, the ROM is not all that must be measured.
The OvmfSevMetadata sections describe ranges of memory that must be
measured with different types than PAGE_TYPE_NORMAL, except one. The
SevSnpKernelHashes page is also PAGE_TYPE_NORMAL, but is populated by
the VMM from configuration data that is separate from the OVMF build
itself. To more compactly provide reference values for the measurement
of the firmware separately from the kernel hashes, it's advantageous to
measure as much known information as possible first.

Whereas VMMs are permitted to measure these sections in any order they
prefer, the normative order of how they appear in the .fd is easiest to
follow. This change is semantics-preserving. Measurement calculation
tools that do not follow the normative ordering would need updating to
accommodate, but I don't know of any. The accounting for EC2 moving the
CPUID page to the end of measurement would be unchanged.

This change is to improve performance of a proposed launch update event
log to separate responsibility for initially measured data before VM
launch, application/vnd.amd.sevsnp.launch-updates+cbor:

https://github.com/deeglaze/draft-deeglaze-amd-sev-snp-corim-profile

Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
2024-08-31 00:10:51 +00:00
Oliver Smith-Denny 662272ef41 Sync AARCH64 GCD Capabilities with Page Table
On AARCH64 systems, the GCD is not fully synced with the page table. On
x86 systems, the GCD is synced by adding `EFI_MEMORY_RO`,
`EFI_MEMORY_RP`, and `EFI_MEMORY_XP` to the current capabilities of the
GCD, then the page table attributes are set on the GCD attributes.

However, on AARCH64, the GCD capabilities do not get updated, instead
only the attributes from the page table are masked by the existing GCD
capabilities, which means that any new page table attribute which are
already set are dropped and the GCD does not reflect the state of the
system. This has been seen to cause issues where memory in the page
table that was marked `EFI_MEMORY_XP` had an additional attribute set
using the GCD capabilities, which did not include `EFI_MEMORY_XP`, this
caused the page table to be updated to lose `EFI_MEMORY_XP`, which is a
potential security issue.

The existing behavior on AARCH64 systems is an implementation error, it
assumes one of two things:
- The page table attributes must be a subset of the GCD capabilities
- The GCD does not need to have its capabilities synced to what the page
table attributes are

The first is incorrect as important attributes such as `EFI_MEMORY_XP`
do not get applied to the GCD capabilities by default and therefore must
be synced back. This comment from ArmPkg's CpuDxe driver helps explain:

```c
  // The GCD implementation maintains its own copy of the state of memory
  // space attributes.  GCD needs to know what the initial memory space
  // attributes are.  The CPU Arch. Protocol does not provide a
  // GetMemoryAttributes function for GCD to get this so we must resort to
  // calling GCD (as if we were a client) to update its copy of the
  // attributes.  This is bad architecture and should be replaced with a
  // way for GCD to query the CPU Arch. driver of the existing memory
  // space attributes instead.
```

However, this comment misses that updating the capabilities is critical
to updating the attributes.

The second is incorrect because significant pieces of core code
reference the GCD attributes instead of the page table attributes. For
example, NonDiscoverablePciDeviceDxe uses the GCD capabilities and
attributes when interacting with a non-discoverable PCI device. When the
GCD is not synced to the page table, we get the errors and security
concerns listed above.

Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
2024-08-30 23:03:21 +00:00
Gerd Hoffmann 2069a63a8e OvmfPkg/PlatformInitLib: allow switching to 4-level paging
There are a number of mostly older guests such as RHEL-7 which do not
support 5-level paging.  This patch adds support for switching from
5-level paging mode back to 4-level paging mode.  This is done in PEI,
after inspecting the address space needed (installed memory and
reservations configured via fw_cfg).

By default small guests (which need less than 1 TB) will use 4-level
paging mode.  There is a fw_cfg override though, so it is possible to
force the one or the other this way:

qemu-system-x86_64 -fw_cfg name=opt/org.tianocode/PagingLevel,string=5

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2024-08-30 22:13:44 +00:00
Chao Li f6092b5e2b MdePkg: Remove the old name of LoongArch CSR 0x20
Since all places where the old name was used for the LoongArch CSR 0x20
regiser have been changed to the new name, the old name is removed.

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>
2024-08-30 19:54:01 +00:00
Chao Li bc518f81fd OvmfPkg: Using the new name of LoongArch CSR 0x20 register
Since the LoongArch SPEC has adjusted the CSR 0x20 register name and
the MdePkg also added the new name, so enable it in OvmfPkg.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
2024-08-30 19:54:01 +00:00
Chao Li 2fe24171ac UefiCpuPkg: Using the new name of LoongArch CSR 0x20 register
Since the LoongArch SPEC has adjusted the CSR 0x20 register name and
the MdePkg also added the new name, so enable it in UefiCpuPkg.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
2024-08-30 19:54:01 +00:00
Chao Li a066ca16d3 MdePkg: Rename the LoongArch CSR 0x20 register
Added a new name for CSR 0x20 because LoongArch SPEC has adjustd the CSR
0x20 register name.

Ref: LoongArch Reference Manual Vol 1, Seciton 7.1.
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers

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>
2024-08-30 19:54:01 +00:00
Wei6 Xu d5c7bba504 StandaloneMmPkg: Restart dispatcher once MM entry is registered for X64
X64 arch needs to restart the MM dispatcher once MM entry point is
registered, therefore set PcdRestartMmDispatcherOnceMmEntryRegistered
to TRUE by default for X64 only.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2024-08-30 18:27:36 +00:00
Anthony PERARD 0b0b7041cc OvmfPkg/OvmfXen: Introduce Xen's ResetSystemLib, to use xen hypercall
When booting OvmfXen, the ACPI interface for shutdown/reset might not
be available, instead use the hypercall interface.

While it's probably possible to use the hypercall in all cases, we
keep using the same interface while it still possible. That is ACPI on
HVM guest, and fallback to hypercall on PVH guest.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
2024-08-30 16:55:41 +00:00
Anthony PERARD 6ed258d89d OvmfPkg/XenHypercallLib: Add SchedOp hypercall
Add a new function to allow to make an hypercall to shutdown the
machine.

This import "sched.h" public header from Xen Project's repo. Some
changes have been made to be closer to EDK2's coding style.

Add the entire OvmfPkg/Include/IndustryStandard/Xen/ directory to
LicenseCheck ignore.  All the existing header files, as well as the new
sched.h, are MIT licensed.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
2024-08-30 16:55:41 +00:00
Jason Andryuk 043eab84e5 OvmfPkg/XenPlatformPei: Remove Hypercall Page
XenHypercallLib now makes direct hypercalls, so HyperPages is
unnecessary and can be removed.

Change the XenPvhDetected() ASSERT to use the Xen version.  That has
never been 0, AFAIK.

Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
2024-08-30 16:55:41 +00:00
Jason Andryuk 0e6f6c715c OvmfPkg/XenHypercallLib: Use direct hypercalls
This removes the need to allocate memory for the hypercall page,
particularly for use during runtime.  This also makes the library usable
in all phases, so LIBRARY_CLASS can remove the restrictions.

The processor vendor is used to select vmmcall or vmcall instructions.
The listed vendors are those in the Xen tree.

Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
2024-08-30 16:55:41 +00:00
Ceping Sun 9d5a9940e4 OvmfPkg: Refactor PcdSetNxForStack usage in TDVF
In the current code, TDVF reads the PcdSetNxForStack value via fw_cfg ,
but overwrites it with a fixed value after the read is complete.

In this patch, TDVF removes the redundant logic code.

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-08-30 15:45:40 +00:00
Rebecca Cran a1b0703e8e EmbeddedPkg: Improve LocateAndInstallAcpiFromFvConditional
LocateAndInstallAcpiFromFvConditional was always returning EFI_SUCCESS
even when it failed to find `AcpiFile`. Fix that, and improve the layout
by checking if an error occurred and breaking earlier.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-08-30 14:03:51 +00:00
Wei6 Xu 5aa6842715 MdeModulePkg/VariableStandaloneMm: Fix TCG MOR secure feature issue
According to TCG's Platform Reset Attack Mitigation spec, the OS should
never create the MOR variable, only read and write it.
But some OSes (Fedora 24 and 25) don't follow the TCG's Platform Reset
Attack Mitigation spec and unintentionally create MOR variable.

The commit fda8f631ed added function
VariableHaveTcgProtocols() to check against Tcg/Tcg2 protocol to infer
whether the MOR variable is created by platform firmware or not. If not,
delete the variable created by OS and lock the variable to avoid OS to
create it.

But in VariableStandaloneMm, VariableHaveTcgProtocols() always returns
FALSE, it causes TCG MOR secure feature does not work in standalone MM
environment.

As Fedora 24 and 25 are EOL today, directly returns TRUE in the function
VariableHaveTcgProtocols() for VariableStandaloneMm, and rename the
function to VariableIsMorVariableLegitimate() to make it more obvious
what the narrow use-case is for which it exists.

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2024-08-30 13:18:08 +00:00