浏览代码

arm-bsp: add new sbsa-ref machine

This is mostly based on the existing qemu-generic-arm64 machine, but by
not being based on the genericarm64 and instead being specifically a
machine to run on the qemu sbsa-ref machine we get to tune differently.

Specifically, this configures sbsa-ref to be a Neoverse N2 (v9), and the
tune is set to match.  Another notable difference to qemu-generic-arm64
is that the kernel configuration is at present defconfig.  We may wish
to change this in the future to be the same fragmented configuration as
genericarm64.

We have to ignore two testimage parselogs failures: one from NUMA which
will be fixed in a future EDK2 release, and one from efifb where we
should be using the bochsdrm driver instead (further investigation is
needed)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
Ross Burton 1 年之前
父节点
当前提交
a86f62f144

+ 10 - 0
.gitlab-ci.yml

@@ -173,6 +173,16 @@ genericarm64:
 generic-arm64:
   extends: .build
 
+sbsa-ref:
+  extends: .build
+  parallel:
+    matrix:
+      - KERNEL: [linux-yocto, linux-yocto-rt]
+        TOOLCHAINS: [gcc, clang]
+        TESTING: testimage
+      - KERNEL: linux-yocto-dev
+        TESTING: testimage
+
 juno:
   extends: .build
   parallel:

+ 10 - 0
ci/sbsa-ref.yml

@@ -0,0 +1,10 @@
+header:
+  version: 14
+  includes:
+    - ci/base.yml
+
+machine: sbsa-ref
+
+target:
+  - core-image-sato
+  - sbsa-acs

+ 2 - 0
meta-arm-bsp/conf/layer.conf

@@ -26,3 +26,5 @@ BBFILES_DYNAMIC += " \
 "
 
 WARN_QA:append:layer-meta-arm-bsp = " patch-status"
+
+addpylib ${LAYERDIR}/lib oeqa

+ 43 - 0
meta-arm-bsp/conf/machine/sbsa-ref.conf

@@ -0,0 +1,43 @@
+#@TYPE: Machine
+#@NAME: sbsa-ref
+#@DESCRIPTION: Reference SBSA machine in qemu-system-aarch64 on Neoverse N2
+
+require conf/machine/include/arm/armv9a/tune-neoversen2.inc
+require conf/machine/include/qemu.inc
+
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
+KERNEL_IMAGETYPE = "Image"
+MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
+
+MACHINE_FEATURES = " alsa bluetooth efi qemu-usermode rtc screen usbhost vfat wifi"
+
+IMAGE_FSTYPES += "wic.qcow2"
+
+# This unique WIC file is necessary because kernel boot args cannot be passed
+# because there is no default kernel (see below).  There is no default kernel
+# because QEMU will only allow firmware or kernel to be passed in as a
+# parameter, and we need the firmware.  So, to allow for "ip=dhcp" as a kernel
+# boot arg (which we need for testimage), we have to have a WIC file unique to
+# this platform.
+WKS_FILE = "qemu-efi-disk.wks.in"
+
+EFI_PROVIDER ?= "${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd-boot", "grub-efi", d)}"
+
+SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0"
+
+EXTRA_IMAGEDEPENDS += "edk2-firmware"
+
+QB_SYSTEM_NAME = "qemu-system-aarch64"
+QB_MACHINE = "-machine sbsa-ref"
+QB_CPU = "-cpu neoverse-n2"
+QB_MEM = "-m 1024"
+QB_DEFAULT_FSTYPE = "wic.qcow2"
+QB_NETWORK_DEVICE = "-device virtio-net-pci,netdev=net0,mac=@MAC@"
+QB_DRIVE_TYPE = "/dev/hd"
+QB_ROOTFS_OPT = "-drive file=@ROOTFS@,if=ide,format=qcow2"
+QB_DEFAULT_KERNEL = "none"
+QB_OPT_APPEND = "-device usb-tablet -device usb-kbd -pflash @DEPLOY_DIR_IMAGE@/SBSA_FLASH0.fd -pflash @DEPLOY_DIR_IMAGE@/SBSA_FLASH1.fd"
+QB_SERIAL_OPT = "-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon"
+QB_TCPSERIAL_OPT = "-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
+# sbsa-ref is a true virtual machine so can't use KVM
+QEMU_USE_KVM = "0"

+ 5 - 0
meta-arm-bsp/lib/oeqa/runtime/cases/parselogs-ignores-sbsa-ref.txt

@@ -0,0 +1,5 @@
+# The release of EDK2 after 202402 should fix this
+NUMA: Failed to initialise from firmware
+
+# TODO: we should be using bochsdrm over efifb?
+efifb: cannot reserve video memory at 0x80000000

+ 6 - 0
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-sbsa-ref.inc

@@ -0,0 +1,6 @@
+# sbsa-ref specific TF-A support
+
+COMPATIBLE_MACHINE = "sbsa-ref"
+
+TFA_PLATFORM       = "qemu_sbsa"
+TFA_INSTALL_TARGET = "bl1 fip"

+ 1 - 0
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend

