Skip to content

KVM: arm64: Rework guest VM fixed feature handling and trapping in pKVM

Fuad Tabba kvmarm linux-arm-kernel 5 versions – Applied

Status from this message: Applied to next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest17 patches 1 replyApplied
  2. v414 patches 22 repliesSuperseded
  3. v315 patches 9 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v212 patches6 repliesSuperseded
v112 patches5 repliesSuperseded

Changes in v5 from the cover letter

- (Oliver) Add assertion in kvm_init_pvm_id_regs() that vm_table lock is held.
- (Quentin) Carve out patches that fix RAS and that remove the feature KVM_ARM_VCPU_POWER_OFF from original patches, for clarity.
- (Quentin) Add a patch that refactors existing code to use kvm_vcpu_has_feature() instead of __vcpu_has_feature().
- (Quentin) Fixes to commit messages.

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/17KVM: arm64: Consolidate allowed and restricted VM feature checksarch/arm64/kvm/hyp/include/nvhe/fixed_config.h arch/arm64/kvm/hyp/nvhe/pkvm.c arch/arm64/kvm/hyp/nvhe/sys_regs.c+26 -430 replies
2/17KVM: arm64: Group setting traps for protected VMs by control registerarch/arm64/kvm/hyp/nvhe/pkvm.c+144 -1730 replies
3/17KVM: arm64: Move checking protected vcpu features to a separate functionarch/arm64/kvm/hyp/nvhe/pkvm.c+32 -130 replies
4/17KVM: arm64: Remove KVM_ARM_VCPU_POWER_OFF from protected VMs allowed features in pKVMarch/arm64/kvm/hyp/nvhe/pkvm.c+0 -20 replies
5/17KVM: arm64: Use KVM extension checks for allowed protected VM capabilitiesarch/arm64/include/asm/kvm_pkvm.h arch/arm64/kvm/arm.c arch/arm64/kvm/hyp/nvhe/pkvm.c+33 -450 replies
6/17KVM: arm64: Initialize feature id registers for protected VMsarch/arm64/kvm/hyp/include/nvhe/fixed_config.h arch/arm64/kvm/hyp/include/nvhe/pkvm.h arch/arm64/kvm/hyp/nvhe/pkvm.c +1 more+51 -60 replies
7/17KVM: arm64: Fix RAS trapping in pKVM for protected VMsarch/arm64/kvm/hyp/nvhe/pkvm.c+2 -30 replies
8/17KVM: arm64: Set protected VM traps based on its view of feature registersarch/arm64/kvm/hyp/nvhe/pkvm.c arch/arm64/kvm/hyp/nvhe/sys_regs.c+30 -610 replies
9/17KVM: arm64: Rework specifying restricted features for protected VMsarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/hyp/include/nvhe/fixed_config.h arch/arm64/kvm/hyp/nvhe/sys_regs.c+189 -1700 replies
10/17KVM: arm64: Remove fixed_config.h headerarch/arm64/kvm/hyp/include/nvhe/fixed_config.h arch/arm64/kvm/hyp/include/nvhe/pkvm.h arch/arm64/kvm/hyp/nvhe/pkvm.c +3 more+6 -2100 replies
11/17KVM: arm64: Remove redundant setting of HCR_EL2 trap bitarch/arm64/kvm/hyp/nvhe/pkvm.c+0 -30 replies
12/17KVM: arm64: Calculate cptr_el2 traps on activating trapsarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c arch/arm64/kvm/hyp/nvhe/pkvm.c +1 more+32 -630 replies
13/17KVM: arm64: Refactor kvm_reset_cptr_el2()arch/arm64/include/asm/kvm_emulate.h+2 -80 replies
14/17KVM: arm64: Fix the value of the CPTR_EL2 RES1 bitmask for nVHEarch/arm64/include/asm/kvm_arm.h arch/arm64/include/asm/kvm_emulate.h+3 -30 replies
15/17KVM: arm64: Remove PtrAuth guest vcpu flagarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/hyp/nvhe/pkvm.c +1 more+3 -260 replies
16/17KVM: arm64: Convert the SVE guest vcpu flag to a vm flagarch/arm64/include/asm/kvm_emulate.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/hyp/nvhe/pkvm.c +1 more+29 -140 replies
17/17KVM: arm64: Use kvm_vcpu_has_feature() directly for struct kvmarch/arm64/kvm/nested.c+4 -40 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 00/17] KVM: arm64: Rework guest VM fixed feature handling and trapping in pKVM

