Skip to content

KVM: arm64: selftests: Tests for protected VMs

Fuad Tabba kvm kvmarm linux-arm-kernel linux-kselftest lkml 2 versions – Applied

Status from this message: Applied to fixes, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest19 patches 7 repliesApplied
  2. v116 patches 6 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/19KVM: arm64: Hide generic ptrauth from protected VMs without ptrautharch/arm64/kvm/hyp/nvhe/sys_regs.c+2 -25 replies
2/19KVM: arm64: selftests: Inject an abort before a vCPU's first runtools/testing/selftests/kvm/arm64/external_aborts.c+21 -00 replies
3/19KVM: selftests: Allow arm64 tests to create protected VMstools/testing/selftests/kvm/lib/kvm_util.c+3 -20 replies
4/19tools: arm-smccc: Add the pKVM memory sharing function IDstools/include/linux/arm-smccc.h+22 -00 replies
5/19KVM: selftests: Export the ucall pool's guest physical addresstools/testing/selftests/kvm/include/ucall_common.h tools/testing/selftests/kvm/lib/ucall_common.c+9 -10 replies
6/19KVM: arm64: selftests: Add protected-VM boot trampolinetools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/include/arm64/pkvm.h tools/testing/selftests/kvm/lib/arm64/pvm-entry.S+107 -00 replies
7/19KVM: arm64: selftests: Add protected-VM library helperstools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/include/arm64/pkvm.h tools/testing/selftests/kvm/lib/arm64/pkvm.c+282 -00 replies
8/19KVM: arm64: selftests: Add pkvm_host_abi host-interface testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_host_abi.c+436 -00 replies
9/19KVM: arm64: selftests: Add pkvm_psci multi-vCPU PSCI testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_psci.c+633 -00 replies
10/19KVM: arm64: selftests: Add pkvm_mem_share hypercall testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_mem_share.c+395 -00 replies
11/19KVM: arm64: selftests: Add pkvm_smccc hypercall testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_smccc.c+118 -00 replies
12/19KVM: arm64: selftests: Add pkvm_id_regs register and trap testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_id_regs.c+325 -00 replies
13/19KVM: arm64: selftests: Add pkvm_vcpu_regs register-state testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_vcpu_regs.c+219 -00 replies
14/19KVM: arm64: selftests: Add pkvm_irq interrupt testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_irq.c+269 -00 replies
15/19KVM: arm64: selftests: Add pkvm_isolation host-access testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_isolation.c+226 -00 replies
16/19KVM: arm64: selftests: Add pkvm_lifecycle teardown testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_lifecycle.c+111 -00 replies
17/19KVM: arm64: selftests: Add pkvm_exceptions debug and SError testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_exceptions.c+262 -00 replies
18/19KVM: arm64: selftests: Add pkvm_sve vector-length testtools/testing/selftests/kvm/Makefile.kvm tools/testing/selftests/kvm/arm64/pkvm_sve.c+358 -00 replies
19/19KVM: arm64: selftests: Check MOPS, PIE, POE and FPMR in a protected VMtools/testing/selftests/kvm/arm64/pkvm_id_regs.c+70 -00 replies

Reviews trailers per patch

3 of 19 patches have a Reviewed-by or Acked-by.

PatchJoey GoulyȘtefania IonMihai Moldovanu
SeriesT-b T-b
1/19
2/19
3/19R-b
4/19
5/19
6/19R-b
7/19R-b
8/19
9/19
10/19
11/19
12/19
13/19
14/19
15/19
16/19
17/19
18/19
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/19] KVM: arm64: selftests: Tests for protected VMs

Hi folks,

Changes since v1 [1]:
- New patch 1, which hides generic PtrAuth from a protected VM without PtrAuth. The pkvm_id_regs test checks for it.
- New pkvm_sve test, and MOPS, PIE, POE and FPMR checks in pkvm_id_regs.
- Use the selftest syscall wrappers and vm_check_cap().
- Marked pkvm_hvc() as called from the guest. (Joey)
- Collected Reviewed-by from Joey on patches 3, 6 and 7. (thanks!)

This series adds selftests for protected VMs. A test skips on a host without pKVM, and so does any case where the host doesn't have the required feature, e.g., PtrAuth, SVE or hugetlb pages.

A couple of points:

- Patch 1 is a fix, included here so that pkvm_id_regs can check the correct behaviour. Without it, generic PtrAuth is advertised to a protected VM without PtrAuth.

- Each area gets its own test rather than cases folded into existing tests such as psci_test, hypercalls, set_id_regs, etc. A protected guest requires its own boot path, and has to share the ucall pool before its first ucall. On top of that, a protected guest gets the opposite result for many of those tests' checks.

