summaryrefslogtreecommitdiffstats
path: root/ArmVirtPkg
Commit message (Collapse)AuthorAgeFilesLines
* MdePkg: MdeLibs.dsc.inc: Apply StackCheckLibNull to All Module TypesOliver Smith-Denny8 days1-3/+0
| | | | | | | | | | | | | | | Now that the ResetVectors are USER_DEFINED modules, they will not be linked against StackCheckLibNull, which were the only modules causing issues. So, we can now remove the kludge we had before and the requirement for every DSC to include StackCheckLibNull for SEC modules and just apply StackCheckLibNull globally. This also changes every DSC to drop the SEC definition of StackCheckLibNull. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmVirtPkg/MemoryInitPei: Remove Non-RT Types from Mem Type Info HOBMichael Kubacki10 days2-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removes the following types from the memory type information HOBs produced in the MemoryInitPei PEIM: - `EfiBootServicesCode` - `EfiBootServicesData` - `EfiLoaderCode` - `EfiLoaderData` Our platform has a memory type information validation routine that currently expects those types to be excluded as they would not impact the UEFI memory map since they are not runtime memory types. This follows the guidance in the whitepaper "A Tour Beyond BIOS Memory Map and Practices in UEFI BIOS". https://github.com/tianocore-docs/Docs/raw/master/White_Papers/A_Tour_Beyond_BIOS_Memory_Map_And_Practices_in_UEFI_BIOS_V2.pdf "NOTE: We recommend a platform only define the ReservedMemory, ACPINvs, ACPIReclaim, RuntimeCode, RuntimeData in Memory Type Information table, because OSes only request these regions to be consistent. There is no need to add BootServicesCode, BootServicesData, LoaderCode, LoaderData in memory type information table, because these regions will not be reserved during S4 resume." Since these memory types are not tracked in memory type information any longer it also reduces the number of resets that may need to occur to update memory type buckets that are not needed. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* ArmVirtPkg: mark fixed network PCDsAleksandr Goncharov10 days2-2/+2
| | | | | | | | | | Rename `NetworkPcds` to `NetworkFixedPcds` to avoid confusion with dynamic PCDs. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Aleksandr Goncharov <chat@joursoir.net>
* ArmVirtPkg: use NetworkDynamicPcds include fileAleksandr Goncharov10 days2-14/+2
| | | | | | | | | | | | | | Start using the include file in the ArmVirtPkg package to manage dynamic network-related PCDs. This change removes the manual addition of `PcdIPv4PXESupport` and `PcdIPv6PXESupport` from the DSC file, relying instead on the centralized include file introduced in NetworkPkg. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Aleksandr Goncharov <chat@joursoir.net>
* ArmVirtPkg: KvmTool: Fix clang linker errorSudeep Holla2024-10-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang build for ArmVirtPkg/ArmVirtKvmTool.dsc fails with the below warning: | ld.lld: error: duplicate symbol: PciExpressRegisterForRuntimeAccess | ld.lld: error: duplicate symbol: GetPciExpressBaseAddress | ld.lld: error: duplicate symbol: PciExpressRead8 | ld.lld: error: duplicate symbol: PciExpressWrite8 | ld.lld: error: duplicate symbol: PciExpressOr8 | ld.lld: error: duplicate symbol: PciExpressAnd8 | ld.lld: error: duplicate symbol: PciExpressAndThenOr8 | ld.lld: error: duplicate symbol: PciExpressBitFieldRead8 | ld.lld: error: duplicate symbol: PciExpressBitFieldWrite8 | ld.lld: error: duplicate symbol: PciExpressBitFieldOr8 | ld.lld: error: duplicate symbol: PciExpressBitFieldAnd8 | ld.lld: error: duplicate symbol: PciExpressBitFieldAndThenOr8 | ld.lld: error: duplicate symbol: PciExpressRead16 | ld.lld: error: duplicate symbol: PciExpressWrite16 | ld.lld: error: duplicate symbol: PciExpressOr16 | ld.lld: error: duplicate symbol: PciExpressAnd16 | ld.lld: error: duplicate symbol: PciExpressAndThenOr16 | ld.lld: error: duplicate symbol: PciExpressBitFieldRead16 | ld.lld: error: duplicate symbol: PciExpressBitFieldWrite16 | ld.lld: error: duplicate symbol: PciExpressBitFieldOr16 | >>> defined in MdePkg/Library/BasePciExpressLib/BasePciExpressLib/OUTPUT/BasePciExpressLib.lib(PciExpressLib.obj) | >>> defined in OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib/OUTPUT/BaseCachingPciExpressLib.lib(PciExpressLib.obj) | | ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors) | clang: error: linker command failed with exit code 1 (use -v to see invocation) OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf is getting linked as NULL library in these pacakges: 1. UefiCpuPkg/CpuMmio2Dxe/CpuMmio2Dxe.inf 2. MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf 3. MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf which results in duplicate symbols shown in the warning above as MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf is not properly replaced by OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf as PciExpressLib library. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
* ArmVirtPkg/ArmVirtQemu: avoid unnecessary use of $(ARCH) conditionalLeif Lindholm2024-10-021-4/+2
| | | | | | | | ARCH as set by "build" command is not really useful for conditionals, so move AArch64-specific Pcd to [PcdsFixedAtBuild.AARCH64]. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmVirtPkg: add QemuVirtMemInfoLib missing dependency/includesLeif Lindholm2024-09-272-0/+2
| | | | | | | | | QemuVirtMemInfoLib makes use of BaseLib but never declared the dependency or included the header. The code still built by luck and by including the EmbeddedPkg FdtLib. Which is going away, so add the missing stanzas in preparation. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmVirtPkg: Correct PcdDxeNxMemoryProtectionPolicy commentHeinrich Schuchardt2024-09-261-2/+4
| | | | | | | | | | | | Since commit 2997ae387397 ("ArmVirtPkg: make EFI_LOADER_DATA non-executable") the comment for PcdDxeNxMemoryProtectionPolicy is incorrect. * Remove the incorrect part of the description. * Describe overriding NX protection by passing a pcd parameter on the build command line. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
* ArmVirtPkg: Add Null Stack Check LibOliver Smith-Denny2024-09-131-3/+3
| | | | | | | Remove the old stack check lib now that MdeLibs.inc includes the new one. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmVirtPkg: Fix unable to build with -D NETWORK_ENABLE=0Mike Beaton2024-09-122-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=4829 7f17a15 (2024/02/22) "OvmfPkg: Shell*.inc: allow building without network support" breaks building OVMF with `-D NETWORK_ENABLE=0`. Before this commit we could build OVMF e.g. with the following command in the OvmfPkg directory: ./build.sh -D NETWORK_ENABLE=0 After the commit the same command fails early with: /home/user/OpenSource/edk2/OvmfPkg/OvmfPkgX64.dsc(15): error F001: Pcd (gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections) defined in DSC is not declared in DEC files referenced in INF files in FDF. Arch: ['X64'] This problem also applies in the ArmVirtPkg platforms which are modified here, but is currently masked by another issue, namely that these platforms incorrectly still include some network packages when most are disabled. (A fix for this was previously applied, for OvmfPkg Intel platforms only, by d933ec1 followed by 7f17a15 .) This commit was created at the same time as the commits resolving this issue in NetworkPkg and OvmfPkg. It makes conditional the Pcd references in ArmVirtPkg platforms which will become references to undefined Pcds as and when the other issue mentioned above is fixed. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* MdePkg: Move CompilerIntrinsicsLib from ArmPkgOliver Smith-Denny2024-09-121-6/+0
| | | | | | | | | | | | | | | | | | | | As per the emailed RFC in https://edk2.groups.io/g/devel/topic/rfc_move/107675828, this patch moves CompilerIntrinsicsLib from ArmPkg to MdePkg as this library provides compiler intrinsics, which are industry standard. This aligns with the goal of integrating ArmPkg into existing packages: https://bugzilla.tianocore.org/show_bug.cgi?id=4121. The newly placed CompilerIntrinsicsLib is added to MdeLibs.dsc.inc as every DSC that builds ARM/AARCH64 needs this library added. The old location is removed from every DSC in edk2 in this commit also to not break bisectability with minimal hoop jumping. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdePkg: Move AsmMacroIoLib*.h from ArmPkgOliver Smith-Denny2024-09-123-3/+3
| | | | | | | | | | | | | | | | | | | AsmMacroIoLib.h and AsmMacroIoLibV8.h are used by the CompilerIntrinsicsLib, which is moving to MdePkg. These functions provide standard definitions for ARM/AARCH64 assembly code, respectively, and so are moved to the arch directories in MdePkg to avoid MdePkg having a dependency on ArmPkg. Now that the files are in Arm/ and AArch64/ directories, the filenames are changed to AsmMacroLib.h as we can distinguish the architecture from the path. AsmMacroIoLib.inc is unused and so is removed. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmVirtPkg ARM: Move to MbedTls for cryptoArd Biesheuvel2024-09-042-11/+14
| | | | | | | | | | | | | Move all BaseCryptLib resolutions for 32-bit ARM to MbedTls, which does not require a softfloat library, which can therefore be dropped from EDK2 entirely going forward. Note that this implies no TLS networking for 32-bit ARM, as this code has a direct dependency on OpenSSL, so move the TlsLib resolution to a AARCH64-only section to force the build to fail early when attempting to build 32-bit ARM targets with NETWORK_TLS_ENABLE set. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Resolve RngLib via RngDxe for TRNG supportArd Biesheuvel2024-09-031-0/+4
| | | | | | | | | | | | | | | | Gerd reports that ArmVirtQemu running under KVM lost network boot support on systems that do not implement the RNDR/RNDRRS system registers, which provide an architectural, CPU-based source of random numbers. Under KVM, the TRNG SMCCC is available as a fallback, which is exposed via RngDxe but not via the base RngLib library. This means that direct users of RngLib, such as OpensslLib, have no access to the TRNG based entropy source. Let's fix this by resolving RngLib dependencies for UEFI_DRIVER type drivers via DxeRngLib, which uses the protocol exposed by RngDxe internally. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Drop incorrect reference to LzmaDecompressLibArd Biesheuvel2024-08-304-4/+3
| | | | | | | | | | | LzmaDecompressLib does not exist as a library class, and the library implementation that is usually referenced in this context is intended to be incorporated using NULL library class resolution. Let's fix this so that we can drop the reference to LzmaDecompressLib. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Sami Mujawar <sami.mujawar@arm.com>
* ArmVirtPkg/ArmPlatformLib: Drop unused MPCore routinesArd Biesheuvel2024-08-301-25/+0
| | | | | | | | Some of the boilerplate in ArmPlatformLib is only relevant when entering UEFI on multiple cores, and this is no longer supported. So retire the associated helper routines. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Fix some spelling mistakes found by cspellRebecca Cran2024-08-012-15/+15
| | | | | | | | | | | When cspell is installed (via `npm install cspell`), CI checks for spelling mistakes. There are currently a very large number of them: some are genuine mistakes while others are words or acryonyms that cspell doesn't know. Fix a few of the misspellings in ArmVirtPkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
* ArmVirtPkg: Switch all PrePeiCore users to new Sec.infArd Biesheuvel2024-08-014-4/+4
| | | | | | | | Switch to the new SEC driver based on PrePeiCore, but with a sane name. The old one will be retired once all users have migrated, including many in edk2-platforms. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg/PrePi: Drop call to TimerConstructor()Ard Biesheuvel2024-08-012-8/+0
| | | | | | | Drop the call to the TimerConstructor, which should not be called explicitly, and does nothing useful to begin with. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Drop bogus reference to MPCore related PCDArd Biesheuvel2024-08-011-5/+0
| | | | | | | Bringing up secondaries is out of scope for ArmVirtPkg, and the declared PCD reference is never actually made from the code. So drop it. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Kvmtool: Update Pci Config Space Info in Cfg ManagerSami Mujawar2024-07-291-1/+3
| | | | | | | | | | | | | | | | | | | The Pci Config Space Info object was moved from the Arm Namespace to the Arch Common namespace. Therefore, update the Kvmtool guest firmware configuration manager to reflect this change. Cc: Pierre Gondois <Pierre.Gondois@arm.com> Cc: Yeo Reum Yun <YeoReum.Yun@arm.com> Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com> Cc: Jeshua Smith <jeshuas@nvidia.com> Cc: Jeff Brasen <jbrasen@nvidia.com> Cc: Girish Mahadevan <gmahadevan@nvidia.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* ArmVirtPkg: Kvmtool: Update Power Mgmt Profile info in Cfg ManagerSami Mujawar2024-07-292-20/+20
| | | | | | | | | | | | | | | | | | | The PowerManagementProfileInfo Object has been moved from the Arm Namespace to the Arch Common namespace. Therefore, update the Kvmtool Guest firmware configuration manager to reflect this change. Cc: Pierre Gondois <Pierre.Gondois@arm.com> Cc: Yeo Reum Yun <YeoReum.Yun@arm.com> Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com> Cc: Jeshua Smith <jeshuas@nvidia.com> Cc: Jeff Brasen <jbrasen@nvidia.com> Cc: Girish Mahadevan <gmahadevan@nvidia.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* ArmVirtPkg: Kvmtool: Update ConfigMgr to support ArchCommonSami Mujawar2024-07-291-0/+70
| | | | | | | | | | | | | | | | | Update the Configuration Manager for Kvmtool guest firmware to handle ArchComm namespace objects. Cc: Pierre Gondois <Pierre.Gondois@arm.com> Cc: Yeo Reum Yun <YeoReum.Yun@arm.com> Cc: AbdulLateef Attar <AbdulLateef.Attar@amd.com> Cc: Jeshua Smith <jeshuas@nvidia.com> Cc: Jeff Brasen <jbrasen@nvidia.com> Cc: Girish Mahadevan <gmahadevan@nvidia.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
* ArmVirtPkg/ArmVirtQemu: Switch to generic ResetSystemLibArd Biesheuvel2024-07-273-285/+3
| | | | | | | | Retire the special ResetSystemLib implementation for the PEI phase on virtual platforms, which has been superseded by the generic version combined with a PEI-compatible implementation of ArmMonitorLib. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Implement DT-based ArmMonitorLib for the PEI phaseArd Biesheuvel2024-07-272-0/+163
| | | | | | | | | The TPM2 related PEIMs depend on ResetSystemLib too, and so in order to be able to switch to the generic ArmPkg implementation which relies on ArmMonitorLib, the latter library class requires a PEIM-compatible implementation too. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Move to generic ArmPsciResetSystemLibArd Biesheuvel2024-07-273-267/+1
| | | | | | | | | | | Switch to the new, generic ArmPsciResetSystemLib implementation that obtains the conduit using ArmMonitorLib, of which a version already exists that determines the conduit by looking up the PSCI DT node. This permits the removal of the ArmVirtPkg specific implementation of ResetSystemLib, which essentially does the exact same thing, but in a single library. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmPkg: Convert PcdMonitorConduitHvc to FixedAtBuildArd Biesheuvel2024-07-251-2/+2
| | | | | | | | | | Feature PCDs and fixed-at-build PCDs are identical in concept, but the latter are accessible from assembler, whereas the former are not. So convert the SMCCC conduit selection PCD to fixed-at-build so we can make use of this in a subsequent patch. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: KvmtoolRtcFdtClientLib: Set MMIO Memory NXOliver Smith-Denny2024-07-231-2/+2
| | | | | | | | | | When setting memory attributes on its MMIO region, KvmtoolRtcFdtClientLib will clear EFI_MEMORY_XP from the region if a platform has it set. This MMIO region is not intended to be executed from, so fix this by explicitly setting EFI_MEMORY_XP on this region in the lib. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmVirtPkg: QemuVirtMemInfoPeiLib: Allow Dynamic PcdSystemMemorySizeMichael Kubacki2024-07-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Platforms today may use this PCD as a dynamic PCD as that is an allowed type in its PCD declaration. From `ArmPkg.dec`: [PcdsFixedAtBuild.common, PcdsDynamic.common, PcdsPatchableInModule.common] gArmTokenSpaceGuid.PcdSystemMemorySize|0|UINT64|0x0000002A This library causes a build error if it used as a dynamic PCD since it places the PCD in a `[FixedPcd]` section in the INF. Other libraries do set the PCD and depend on the dynamic PCD behavior. Since this library accesses the PCD with `PcdGet64 ()` which is compatible with FixedAtBuild PCDs, this change moves the PCD out an explicit `[FixedPcd]` section to resolve the following build error: ``` INFO - : error 3000: Building modules from source INFs, following PCD use Dynamic and FixedAtBuild access method. It must be corrected to use only one access method. INFO - gArmTokenSpaceGuid.PcdSystemMemorySize ``` Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* ArmVirtPkg: drop use of PcdArmArchTimerFreqInHzLeif Lindholm2024-06-264-20/+0
| | | | | | | | | | PcdArmArchTimerFreqInHz lets platforms override the architectural timer frequency, but this really isn't supported in hardware by anything lower than EL3. Setting it to 0 skips the override - but that is also the default. So drop the explicit setting in ArmVirtPkg platforms in preparation for deleting the Pcd completely. Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmPkg,MdePkg: Move ArmPkg/Chipset/ArmV7[|Mmu].h to MdePkgPierre Gondois2024-06-151-1/+1
| | | | | | | | | | | | | | Following the discussion at [1] and as the ArmLib relies on them, move ArmPkg/Chipset/ArmV7[|Mmu].h files to the MdePkg. Update the path to correctly include the moved files. [1] https://edk2.groups.io/g/devel/message/111566 Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
* ArmPkg: Revert "Allow SMC/HVC monitor conduit to be specified at runtime"Ard Biesheuvel2024-06-102-2/+2
| | | | | | | | | This reverts commit 32460bb5b17b5caec29037a4e9462ca149a190e6, which is no longer needed as ArmVirtQemu now has its own special implementation for ArmMonitorLib. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg/ArmVirtQemu: Revert "Permit the use of dynamic PCDs in PEI"Ard Biesheuvel2024-06-102-2/+6
| | | | | | | | This reverts commit 865229bcc8939c7a69d525f2b0627ef1532d5bc6, and restores the old state where dynamic PCDs are only used when TPM support is configured. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Revert "Use dynamic PCD to set the SMCCC conduit"Ard Biesheuvel2024-06-106-14/+0
| | | | | | | | | This reverts commit c98f7f75508912c086158892fc56b0c3b85abcf1, which is no longer needed: the SMCCC conduit will be converted back to being hardcoded, as PrePi based ArmVirtPkg build cannot support dynamic PCDs, and falling back to patchable PCDs does not work either. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg/ArmVirtQemu: Implement ArmMonitorLib for QEMU specificallyArd Biesheuvel2024-06-105-12/+138
| | | | | | | | | | | | | | | | | | | | | Whether SMCCC calls use HVC or SMC generally depends on the exception level that the firmware executes at, but also on whether or not EL2 is implemented. This is almost always known at build time, which is why the default ArmMonitorLib used to model this as a feature PCD. However, on QEMU, things are not that simple. However, SMCCC specifies that the conduit is the same as the one used for PSCI calls (which has been retrofitted into SMCCC when it was defined). Given that QEMU provides this information via the device tree, let's use it to select the conduit, using a special ArmMonitorLib implementation. This also removes the need to set the associated PCD at runtime, given that its updated value will no longer be used. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg/PrePi: Enable VFP before calling into C codeArd Biesheuvel2024-06-102-22/+24
| | | | | | | | | | | | When building ArmVirtQemuKernel with CLANGDWARF (which does not require a GCC workaround where -mgeneral-regs-only is needed to ensure -mstrict-align works as expected), the C code invoked from the PrePi startup code may contain instructions that access the FP/SIMD register file. This means that the FP/SIMD must be enabled before making such calls, and this is currently not the case. So fix that, by moving the call to ArmEnableVFP() early into the asm startup code. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Remove the NorFlashQemuLibChao Li2024-06-052-178/+0
| | | | | | | | | | | | The FdtNorFlashQemuLib has been enabled, remove ArmVirtPkg version. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4770 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Chao Li <lichao@loongson.cn>
* ArmVirtPkg: Enable the non-hardcode version FdtNorFlashQemuLibChao Li2024-06-043-8/+38
| | | | | | | | | | | | | | | | | | | Enable the non-hardcode version of FdtNorFlashQemuLib in ArmVirtQemu.dsc and ArmVirtQemuKernel.dsc, and it can work rightly after enabling it. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4770 Build-tested (with "ArmVirtQemu.dsc" and "ArmVirtQemuKernel.dsc"). Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Co-authored-by: Xianglai Li <lixianglai@loongson.cn> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* ArmVirtPkg/ArmVirtQemu: Add RngDxe driveredk2-stable202405Ard Biesheuvel2024-05-244-1/+7
| | | | | | | | | | | | | | | | | | | | | Add the RngDxe driver to the build, backed by either RNDR or TRNG, one of which is expected to be available in most cases: - RNDR is implemented by the 'max' CPU that QEMU implements in TCG mode - TRNG is implemented by the KVM hypervisor, which backs QEMU's 'host' CPU Other TCG modes (e.g., the 'cortex-a*' CPUs) implement neither, which should prevent the RngDxe driver from dispatching entirely, resulting in the same situation as before. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Committed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Reverse inclusion order of MdeLibs.inc and ArmVirt.dsc.incArd Biesheuvel2024-05-243-6/+6
| | | | | | | | | | | | | | | | MdeLibs.inc sets default library class resolutions which are much more general than the ones that might be specified in ArmVirt.dsc.inc. So the latter should be included *after* MdeLibs.inc to ensure that its definitions take precedence. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Committed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Use dynamic PCD to set the SMCCC conduitArd Biesheuvel2024-05-246-0/+26
| | | | | | | | | | | | | | | | | | | | On ARM systems, whether SMC or HVC instructions need to be used to issue monitor calls is typically dependent on the exception level, but there are also cases where EL1 might use SMC instructions, so there is no hard and fast rule. For ArmVirtQemu, this does depend strictly on the exception level, so set the default to HVC (for EL1 execution) and override it to SMC when booted at EL2. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Committed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg/ArmVirtQemu: Permit the use of dynamic PCDs in PEIArd Biesheuvel2024-05-242-6/+2
| | | | | | | | | | | | | | | | Currently, only TPM2 builds enable the PCD PEIM, which is a prerequisite for being able to use dynamic PCDs already at the PEI stage. This facility will be used for other reasons too so move those pieces out of code block that are conditional on TPM2_ENABLE Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Committed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Move PcdMonitorConduitHvcFlickdm2024-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This moves the PcdMonitorConduitHvc from PcdsFeatureFlag.Common to PcdsFixedAtBuild.Common This is a follow on to the previous commit: ArmPkg: Allow SMC/HVC monitor conduit to be specified at runtime ArmVirtQemu may execute at EL2, in which case monitor calls are generally made using SMC instructions instead of HVC instructions. Whether or not this is the case can only be decided at runtime, and so the associated PCD needs to be settable at runtime, if the platform definition chooses so. This implies a boolean PCD, given that a feature PCD is build-time configurable only. Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Add Hash2DxeCrypto to ArmVirtPkgFlickdm2024-05-243-0/+15
| | | | | | | | | | | | | This patch adds Hash2DxeCrypto to ArmVirtPkg. The Hash2DxeCrypto is used to provide the hashing protocol services. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg PlatformCI: Support virtio-rng-pciFlickdm2024-05-241-0/+2
| | | | | | | | | | | | | This patch adds "virtio-rng-pci" to the PlatformBuildLib.py This adds Rng services to the guest VM Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* ArmVirtPkg: Enable QemuFwCfgMmioDxeLib.infChao Li2024-04-302-2/+2
| | | | | | | | | | | | | | | | Enable QemuFwCfgMmioDxeLib.inf in ArmVirtQemu.dsc and ArmVirtQemuKernel.dsc. Build-tested only (with "ArmVirtQemu.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4755 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Chao Li <lichao@loongson.cn>
* ArmVirtPkg/ArmVirtQemu: always build XIP code with strict alignmentArd Biesheuvel2024-04-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The optimization that enabled entry with MMU and caches enabled at EL1 removed the strict alignment requirement for XIP code (roughly, any code that might execute with the MMU and caches off, which means SEC and PEI phase modules but also *all* BASE libraries), on the basis that QEMU can only run guest payloads at EL2 in TCG emulation, which used to ignore alignment violations, and execution at EL1 would always occur with the MMU enabled. This assumption no longer holds: not only does QEMU now enforce strict alignment for memory accesses with device semantics, there are also cases where this code might execute at EL2 under virtualization (i.e., under NV2 nested virtualization) where the strict alignment is required too. The latter case could be optimized too, by enabling VHE and pretending execution is occurring at EL1, which would allow the existing logic for entry with the MMU enabled to be reused. However, this would leave non-VHE CPUs behind. So in summary, strict alignment needs to be enforced for any code that may execute with the MMU off, so drop the override that sets the XIP flags to the empty string. Cc: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* ArmVirtPkg: auto-generate SEC ProcessLibraryConstructorList() declLaszlo Ersek2024-03-082-7/+1
| | | | | | | | | | | | | | | | | | | | Rely on AutoGen for declaring ProcessLibraryConstructorList(). Build-tested with: build -a AARCH64 -b DEBUG \ -m ArmVirtPkg/PrePi/ArmVirtPrePiUniCoreRelocatable.inf \ -p ArmVirtPkg/ArmVirtKvmTool.dsc -t GCC5 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=990 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240305113843.68812-7-lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com>
* ArmVirtPkg/XenAcpiPlatformDxe: Install FACS table from DTDavid Woodhouse2024-02-251-8/+29
| | | | | | | | | | | | | | | | The FACS may still exist when the reduced hardware flag is set in FADT; it is optional. Since it contains the hardware signature field which indicates that a hibernated system should boot cleanly instead of attempting to resume, a platform may choose to expose it. Propagate it correctly. Also avoid a NULL pointer dereference if the platform doesn't provide a DSDT. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <881dd0a2558ecbdfa02c844722d8a1103ab97ab3.camel@infradead.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: uncrustify]
* ArmVirtPkg: Move PlatformBootManagerLib to OvmfPkgChao Li2024-02-067-1544/+2
| | | | | | | | | | | | | | | | | | | Moved the PlatformBootManagerLib to OvmfPkg and renamed to PlatformBootManagerLibLight for easy use by other ARCH. Build-tested only (with "ArmVirtQemu.dsc and OvmfPkgX64.dsc"). BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4663 Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Lazlo Ersek <lersek@redhat.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Laszlo Ersek <lersek@redhat.com>