Skip to content

x86: fixes for running KUT as EFI on non-QEMU KVM hosts

Giacomo Mazzola kvm 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 0 repliesNew
  2. v18 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- 8/8: reworked per Drew's review. Moved the implementation from lib/efi.c to lib/argv.c so the feature is available to non-EFI builds as well, use a strncmp() prefix match instead of strstr(), shift argv down instead of swapping with the last element so argument order is preserved, and drop the redundant isspace() check and COMMAND_LINE_SIZE cap. Retitled accordingly ("efi: parse KUT_ENV= from load options into environ" -> "lib: parse KUT_ENV= from command line into environ"). This patch was already posted standalone as v2 and reviewed [2]; it is included here unchanged so the series is complete.
- 1/8 - 7/8: unchanged.
- Picked up Andrew Jones' Reviewed-by on 7/8 and 8/8.
- Rebased onto current master.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8x86: efi: use PER_CPU_SIZE for per-CPU stack allocationx86/efi/efistart64.S+1 -10 replies
2/8x86: fix EFI memory allocator to clamp regions to 4 GiBlib/x86/setup.c+17 -30 replies
3/8x86: skip PMU init when no PMU is advertisedlib/x86/setup.c+3 -10 replies
4/8x86: fix ISR thunk to use absolute indirect jumplib/x86/isr.c+5 -30 replies
5/8x86: replace per-AP bringup prints with a single summary linelib/x86/apic.c lib/x86/smp.c+2 -30 replies
6/8x86: add timeout-based SMP bringup when fw_cfg is unavailablelib/x86/smp.c+25 -20 replies
7/8efi: fix load_options_size conversion to character countlib/efi.c+1 -10 replies
8/8lib: parse KUT_ENV= from command line into environlib/argv.c+35 -00 replies

Reviews trailers per patch

2 of 8 patches have a Reviewed-by or Acked-by.

PatchAndrew Jones
1/8
2/8
3/8
4/8
5/8
6/8
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [kvm-unit-tests PATCH v2 0/8] x86: fixes for running KUT as EFI on non-QEMU KVM hosts

This series fixes several issues encountered when running KUT x86 tests as EFI applications on a KVM-based hypervisor that lacks any ad-hoc para-virtualized interface (e.g. fw_cfg), on arbitrary VM shapes (variable CPU count and memory size).

Patches 1-4 fix crashes and faults:
- Stack size mismatch between EFI and non-EFI paths
- Memory allocator selecting regions above the 4 GiB identity map
- #GP on systems without a PMU
- ISR thunks using rel32 jumps that overflow beyond 2 GiB

Patches 5-6 fix SMP bringup:
- Replace per-AP serial prints that cause watchdog timeouts on large systems
- Add timeout-based AP detection when fw_cfg is unavailable

Patches 7-8 fix command line handling:
- Correct the load_options_size byte-to-character conversion
- Add KUT_ENV= parsing for passing environment variables via the command line

Regression-tested by running the full KUT suite under QEMU+KVM+OVMF, in both ./configure and ./configure --enable-efi. Results are identical with and without this series.

v1 -> v2:
- 8/8: reworked per Drew's review. Moved the implementation from lib/efi.c to lib/argv.c so the feature is available to non-EFI builds as well, use a strncmp() prefix match instead of strstr(), shift argv down instead of swapping with the last element so argument order is preserved, and drop the redundant isspace() check and COMMAND_LINE_SIZE cap. Retitled accordingly ("efi: parse KUT_ENV= from load options into environ" -> "lib: parse KUT_ENV= from command line into environ"). This patch was already posted standalone as v2 and reviewed [2]; it is included here unchanged so the series is complete.
- 1/8 - 7/8: unchanged.
- Picked up Andrew Jones' Reviewed-by on 7/8 and 8/8.
- Rebased onto current master.

Patches 1-6 received no review in v1, so they are unchanged and still need a look. Resending the full series to make it reviewable as a whole.

[1] v1: https://lore.kernel.org/kvm/[email protected]/
[2] v2 8/8 standalone: https://lore.kernel.org/kvm/[email protected]/

Giacomo Mazzola (8):
x86: efi: use PER_CPU_SIZE for per-CPU stack allocation
x86: fix EFI memory allocator to clamp regions to 4 GiB
x86: skip PMU init when no PMU is advertised
x86: fix ISR thunk to use absolute indirect jump
x86: replace per-AP bringup prints with a single summary line
x86: add timeout-based SMP bringup when fw_cfg is unavailable
efi: fix load_options_size conversion to character count
lib: parse KUT_ENV= from command line into environ

 lib/argv.c           | 35 +++++++++++++++++++++++++++++++++++
 lib/efi.c            |  2 +-
 lib/x86/apic.c       |  1 -
 lib/x86/isr.c        |  8 +++++---
 lib/x86/setup.c      | 24 ++++++++++++++++++++----
 lib/x86/smp.c        | 31 +++++++++++++++++++++++++++----
 x86/efi/efistart64.S |  2 +-
 7 files changed, 89 insertions(+), 14 deletions(-)

base-commit: 5a221342a025948fa7d84f0c404748f6ba57f3ad

Signature · 1 line
2.47.3