All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Zixuan Wang <zxwang42@gmail.com>,
	kvm@vger.kernel.org, drjones@redhat.com
Cc: marcorr@google.com, baekhw@google.com, tmroeder@google.com,
	erdemaktas@google.com, rientjes@google.com, seanjc@google.com,
	brijesh.singh@amd.com, Thomas.Lendacky@amd.com,
	varad.gautam@suse.com, jroedel@suse.de, bp@suse.de
Subject: Re: [kvm-unit-tests PATCH v3 05/17] x86 UEFI: Boot from UEFI
Date: Thu, 21 Oct 2021 14:18:00 +0200	[thread overview]
Message-ID: <1f0144a6-3eb5-ad58-e1c2-68c8fcc29841@redhat.com> (raw)
In-Reply-To: <20211004204931.1537823-6-zxwang42@gmail.com>

On 04/10/21 22:49, Zixuan Wang wrote:
> From: Zixuan Wang <zixuanwang@google.com>
> 
> This commit provides initial support for x86 test cases to boot from
> UEFI:
> 
>     1. UEFI compiler flags are added to Makefile
>     2. A new TARGET_EFI macro is added to turn on/off UEFI startup code
>     3. Previous Multiboot setup code is refactored and updated for
>        supporting UEFI, including the following changes:
>        1. x86/efi/crt0-efi-x86_64.S: provides entry point and jumps to
>           setup code in lib/efi.c.
>        2. lib/efi.c: performs UEFI setup, calls arch-related setup
>           functions, then jumps to test case main() function
>        3. lib/x86/setup.c: provides arch-related setup under UEFI
> 
> To build test cases for UEFI, please first install the GNU-EFI library.
> Check x86/efi/README.md for more details.
> 
> This commit is tested by a simple test calling report() and
> report_summayr(). This commit does not include such a test to avoid
> unnecessary files added into git history. To build and run this test in
> UEFI (assuming file name is x86/dummy.c):
> 
>     ./configure --target-efi
>     make x86/dummy.efi
>     ./x86/efi/run ./x86/dummy.efi
> 
> To use the default Multiboot instead of UEFI:
> 
>     ./configure
>     make x86/dummy.flat
>     ./x86/run ./x86/dummy.flat
> 
> Some x86 test cases require additional fixes to work in UEFI, e.g.,
> converting to position independent code (PIC), setting up page tables,
> etc. This commit does not provide these fixes, so compiling and running
> UEFI test cases other than x86/dummy.c may trigger compiler errors or
> QEMU crashes. These test cases will be fixed by the follow-up commits in
> this series.
> 
> The following code is ported from github.com/rhdrjones/kvm-unit-tests
>     - ./configure: 'target-efi'-related code
> 
> See original code:
>     - Repo: https://github.com/rhdrjones/kvm-unit-tests
>     - Branch: target-efi
> 
> Co-developed-by: Varad Gautam <varad.gautam@suse.com>
> Signed-off-by: Varad Gautam <varad.gautam@suse.com>
> Signed-off-by: Zixuan Wang <zixuanwang@google.com>

This is missing

diff --git a/x86/Makefile.i386 b/x86/Makefile.i386
index 340c561..7d19d55 100644
--- a/x86/Makefile.i386
+++ b/x86/Makefile.i386
@@ -2,6 +2,7 @@ cstart.o = $(TEST_DIR)/cstart.o
  bits = 32
  ldarch = elf32-i386
  exe = flat
+bin = elf
  COMMON_CFLAGS += -mno-sse -mno-sse2

  cflatobjs += lib/x86/setjmp32.o lib/ldiv32.o

for 32-bit tests to build; and also:

diff --git a/configure b/configure
index b6c09b3..6f4a8f0 100755
--- a/configure
+++ b/configure
@@ -265,6 +265,11 @@ if [ -f "$srcdir/$testdir/run" ]; then
      ln -fs "$srcdir/$testdir/run" $testdir-run
  fi

+testsubdir=$testdir
+if [ -n "$target_efi" ]; then
+    testsubdir=$testdir/efi
+fi
+
  # check if uint32_t needs a long format modifier
  cat << EOF > lib-test.c
  __UINT32_TYPE__
@@ -291,8 +301,11 @@ if test ! -e Makefile; then
      ln -s "$srcdir/Makefile" .

      echo "linking tests..."
-    mkdir -p $testdir
+    mkdir -p $testsubdir
      ln -sf "$srcdir/$testdir/run" $testdir/
