Skip to content

Introduce separate nVHE hyp context

Andrew Scull kvmarm linux-arm-kernel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest19 patches 2 repliesIn review
  2. v318 patches 17 repliesSuperseded
  3. v220 patches 0 repliesSuperseded

Changes in v4 from the cover letter

- https://lore.kernel.org/kvmarm/[email protected]/
- Rebased onto 5.9-rc4
- Addressed review comments

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19KVM: arm64: Remove __activate_vm wrapperarch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/vhe/switch.c+9 -140 replies
2/19KVM: arm64: Remove hyp_panic argumentsarch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/hyp-entry.S arch/arm64/kvm/hyp/include/hyp/switch.h +2 more+15 -160 replies
3/19KVM: arm64: Remove kvm_host_data_t typedefarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c+3 -50 replies
4/19KVM: arm64: Choose hyp symbol based on contextarch/arm64/include/asm/kvm_asm.h+19 -60 replies
5/19KVM: arm64: Save chosen hyp vector to a percpu variablearch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/arm.c arch/arm64/kvm/hyp/vhe/switch.c+7 -20 replies
6/19KVM: arm64: nVHE: Use separate vector for the hostarch/arm64/include/asm/kvm_asm.h arch/arm64/kernel/image-vars.h arch/arm64/kvm/arm.c +4 more+125 -680 replies
7/19KVM: arm64: nVHE: Don't consume host SErrors with ESBarch/arm64/kvm/hyp/nvhe/host.S+5 -10 replies
8/19KVM: arm64: Introduce hyp contextarch/arm64/include/asm/kvm_hyp.h arch/arm64/kernel/image-vars.h arch/arm64/kvm/arm.c +4 more+21 -90 replies
9/19KVM: arm64: Update context references from host to hyparch/arm64/include/asm/kvm_ptrauth.h arch/arm64/kvm/hyp/entry.S+14 -140 replies
10/19KVM: arm64: Restore hyp when panicking in guest contextarch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/hyp/entry.S arch/arm64/kvm/hyp/hyp-entry.S +2 more+44 -41 reply
11/19KVM: arm64: Share context save and restore macrosarch/arm64/include/asm/kvm_asm.h arch/arm64/kvm/hyp/entry.S+39 -390 replies
12/19KVM: arm64: nVHE: Switch to hyp context for EL2arch/arm64/kvm/hyp/include/hyp/switch.h arch/arm64/kvm/hyp/nvhe/Makefile arch/arm64/kvm/hyp/nvhe/host.S +1 more+89 -191 reply
13/19KVM: arm64: nVHE: Handle hyp panicsarch/arm64/include/asm/kvm_hyp.h arch/arm64/kvm/hyp/nvhe/host.S arch/arm64/kvm/hyp/nvhe/switch.c+64 -340 replies
14/19KVM: arm64: nVHE: Pass pointers consistently to hyp-initarch/arm64/kvm/arm.c arch/arm64/kvm/hyp/nvhe/hyp-init.S+1 -10 replies
15/19smccc: Define vendor hyp owned service call regioninclude/linux/arm-smccc.h+1 -00 replies
16/19smccc: Use separate variables for args and resultsinclude/linux/arm-smccc.h+29 -440 replies
17/19KVM: arm64: nVHE: Migrate hyp interface to SMCCCarch/arm64/include/asm/kvm_asm.h arch/arm64/include/asm/kvm_host.h arch/arm64/kvm/arm.c +2 more+139 -430 replies
18/19KVM: arm64: nVHE: Migrate hyp-init to SMCCCarch/arm64/include/asm/kvm_host.h arch/arm64/kvm/Makefile arch/arm64/kvm/arm.c +2 more+43 -570 replies
19/19KVM: arm64: nVHE: Fix pointers during SMCCC convertionarch/arm64/kvm/hyp/nvhe/hyp-main.c arch/arm64/kvm/hyp/nvhe/switch.c arch/arm64/kvm/hyp/nvhe/tlb.c +1 more+8 -120 replies

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH v4 00/19] Introduce separate nVHE hyp context

As a step on the way to isolating hyp from the host on nVHE as part of Android's "Protected KVM" project, this series introduces a separate register context. Topics include:

- RAS for nVHE
- Panicking from guest vectors with SCS
- Switching to hyp context
- Migrating hyp interface off of function pointers

First 4 patches are small refactors. Then an exception vector is added just for the nVHE host to untangle the existing EL2 vector e.g. to separate the RAS cases.

