]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
2 years agoMdeModulePkg: Add a check for metadata size in NvmExpress Driver
Ma, Hua [Thu, 3 Mar 2022 05:06:04 +0000 (13:06 +0800)]
MdeModulePkg: Add a check for metadata size in NvmExpress Driver

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3856

Currently this NvmeExpress Driver do not support metadata handling.
According to the NVME specs, metadata may be transferred to the host after
the logical block data. It can overrun the input buffer which may only
be the size of logical block data.

Add a check to return not support for the namespaces formatted with
metadata.

v2 changes:
 - Change debug log level from INFO to ERROR
 - Change to if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0)

v1: https://edk2.groups.io/g/devel/message/87242

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoUefiPayloadPkg: Fix case of protocol
Sean Rhodes [Fri, 4 Mar 2022 23:05:11 +0000 (16:05 -0700)]
UefiPayloadPkg: Fix case of protocol

Fix case match in <Protocol/MpService.h> to avoid build failure on
Linux.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoUefiPayloadPkg: Add build option for Above 4G Memory
Sean Rhodes [Wed, 23 Feb 2022 22:59:33 +0000 (15:59 -0700)]
UefiPayloadPkg: Add build option for Above 4G Memory

When build option ABOVE_4G_MEMORY is set to true, nothing will change
and EDKII will use all available memory.

Setting it to false will create memory type information HOB in
payload entry, so that EDKII will reserve enough memory below 4G
for EDKII modules. This option is useful for bootloaders that are not
fully 64-bit aware such as Qubes R4.0.4 bootloader, Zorin and Proxmox.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoMaintainers.txt: Add new reviewer for UefiPayloadPkg
Guo Dong [Wed, 23 Feb 2022 23:19:01 +0000 (16:19 -0700)]
Maintainers.txt: Add new reviewer for UefiPayloadPkg

Add Sean Rhodes as UefiPayload reviewer mainly focus on
UEFI payload for coreboot support.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2 years agoUefiCpuPkg: Extend SMM CPU Service with rendezvous support.
Li, Zhihao [Tue, 1 Mar 2022 11:22:19 +0000 (19:22 +0800)]
UefiCpuPkg: Extend SMM CPU Service with rendezvous support.

REF? https://bugzilla.tianocore.org/show_bug.cgi?id=3815

This patch define a new Protocol with the new services
SmmWaitForAllProcessor(), which can be used by SMI handler
to optionally wait for other APs to complete SMM rendezvous in
relaxed AP mode.

A new library SmmCpuRendezvousLib is provided to abstract the service
into library API to simple SMI handler code.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Zhihao Li <zhihao.li@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
2 years agoOvmfPkg: CloudHv: Add README
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:37 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Add README

Add some documentation to the CloudHv target in order to clarify how to
use it and what to expect from it.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: CloudHv: Rely on PVH memmap instead of CMOS
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:36 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Rely on PVH memmap instead of CMOS

Instead of using the CMOS, the CloudHv platform relies on the list of
memmap entries provided through the PVH boot protocol to determine the
last RAM address below 4G.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: CloudHv: Retrieve RSDP address from PVH
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:35 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Retrieve RSDP address from PVH

Instead of hardcoding the address of the RSDP in the firmware, let's
rely on the PVH structure hvm_start_info to retrieve this information.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Generate CloudHv as a PVH ELF binary
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:34 +0000 (21:31 +0800)]
OvmfPkg: Generate CloudHv as a PVH ELF binary

Following the model from the Xen target, CloudHv is generated as a PVH
ELF binary to take advantage of the PVH specification, which requires
less emulation from the VMM.

The fdf include file CloudHvElfHeader.fdf.inc has been generated from
the following commands:

$ gcc -D PVH64 -o elf_gen OvmfPkg/OvmfXenElfHeaderGenerator.c
$ ./elf_gen 4194304 OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: CloudHv: Remove VARS and CODE sections
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:33 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Remove VARS and CODE sections

CloudHv doesn't need any VARS store, and it doesn't need the CODE
section to be generated separately either. The only thing needed is to
generate a firmware binary that can be used by Cloud Hypervisor.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Xen: Generate fdf include file from ELF header generator
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:32 +0000 (21:31 +0800)]
OvmfPkg: Xen: Generate fdf include file from ELF header generator

Updating the fdf include file based on the run of the ELF header
generator. The diff from this patch is the result of:

$ gcc -o elf_gen OvmfPkg/OvmfXenElfHeaderGenerator.c
$ ./elf_gen 2097152 OvmfPkg/XenElfHeader.fdf.inc

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Xen: Use a new fdf include for the PVH ELF header
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:31 +0000 (21:31 +0800)]
OvmfPkg: Xen: Use a new fdf include for the PVH ELF header

Instead of having the PVH ELF header part of the fdf file directly, we
move it to a dedicated include file. This is the first step in
automating the generation of the header.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Make the Xen ELF header generator more flexible
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:30 +0000 (21:31 +0800)]
OvmfPkg: Make the Xen ELF header generator more flexible

Adding some flexibility to the program through optional parameters and
global define, so that other targets can use the generator.

* A global define is added so that we can choose at build time if we
  want to use 32-bit or 64-bit base structures.
* A first optional parameter is added so the user can provide the
  expected blob size of the generated binary.
* A second optional parameter is added so the user can specify an output
  file to which the generated output will be printed.

The default behavior isn't modified.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting
Sean Rhodes [Thu, 24 Feb 2022 11:38:18 +0000 (19:38 +0800)]
MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting

No need to check the interface protocol then conditionally setting,
just set it to BOOT_PROTOCOL and check for error.

This is what Linux does for HID devices as some don't follow the USB spec.
One example is the Aspeed BMC HID keyboard device, which adds a massive
boot delay without this patch as it doesn't respond to
'GetProtocolRequest'.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoEmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully
Guomin Jiang [Tue, 22 Feb 2022 03:29:23 +0000 (11:29 +0800)]
EmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668