+    if test "$testdir" != "$testsubdir"; then
+        ln -sf "$srcdir/$testsubdir/run" $testsubdir/
+    fi
      ln -sf "$srcdir/$testdir/unittests.cfg" $testdir/
      ln -sf "$srcdir/run_tests.sh"

@@ -332,6 +345,7 @@ OBJDUMP=$cross_prefix$objdump
  AR=$cross_prefix$ar
  ADDR2LINE=$cross_prefix$addr2line
  TEST_DIR=$testdir
+TEST_SUBDIR=$testsubdir
  FIRMWARE=$firmware
  ENDIAN=$endian
  PRETTY_PRINT_STACKS=$pretty_print_stacks
diff --git a/run_tests.sh b/run_tests.sh
index 9f233c5..f61e005 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -31,7 +31,7 @@ specify the appropriate qemu binary for ARCH-run.
  EOF
  }

-RUNTIME_arch_run="./$TEST_DIR/run"
+RUNTIME_arch_run="./$TEST_SUBDIR/run"
  source scripts/runtime.bash

  # require enhanced getopt


As of this patch tests don't seem to work correctly, but at least the 
build machinery works (they build and ./x86/efi/run starts them).

./run_tests.sh does not work, either.

Paolo


  reply	other threads:[~2021-10-21 12:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04 20:49 [kvm-unit-tests PATCH v3 00/17] x86_64 UEFI and AMD SEV/SEV-ES support Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 01/17] x86: Move IDT, GDT and TSS to desc.c Zixuan Wang
2021-10-20 15:26   ` Paolo Bonzini
2021-10-20 17:56     ` Zixuan Wang
2021-10-21 11:50       ` Paolo Bonzini
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 02/17] x86 UEFI: Copy code from Linux Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 03/17] x86 UEFI: Implement UEFI function calls Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 04/17] x86 UEFI: Copy code from GNU-EFI Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 05/17] x86 UEFI: Boot from UEFI Zixuan Wang
2021-10-21 12:18   ` Paolo Bonzini [this message]
2021-10-21 14:11   ` Paolo Bonzini
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 06/17] x86 UEFI: Load IDT after UEFI boot up Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 07/17] x86 UEFI: Load GDT and TSS " Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 08/17] x86 UEFI: Set up memory allocator Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 09/17] x86 UEFI: Set up RSDP after UEFI boot up Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 10/17] x86 UEFI: Set up page tables Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 11/17] x86 UEFI: Convert x86 test cases to PIC Zixuan Wang
2021-10-21 14:12   ` Paolo Bonzini
2021-10-26  6:26     ` Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 12/17] x86 AMD SEV: Initial support Zixuan Wang
2021-10-21 13:31   ` Paolo Bonzini
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 13/17] x86 AMD SEV: Page table with c-bit Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 14/17] x86 AMD SEV-ES: Check SEV-ES status Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 15/17] x86 AMD SEV-ES: Copy UEFI #VC IDT entry Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 16/17] x86 AMD SEV-ES: Set up GHCB page Zixuan Wang
2021-10-04 20:49 ` [kvm-unit-tests PATCH v3 17/17] x86 AMD SEV-ES: Add test cases Zixuan Wang
2021-10-18 11:47   ` Varad Gautam
2021-10-19  4:38     ` Zixuan Wang
2021-10-19 14:14       ` Marc Orr
2021-10-19 15:31         ` Andrew Jones
2021-10-20 17:59           ` Zixuan Wang
2021-10-19 16:44         ` Varad Gautam
2021-10-20 17:59           ` Zixuan Wang
2021-10-21 14:04     ` Paolo Bonzini
2021-10-21 14:10 ` [kvm-unit-tests PATCH v3 00/17] x86_64 UEFI and AMD SEV/SEV-ES support Paolo Bonzini
2021-10-21 14:22   ` Marc Orr
2021-10-21 14:27     ` Paolo Bonzini
2021-11-25 15:21   ` Varad Gautam
2021-11-29 14:44     ` Marc Orr
2021-11-29 15:24       ` Tom Lendacky

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=1f0144a6-3eb5-ad58-e1c2-68c8fcc29841@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Thomas.Lendacky@amd.com \
    --cc=baekhw@google.com \
    --cc=bp@suse.de \
    --cc=brijesh.singh@amd.com \
    --cc=drjones@redhat.com \
    --cc=erdemaktas@google.com \
    --cc=jroedel@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=marcorr@google.com \
    --cc=rientjes@google.com \
    --cc=seanjc@google.com \
    --cc=tmroeder@google.com \
    --cc=varad.gautam@suse.com \
    --cc=zxwang42@gmail.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.