@@ -7,6 +7,7 @@ MACHINE_TFA_REQUIRE:corstone1000 = "trusted-firmware-a-corstone1000.inc"
 MACHINE_TFA_REQUIRE:fvp-base = "trusted-firmware-a-fvp-base.inc"
 MACHINE_TFA_REQUIRE:juno = "trusted-firmware-a-juno.inc"
 MACHINE_TFA_REQUIRE:n1sdp = "trusted-firmware-a-n1sdp.inc"
+MACHINE_TFA_REQUIRE:sbsa-ref = "trusted-firmware-a-sbsa-ref.inc"
 MACHINE_TFA_REQUIRE:sgi575 = "trusted-firmware-a-sgi575.inc"
 MACHINE_TFA_REQUIRE:tc = "trusted-firmware-a-tc.inc"
 

+ 19 - 0
meta-arm-bsp/recipes-bsp/uefi/edk2-firmware-sbsa-ref.inc

@@ -0,0 +1,19 @@
+COMPATIBLE_MACHINE:sbsa-ref = "sbsa-ref"
+
+DEPENDS:append:sbsa-ref     = " trusted-firmware-a coreutils-native"
+
+EDK2_PLATFORM:sbsa-ref      = "SbsaQemu"
+EDK2_PLATFORM_DSC:sbsa-ref  = "Platform/Qemu/SbsaQemu/SbsaQemu.dsc"
+EDK2_BIN_NAME:sbsa-ref      = "SBSA_FLASH0.fd"
+
+do_compile:prepend:sbsa-ref() {
+    mkdir -p ${B}/Platform/Qemu/Sbsa/
+    cp ${RECIPE_SYSROOT}/firmware/bl1.bin ${B}/Platform/Qemu/Sbsa/
+    cp ${RECIPE_SYSROOT}/firmware/fip.bin ${B}/Platform/Qemu/Sbsa/
+}
+
+do_install:append:sbsa-ref() {
+    install ${B}/Build/${EDK2_PLATFORM}/${EDK2_BUILD_MODE}_${EDK_COMPILER}/FV/SBSA_FLASH*.fd ${D}/firmware/
+    # QEMU requires that the images be minimum of 256M in size
+    truncate -s 256M ${D}/firmware/SBSA_FLASH*.fd
+}

+ 1 - 0
meta-arm-bsp/recipes-bsp/uefi/edk2-firmware_%.bbappend

@@ -4,6 +4,7 @@ MACHINE_EDK2_REQUIRE ?= ""
 
 MACHINE_EDK2_REQUIRE:fvp-base = "edk2-firmware-fvp-base.inc"
 MACHINE_EDK2_REQUIRE:juno = "edk2-firmware-juno.inc"
+MACHINE_EDK2_REQUIRE:sbsa-ref = "edk2-firmware-sbsa-ref.inc"
 MACHINE_EDK2_REQUIRE:sgi575 = "edk2-firmware-sgi575.inc"
 MACHINE_EDK2_REQUIRE:n1sdp = "edk2-firmware-n1sdp.inc"
 

+ 7 - 0
meta-arm-bsp/recipes-kernel/linux/linux-arm-platforms.inc

@@ -106,3 +106,10 @@ KCONFIG_MODE:sgi575 = "--alldefconfig"
 COMPATIBLE_MACHINE:tc = "(tc0|tc1)"
 KBUILD_DEFCONFIG:tc = "defconfig"
 KCONFIG_MODE:tc = "--alldefconfig"
+
+#
+# sbsa-ref KMACHINE
+#
+COMPATIBLE_MACHINE:sbsa-ref = "sbsa-ref"
+KBUILD_DEFCONFIG:sbsa-ref = "defconfig"
+KCONFIG_MODE:sbsa-ref = "--alldefconfig"

+ 1 - 0
meta-arm-bsp/recipes-security/optee/optee-ftpm_%.bbappend

@@ -0,0 +1 @@
+COMPATIBLE_MACHINE:sbsa-ref = "sbsa-ref"

+ 1 - 0
meta-arm-bsp/recipes-security/optee/optee-os-sbsa-ref.inc

@@ -0,0 +1 @@
+COMPATIBLE_MACHINE:sbsa-ref = "sbsa-ref"

+ 2 - 1
meta-arm-bsp/recipes-security/optee/optee-os_4.%.bbappend

@@ -2,7 +2,8 @@
 # Machine specific configurations
 MACHINE_OPTEE_OS_REQUIRE ?= ""
 MACHINE_OPTEE_OS_REQUIRE:corstone1000 = "optee-os-corstone1000-common.inc"
-MACHINE_OPTEE_OS_REQUIRE:n1sdp = "optee-os-n1sdp.inc"
 MACHINE_OPTEE_OS_REQUIRE:fvp-base = "optee-os-fvp-base.inc"
+MACHINE_OPTEE_OS_REQUIRE:n1sdp = "optee-os-n1sdp.inc"
+MACHINE_OPTEE_OS_REQUIRE:sbsa-ref = "optee-os-sbsa-ref.inc"
 
 require ${MACHINE_OPTEE_OS_REQUIRE}