Changes from v4:
- (Oliver) Add assertion in kvm_init_pvm_id_regs() that vm_table lock is held.
- (Quentin) Carve out patches that fix RAS and that remove the feature KVM_ARM_VCPU_POWER_OFF from original patches, for clarity.
- (Quentin) Add a patch that refactors existing code to use kvm_vcpu_has_feature() instead of __vcpu_has_feature().
- (Quentin) Fixes to commit messages.

Other than added assertion, no functional changes between v4 and v5.

This patch series redoes how fixed features for protected guests are specified in pKVM, as well as how trapping is handled based on the features available for the VM. It also fixes a couple of existing bugs in the process. Please refer to v4 for context [1].

This series is based on kvmarm/next (60ad25e14ab5), since it requires the patches from the series that fixes initialization of trap register values in pKVM [2].

Cheers,
/fuad

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

Fuad Tabba (17):
KVM: arm64: Consolidate allowed and restricted VM feature checks
KVM: arm64: Group setting traps for protected VMs by control register
KVM: arm64: Move checking protected vcpu features to a separate
function
KVM: arm64: Remove KVM_ARM_VCPU_POWER_OFF from protected VMs allowed
features in pKVM
KVM: arm64: Use KVM extension checks for allowed protected VM
capabilities
KVM: arm64: Initialize feature id registers for protected VMs
KVM: arm64: Fix RAS trapping in pKVM for protected VMs
KVM: arm64: Set protected VM traps based on its view of feature
registers
KVM: arm64: Rework specifying restricted features for protected VMs
KVM: arm64: Remove fixed_config.h header
KVM: arm64: Remove redundant setting of HCR_EL2 trap bit
KVM: arm64: Calculate cptr_el2 traps on activating traps
KVM: arm64: Refactor kvm_reset_cptr_el2()
KVM: arm64: Fix the value of the CPTR_EL2 RES1 bitmask for nVHE
KVM: arm64: Remove PtrAuth guest vcpu flag
KVM: arm64: Convert the SVE guest vcpu flag to a vm flag
KVM: arm64: Use kvm_vcpu_has_feature() directly for struct kvm

 arch/arm64/include/asm/kvm_arm.h              |   2 +-
 arch/arm64/include/asm/kvm_emulate.h          |  29 +-
 arch/arm64/include/asm/kvm_host.h             |  25 +-
 arch/arm64/include/asm/kvm_pkvm.h             |  25 ++
 arch/arm64/kvm/arm.c                          |  30 +-
 .../arm64/kvm/hyp/include/nvhe/fixed_config.h | 223 ----------
 arch/arm64/kvm/hyp/include/nvhe/pkvm.h        |   7 +
 arch/arm64/kvm/hyp/nvhe/pkvm.c                | 341 ++++++---------
 arch/arm64/kvm/hyp/nvhe/setup.c               |   1 -
 arch/arm64/kvm/hyp/nvhe/switch.c              |  52 ++-
 arch/arm64/kvm/hyp/nvhe/sys_regs.c            | 404 ++++++++++--------
 arch/arm64/kvm/nested.c                       |   8 +-
 arch/arm64/kvm/reset.c                        |   6 +-
 13 files changed, 446 insertions(+), 707 deletions(-)
 delete mode 100644 arch/arm64/kvm/hyp/include/nvhe/fixed_config.h

base-commit: 60ad25e14ab5a4e56c8bf7f7d6846eacb9cd53df

Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog