tests/uefi-test-tools: report the SMBIOS entry point structuresOn UEFI systems, the SMBIOS entry point (a.k.a. anchor) structures arefound similarly to the ACPI RSD PTR table(s): by scanning theC
tests/uefi-test-tools: report the SMBIOS entry point structuresOn UEFI systems, the SMBIOS entry point (a.k.a. anchor) structures arefound similarly to the ACPI RSD PTR table(s): by scanning theConfigurationTable array in the EFI system table for well-known GUIDs.Locate the SMBIOS 2.1 (32-bit) and 3.0 (64-bit) anchors in theBiosTablesTest UEFI application, and report the addresses in new fieldsappended to the BIOS_TABLES_TEST structure.Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>Cc: Igor Mammedov <imammedo@redhat.com>Launchpad: https://bugs.launchpad.net/qemu/+bug/1821884Signed-off-by: Laszlo Ersek <lersek@redhat.com>Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>Reviewed-by: Igor Mammedov <imammedo@redhat.com>Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>Tested-by: Igor Mammedov <imammedo@redhat.com>
show more ...
tests: introduce "uefi-test-tools" with the BiosTablesTest UEFI appThe "bios-tables-test" program in QEMU's test suite locates the RSD PTRACPI table in guest RAM, and (chasing pointers to other AC
tests: introduce "uefi-test-tools" with the BiosTablesTest UEFI appThe "bios-tables-test" program in QEMU's test suite locates the RSD PTRACPI table in guest RAM, and (chasing pointers to other ACPI tables)performs various sanity checks on the QEMU-generated andfirmware-installed tables.Currently this set of test cases doesn't work with UEFI guests. The ACPIspec defines distinct methods for OSPM to locate the RSD PTR ontraditional BIOS vs. UEFI platforms, and the UEFI method is more difficultto implement from the hypervisor side with just raw guest memory access.Add a UEFI application (to be booted in the UEFI guest) that populates asmall, MB-aligned structure in guest RAM. The structure begins with asignature GUID. The hypervisor should loop over all MB-aligned pages inguest RAM until one matches the signature GUID at offset 0, at which pointthe hypervisor can fetch the RSDP address field(s) from the structure.QEMU's test logic currently spins on a pre-determined guest address, untilthat address assumes a magic value. The method described in this patch isconceptually the same ("busy loop until match is found"), except there isno hard-coded address. This plays a lot more nicely with UEFI guestfirmware (we'll be able to use the normal page allocation UEFI service).Given the size of EFI_GUID (16 bytes -- 128 bits), mismatches should beastronomically unlikely. In addition, given the typical guest RAM size forsuch tests (128 MB), there are 128 locations to check in one iteration ofthe "outer" loop, which shouldn't introduce an intolerable delay after theguest stores the RSDP address(es), and then the GUID.The GUID that the hypervisor should search for is AB87A6B1-2034-BDA0-71BD-375007757785Expressed as a byte array: { 0xb1, 0xa6, 0x87, 0xab, 0x34, 0x20, 0xa0, 0xbd, 0x71, 0xbd, 0x37, 0x50, 0x07, 0x75, 0x77, 0x85 }Note that in the patch, we define "gBiosTablesTestGuid" with all bitsinverted. This is a simple method to prevent the UEFI binary, whichincorporates "gBiosTablesTestGuid", from matching the actual GUID in guestRAM.The UEFI application is written against the edk2 framework, which wasintroduced earlier as a git submodule. The next patch will provide buildscripts for maintainers.The source code follows the edk2 coding style, and is licensed under the2-clause BSDL (in case someone would like to include UefiTestToolsPkgcontent in a different edk2 platform).The "UefiTestToolsPkg.dsc" platform description file resolves the usededk2 library classes to instances (= library implementations) such thatthe UEFI binaries inherit no platform dependencies. They are expected torun on any system that conforms to the UEFI-2.3.1 spec (which was releasedin 2012). The arch-specific build options are carried over from edk2'sArmVirtPkg and OvmfPkg platforms.Cc: "Michael S. Tsirkin" <mst@redhat.com>Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>Cc: Gerd Hoffmann <kraxel@redhat.com>Cc: Igor Mammedov <imammedo@redhat.com>Cc: Philippe Mathieu-Daudé <philmd@redhat.com>Cc: Shannon Zhao <shannon.zhaosl@gmail.com>Signed-off-by: Laszlo Ersek <lersek@redhat.com>Message-Id: <20190204160325.4914-4-lersek@redhat.com>Reviewed-by: Igor Mammedov <imammedo@redhat.com>Reviewed-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>