summaryrefslogtreecommitdiffstats
path: root/ArmVirtPkg
Commit message (Collapse)AuthorAgeFilesLines
* ArmVirtPkg: Enable UDF file system supportPaulo Alcantara2017-09-085-4/+9
| | | | | | | | | | | | This patch enables UDF file system support by default. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* ArmVirtPkg: remove DmaLib library class resolutionArd Biesheuvel2017-08-301-1/+0
| | | | | | | | | | The virt targets never use non-coherent DMA, so there is no point in having a shared DmaLib library class resolution pointing to ArmDmaLib. So drop it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: drop unused Pcds from ArmVirt.dsc.incLeif Lindholm2017-08-241-12/+0
| | | | | | | | | | A block of settings has been copied around ARM platforms for years. These are consumed only by Ebl, and since none of the ArmVirtPkg platforms use that, drop them. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: remove QemuVideoDxe from ArmVirtQemu and ArmVirtQemuKernelArd Biesheuvel2017-08-243-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the reasons for introducing virtio-gpu support to OvmfPkg and ArmVirtpkg was the fact that under KVM virtualization on ARM, the legacy VGA cannot be used reliably. This is due to an implementation detail of QEMU+KVM, which remaps cached host memory into the guest address space as a framebuffer behind a PCI BAR. Given that the purpose of a memory mapped framebuffer is its side effects, such BARs should never be mapped cacheable in the guest, and the mismatched attributes between host and guest result in a loss of coherency, visible as corruption in the framebuffer image. This issue does not occur under TCG emulation, nor did we expect it to actually bring down the guest under KVM, and so it was deemed harmless to keep support for the VGA device as well. However, as it turns out, the fact that the framebuffer BAR is mapped using device semantics by default may result in unalignment faults when we use the ordinary string copy routines on the contents. In theory, we could work around this by remapping the BAR as write combining, but it appears the generic PCI bus driver does not actually implement this. So let's remove the QemuVideoDxe driver altogether. This may result in loss of functionality for use cases that rely on the framebuffer to be directly addressable (such as EFIFB), but given that this never worked reliably under KVM in the first place, let's not let that stop us from dropping support for it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* ArmVirtPkg/FdtPL011SerialPortLib: call PL011UartLib in all SerialPortLib APIsLaszlo Ersek2017-08-171-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the SerialDxe change in commit 4cf3f37c87ba ("MdeModulePkg SerialDxe: Process timeout consistently in SerialRead", 2017-07-18), setting EFI_SERIAL_INPUT_BUFFER_EMPTY in the "Control" output parameter, in the GetControl() SerialPortLib function, is no longer a "small optimization". Namely, due to the SerialDxe change, the GetOneKeyFromSerial() call in TerminalDxe's TerminalConInTimerHandler() can take very long if the input queue is empty, even if GetOneKeyFromSerial()'s return value causes the loop to be exited right after, in the first iteration. This issue causes a boot hang in ArmVirtQemu: with the input queue empty, TerminalConInTimerHandler() takes so long to return that, by the time it returns, there's another execution queued already (due to the associated timer event being signaled meanwhile). The boot process is stuck in the timer event handler. Therefore even the first GetOneKeyFromSerial() iteration must be prevented in TerminalConInTimerHandler() if the input queue is empty, and that requires implementing GetControl() for real. Implement the SetAttributes(), SetControl() and GetControl() APIs (of SerialPortExtLib origin) in FdtPL011SerialPortLib with calls to matching PL011UartLib functions. This follows the example of "ArmPlatformPkg/Library/PL011SerialPortLib" and also matches Star's original idea under [1]. The patch can be considered a continuation of commit ad7f6bc2e116 ("ArmVirtPkg: Use SerialDxe in MdeModulePkg instead of EmbeddedPkg", 2015-11-26), based on the mailing list threads [1] [2] [3]. [1] http://mid.mail-archive.com/1447752930-32880-12-git-send-email-star.zeng@intel.com [2] http://mid.mail-archive.com/1448243067-1880-12-git-send-email-star.zeng@intel.com [3] http://mid.mail-archive.com/b748580c-cb51-32c9-acf9-780841ef15da@redhat.com Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Heyi Guo <guoheyi@huawei.com> Cc: Star Zeng <star.zeng@intel.com> Originally-suggested-by: Star Zeng <star.zeng@intel.com> Reported-by: Brijesh Singh <brijesh.singh@amd.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Brijesh Singh <brijesh.singh@amd.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* edk2: Move License.txt file to rootMichael D Kinney2017-08-031-29/+0
| | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=642 Add top level License.txt file with the BSD 2-Clause License that is used by the majority of the EKD II open source project content. Merge copyright statements from the BSD 2-Clause License files in each package directory and remove the duplication License.txt file from package directories. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Andrew Fish <afish@apple.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* edk2: Move TianoCore Contribution Agreement to rootMichael D Kinney2017-08-031-218/+0
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=629 Move Contributions.txt that contains the TianoCore Contribution Agreement 1.0 to the root of the edk2 repository and remove the duplicate Contributions.txt files from all packages. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Andrew Fish <afish@apple.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* ArmVirtPkg: remove status code supportArd Biesheuvel2017-07-051-9/+2
| | | | | | | | | | | | | | | | | | | | Commit 7b1dc6c569a 'ArmVirtPkg: switch to generic ResetSystemRuntimeDxe' replaced all references in ArmVirtPkg to the deprecated ResetRuntimeDxe from EmbeddedPkg with the well maintained generic alternative that lives in MdeModulePkg. However, as it turns out, the generic driver has a dependency on the library class ReportStatusCodeLib, whose default resolution is an implementation that is not safe for use at runtime, resulting in crashes when trying to invoke it from the OS. Since we have no use for status codes in any of the ArmVirtPkg platforms, let's replace all resolutions with a common one to the NULL implementation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: switch to generic ResetSystemRuntimeDxeArd Biesheuvel2017-07-038-54/+91
| | | | | | | | | | | | | | | | | | | | | | | | | For obscure reasons, ARM platforms use a different implementation of the ResetSystem() runtime service call than other platforms. So let's switch all ArmVirtPkg platforms to the generic version instead. Given that all platforms use an implementation of EfiResetSystemLib [as consumed by the ResetRuntimeDxe in EmbeddedPkg that we are replacing] which is unlikely to be depended upon by out of tree platforms, let's simply modify this library into an implementation of ResetSystemLib instead [which is what the generic driver in MdeModulePkg consumes] This does mean we need to update all clients at the same time, which is why all changes are part of the same patch. As before, warm reset and platform specific reset are mapped onto cold reset (which is the only thing PSCI implements, at least the version we depend on). The new library function EnterS3WithImmediateWake() is left unimplemented, as permitted by the ResetSystemLib library class. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmPlatformPkg,ArmVirtPkg: delete redundant PL031 functionsLeif Lindholm2017-05-101-0/+1
| | | | | | | | | | Remove the functions now provided by TimeBaseLib from PL031RealTimeClockLib. Add TimeBaseLib resolution to ArmVirtPkg in same commit to prevent breakage. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg: install EdkiiPlatformHasDeviceTree proto in the 32-bit buildsNerijus Baliƫnas2017-05-035-5/+5
| | | | | | | | | | | | | | | | | | Include XenPlatformHasAcpiDtDxe and PlatformHasAcpiDtDxe in the 32-bit builds too. Please see https://bugzilla.tianocore.org/show_bug.cgi?id=524 why it is needed. With this patch my arm uefi VM boots. Fixes: 3a2c1548fe2df4b0b067671e2025da6372063218 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Nerijus Baliƫnas <nerijus@users.sourceforge.net> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: move long subj to commit msg body, add short subj] [lersek@redhat.com: add Fixes reference] [lersek@redhat.com: keep ACPI DXE modules grouped in QEMU DSCs] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/ArmVirtXen: remove ARM BdsLib library class resolutionArd Biesheuvel2017-04-131-2/+0
| | | | | | | | | Remove the library class resolution for ARM's BdsLib: no included module actually depends on it, and it will be removed shortly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg: move PlatformHasAcpiGuid from EmbeddedPkgArd Biesheuvel2017-04-052-0/+2
| | | | | | | | | | | | Given the agreement on the edk2-devel regarding the fact that the notion whether or not a 'platform has ACPI' is a universal one, move the PlatformHasAcpi GUID to MdeModulePkg. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: "Zeng, Star" <star.zeng@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* ArmVirtPkg/ArmVirtQemuKernel: increase slack space for DTBArd Biesheuvel2017-04-041-6/+6
| | | | | | | | | | | | | | | | | | | | The relocatable build of ArmVirtQemuKernel is designed to be executed from RAM, and contains some scratch memory at the start of the image to use as a stack very early on, and to preserve the DTB image received from QEMU while it discovers and initializes memory. It turns out that 8 KB is a bit on the small side here, especially when executing with secure world emulation enabled, in which case there are additional nodes present. So increase the slack space to 32 KB. While at it, remove a stale Xen reference that was copy/pasted when this file was created. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/PlatformPeiLib: honor DT node 'status' propertyArd Biesheuvel2017-04-041-0/+7
| | | | | | | | | | | | | | In some cases, (e.g., when running QEMU with TrustZone emulation), the DT may contain DT nodes whose status is set to 'secure'. Similarly, the status may be set to 'disabled' if the consumer of the DT image is expected to treat it as if it weren't there. So check whether a 'status' property is present, and if so, ignore the node if the status is not 'okay'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' propertyArd Biesheuvel2017-04-041-0/+6
| | | | | | | | | | | | | | In some cases, (e.g., when running QEMU with TrustZone emulation), the DT may contain DT nodes whose status is set to 'secure'. Similarly, the status may be set to 'disabled' if the consumer of the DT image is expected to treat it as if it weren't there. So check whether a 'status' property is present, and if so, ignore the node if the status is not 'okay'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/FdtClientDxe: honor memory DT node 'status' propertyArd Biesheuvel2017-04-041-0/+8
| | | | | | | | | | | | | | In some cases, (e.g., when running QEMU with TrustZone emulation), the DT may contain memory nodes whose status is set to 'secure'. Similarly, the status may be set to 'disabled' if the consumer of the DT image is expected to treat it as if it weren't there. So check whether a 'status' property is present, and if so, ignore the node if the status is not 'okay'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable overrideArd Biesheuvel2017-03-314-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In general, we should not present two separate (and inevitably different) hardware descriptions to the OS, in the form of ACPI tables and a device tree blob. For this reason, we recently added the logic to ArmVirtQemu to only expose the ACPI 2.0 entry point if no DT binary is being passed, and vice versa. However, this is arguably a regression for those who relied on DT descriptions being available, even if the former behavior can be restored by passing the -no-acpi switch to QEMU. So allow a secret handshake with the UEFI Shell, to set a variable that will result in ACPI to be disabled on subsequent boots even if -no-acpi was not passed on the QEMU command line. setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =01 To delete the variable and revert to the old situation, simply omit the value after the = setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi = Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
* ArmVirtPkg: remove ArmCpuLib referencesArd Biesheuvel2017-03-313-19/+0
| | | | | | | | | ArmCpuLib is never used anywhere, and is about to be removed. So remove any references from our .DSC files. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBootLaszlo Ersek2017-03-282-15/+0
| | | | | | | | | | The build flag and the FeaturePCD have no effect any longer, remove them. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPILaszlo Ersek2017-03-282-23/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will let QEMU's "-no-acpi" option exclusively expose DT vs. ACPI to the guest. Showing both is never needed (it is actually detrimental to the adoption of standards, such as SBSA / SBBR). * Without "-no-acpi", the firmware logs (from PlatformHasAcpiDtDxe) > Found FwCfg @ 0x9020008/0x9020000 > Found FwCfg DMA @ 0x9020010 > InstallProtocolInterface: [EdkiiPlatformHasAcpi] 0 plus the usual messages. Later the guest kernel logs > [ 0.000000] efi: SMBIOS 3.0=0x13bdb0000 ACPI 2.0=0x138440000 > MEMATTR=0x13a675018 before it lists the ACPI tables one by one. In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern matches no files, while the "/sys/firmware/acpi/tables/*" pattern matches the ACPI tables. * With "-no-acpi", the firmware logs: > PlatformHasAcpiDtDxe | Found FwCfg @ 0x9020008/0x9020000 > PlatformHasAcpiDtDxe | Found FwCfg DMA @ 0x9020010 > PlatformHasAcpiDtDxe | InstallProtocolInterface: > PlatformHasAcpiDtDxe | [EdkiiPlatformHasDeviceTree] 0 > FdtClientDxe | OnPlatformHasDeviceTree: exposing DTB @ > FdtClientDxe | 0x13FFBF000 to OS > ... > DXE_CORE | Driver [AcpiTableDxe] was discovered but not > DXE_CORE | loaded!! > DXE_CORE | Driver [QemuFwCfgAcpiPlatform] was discovered but > DXE_CORE | not loaded!! > ... > RamDiskDxe | RamDiskAcpiCheck: Cannot locate the EFI ACPI > RamDiskDxe | Table Protocol, unable to publish RAM disks to > RamDiskDxe | NFIT. (BootGraphicsResourceTableDxe's ReadyToBoot callback -- InstallBootGraphicsResourceTable() -- handles the lack of EFI_ACPI_TABLE_PROTOCOL silently.) Later the guest kernel logs > [ 0.000000] efi: SMBIOS 3.0=0x13bdb0000 MEMATTR=0x138caa018 In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern matches the directory "/sys/firmware/devicetree/base", which contains a large number of DT nodes, while the "/sys/firmware/acpi/tables/*" pattern matches no files. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1430262 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notifyLaszlo Ersek2017-03-282-12/+97
| | | | | | | | | | | | Replace the dependency on PcdPureAcpiBoot with a Platform Has Device Tree notification callback. Move the sysconfig table installation from the entry point function to the callback. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamicallyLaszlo Ersek2017-03-286-1/+13
| | | | | | | | | | | | | | | | In this patch, the ACPI protocol / driver chain is enabled dynamically, when appropriate. This is being done in one larger patch, because ArmVirt.dsc.inc, where AcpiTableDxe is built, is used by all the platform DSCs. No change in behavior should be observable after this patch on any ArmVirtPkg platform. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg: add XenPlatformHasAcpiDtDxeLaszlo Ersek2017-03-282-0/+114
| | | | | | | | | | | | | This driver produces the EDKII Platform Has ACPI and Platform Has Device Tree protocols, exactly matching the current ACPI / DT exposure on Xen, according to ARM vs. AARCH64. At this point it differs from the QEMU driver PlatformHasAcpiDtDxe in that this one always installs the DT. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg: add PlatformHasAcpiDtDxeLaszlo Ersek2017-03-282-0/+124
| | | | | | | | | | | | This driver produces the EDKII Platform Has ACPI and Platform Has Device Tree protocols, exactly matching the current ACPI / DT exposure on QEMU, according to ARM vs. AARCH64, and (in the latter case) to PcdPureAcpiBoot. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directlyLaszlo Ersek2017-03-281-1/+2
| | | | | | | | | | Because that breaks the (potential) 32-bit build of the driver. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot"Laszlo Ersek2017-03-282-41/+9
| | | | | | | | | | | | | | | | | | | This reverts commit 18f6d4df9ece8b91b86511bcdd1cf7da478c3627. We realized that DXE drivers that are independent of AcpiPlatformDxe (that is, independent of QEMU's ACPI generation), such as RamDiskDxe and BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables, at driver dispatch or even at Ready To Boot. This makes it unsafe for us to check for ACPI presence in the UEFI system config table in a Ready To Boot callback, in order to decide about exposing the DT. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* Revert "ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependent"Laszlo Ersek2017-03-284-13/+23
| | | | | | | | | | | | | | | | | | | This reverts commit 78c41ff519b187d8979cda7074f007a6323f9acd. We realized that DXE drivers that are independent of AcpiPlatformDxe (that is, independent of QEMU's ACPI generation), such as RamDiskDxe and BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables, at driver dispatch or even at Ready To Boot. This makes it unsafe for us to check for ACPI presence in the UEFI system config table in a Ready To Boot callback, in order to decide about exposing the DT. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Leif Lindholm <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg/ArmVirtQemu: refer to Shell app via its declared GUIDArd Biesheuvel2017-03-224-6/+4
| | | | | | | | | | | | | | Currently, the file GUID reference of the UEFI Shell app is indirected via the PCD gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile, which is set to a fixed value for our platforms. So instead, use the new symbolic GUID added for this purpose, and drop the reference to this PCD, and to the IntelFrameworkModulePkg package entirely. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/HighMemDxe: check new regions against GCD memory space mapArd Biesheuvel2017-03-212-12/+19
| | | | | | | | | | | | | | | | Instead of looking at the PCD gArmTokenSpaceGuid.PcdSystemMemoryBase to decide which DT node covers the memory we are already using, query the GCD memory space map, which is the authoritative source for this kind of information This fixes a problem observed by Michael on platforms where this PCD is of the 'Patchable' type, which means updates to its value do not propagate to other modules. Reported-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/HighMemDxe: use CPU arch protocol to apply memprotect policyArd Biesheuvel2017-03-212-7/+25
| | | | | | | | | | | | | Instead of invoking gDS->SetMemorySpaceAttributes to set the EFI_MEMORY_XP attribute on newly added regions, which is guaranteed to fail if the same attribute was not declared as a capability of the region when it as added, invoke the CPU arch protocol directly to set the EFI_MEMORY_XP attribute if our memory protection policy demands it. Reported-by: Michael Zimmermann <sigmaepsilon92@gmail.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg, OvmfPkg: retire QemuFwCfgS3Enabled() from QemuFwCfgLibLaszlo Ersek2017-03-141-17/+0
| | | | | | | | | | | | | | | | | | | | At this point we're ready to retire QemuFwCfgS3Enabled() from the QemuFwCfgLib class, together with its implementations in: - ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c - OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c Extend all modules that call the function with a new QemuFwCfgS3Lib class dependency. Thanks to the previously added library class, instances, and class resolutions, we can do this switch now as tightly as possible. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg: resolve QemuFwCfgS3LibLaszlo Ersek2017-03-142-0/+2
| | | | | | | | | | | | | | | | | QemuFwCfgS3Enabled() in "ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c" returns constant FALSE. The same implementation is now available factored-out in "OvmfPkg/Library/QemuFwCfgS3Lib/QemuFwCfgS3Base.c". Resolve QemuFwCfgS3Lib to BaseQemuFwCfgS3LibNull. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg/FdtClientDxe: make DT table installation !ACPI dependentArd Biesheuvel2017-03-094-23/+13
| | | | | | | | | | | | Instead of having a build time switch to prevent the FDT configuration table from being installed, make this behavior dependent on whether we are passing ACPI tables to the OS. This is done by looking for the ACPI 2.0 configuration table, and only installing the FDT one if the ACPI one cannot be found. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBootArd Biesheuvel2017-03-092-9/+41
| | | | | | | | | | | | Defer FDT configuration table installation until ReadyToBoot is signaled. This allows any driver to make modifications in the mean time, and will also allow us to defer the decision of whether to install it in the first place to later on in the boot. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/ArmVirtPL031FdtClientLib: unconditionally disable DT nodeArd Biesheuvel2017-03-092-15/+10
| | | | | | | | | | | | Disable the PL031 RTC DT node unconditionally rather than only when the DT will be exposed to the OS. This allows us to defer the decision whether to expose it to the OS to a later time without creating an additional dependency on the FDT client code by the RTC driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/FdtClientDxe: supplement missing EFIAPI calling conv specifiersLaszlo Ersek2017-03-091-0/+3
| | | | | | | | | | | | Add missing EFIAPI calling convention specifiers to STATIC function that are exposed via the FdtClientProtocol interface. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* ArmVirtPkg: apply PE/COFF memory protection to DxeCore as wellArd Biesheuvel2017-03-081-1/+1
| | | | | | | | | | Include DXE_CORE in the BuildOptions that are set to force 4 KB section alignment for PE/COFF images in order to allow them to be mapped with strict memory permissions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: enable non-executable DXE stack for all platformsArd Biesheuvel2017-03-073-4/+5
| | | | | | | | | | | | | | | Now that ARM has grown support for managing memory permissions in ArmMmuLib, we can enable the non-executable DXE stack for all virt platforms. Note that this includes the AARCH64 Xen platform as well. Note that this is not [entirely] redundant: the non-executable stack is configured before DxeCore is invoked. The image and memory protection features configured during DXE only take affect when the CPU arch protocol implementation is registered. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: enable PE/COFF image and memory protection for ARM platformsArd Biesheuvel2017-03-071-5/+4
| | | | | | | | | | | | Like for AARCH64, enable PE/COFF image and NX memory protection for all 32-bit ARM virt platforms. Note that this does not [yet] protect EfiLoaderData regions, due to compatibility issues with GRUB. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg AARCH64: enable NX memory protection for all platformsArd Biesheuvel2017-03-011-0/+7
| | | | | | | | | | | | | | | This sets the recently introduced PCD PcdDxeNxMemoryProtectionPolicy to a value that protects all memory regions except code regions against inadvertent execution. Note that this does not [yet] protect EfiLoaderData regions, due to compatibility issues with shim and GRUB. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: move UefiBootManagerLib resolution to ArmVirt.dsc.incArd Biesheuvel2017-03-013-2/+1
| | | | | | | | | | | Recent changes to ShellPkg require a resolution for UefiBootManagerLib for all platforms in ArmVirtPkg. So move the resolution to the shared include ArmVirt.dsc.inc. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg/HighMemDxe: preserve non-exec permissions on newly added regionsArd Biesheuvel2017-03-012-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using DxeServices::SetMemorySpaceAttributes to set cacheability attributes has the side effect of stripping permission attributes, given that those are bits in the same bitfield, and so setting the Attributes argument to EFI_MEMORY_WB implies not setting EFI_MEMORY_XP or EFI_MEMORY_RO attributes. In fact, the situation is even worse, given that the descriptor returned by DxeServices::GetMemorySpaceDescriptor does not reflect the permission attributes that may have been set by the preceding call to DxeServices::AddMemorySpace if PcdDxeNxMemoryProtectionPolicy has been configured to map EfiConventionalMemory with non-executable permissions. Note that this applies equally to the non-executable stack and to PE/COFF sections that may have been mapped with R-X or RW- permissions. This is due to the ambiguity in the meaning of the EFI_MEMORY_RO/EFI_MEMORY_XP attributes when used in the GCD memory map, i.e., between signifying that an underlying RAM region has the controls to be configured as read-only or non-executable, and signifying that the contents of a certain UEFI memory region allow them to be mapped with certain restricted permissions. So let's check the policy in PcdDxeNxMemoryProtectionPolicy directly, and set the EFI_MEMORY_XP attribute if appropriate for EfiConventionalMemory regions. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmPkg: remove unused PcdArmUncachedMemoryMask PCDArd Biesheuvel2017-02-273-15/+0
| | | | | | | | | | | | This removes the PCD PcdArmUncachedMemoryMask from ArmPkg, along with any remaining references to it in various platform .DSC files. It is no longer used now that we removed the virtual uncached pages protocol and the associated DebugUncachedMemoryAllocationLib library instance. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* ArmVirtPkg: clear PcdPerformanceLibraryPropertyMask PCDArd Biesheuvel2017-02-271-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only observeable effect of having PcdPerformanceLibraryPropertyMask set to 1 is that a EfiReservedMemory region of 4 pages is allocated right below the 4 GB mark. This region is out of bounds for the OS, which means it is not even allowed to map it, to avoid speculative loads from it. On Linux, this may prevent the kernel from using a 1 GB block mapping for this region, and instead it has to carve up the block as follows: 0xffffffff80000000-0xffffffffbe000000 992M PMD CON BLK 0xffffffffbe000000-0xffffffffbfe00000 30M PMD BLK 0xffffffffbfe00000-0xffffffffbfff0000 1984K PTE CON 0xffffffffbfff0000-0xffffffffbfffc000 48K PTE where it would otherwise use a single 1 GB mapping (*), i.e., 0xffffffff80000000-0xffffffffc0000000 1G PGD To clarify, the latter is a single 8 byte entry in the top level page table, whereas in the former case, we have two additional levels of paging, requiring two extra 4 KB pages (on a 4 KB pagesize kernel). The real cost, however, is the TLB footprint, which goes up from a single entry to a number between 90 and 1020, depending on whether contiguous hints are honoured by the hardware. So let's remove PcdPerformanceLibraryPropertyMask until we find a reason why we need it. (*) provided that no other allocations were deliberately located right below the 4 GB mark, and that we are running with more than 3 GB of memory, in which case most allocations will be over 4 GB, given EDK2's default top-down allocation policy. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmVirtPkg: resolve OpensslLib to OpensslLibCryptoLaszlo Ersek2017-02-251-1/+1
| | | | | | | | | | | | | | | | The OpensslLibCrypto library instance (which does not contain libssl functions) is sufficient for the Secure Boot feature. It would not be sufficient for HTTPS booting (which requires TLS), but in ArmVirtPkg, we don't even enable plaintext HTTP booting for the time being. Ease security analysis by excluding libssl functionality from the OpensslLib instance we use. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Tomas Hoger <thoger@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
* ArmVirtPkg/ArmVirt.dsc.inc: AARCH64: enable DXE image protection featureArd Biesheuvel2017-02-241-0/+10
| | | | | | | | | | | | | | | | Enable the new DXE image protection for all image, i.e., FV images but also external images that originate from disk or the network, such as OS loaders. This complements work that is underway on the arm64/Linux kernel side, to emit the OS loader with 4 KB section alignment, and a suitable split between code and data. http://marc.info/?l=linux-arm-kernel&m=148655557227819 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* ArmPkg: remove DebugUncachedMemoryAllocationLibArd Biesheuvel2017-02-231-2/+0
| | | | | | | | | | | | | | | | | | | | | The debug implementation of the UncachedMemoryAllocationLib library class relies on the creation of an uncached alias of a memory range, while keeping the original cached mapping, but with read-only attributes to trap inadvertent write accesses. This is not a terribly good idea, given that the ARM architecture does not allow mismatched attributes, and so creating them deliberately is not something we should encourage by doing it in reference code. So remove the library, and replace all references to it with a reference to the non-debug version (unless the platform does not require a resolution for it in the first place, in which case all UncachedMemoryAllocationLib references can be removed altogether). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* ArmVirtPkg/QemuFwCfgLib: implement QemuFwCfgSkipBytes() APILaszlo Ersek2017-01-311-0/+78
| | | | | | | | | | | | | | | | | We are now sufficiently equipped to implement the new QemuFwCfgSkipBytes() API. The previous patch and this one enable ArmVirtPkg/QemuFwCfgLib to overwrite part of a writeable fw_cfg file, which will be particularly useful for the upcoming QEMU_LOADER_WRITE_POINTER command in OvmfPkg/AcpiPlatformDxe. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* ArmVirtPkg/QemuFwCfgLib: use DMA for QemuFwCfgWriteBytes() if availableLaszlo Ersek2017-01-311-6/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | We use the "InternalQemuFwCfgReadBytes" static function pointer to dispatch the reading of fw_cfg bytes between MMIO and DMA. This pointer is initialized to MMIO, and we set it to DMA in the library constructor if DMA is available. Unlike the above, we write fw_cfg bytes only with MMIO at the moment. Extend the write functionality so that it follows the read pattern: - introduce the new function typedef WRITE_BYTES_FUNCTION, - extract the current (MMIO-only) write internals from QemuFwCfgWriteBytes() to MmioWriteBytes(), - provide a DMA-based implementation in DmaWriteBytes() -- a thin wrapper around DmaTransferBytes(), - set the new static function pointer "InternalQemuFwCfgWriteBytes" according to the DMA feature provided by QEMU, - In QemuFwCfgWriteBytes(), call the best available method through "InternalQemuFwCfgWriteBytes". Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>