All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Koller <ricarkol@google.com>
To: Nikos Nikoleris <nikos.nikoleris@arm.com>
Cc: kvm@vger.kernel.org, drjones@redhat.com, pbonzini@redhat.com,
	jade.alglave@arm.com, alexandru.elisei@arm.com
Subject: Re: [kvm-unit-tests PATCH v2 23/23] arm64: Add an efi/run script
Date: Tue, 21 Jun 2022 16:09:38 -0700	[thread overview]
Message-ID: <YrJPsmon33EAfe54@google.com> (raw)
In-Reply-To: <20220506205605.359830-24-nikos.nikoleris@arm.com>

On Fri, May 06, 2022 at 09:56:05PM +0100, Nikos Nikoleris wrote:
> This change adds a efi/run script inspired by the one in x86. This
> script will setup a folder with the test compiled as an EFI app and a
> startup.nsh script. The script launches QEMU providing an image with
> EDKII and the path to the folder with the test which is executed
> automatically.
> 
> For example:
> 
> $> ./arm/efi/run ./arm/selftest.efi setup smp=2 mem=256
> 
> Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
> ---
>  scripts/runtime.bash | 14 +++++-----
>  arm/efi/run          | 61 ++++++++++++++++++++++++++++++++++++++++++++
>  arm/run              |  8 ++++--
>  arm/Makefile.common  |  1 +
>  arm/dummy.c          |  4 +++
>  5 files changed, 78 insertions(+), 10 deletions(-)
>  create mode 100755 arm/efi/run
>  create mode 100644 arm/dummy.c
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 7d0180b..dc28f24 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -131,14 +131,12 @@ function run()
>      fi
>  
>      last_line=$(premature_failure > >(tail -1)) && {
> -        skip=true
> -        if [ "${CONFIG_EFI}" == "y" ] && [[ "${last_line}" =~ "enabling apic" ]]; then
> -            skip=false
> -        fi
> -        if [ ${skip} == true ]; then
> -            print_result "SKIP" $testname "" "$last_line"
> -            return 77
> -        fi
> +        if [ "${CONFIG_EFI}" == "y" ] && [ "${ARCH}" = x86_64 ]; then
> +		if ! [[ "${last_line}" =~ "enabling apic" ]]; then
> +			print_result "SKIP" $testname "" "$last_line"
> +			return 77
> +		fi
> +	fi
>      }
>  
>      cmdline=$(get_cmdline $kernel)
> diff --git a/arm/efi/run b/arm/efi/run
> new file mode 100755
> index 0000000..dfff717
> --- /dev/null
> +++ b/arm/efi/run
> @@ -0,0 +1,61 @@
> +#!/bin/bash
> +
> +set -e
> +
> +if [ $# -eq 0 ]; then
> +	echo "Usage $0 TEST_CASE [QEMU_ARGS]"
> +	exit 2
> +fi
> +
> +if [ ! -f config.mak ]; then
> +	echo "run './configure --enable-efi && make' first. See ./configure -h"
> +	exit 2
> +fi
> +source config.mak
> +source scripts/arch-run.bash
> +source scripts/common.bash
> +
> +: "${EFI_SRC:=$(realpath "$(dirname "$0")/../")}"
> +: "${EFI_UEFI:=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd}"
> +: "${EFI_TEST:=efi-tests}"
> +: "${EFI_CASE:=$(basename $1 .efi)}"
> +
> +if [ ! -f "$EFI_UEFI" ]; then
> +	echo "UEFI firmware not found: $EFI_UEFI"
> +	echo "Please install the UEFI firmware to this path"
> +	echo "Or specify the correct path with the env variable EFI_UEFI"
> +	exit 2
> +fi
> +
> +# Remove the TEST_CASE from $@
> +shift 1
> +
> +# Fish out the arguments for the test, they should be the next string
> +# after the "-append" option
> +qemu_args=()
> +cmd_args=()
> +while (( "$#" )); do
> +	if [ "$1" = "-append" ]; then
> +		cmd_args=$2
> +		shift 2

Does this work with params like this (2 words)?

	[pmu-cycle-counter]
	file = pmu.flat
	groups = pmu
	extra_params = -append 'cycle-counter 0'

> +	else
> +		qemu_args+=("$1")
> +		shift 1
> +	fi
> +done
> +
> +if [ "$EFI_CASE" = "_NO_FILE_4Uhere_" ]; then
> +	EFI_CASE=dummy
> +fi
> +
> +: "${EFI_CASE_DIR:="$EFI_TEST/$EFI_CASE"}"
> +mkdir -p "$EFI_CASE_DIR"
> +
> +cp "$EFI_SRC/$EFI_CASE.efi" "$EFI_TEST/$EFI_CASE/"
> +echo "@echo -off" > "$EFI_TEST/$EFI_CASE/startup.nsh"
> +echo "$EFI_CASE.efi" "${cmd_args[@]}" >> "$EFI_TEST/$EFI_CASE/startup.nsh"
> +
> +EFI_RUN=y $TEST_DIR/run \
> +       -bios "$EFI_UEFI" \
> +       -drive file.dir="$EFI_TEST/$EFI_CASE/",file.driver=vvfat,file.rw=on,format=raw,if=virtio \
> +       "${qemu_args[@]}"
> diff --git a/arm/run b/arm/run
> index 28a0b4a..e96875e 100755
> --- a/arm/run
> +++ b/arm/run
> @@ -67,7 +67,11 @@ fi
>  
>  A="-accel $ACCEL"
>  command="$qemu -nodefaults $M $A -cpu $processor $chr_testdev $pci_testdev"
> -command+=" -display none -serial stdio -kernel"
> +command+=" -display none -serial stdio"
>  command="$(migration_cmd) $(timeout_cmd) $command"
>  
> -run_qemu $command "$@"
> +if [ "$EFI_RUN" = "y" ]; then
> +	ENVIRON_DEFAULT=n run_qemu $command "$@"
> +else
> +	run_qemu $command -kernel "$@"
> +fi
> diff --git a/arm/Makefile.common b/arm/Makefile.common
> index a8007f4..aabd335 100644
> --- a/arm/Makefile.common
> +++ b/arm/Makefile.common
> @@ -12,6 +12,7 @@ tests-common += $(TEST_DIR)/gic.$(exe)
>  tests-common += $(TEST_DIR)/psci.$(exe)
>  tests-common += $(TEST_DIR)/sieve.$(exe)
>  tests-common += $(TEST_DIR)/pl031.$(exe)
> +tests-common += $(TEST_DIR)/dummy.$(exe)
>  
>  tests-all = $(tests-common) $(tests)
>  all: directories $(tests-all)
> diff --git a/arm/dummy.c b/arm/dummy.c
> new file mode 100644
> index 0000000..5019e79
> --- /dev/null
> +++ b/arm/dummy.c
> @@ -0,0 +1,4 @@
> +int main(int argc, char **argv)
> +{
> +	return 0;
> +}
> -- 
> 2.25.1
> 

  reply	other threads:[~2022-06-21 23:09 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 20:55 [kvm-unit-tests PATCH v2 00/23] EFI and ACPI support for arm64 Nikos Nikoleris
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 01/23] lib: Move acpi header and implementation to lib Nikos Nikoleris
2022-05-19 13:21   ` Andrew Jones
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 02/23] lib: Ensure all struct definition for ACPI tables are packed Nikos Nikoleris
2022-05-19 13:17   ` Andrew Jones
2022-05-19 15:52     ` Nikos Nikoleris
2022-05-19 17:14       ` Andrew Jones
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 03/23] lib: Add support for the XSDT ACPI table Nikos Nikoleris
2022-05-19 13:30   ` Andrew Jones
2022-06-18  0:38   ` Ricardo Koller
2022-06-20  8:53     ` Alexandru Elisei
2022-06-20 11:06       ` Nikos Nikoleris
2022-06-21 12:25         ` Alexandru Elisei
2022-06-21 11:26     ` Nikos Nikoleris
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 04/23] lib: Extend the definition of the ACPI table FADT Nikos Nikoleris
2022-05-19 13:42   ` Andrew Jones
2022-06-18  1:00   ` Ricardo Koller
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 05/23] arm/arm64: Add support for setting up the PSCI conduit through ACPI Nikos Nikoleris
2022-05-19 13:54   ` Andrew Jones
2022-06-21 16:06   ` Ricardo Koller
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 06/23] arm/arm64: Add support for discovering the UART " Nikos Nikoleris
2022-05-19 13:59   ` Andrew Jones
2022-06-21 16:07   ` Ricardo Koller
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 07/23] arm/arm64: Add support for timer initialization " Nikos Nikoleris
2022-05-19 14:10   ` Andrew Jones
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 08/23] arm/arm64: Add support for cpu " Nikos Nikoleris
2022-05-19 14:23   ` Andrew Jones
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 09/23] lib/printf: Support for precision modifier in printing strings Nikos Nikoleris
2022-05-19 14:52   ` Andrew Jones
2022-05-19 16:02     ` Andrew Jones
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 10/23] lib/printf: Add support for printing wide strings Nikos Nikoleris
2022-06-21 16:11   ` Ricardo Koller
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 11/23] lib/efi: Add support for getting the cmdline Nikos Nikoleris
2022-06-21 16:33   ` Ricardo Koller
2022-06-27 16:12     ` Nikos Nikoleris
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 12/23] arm/arm64: mmu_disable: Clean and invalidate before disabling Nikos Nikoleris
2022-05-13 13:15   ` Alexandru Elisei
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 13/23] arm/arm64: Rename etext to _etext Nikos Nikoleris
2022-06-21 16:42   ` Ricardo Koller
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 14/23] lib: Avoid ms_abi for calls related to EFI on arm64 Nikos Nikoleris
2022-05-20 14:02   ` Andrew Jones
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 15/23] arm64: Add a new type of memory type flag MR_F_RESERVED Nikos Nikoleris
2022-06-21 16:44   ` Ricardo Koller
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 16/23] arm/arm64: Add a setup sequence for systems that boot through EFI Nikos Nikoleris
2022-05-13 13:31   ` Alexandru Elisei
2022-06-27 16:36     ` Nikos Nikoleris
2022-05-06 20:55 ` [kvm-unit-tests PATCH v2 17/23] arm64: Copy code from GNU-EFI Nikos Nikoleris
2022-06-21 17:59   ` Ricardo Koller
2022-05-06 20:56 ` [kvm-unit-tests PATCH v2 18/23] arm64: Change gnu-efi imported file to use defined types Nikos Nikoleris
2022-05-06 20:56 ` [kvm-unit-tests PATCH v2 19/23] arm64: Use code from the gnu-efi when booting with EFI Nikos Nikoleris
2022-06-21 22:32   ` Ricardo Koller
2022-06-27 17:10     ` Nikos Nikoleris
2022-06-30  5:13       ` Ricardo Koller
2022-05-06 20:56 ` [kvm-unit-tests PATCH v2 20/23] lib: Avoid external dependency in libelf Nikos Nikoleris
2022-06-21 22:39   ` Ricardo Koller
2022-05-06 20:56 ` [kvm-unit-tests PATCH v2 21/23] x86: Move x86_64-specific EFI CFLAGS to x86_64 Makefile Nikos Nikoleris
2022-06-21 22:45   ` Ricardo Koller
2022-06-22 13:47     ` Nikos Nikoleris
2022-05-06 20:56 ` [kvm-unit-tests PATCH v2 22/23] arm64: Add support for efi in Makefile Nikos Nikoleris
2022-06-21 22:51   ` Ricardo Koller
2022-06-22 13:52     ` Nikos Nikoleris
2022-06-21 22:52   ` Ricardo Koller
2022-05-06 20:56 ` [kvm-unit-tests PATCH v2 23/23] arm64: Add an efi/run script Nikos Nikoleris
2022-06-21 23:09   ` Ricardo Koller [this message]
2022-06-22 14:13     ` Nikos Nikoleris
2022-06-30  5:22       ` Ricardo Koller
2022-05-13 14:09 ` [kvm-unit-tests PATCH v2 00/23] EFI and ACPI support for arm64 Alexandru Elisei
2022-05-18  9:00   ` Nikos Nikoleris
2022-05-20  9:58     ` Alexandru Elisei
2022-05-17 17:56 ` Ricardo Koller
2022-05-18 12:44   ` Nikos Nikoleris
2022-05-18 16:10     ` Ricardo Koller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrJPsmon33EAfe54@google.com \
    --to=ricarkol@google.com \
    --cc=alexandru.elisei@arm.com \
    --cc=drjones@redhat.com \
    --cc=jade.alglave@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=nikos.nikoleris@arm.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.