Skip to content

KVM: arm64: Fixes to fine grain traps and pKVM traps

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

Status from this message: Applied to next with the changes agreed on the list.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest17 patches 17 repliesApplied
  2. v212 patches 17 repliesSuperseded
  3. v16 patches 2 repliesSuperseded

Changes in v3 from the cover letter

- Rebased on arm64/for-next/sysregs, which includes new system register definitions (Mark, Joey)
- Explicitly trap unsupported HFGxTR_EL2 features rather than relying on its nMASK (Joey)
- Add new system registers to the auto-generated sysreg rather than hardcoding them (Mark)
- Drop patch that was meant as RFC
- Added missing system registers, fields, and system instructions
- Split patches that make system register changes
- Fixes to patches defining allowed features for protected VMs
- Other minor fixes and tidying up

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/17arm64/sysreg: Add missing Pauth_LR field definitions to ID_AA64ISAR1_EL1arch/arm64/tools/sysreg+2 -02 replies
2/17arm64/sysreg: Add missing ExtTrcBuff field definition to ID_AA64DFR0_EL1arch/arm64/tools/sysreg+4 -11 reply
3/17arm64/sysreg: Add missing system register definitions for FGTarch/arm64/tools/sysreg+43 -01 reply
4/17arm64/sysreg: Add missing system instruction definitions for FGTarch/arm64/include/asm/sysreg.h+7 -00 replies
5/17KVM: arm64: Explicitly trap unsupported HFGxTR_EL2 featuresarch/arm64/kvm/hyp/include/hyp/switch.h+6 -30 replies
6/17KVM: arm64: Add missing HFGxTR_EL2 FGT entries to nested virtarch/arm64/kvm/emulate-nested.c+10 -00 replies
7/17KVM: arm64: Add missing HFGITR_EL2 FGT entries to nested virtarch/arm64/kvm/emulate-nested.c+5 -00 replies
8/17KVM: arm64: Add bit masks for HAFGRTR_EL2arch/arm64/include/asm/kvm_arm.h+4 -00 replies
9/17KVM: arm64: Handle HAFGRTR_EL2 trapping in nested virtarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/emulate-nested.c arch/arm64/kvm/hyp/include/hyp/switch.h +1 more+62 -01 reply
10/17KVM: arm64: Update and fix FGT register masksarch/arm64/include/asm/kvm_arm.h+24 -150 replies
11/17KVM: arm64: Add build validation for FGT trap mask valuesarch/arm64/kvm/hyp/include/hyp/switch.h+18 -00 replies
12/17KVM: arm64: Use generated FGT RES0 bits instead of specifying themarch/arm64/include/asm/kvm_arm.h+16 -180 replies
13/17KVM: arm64: Define FGT nMASK bits relative to other fieldsarch/arm64/include/asm/kvm_arm.h+7 -72 replies
14/17KVM: arm64: Macros for setting/clearing FGT bitsarch/arm64/kvm/hyp/include/hyp/switch.h+21 -397 replies
15/17KVM: arm64: Fix which features are marked as allowed for protected VMsarch/arm64/kvm/hyp/include/nvhe/fixed_config.h+7 -10 replies
16/17KVM: arm64: Mark PAuth as a restricted feature for protected VMsarch/arm64/kvm/hyp/include/nvhe/fixed_config.h+11 -30 replies
17/17KVM: arm64: Trap external trace for protected VMsarch/arm64/kvm/hyp/nvhe/pkvm.c+4 -00 replies

Reviews trailers per patch

5 of 17 patches have a Reviewed-by or Acked-by.

PatchMark Brown
1/17R-b
2/17R-b
3/17R-b
4/17
5/17
6/17
7/17
8/17R-b
9/17R-b
10/17
11/17
12/17
13/17
14/17
15/17
16/17
17/17

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

Read the v3 thread

Cover letter [PATCH v3 00/17] KVM: arm64: Fixes to fine grain traps and pKVM traps

Changes from v2:
- Rebased on arm64/for-next/sysregs, which includes new system register definitions (Mark, Joey)
- Explicitly trap unsupported HFGxTR_EL2 features rather than relying on its nMASK (Joey)
- Add new system registers to the auto-generated sysreg rather than hardcoding them (Mark)
- Drop patch that was meant as RFC
- Added missing system registers, fields, and system instructions
- Split patches that make system register changes
- Fixes to patches defining allowed features for protected VMs
- Other minor fixes and tidying up

Changes from v1:
- Handle HAFGRTR_EL2 in nested virt
- Update the nested virt FGT tables with the added trap bits (Marc)
- Use the generated value for RES0 (Marc)
- Calculate the value of NMASK based on RES0 and MASK

This patch series has fixes, updates, and code for validating fine grain trap register masks, as well as some fixes to feature trapping in pKVM.

New fine grain trap (FGT) bits have been defined in the latest Arm Architecture System Registers xml specification (DDI0601 and DDI0602 2023-09) [1], so the code is updated to reflect them. Moreover, some of the already-defined masks overlap with RES0, which this series fixes.

It also adds FGT register masks that weren't defined earlier, handling of HAFGRTR_EL2 in nested virt, as well as build time validation that the bits of the various masks are all accounted for and without overlap.

Based on arm64/for-next/sysregs (e94e06d8a796), which is composed of system register updates [2] and is based on Linux 6.7-rc3.

Cheers,
/fuad

[1] https://developer.arm.com/downloads/-/exploration-tools
[2] https://lore.kernel.org/all/[email protected]/

Fuad Tabba (17):
arm64/sysreg: Add missing Pauth_LR field definitions to

    ID_AA64ISAR1_EL1
  arm64/sysreg: Add missing ExtTrcBuff field definition to
    ID_AA64DFR0_EL1

arm64/sysreg: Add missing system register definitions for FGT arm64/sysreg: Add missing system instruction definitions for FGT
KVM: arm64: Explicitly trap unsupported HFGxTR_EL2 features
KVM: arm64: Add missing HFGxTR_EL2 FGT entries to nested virt
KVM: arm64: Add missing HFGITR_EL2 FGT entries to nested virt
KVM: arm64: Add bit masks for HAFGRTR_EL2
KVM: arm64: Handle HAFGRTR_EL2 trapping in nested virt
KVM: arm64: Update and fix FGT register masks
KVM: arm64: Add build validation for FGT trap mask values
KVM: arm64: Use generated FGT RES0 bits instead of specifying them
KVM: arm64: Define FGT nMASK bits relative to other fields
KVM: arm64: Macros for setting/clearing FGT bits
KVM: arm64: Fix which features are marked as allowed for protected VMs
KVM: arm64: Mark PAuth as a restricted feature for protected VMs
KVM: arm64: Trap external trace for protected VMs

 arch/arm64/include/asm/kvm_arm.h              | 61 +++++++++------
 arch/arm64/include/asm/kvm_host.h             |  1 +
 arch/arm64/include/asm/sysreg.h               |  7 ++
 arch/arm64/kvm/emulate-nested.c               | 63 +++++++++++++++
 arch/arm64/kvm/hyp/include/hyp/switch.h       | 77 +++++++++++--------
 .../arm64/kvm/hyp/include/nvhe/fixed_config.h | 22 +++++-
 arch/arm64/kvm/hyp/nvhe/pkvm.c                |  4 +
 arch/arm64/kvm/sys_regs.c                     |  1 +
 arch/arm64/tools/sysreg                       | 50 +++++++++++-
 9 files changed, 225 insertions(+), 61 deletions(-)

base-commit: e94e06d8a7960fd840ea92021ca1bf1362ea67f8

Signature · 1 line
2.43.0.472.g3155946c3a-goog