On Fri, Jul 2, 2021 at 4:48 AM Varad Gautam <varad.gautam@xxxxxxxx> wrote: > > This series brings EFI support to a reduced subset of kvm-unit-tests > on x86_64. I'm sending it out for early review since it covers enough > ground to allow adding KVM testcases for EFI-only environments. > > EFI support works by changing the test entrypoint to a stub entry > point for the EFI loader to jump to in long mode, where the test binary > exits EFI boot services, performs the remaining CPU bootstrapping, > and then calls the testcase main(). > > Since the EFI loader only understands PE objects, the first commit > introduces a `configure --efi` mode which builds each test as a shared > lib. This shared lib is repackaged into a PE via objdump. > > Commit 2-4 take a trip from the asm entrypoint to C to exit EFI and > relocate ELF .dynamic contents. > > Commit 5 adds post-EFI long mode x86_64 setup and calls the testcase. > > Commit 6 patches out some broken tests for EFI. Testcases that refuse > to build as shared libs are also left disabled, these need some massaging. > > git tree: https://github.com/varadgautam/kvm-unit-tests/commits/efi-stub Thanks for this patchset. My colleague, Zixuan Wang <zixuanwang@xxxxxxxxxx>, has also been working to extend kvm-unit-tests to run under UEFI. Our goal is to enable running kvm-unit-tests under SEV-ES. Our approach is a bit different. Rather than pull in bits of the EFI library and Linux EFI ABI, we've elected to build the entire kvm-unit-tests binaries as an EFI app (similar to the ARM approach). To date, we have _most_ x86 test cases (39/44) working under UEFI and we've also got some of the test cases to boot under SEV-ES, using the UEFI #VC handler. We will post our patchset as soon as possible (hopefully by Monday) so that the community can see our approach. We are very eager to see kvm-unit-tests running under SEV-ES (and SNP) and are happy to work with you all on either approach, depending on what the community thinks is the best approach. Thanks in advance, Marc