From 4f565b52225785bfa268ea19c4c347917d38ade4 Mon Sep 17 00:00:00 2001 From: Romain Naour Date: Mon, 5 Feb 2024 14:35:30 +0100 Subject: [PATCH] support/testing: use Nehalem cpu emulation for TestGrubX8664EFI In commit 7e0e6e3b8618 (toolchain/toolchain-external/toolchain-external-bootlin: update to 2023.11-1) the TestGrubX8664EFI fails with this error: # efivar -l traps: efivar[86] trap invalid opcode ip:7fc187f4c7f4 sp:7fff9bbaa930 error:0 in libefivar.so.1.38[7fc187f4c000+16000] Illegal instruction This error can be reproduced by installing other packages like "file". The 2023.11-1 Bootlin toolchains are built for a corei7 CPU [0], which is in fact a Nehalem CPU; we switched to the new names in commit 653fa001f304 (arch/Config.in.x86: add "newer" names for several Intel x86 CPU variants). This means that the Bootlin toolchains may use Nehalem-specific instructions. The TestGrubX8664EFI test is also setup for BR2_x86_corei7, so our executables will also contain Nehalem instructions. However, the default Qemu x86_64 is not guaranteed to emulate all the instructions specific to Nehalem, causing runtime issues as reported above. A similar issue has been fixed in toolchain-builder by adding Nehalem cpu emulation on the qemu command line [0]. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/6093853712 [0] https://gitlab.com/buildroot.org/toolchains-builder/-/commit/f2b253732b4d1fc5b87badba7c2d48f12a197f76 Signed-off-by: Romain Naour [yann.morin.1998@free.fr: - reword the commit log to explain corei7 -> Nehalem equivalence - note that the toolchain-builder *and* our test target corei7, thus Nehalem ] Signed-off-by: Yann E. MORIN --- support/testing/tests/boot/test_grub.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/testing/tests/boot/test_grub.py b/support/testing/tests/boot/test_grub.py index 9f3a6a8495..5315fa23ba 100644 --- a/support/testing/tests/boot/test_grub.py +++ b/support/testing/tests/boot/test_grub.py @@ -120,7 +120,7 @@ class TestGrubX8664EFI(infra.basetest.BRTest): # https://github.com/tianocore/edk2/commit/bf5678b5802685e07583e3c7ec56d883cbdd5da3 # http://lists.busybox.net/pipermail/buildroot/2023-July/670825.html qemu_fw_cfg = "name=opt/org.tianocore/X-Cpuhp-Bugcheck-Override,string=yes" - self.emulator.boot(arch="x86_64", options=["-bios", bios, "-hda", hda, "-fw_cfg", qemu_fw_cfg]) + self.emulator.boot(arch="x86_64", options=["-bios", bios, "-cpu", "Nehalem", "-hda", hda, "-fw_cfg", qemu_fw_cfg]) self.emulator.login() cmd = "modprobe efivarfs"