- Cases for a feature a protected VM may not have follow what the VM is given, so they pass with or without the series that adds it [2], and run once it lands. The debug cases follow ID_AA64DFR0_EL1.DebugVer, the SVE cases KVM_CAP_ARM_SVE on a protected VM's fd, and the MOPS, PIE, POE and FPMR checks their ID register fields.

The series is structured as follows:

  01:     Hide generic PtrAuth from protected VMs without PtrAuth.
  02:     external_aborts: an abort injected before a vCPU's first run.
  03-05:  Generic selftest changes: creating a protected VM, the pKVM
          function IDs and the ucall pool's address.
  06-07:  Protected-VM library: boot trampoline and helpers.
  08-18:  The tests, one per area.
  19:     MOPS, PIE, POE and FPMR checks in pkvm_id_regs.

Based on Linux 7.4-rc1 (6628e7d4c6b25; also applies to 7.4-rc2 7475ea8b58616).

Cheers,
/fuad

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (18):
KVM: arm64: Hide generic ptrauth from protected VMs without ptrauth
KVM: arm64: selftests: Inject an abort before a vCPU's first run
KVM: selftests: Allow arm64 tests to create protected VMs
tools: arm-smccc: Add the pKVM memory sharing function IDs
KVM: selftests: Export the ucall pool's guest physical address
KVM: arm64: selftests: Add protected-VM library helpers
KVM: arm64: selftests: Add pkvm_host_abi host-interface test
KVM: arm64: selftests: Add pkvm_psci multi-vCPU PSCI test
KVM: arm64: selftests: Add pkvm_mem_share hypercall test
KVM: arm64: selftests: Add pkvm_smccc hypercall test
KVM: arm64: selftests: Add pkvm_id_regs register and trap test
KVM: arm64: selftests: Add pkvm_vcpu_regs register-state test
KVM: arm64: selftests: Add pkvm_irq interrupt test
KVM: arm64: selftests: Add pkvm_isolation host-access test
KVM: arm64: selftests: Add pkvm_lifecycle teardown test
KVM: arm64: selftests: Add pkvm_exceptions debug and SError test
KVM: arm64: selftests: Add pkvm_sve vector-length test
KVM: arm64: selftests: Check MOPS, PIE, POE and FPMR in a protected VM

Will Deacon (1):
KVM: arm64: selftests: Add protected-VM boot trampoline

 arch/arm64/kvm/hyp/nvhe/sys_regs.c            |   4 +-
 tools/include/linux/arm-smccc.h               |  22 +
 tools/testing/selftests/kvm/Makefile.kvm      |  13 +
 .../selftests/kvm/arm64/external_aborts.c     |  21 +
 .../selftests/kvm/arm64/pkvm_exceptions.c     | 261 ++++++++
 .../selftests/kvm/arm64/pkvm_host_abi.c       | 435 ++++++++++++
 .../selftests/kvm/arm64/pkvm_id_regs.c        | 394 +++++++++++
 tools/testing/selftests/kvm/arm64/pkvm_irq.c  | 268 ++++++++
 .../selftests/kvm/arm64/pkvm_isolation.c      | 225 +++++++
 .../selftests/kvm/arm64/pkvm_lifecycle.c      | 110 +++
 .../selftests/kvm/arm64/pkvm_mem_share.c      | 394 +++++++++++
 tools/testing/selftests/kvm/arm64/pkvm_psci.c | 632 ++++++++++++++++++
 .../testing/selftests/kvm/arm64/pkvm_smccc.c  | 117 ++++
 tools/testing/selftests/kvm/arm64/pkvm_sve.c  | 357 ++++++++++
 .../selftests/kvm/arm64/pkvm_vcpu_regs.c      | 218 ++++++
 .../selftests/kvm/include/arm64/pkvm.h        |  75 +++
 .../selftests/kvm/include/ucall_common.h      |   1 +
 tools/testing/selftests/kvm/lib/arm64/pkvm.c  | 255 +++++++
 .../selftests/kvm/lib/arm64/pvm-entry.S       |  57 ++
 tools/testing/selftests/kvm/lib/kvm_util.c    |   5 +-
 .../testing/selftests/kvm/lib/ucall_common.c  |   9 +-
 21 files changed, 3868 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_exceptions.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_host_abi.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_id_regs.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_irq.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_isolation.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_lifecycle.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_mem_share.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_psci.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_smccc.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_sve.c
 create mode 100644 tools/testing/selftests/kvm/arm64/pkvm_vcpu_regs.c
 create mode 100644 tools/testing/selftests/kvm/include/arm64/pkvm.h
 create mode 100644 tools/testing/selftests/kvm/lib/arm64/pkvm.c
 create mode 100644 tools/testing/selftests/kvm/lib/arm64/pvm-entry.S
Signature · 1 line
2.47.3