Hyp panics from the guest context, e.g. from an invalid vector, are fixed so they have a chance of completely cleanly with features that depend on register state such as x18 for shadow call stack (SCS) enabled on VHE.

Finally, hyp is made to switch to its own context rather than borrowing the host context before migrating the hyp interface from raw function pointers to SMCCC based functions IDs.

From v3:
- https://lore.kernel.org/kvmarm/[email protected]/
- Rebased onto 5.9-rc4
- Addressed review comments

From v2:
- https://lore.kernel.org/kvmarm/[email protected]/
- Rebased onto 5.9-rc3.
- Removed some of the unused separation of host and hyp.

From v1:
- https://lore.kernel.org/kvmarm/[email protected]/
- HVC microbenchmark overhead cut from over 15% to under 6%.
- Abandon the symmetry of a run loop in hyp and treating the host as a vCPU as there was little practical benefit for the overhead it introduced.

Cc Marc Zyngier <[email protected]>
Cc James Morse <[email protected]>
Cc Suzuki Poulose <[email protected]>
Cc Sudeep Holla <[email protected]>
Cc Will Deacon <[email protected]>
Cc Catalin Marinas <[email protected]>

*** BLURB HERE ***

Andrew Scull (19):
KVM: arm64: Remove __activate_vm wrapper
KVM: arm64: Remove hyp_panic arguments
KVM: arm64: Remove kvm_host_data_t typedef
KVM: arm64: Choose hyp symbol based on context
KVM: arm64: Save chosen hyp vector to a percpu variable
KVM: arm64: nVHE: Use separate vector for the host
KVM: arm64: nVHE: Don't consume host SErrors with ESB
KVM: arm64: Introduce hyp context
KVM: arm64: Update context references from host to hyp
KVM: arm64: Restore hyp when panicking in guest context
KVM: arm64: Share context save and restore macros
KVM: arm64: nVHE: Switch to hyp context for EL2
KVM: arm64: nVHE: Handle hyp panics
KVM: arm64: nVHE: Pass pointers consistently to hyp-init
smccc: Define vendor hyp owned service call region
smccc: Use separate variables for args and results
KVM: arm64: nVHE: Migrate hyp interface to SMCCC
KVM: arm64: nVHE: Migrate hyp-init to SMCCC
KVM: arm64: nVHE: Fix pointers during SMCCC convertion

 arch/arm64/include/asm/kvm_asm.h        | 100 ++++++++++++-
 arch/arm64/include/asm/kvm_host.h       |  26 ++--
 arch/arm64/include/asm/kvm_hyp.h        |   9 +-
 arch/arm64/include/asm/kvm_ptrauth.h    |   6 +-
 arch/arm64/kernel/image-vars.h          |   2 +
 arch/arm64/kvm/Makefile                 |   2 +-
 arch/arm64/kvm/arm.c                    |  34 ++++-
 arch/arm64/kvm/hyp.S                    |  34 -----
 arch/arm64/kvm/hyp/entry.S              |  95 +++++-------
 arch/arm64/kvm/hyp/hyp-entry.S          |  76 +---------
 arch/arm64/kvm/hyp/include/hyp/switch.h |  15 +-
 arch/arm64/kvm/hyp/nvhe/Makefile        |   2 +-
 arch/arm64/kvm/hyp/nvhe/host.S          | 187 ++++++++++++++++++++++++
 arch/arm64/kvm/hyp/nvhe/hyp-init.S      |  67 +++++----
 arch/arm64/kvm/hyp/nvhe/hyp-main.c      | 117 +++++++++++++++
 arch/arm64/kvm/hyp/nvhe/switch.c        |  41 +++---
 arch/arm64/kvm/hyp/nvhe/tlb.c           |   2 -
 arch/arm64/kvm/hyp/vhe/switch.c         |  24 +--
 arch/arm64/kvm/vgic/vgic-v3.c           |   4 +-
 include/linux/arm-smccc.h               |  74 ++++------
 20 files changed, 602 insertions(+), 315 deletions(-)
 delete mode 100644 arch/arm64/kvm/hyp.S
 create mode 100644 arch/arm64/kvm/hyp/nvhe/host.S
 create mode 100644 arch/arm64/kvm/hyp/nvhe/hyp-main.c
Signature · 6 lines
2.28.0.618.gf4bc123cb7-goog

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm