feat: set qemu prebuilt path based on host machine

Adjust qemu prebuilt binary path based on probed machine to be
either x86 or aarch64.

Change-Id: If3a4be22f05aff52cc354cd7f635d63331244f75
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index d95c0b1..96b49ae 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -26,8 +26,12 @@
 import sys
 import time
 import fdt
+import platform
 from telnetlib import Telnet
 
+MACHINE = platform.machine()
+MACHINE = "linux-" + ("x64" if MACHINE == "x86_64" else MACHINE)
+
 HFTEST_LOG_PREFIX = "[hftest] "
 HFTEST_LOG_FAILURE_PREFIX = "Failure:"
 HFTEST_LOG_FINISHED = "FINISHED"
@@ -42,6 +46,7 @@
     os.path.dirname(HF_ROOT), "fvp", "Base_RevC_AEMvA_pkg", "models",
     "Linux64_GCC-9.3", "FVP_Base_RevC-2xAEMvA")
 HF_PREBUILTS = os.path.join(HF_ROOT, "prebuilts")
+QEMU_PREBUILTS = os.path.join(HF_PREBUILTS, MACHINE, "qemu", "qemu-system-aarch64")
 FVP_PREBUILTS_TFA_TRUSTY_ROOT = os.path.join(
     HF_PREBUILTS, "linux-aarch64", "trusted-firmware-a-trusty", "fvp")
 FVP_PREBUILT_DTS = os.path.join(
@@ -223,7 +228,7 @@
         cpu = self.args.cpu or "max"
         exec_args = [
             "timeout", "--foreground", time_limit,
-            os.path.abspath("prebuilts/linux-x64/qemu/qemu-system-aarch64"),
+            QEMU_PREBUILTS,
             "-no-reboot", "-machine", "virt,virtualization=on,gic-version=3",
             "-cpu", cpu, "-smp", "8", "-m", "1G",
             "-nographic", "-nodefaults", "-serial", "stdio",