WindowOpen will fail in some case. for example, without XServer.

Shouldn't set ModeInfo in this case to avoid the caller use it
incorrectly

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoMdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error
Guomin Jiang [Sun, 20 Feb 2022 06:53:01 +0000 (14:53 +0800)]
MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668

SetMode will fail in some case. for example, without XServer.
Should handle these case when SetMode fail.

If we don't handle it, it will Segmentation fault.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoedk2/MdeModulePkg/Debuglib: Add Standalone MM support
Xiaolu.Jiang [Tue, 22 Feb 2022 14:14:05 +0000 (22:14 +0800)]
edk2/MdeModulePkg/Debuglib: Add Standalone MM support

https://bugzilla.tianocore.org/show_bug.cgi?id=3844

This change added Standalone MM instance of DebugLib.

Reviewd-by: Jian J Wang <jian.j.wang@intel.com>
Reviewd-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Xiaolu.Jiang <xiaolu.jiang@intel.com>
2 years agoUefiPayloadPkg/PayloadLoaderPeim: Use INT64 as input parameter
Guomin Jiang [Sat, 29 Jan 2022 08:28:02 +0000 (16:28 +0800)]
UefiPayloadPkg/PayloadLoaderPeim: Use INT64 as input parameter

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3818

It will have some potential issue when memory larger than 2G because
the high memory address will be fill with 0xFFFFFFFF when do the
operation of INTN + INT64 but it is 32 bit normal data in fact.

Should use same data type INT64 + INT64.

V3:
1. Use INT64 as input parameter because all date type is 64 bit
V2:
1. Force the data type to UINTN to avoid high dword be filled with
0xFFFFFFFF
2. Keep INTN because the offset may postive or negative.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoBaseTools: Upgrade the version of NASM tool
Jason [Mon, 10 Jan 2022 14:30:29 +0000 (22:30 +0800)]
BaseTools: Upgrade the version of NASM tool

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Upgrade the version of NASM tool to avoid compilation errors when
compiling NASM code change.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
2 years agoMdePkg: Remove the macro definitions regarding Opcode.
Jason [Mon, 10 Jan 2022 14:05:47 +0000 (22:05 +0800)]
MdePkg: Remove the macro definitions regarding Opcode.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Remove the macro definitions regarding Opcode because new version of
NASM tool(e.g. v2.15.05) supports the corresponding instructions.
Note: This patch need to be merged after other NASM code change to avoid
compilation errors.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoUefiCpuPkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 14:01:18 +0000 (22:01 +0800)]
UefiCpuPkg: Replace Opcode with the corresponding instructions.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2 years agoSourceLevelDebugPkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 13:52:52 +0000 (21:52 +0800)]
SourceLevelDebugPkg: Replace Opcode with the corresponding instructions.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoMdePkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 13:46:27 +0000 (21:46 +0800)]
MdePkg: Replace Opcode with the corresponding instructions.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoMdeModulePkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 13:04:09 +0000 (21:04 +0800)]
MdeModulePkg: Replace Opcode with the corresponding instructions.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg: Correct high-memory use in NvmExpressDxe
Tomas Pilar [Thu, 24 Feb 2022 16:22:19 +0000 (16:22 +0000)]
MdeModulePkg: Correct high-memory use in NvmExpressDxe

Move the logic that stores starting PCI attributes and sets the
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE attribute to
DriverBindingStart() before the memory that backs the
DMA engine is allocated.

This ensures that the DMA-backing memory is not forcibly allocated
below 4G in system address map. Otherwise the allocation fails on
platforms that do not have any memory below the 4G mark and the drive
initialisation fails.

Leave the PCI device enabling attribute logic in NvmeControllerInit()
to ensure that the device is re-enabled on reset in case it was
disabled via PCI attributes.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Tomas Pilar <quic_tpilar@quicinc.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoOvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea
Brijesh Singh [Mon, 21 Feb 2022 14:59:14 +0000 (22:59 +0800)]
OvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3582

Improve the MemEncryptSev{Es,Snp}IsEnabled() to use the SEV_STATUS MSR
value saved in the workarea. Since workarea is valid until the PEI phase,
so, for the Dxe phase use the PcdConfidentialComputingGuestAttr to
determine which SEV technology is enabled.

Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/ResetVector: cache the SEV status MSR value in workarea
Brijesh Singh [Mon, 21 Feb 2022 14:59:13 +0000 (22:59 +0800)]
OvmfPkg/ResetVector: cache the SEV status MSR value in workarea

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3582

In order to probe the SEV feature the BaseMemEncryptLib and Reset vector
reads the SEV_STATUS MSR. Cache the value on the first read in the
workarea. In the next patches the value saved in the workarea will
be used by the BaseMemEncryptLib. This not only eliminates the extra
MSR reads it also helps cleaning up the code in BaseMemEncryptLib.

Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/AmdSev: reserve snp pages
Gerd Hoffmann [Wed, 16 Feb 2022 07:00:57 +0000 (15:00 +0800)]
OvmfPkg/AmdSev: reserve snp pages

The SNP patch series updated the OvmfPkgX64 build but forgot the AmdSev
variant, resulting in a broken OvmfSevMetadata table.

Fixes: cca9cd3dd6bf ("OvmfPkg: reserve CPUID page")
Fixes: 707c71a01b9d ("OvmfPkg: reserve SNP secrets page")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmVirtPkg/ArmVirtKvmTool: wire up configurable timeout
Ard Biesheuvel [Tue, 1 Feb 2022 18:00:47 +0000 (19:00 +0100)]
ArmVirtPkg/ArmVirtKvmTool: wire up configurable timeout

Use the correct PCD type for PcdPlatformBootTimeOut so it gets wired up
to the Timeout EFI variable automatically, which is how the boot manager
stores the timeout preference.

Note that this changes the default to 5 seconds, which appears to be
common across platforms.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmVirtPkg/ArmVirtMemoryInitPeiLib: avoid redundant cache invalidation
Ard Biesheuvel [Sat, 29 Jan 2022 14:58:26 +0000 (15:58 +0100)]
ArmVirtPkg/ArmVirtMemoryInitPeiLib: avoid redundant cache invalidation

Alex reports that the cache invalidation performed by
ArmVirtMemoryInitPeiLib takes a non-negligible amount of time at boot.
This cache invalidation used to be necessary to avoid inconsistencies
between the CPU's cached and uncached views of the permanent PEI memory
region, given that the PEI phase is where the MMU gets enabled.

The only allocations done from permanent PEI memory with the MMU off are
pages used for page tables, and since commit 748fea6279ef
("ArmPkg/ArmMmuLib AARCH64: invalidate page tables before populating
them"), each of those is invalidated in the caches explicitly, for
reasons described in the patch's commit log. All other allocations done
in PEI are either from temporary PEI memory, which includes the stack,
or from permanent PEI memory but after the MMU has been enabled.

This means that the cache invalidation in ArmVirtMemoryInitPeiLib is no
longer necessary, and can simply be dropped.

Reported-by: Alexander Graf <graf@amazon.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoNetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite edk2-stable202202
Heng Luo [Wed, 26 Jan 2022 05:12:21 +0000 (13:12 +0800)]
NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3813

The size of buffer should be 3 CHAR16 for Null-terminated Unicode
string.
The first char is the AKM/Cipher Suite number, the second char is ' ',
the third char is '\0'.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
2 years agoShellPkg: Fix Ping GetTimerPeriod API failure
Rehan, MohammedX [Tue, 15 Feb 2022 08:07:03 +0000 (16:07 +0800)]
ShellPkg: Fix Ping GetTimerPeriod API failure

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3819

Ping GetTimerPeriod API returns sometime zero value when
StallCounter has smaller value than RttTimerTick (divide by zero)
which results some failure at ping UEFI shell command

Signed-off-by: MohammedX Rehan <mohammedx.rehan@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoOvmfPkg/FvbServicesSmm: use the VmgExitLibNull
Brijesh Singh [Tue, 15 Feb 2022 15:16:38 +0000 (23:16 +0800)]
OvmfPkg/FvbServicesSmm: use the VmgExitLibNull

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3835

The commit ade62c18f4742301bbef474ac10518bde5972fba caused a boot failure
when OVMF is build with SECURE_BOOT/SMM enabled.

This happen because the above commit extended the BaseMemEncryptSevLib.inf
to include VmgExitLib. The FvbServicesSmm uses the functions provided
by the MemEncryptSevLib to clear the memory encryption mask from the
page table. It created a dependency, as shown below

OvmfPkg/FvbServicesSmm.inf
 ---> MemEncryptSevLib                   class
 ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
 ---> VmgExitLib
 ---> "OvmfPkg/VmgExitLib"    instance
 ---> LocalApicLib                       class
 ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf    instance
 ---> TimerLib                           class
 ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"              instance
 ---> PciLib                             class
 ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"     instance

The LocalApicLib provides a constructor, execution of the constructor
causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
skip including the VmgExitLib chain. Use the module override to use the
VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib dependency
chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
see commit 19914edc5a0202cc7830f819ffac7e7b2368166a

After the patch, the dependency look like this:

OvmfPkg/FvbServicesSmm.inf
 ---> MemEncryptSevLib                   class
 ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
 ---> VmgExitLib
 ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance

Fixes: ade62c18f4742301bbef474ac10518bde5972fba
Reported-by: Aaron Young <aaron.young@oracle.com>
Cc: Dann Frazier <dann.frazier@canonical.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/VmgExitLib: Fix uninitialized variable warning with XCODE5
Rebecca Cran [Fri, 4 Feb 2022 20:13:02 +0000 (13:13 -0700)]
OvmfPkg/VmgExitLib: Fix uninitialized variable warning with XCODE5

XCODE5 reported the following warning:

OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c:1895:12: note:
uninitialized use occurs here
           Compacted
           ^^^^^^^^^

Initialize the 'Compacted' variable to fix the warning.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoMdeModulePkg: update brotli submodule
Bob Feng [Wed, 26 Jan 2022 08:29:18 +0000 (16:29 +0800)]
MdeModulePkg: update brotli submodule

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3417
Update the brotli submodule to the latest commit (f4153a0)
so that the build isn't broken in GCC 11 compilers.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Update brotli submodule
Bob Feng [Wed, 26 Jan 2022 08:30:14 +0000 (16:30 +0800)]
BaseTools: Update brotli submodule

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3417
Update the brotli submodule to the latest commit (f4153a0)
so that the build isn't broken in GCC 11 compilers.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Update CLANG{35,38}_WARNING_OVERRIDES to ignore unused vars
Rebecca Cran [Fri, 4 Feb 2022 19:50:41 +0000 (03:50 +0800)]
BaseTools: Update CLANG{35,38}_WARNING_OVERRIDES to ignore unused vars

Building with the CLANG35 and CLANG38 toolset fails because of variables
which are set but not otherwise used in the RELEASE build.

GCC added -Wno-unused-but-set-variable back in 2016, and later added
-Wno-unused-const-variable. Add those to CLANG35_WARNING_OVERRIDES and
CLANG38_WARNING_OVERRIDES.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoMaintainers.txt: Update email address
Xiaoyu Lu [Mon, 7 Feb 2022 11:50:15 +0000 (19:50 +0800)]
Maintainers.txt: Update email address

Update Email address for Xiaoyu Lu.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMaintainers.txt: update email for Leif Lindholm
Leif Lindholm [Mon, 31 Jan 2022 11:14:35 +0000 (11:14 +0000)]
Maintainers.txt: update email for Leif Lindholm

NUVIA inc. was acquired by Qualcomm in March 2021, but we continued
contributions under the existing IDs until the start of this year.
We are now switching to use Qualcomm Innovation Center email, so
update Maintainers.txt to reflect this.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoMaintainers.txt: add missing github IDs to OvmfPkf/Fdt reviewers
Leif Lindholm [Mon, 31 Jan 2022 11:11:57 +0000 (11:11 +0000)]
Maintainers.txt: add missing github IDs to OvmfPkf/Fdt reviewers

This section seems to have been missed when introducing github IDs,
so add them.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoMdeModulePkg/UiApp: Fix spelling of 'FRONTPAGE'
Matt DeVillier [Fri, 28 Jan 2022 21:36:39 +0000 (05:36 +0800)]
MdeModulePkg/UiApp: Fix spelling of 'FRONTPAGE'

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex
Gerd Hoffmann [Fri, 21 Jan 2022 12:58:48 +0000 (20:58 +0800)]
MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex

When setting mVirtualMap to NULL also set mVirtualMapMaxIndex to 0.
Without that RuntimeDriverConvertPointer() will go search the ZeroPage
for EFI_MEMORY_DESCRIPTOR entries.

In case mVirtualMapMaxIndex happens to be small small enough that'll go
unnoticed, the search will not find anything and EFI_NOT_FOUND will be
returned.

In case mVirtualMapMaxIndex is big enough the search will reach the end
of the ZeroPage and trigger a page fault.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Fix error leg in DscBuildData.py
Jake Garver via groups.io [Thu, 20 Jan 2022 23:58:24 +0000 (07:58 +0800)]
BaseTools: Fix error leg in DscBuildData.py

Fix a Edk2Logger.warn() message format to match the arguments.

We ran into this after a failure in PcdValueInit.  The failure was
masked by a new exception, "TypeError: not all arguments converted
during string formatting".

Signed-off-by: Jake Garver <jake@nvidia.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools/Conf: Add new macro for customizing dll file reduction.
Wei6 Xu [Thu, 20 Jan 2022 14:59:56 +0000 (22:59 +0800)]
BaseTools/Conf: Add new macro for customizing dll file reduction.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3810

New macro OBJCOPY_STRIPFLAG is added in build_rule.template to replace
'--strip-unneeded -R .eh_frame', so that module can have some unique
objcopy flags for its own purpose.
In tools_def.template, set '--strip-unneeded -R .eh_frame' as default
value of OBJCOPY_STRIPFLAG.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoShellPkg: Fix incorrect PPTT FlagName dereference
Chris Jones [Tue, 14 Dec 2021 12:37:36 +0000 (20:37 +0800)]
ShellPkg: Fix incorrect PPTT FlagName dereference

Bugzilla: 3770 (https://bugzilla.tianocore.org/show_bug.cgi?id=3770)

The PPTT parser in AcpiView incorrectly dereferences a pointer to
FlagName when trying to log an error with the PPTT cache flags, which
can lead to random crashes and other errors.

Also fix some spacing in the error message to ensure the message is
printed cleanly.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoMdeModulePkg/Bus/Pci/PciBusDxe: Support platform PCI ROM override
Michael D Kinney [Sat, 22 Jan 2022 00:48:47 +0000 (16:48 -0800)]
MdeModulePkg/Bus/Pci/PciBusDxe: Support platform PCI ROM override

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3811

Remove ASSERT() statements that are triggered if a platform provides
an override of PCI ROM attached to a PCI Controller.  The PCI Platform
Protocol allows the platform to provide a PCI ROM image for a PCI
Controller.  This works for PCI Controllers that do not have an attached
PCI ROM, but the platform is not allowed to replace the PCI ROM for a
PCI Controller that has its own PCI ROM.  Removing these ASSERT()
statements enables this additional use case.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: Add AmlCodeGenMethodRetInteger function
Rebecca Cran [Thu, 13 Jan 2022 16:40:52 +0000 (09:40 -0700)]
DynamicTablesPkg: Add AmlCodeGenMethodRetInteger function

Add AmlCodeGenMethodRetInteger function to generate AML code for
a Method returning an Integer.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Remove redundant cast in AmlCodeGenReturn
Rebecca Cran [Thu, 13 Jan 2022 16:40:51 +0000 (09:40 -0700)]
DynamicTablesPkg: Remove redundant cast in AmlCodeGenReturn

In AmlCodeGenReturn, the cast to AML_NODE_HEADER* in the call to
AmlSetFixedArgument is redundant because ReturnNode is already a
AML_NODE_HEADER* .

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Add Memory32Fixed function
Rebecca Cran [Thu, 13 Jan 2022 16:40:50 +0000 (09:40 -0700)]
DynamicTablesPkg: Add Memory32Fixed function

Add a Memory32Fixed function to generate code for the corresponding
Memory32Fixed macro in AML.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings
Ard Biesheuvel [Wed, 22 Sep 2021 16:12:20 +0000 (18:12 +0200)]
ArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings

We never run any code at EL0, and so it would seem that any access
permissions set for EL0 (via the AP[1] attribute in the page tables) are
irrelevant. We currently set EL0 and EL1 permissions to the same value
arbitrarily.

However, this causes problems on hardware like the Apple M1 running the
MacOS hypervisor framework, which enters EL1 with SCTLR_EL1.SPAN
enabled, causing the Privileged Access Never (PAN) feature to be enabled
on any exception taken to EL1, including the IRQ exceptions that handle
our timer interrupt. When PAN is enabled, EL1 has no access to any
mappings that are also accessible to EL0, causing the firmware to crash
if it attempts to access such a mapping.

Even though it is debatable whether or not SCTLR_EL1.SPAN should be
disabled at entry or whether the firmware should put all UNKNOWN bits in
all system registers in a consistent state (which it should), using EL0
permissions serves no purpose whatsoever so let's fix that regardless.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Alexander Graf <agraf@csgraf.de>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2 years agoArmVirtPkg/Kvmtool: Enable Acpiview
Sami Mujawar [Fri, 4 Jun 2021 16:43:37 +0000 (17:43 +0100)]
ArmVirtPkg/Kvmtool: Enable Acpiview

Acpiview is a command line tool allowing to display, dump, or check
installed ACPI tables. Add a 'ACPIVIEW_ENABLE' switch to enable it
on an ArmVirt platform.

The switch is set for the ArmVirtKvmTool platform.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg/Kvmtool: Enable ACPI support
Sami Mujawar [Tue, 20 Apr 2021 12:53:10 +0000 (13:53 +0100)]
ArmVirtPkg/Kvmtool: Enable ACPI support

A Configuration Manager that uses the Dynamic Tables framework
to generate ACPI tables for Kvmtool Guests has been provided.
This Configuration Manager uses the FdtHwInfoParser module to
parse the Kvmtool Device Tree and generate the required
Configuration Manager objects for generating the ACPI tables.

Therefore, enable ACPI table generation for Kvmtool.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg/Kvmtool: Add Configuration Manager
Sami Mujawar [Tue, 20 Apr 2021 12:37:47 +0000 (13:37 +0100)]
ArmVirtPkg/Kvmtool: Add Configuration Manager

Add Configuration Manager to enable ACPI tables for Kvmtool
firmware. The Configuration Manager for Kvmtool uses the DT
Hardware Information Parser module (FdtHwInfoParser) to parse
the DT provided by Kvmtool. The FdtHwInfoParser parses the DT
and invokes the callback function HW_INFO_ADD_OBJECT to add
the Configuration Manager objects to the Platform Information
repository.

The information for some Configuration Manager objects may not
be available in the DT. Such objects are initialised locally
by the Configuration Manager.

Support for the following ACPI tables is provided:
 - DBG2
 - DSDT (Empty stub)
 - FADT
 - GTDT
 - MADT
 - SPCR
 - SSDT (Cpu Hierarchy)
 - SSDT (Pcie bus)

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg/Kvmtool: Add DSDT ACPI table
Sami Mujawar [Tue, 20 Apr 2021 11:59:42 +0000 (12:59 +0100)]
ArmVirtPkg/Kvmtool: Add DSDT ACPI table

Most ACPI tables for Kvmtool firmware are dynamically
generated. The AML code is also generated at runtime
for most components in appropriate SSDTs.

Although there may not be much to describe in the DSDT,
the DSDT table is mandatory.

Therefore, add an empty stub for DSDT.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg: Add cspell exceptions
Pierre Gondois [Mon, 14 Jun 2021 15:37:01 +0000 (16:37 +0100)]
ArmVirtPkg: Add cspell exceptions

The cpsell tool checks for unknown words in the upstream CI.
Add some new words to the list of exceptions.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation
Pierre Gondois [Tue, 1 Feb 2022 15:31:53 +0000 (16:31 +0100)]
DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbder are described in the _PRT entry.
The interrupt type is then assumed by the OS.

The Arm BSA, sE.6 "Legacy interrupts" states that PCI legacy
interrupts must be converted to SPIs, and programmed level-sensitive,
active high. Thus any OS must configure interrupts as such and there
is no need to specify the interrupt type.
Plus it is not possible to dynamically configure PCI interrupts.

Thus remove the link device generation and use the second model
for _PRT.

Suggested-by: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI
Pierre Gondois [Tue, 1 Feb 2022 15:30:13 +0000 (16:30 +0100)]
DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbers are described in the _PRT entry.
The interrupt type is then assumed by the OS.

AmlAddPrtEntry() currently only handles the first model. Make
changes to also handle the second model.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info
Pierre Gondois [Wed, 26 Jan 2022 16:43:53 +0000 (17:43 +0100)]
DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info

Parse the Pmu interrupts if a pmu compatible node is present,
and populate the MADT GicC structure accordingly.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: Print specifier macro for CM_OBJECT_ID
Pierre Gondois [Thu, 8 Jul 2021 15:03:07 +0000 (16:03 +0100)]
DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID

Add a macro that specifies the format for printing CM_OBJECT_ID.
This allows to print the CM_OBJECT_ID is a consistent way in the
output logs.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmPkg: Replace CoreId and ClusterId with Mpidr in ARM_CORE_INFO struct
Rebecca Cran [Thu, 16 Dec 2021 03:46:31 +0000 (20:46 -0700)]
ArmPkg: Replace CoreId and ClusterId with Mpidr in ARM_CORE_INFO struct

Remove the ClusterId and CoreId fields in the ARM_CORE_INFO structure in
favor of a new Mpidr field. Update code in
ArmPlatformPkg/PrePeiCore/MainMPCore and ArmPlatformPkg/PrePi/MainMPCore.c
to use the new field and call new macros GET_MPIDR_AFF0 and GET_MPIDR_AFF1
instead.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg/BaseCachingPciExpressLib: Migrate BaseCachingPciExpressLib
Abner Chang [Sat, 29 Jan 2022 16:03:47 +0000 (00:03 +0800)]
OvmfPkg/BaseCachingPciExpressLib: Migrate BaseCachingPciExpressLib

Move BaseCachingPciExpressLib library from ArmVirtPkg to under OvmfPkg.
RISC-V Virt platform can leverage the same library to access PCI Express
registers through PCI Express base address set in PcdPciExpressBaseAddress
and cached in a global variable.

Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg/QemuVideoDxe: parse edid blob, detect display resolution
Gerd Hoffmann [Mon, 17 Jan 2022 09:58:17 +0000 (10:58 +0100)]
OvmfPkg/QemuVideoDxe: parse edid blob, detect display resolution

Check whenever an EDID blob is present.  In case it is get the display
resolution from it.  Unless PcdVideoResolutionSource indicates the
display resolution has been set already, update
PcdVideoHorizontalResolution and PcdVideoVerticalResolution accordingly.
Also add the resolution to the mode list.

This will make OVMF boot up with the display resolution configured by
QEMU, which is 1280x800 by default.  The resolution can be set using the
xres and yres properties.  Here is an example for FullHD:

qemu-system-x86_64 -device VGA,xres=1920,yres=1080

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3778
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1749250
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg/QemuVideoDxe: factor out QemuVideoBochsAddMode
Gerd Hoffmann [Mon, 17 Jan 2022 09:58:16 +0000 (10:58 +0100)]
OvmfPkg/QemuVideoDxe: factor out QemuVideoBochsAddMode

Add helper function to add a video mode to the list of modes.
Move code.  Minor debug logging tweaks, no other functional
change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth
Gerd Hoffmann [Mon, 17 Jan 2022 09:58:15 +0000 (10:58 +0100)]
OvmfPkg/QemuVideoDxe: drop QEMU_VIDEO_BOCHS_MODES->ColorDepth

All video modes in the list are 32-bit,
so drop the useless ColorDepth field.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode
Gerd Hoffmann [Mon, 17 Jan 2022 09:58:14 +0000 (10:58 +0100)]
OvmfPkg/QemuVideoDxe: simplify InitializeBochsGraphicsMode

struct QEMU_VIDEO_MODE_DATA has all the data needed to set the video
mode, there is no need to take the extra indirection and use
struct QEMU_VIDEO_BOCHS_MODES.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg: add PcdVideoResolutionSource
Gerd Hoffmann [Sat, 29 Jan 2022 16:26:14 +0000 (17:26 +0100)]
OvmfPkg: add PcdVideoResolutionSource

It's a UINT8 (enum) PCD telling where the PcdVideoHorizontalResolution
and PcdVideoVerticalResolution values are coming from.  It can be:

 0 (unset aka default from dsc file), or
 1 (from PlatformConfig), or
 2 (set by Video Driver).

It will be used by video drivers to avoid overriding PlatformConfig
values, or override each others values in case multiple display devices
are present.

The underlying problem this tries to solve is that the GOP protocol has
no way to indicate the preferred video mode.  On physical hardware this
isn't much of a problem because using the highest resolution available
works just fine as that is typically the native display resolution

But in a virtual machine you don't want come up with a huge 4k window by
default just because the virtual vga is able to handle that.  Cutting
down the video mode list isn't a great solution either as that would
also remove the modes from the platform configuration so the user
wouldn't be able to pick a resolution higher than the default any more.

So with patch drivers can use use PcdVideoHorizontalResolution and
PcdVideoVerticalResolution to indicate what the preferred display
resolution is, without overwriting the user preferences from
PlatformConfig if present.

A possible alternative approach would be to extend the GOP protocol, but
I'm not sure this is a good plan given this is mostly a problem for
virtual machines and using PCDs allows to keep this local to OvmfPkg.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg: change qemu default resolution to 1280x800
Gerd Hoffmann [Fri, 21 Jan 2022 13:00:54 +0000 (14:00 +0100)]
ArmVirtPkg: change qemu default resolution to 1280x800

ovmf default display resolution is 800x600.  This is rather small for
modern guests.  qemu used 1024x768 as default for a long time and
switched the to 1280x800 recently[1] for the upcoming 7.0 release.

This patch brings ovmf in sync with the recent qemu update and likewise
switches the default to 1280x800.

[1] https://gitlab.com/qemu-project/qemu/-/commit/de72c4b7cdf6ec18bfe9fe714aa96e48db6fd895

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoOvmfPkg: change qemu default resolution to 1280x800
Gerd Hoffmann [Fri, 21 Jan 2022 13:00:53 +0000 (14:00 +0100)]
OvmfPkg: change qemu default resolution to 1280x800

ovmf default display resolution is 800x600.  This is rather small for
modern guests.  qemu used 1024x768 as default for a long time and
switched the to 1280x800 recently[1] for the upcoming 7.0 release.

This patch brings ovmf in sync with the recent qemu update and likewise
switches the default to 1280x800.

[1] https://gitlab.com/qemu-project/qemu/-/commit/de72c4b7cdf6ec18bfe9fe714aa96e48db6fd895

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoMaintainers.txt: Add Sami Mujawar as reviewer for ArmPkg
Sami Mujawar [Wed, 19 Jan 2022 10:20:41 +0000 (10:20 +0000)]
Maintainers.txt: Add Sami Mujawar as reviewer for ArmPkg

Cc: Leif Lindholm <leif@nuviainc.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoNetworkPkg: Add the missing VariablePolicyHelperLib in NetworkPkg.dsc
Liming Gao [Fri, 28 Jan 2022 08:38:36 +0000 (16:38 +0800)]
NetworkPkg: Add the missing VariablePolicyHelperLib in NetworkPkg.dsc

This change is required by f4b7b473b4afd0093768905529bfae09a2061d41.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
2 years agoShellPkg: Add the missing VariablePolicyHelperLib in ShellPkg.dsc
Liming Gao [Fri, 28 Jan 2022 08:36:29 +0000 (16:36 +0800)]
ShellPkg: Add the missing VariablePolicyHelperLib in ShellPkg.dsc

This change is required by f4b7b473b4afd0093768905529bfae09a2061d41.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
2 years agoMdeModulePkg/UefiBootManagerLib: Convert BmLoadOption to Variable Policy
Rebecca Cran [Wed, 19 Jan 2022 21:01:16 +0000 (05:01 +0800)]
MdeModulePkg/UefiBootManagerLib: Convert BmLoadOption to Variable Policy

Since the Variable Lock protocol is deprecated, convert locking of
PlatformRecovery#### in EfiBootManagerLoadOptionToVariable to use the
Variable Policy protocol.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoUefiPayloadPkg: Use BaseCpuTimerLib for Universal Payload by default
Liu, Zhiguang [Wed, 19 Jan 2022 09:16:46 +0000 (17:16 +0800)]
UefiPayloadPkg: Use BaseCpuTimerLib for Universal Payload by default

Current, a macro CPU_TIMER_LIB_ENABLE is added to determine which timerlib
is used. BaseCpuTimerLib.inf is a better way and only fit for recent CPU.
Meanwhile, Universal Payload are only aimed to work with recent CPU.
Therefore, for Universal Payload, use the BaseCpuTimerLib by default

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoEmbeddedPkg: Fix a build error in FwVol.c in X64 arch
Min Xu [Thu, 16 Dec 2021 04:55:51 +0000 (12:55 +0800)]
EmbeddedPkg: Fix a build error in FwVol.c in X64 arch

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3814

CompressedDataLength is declared as UINTN which is UINT64 in X64 arch.
But the second parameter of UefiDecompressGetInfo() is declared as
UINT32. So a build error is triggered. To declare CompressedDataLength
as UINT32 to fix the build error.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
2 years agoArmPkg: MmCommunicationDxe: Update MM communicate `MessageLength` check
Kun Qin [Tue, 25 Jan 2022 19:39:09 +0000 (03:39 +0800)]
ArmPkg: MmCommunicationDxe: Update MM communicate `MessageLength` check

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3751

Current MM communicate routine from ArmPkg would conduct few checks prior
to proceeding with SMC calls. However, the inspection step is different
from PI specification.

This patch updated MM communicate input argument inspection routine to
assure that "if the `MessageLength` is zero, or too large for the MM
implementation to manage, the MM implementation must update the
`MessageLength` to reflect the size of the `Data` buffer that it can
tolerate", as described by `EFI_MM_COMMUNICATION_PROTOCOL.Communicate()`
section in PI specification.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmPkg: MmCommunicationDxe: Update MM communicate `CommSize` check
Kun Qin [Tue, 25 Jan 2022 19:39:08 +0000 (03:39 +0800)]
ArmPkg: MmCommunicationDxe: Update MM communicate `CommSize` check

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3751

Current MM communicate routine from ArmPkg would conduct few checks prior
to proceeding with SMC calls. However, the inspection step is different
from PI specification.

This patch updated MM communicate input argument inspection routine to
assure `CommSize` represents "the size of the data buffer being passed
in" instead of the size of the data being used from data buffer, as
described by section `EFI_MM_COMMUNICATION2_PROTOCOL.Communicate()` in PI
specification.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmPkg: MmCommunicationDxe: Update MM communicate `CommBuffer**` checks
Kun Qin [Tue, 25 Jan 2022 19:39:07 +0000 (03:39 +0800)]
ArmPkg: MmCommunicationDxe: Update MM communicate `CommBuffer**` checks

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3751

Current MM communicate routine from ArmPkg would conduct few checks prior
to proceeding with SMC calls. However, the inspection step is different
from PI specification.

This patch updated MM communicate input argument inspection routine to
assure that return code `EFI_INVALID_PARAMETER` represents "the
`CommBuffer**` parameters do not refer to the same location in memory",
as described by `EFI_MM_COMMUNICATION2_PROTOCOL.Communicate()` section
in PI specification.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmPkg: MmCommunicationDxe: MM communicate function argument attributes
Kun Qin [Tue, 25 Jan 2022 19:39:06 +0000 (03:39 +0800)]
ArmPkg: MmCommunicationDxe: MM communicate function argument attributes

Current MM communicate2 function from ArmPkg described input arguments
`CommBufferPhysical`, `CommBufferVirtual` and `CommSize` as input only,
which mismatches with the "input and output type" as in PI specification.

This change updated function descriptions of MM communite2 to match input
argument types.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoMdePkg: MmCommunication2: Update MM communicate2 function description
Kun Qin [Tue, 25 Jan 2022 19:39:05 +0000 (03:39 +0800)]
MdePkg: MmCommunication2: Update MM communicate2 function description

Current MM communicate2 function definition described input arguments
`CommBufferPhysical`, `CommBufferVirtual` and `CommSize` as input only,
which mismatches with the "input and output type" as in PI specification.

This change updated function descriptions of MM communite2 definition to
match input argument types.

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: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg: VariableSmmRuntimeDxe: Fix Variable Policy Message Length
Kun Qin [Tue, 25 Jan 2022 19:39:04 +0000 (03:39 +0800)]
MdeModulePkg: VariableSmmRuntimeDxe: Fix Variable Policy Message Length

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3709

In EDKII implementation of variable policy, the DXE runtime agent would
communicate to MM to disable, register or query policies. However, these
operations populate the value of MessageLength that includes communicate
header to include MM communicate header, which mismatches with the
description of PI specification.

This fix will correct the MessageLength field calculation to exclude
the size of MM_COMMUNICATE_HEADER.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg/SdMmcPciHcDxe: Robust improvements for SD card 1.8V switch
Aiman Rosli [Thu, 20 Jan 2022 18:53:24 +0000 (02:53 +0800)]
MdeModulePkg/SdMmcPciHcDxe: Robust improvements for SD card 1.8V switch

This changes is by adding 50ms delay during voltage switching from 3.3V to
1.8V, plus adding a goto Voltage33Retry for 3.3V checking and retrying.

Change is for Enabling OS boot from SD card through UEFI payload.

Signed-off-by: Aiman Rosli <muhammad.aiman.rosli@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoMdeModulePkg/Variable: Make only EFI_VARIABLE_NON_VOLATILE invalid
Sunny Wang [Tue, 11 Jan 2022 21:37:20 +0000 (05:37 +0800)]
MdeModulePkg/Variable: Make only EFI_VARIABLE_NON_VOLATILE invalid

Only EFI_VARIABLE_NON_VOLATILE attribute is an invalid combination
of attribute bits, so update the variable driver to return
EFI_INVALID_PARAMETER so that we can prevent the invalid variable
being created.

This change also fixes the SCT failure below:
 - RT.QueryVariableInfo - With being an invalid combination -- FAILURE

For details, please check the threads below:
 - https://edk2.groups.io/g/devel/topic/86486174
 - https://edk2.groups.io/g/devel/message/82466

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: G Edhaya Chandran <edhaya.chandran@arm.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Signed-off-by: Sunny Wang <sunny.wang@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoRedfishPkg/RedfishRestExDxe:Simplify status check
Wenyi Xie [Wed, 19 Jan 2022 03:47:00 +0000 (11:47 +0800)]
RedfishPkg/RedfishRestExDxe:Simplify status check

Remove redundant determine statements.
No functional change.

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
2 years agoFmpDevicePkg/FmpDxe: Update FmpDeviceCheckImageWithStatus() handling
Michael Kubacki [Tue, 4 Jan 2022 20:38:24 +0000 (04:38 +0800)]
FmpDevicePkg/FmpDxe: Update FmpDeviceCheckImageWithStatus() handling

Update the logic handling last attempt status codes from
FmpDeviceCheckImageWithStatus() implementations to account for
cases when the function return status code is EFI_SUCCESS
(since the image was checked successfully) but the ImageUpdatable
value is not valid.

In addition the following sentence is removed from the
LastAttemptStatus parameter definition for
FmpDeviceCheckImageWithStatus() since it can lead to confusion.
The expected status code value range is sufficient to implement
the library API.

  "This value will only be checked when this
   function returns an error."

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoUefiPayloadPkg: Not use BaseCpuTimerLib by default.
Liu, Zhiguang [Fri, 14 Jan 2022 06:15:18 +0000 (23:15 -0700)]
UefiPayloadPkg: Not use BaseCpuTimerLib by default.

For recent X86 CPU, 0x15 CPUID instruction will return Time Stamp
Counter. This is recommended way to get the time, and also how
BaseCpuTimerLib works However, some CPU doesn't support this feature,
so disable it by default.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
2 years agoUefiPayloadPkg: Change the user interface name of the Uiapp
Xie, Yuanhao [Mon, 17 Jan 2022 08:24:28 +0000 (01:24 -0700)]
UefiPayloadPkg: Change the user interface name of the Uiapp

Chanage the name "Uiapp" to "Enter Setup".

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoOvmfPkg: Add CloudHvX64 to the CI
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:35 +0000 (20:31 +0800)]
OvmfPkg: Add CloudHvX64 to the CI

Adding the newly created target for Cloud Hypervisor to the CI,
validating it can be properly built.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: add Maintainers.txt entry
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:34 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: add Maintainers.txt entry

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Remove CSM support
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:33 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Remove CSM support

Cloud Hypervisor doesn't need the support for legacy BIOS, therefore the
CSM support can be removed.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Remove USB support
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:32 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Remove USB support

Cloud Hypervisor doesn't emulate any USB controller or device, therefore
the support can be removed.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Remove video support
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:31 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Remove video support

No need for video or virtio-gpu support since Cloud Hypervisor doesn't
emulate any of these.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Reduce dependency on QemuFwCfg
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:30 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Reduce dependency on QemuFwCfg

Since Cloud Hypervisor doesn't rely on the FwCfg mechanism, remove the
libraries imports when possible.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Remove Q35 specifics
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:29 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Remove Q35 specifics

Anything specific to the QEMU Q35 platform is not relevant for the
CloudHv target.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Remove legacy 8259 PIC support
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:28 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Remove legacy 8259 PIC support

Cloud Hypervisor does not emulate any 8259 PIC, therefore there's no
reason to load the corresponding driver for it.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Connect serial console
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:27 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Connect serial console

Cloud Hypervisor doesn't emulate any LPC bridge, therefore we simply
need to rely on the serial I/O port to be connected as a console.
It reuses the code from Xen since it's very generic.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Replace legacy 8254 PIT with local APIC timer
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:26 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Replace legacy 8254 PIT with local APIC timer

Cloud Hypervisor doesn't emulate the legacy 8254 PIT, which is why
instead of relying on it as the timer UEFI services, rely on the
XenTimerDxe implementation. This is not Xen specific, as it simply uses
the local APIC timer triggering interrupts on the vector 32.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoOvmfPkg/CloudHv: Add new target for Cloud Hypervisor
Sebastien Boeuf [Tue, 11 Jan 2022 12:31:25 +0000 (20:31 +0800)]
OvmfPkg/CloudHv: Add new target for Cloud Hypervisor

Adding the new target CloudHvX64, copied directly from OvmfPkgX64. The
point is to create a target dedicated for Cloud Hypervisor rather than
trying to support both QEMU and Cloud Hypervisor on the same target.

Improvements and cleanups will be performed in follow up patches.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2 years agoBaseTools: Fix wrong variable header size
Chen, Lin Z [Tue, 11 Jan 2022 13:01:12 +0000 (21:01 +0800)]
BaseTools: Fix wrong variable header size

There are two type variable header and their size are different,
need to use matched size when calculating offset info, otherwise
it'll destroy other variables content when patching.

Signed-off-by: Chen, Lin Z <lin.z.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoMdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR
Edwards, Craig [Wed, 5 Jan 2022 16:02:53 +0000 (00:02 +0800)]
MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBR

Read Disk does a modification of ExtMbrStartingLba with the code MultU64x32
(ExtMbrStartingLba, BlockSize) Error detection to see if ExtMbrStartingLBA
has a value of 0. This is invalid as LBA 0 = MBR. After modification, the
next time ExtMbrStartingLba is in this function if ExtMbrStartingLba is set
to 0 in the MBR it never passes the while/do evaluation It is multiplied by
0 by read disk , set to 0 by an invalid MBR and goes back to evaluation
This condition will also cause Ws19 and WS22 to hang, however Microsoft has
developed a hotfix patch that will be released in 2022

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Craig Edwards <craig.edwards@dell.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoUnitTestFrameworkPkg: CI YAML: Grant cmockery spell check exception
Kun Qin [Sat, 8 Jan 2022 02:44:44 +0000 (18:44 -0800)]
UnitTestFrameworkPkg: CI YAML: Grant cmockery spell check exception

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3798

UnitTestFrameworkPkg.dec contains cmockery folder from cmocka submodule.
However, the term "cmockery" is unrecognized by cspell tool.

This change grants spell check exception to "cmockery" to prevent
pipeline building failure.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>