linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Scull <ascull@google.com>
To: kvmarm@lists.cs.columbia.edu
Cc: linux-arm-kernel@lists.infradead.org, kernel-team@android.com,
	suzuki.poulose@arm.com, maz@kernel.org,
	Sudeep Holla <sudeep.holla@arm.com>,
	james.morse@arm.com, Andrew Scull <ascull@google.com>,
	catalin.marinas@arm.com, will@kernel.org,
	julien.thierry.kdev@gmail.com
Subject: [PATCH v2 00/20] Introduce separate nVHE hyp context
Date: Thu, 20 Aug 2020 11:34:26 +0100	[thread overview]
Message-ID: <20200820103446.959000-1-ascull@google.com> (raw)

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 for hyp visiting these topics on the way:

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

After four small refactors, focus turns to adding a new exception vector
for the nVHE hyp to use with the host. With this new freedom, the
erroneous consumption of the host's RAS errors by nVHE is corrected.

Following this, attention turns to fixing hyp panics from the guest
context, e.g. an invalid vector, so they have a chance of completely
cleanly with features such as shadow call stack (SCS) enabled on VHE.

Then, 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.

This series is based on v5.8-rc1 and has been tested on a VIM 3L.

From v1:
 - https://lore.kernel.org/kvmarm/20200715184438.1390996-1-ascull@google.com/
 - 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 <maz@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Suzuki Poulose <suzuki.poulose@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: kernel-team@android.com
Cc: kvmarm@lists.cs.columbia.edu
Cc: linux-arm-kernel@lists.infradead.org

Andrew Scull (20):
  KVM: arm64: Remove __activate_vm wrapper
  KVM: arm64: Remove hyp_panic arguments
  KVM: arm64: Remove kvm_host_data_t typedef
  KVM: arm64: Restrict symbol aliasing to outside nVHE
  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: Preserve host DISR_EL1
  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
  smccc: Cast arguments to unsigned long
  KVM: arm64: nVHE: Pass pointers consistently to hyp-init
  KVM: arm64: nVHE: Migrate hyp interface to SMCCC
  KVM: arm64: nVHE: Migrate hyp-init to SMCCC
  KVM: arm64: nVHE: Fix pointers during SMCCC convertion
  KVM: arm64: nVHE: Handle stub HVCs in the host loop

 arch/arm64/include/asm/kvm_asm.h           |  78 ++++++++++
 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             |  83 +---------
 arch/arm64/kvm/hyp/include/hyp/switch.h    |   9 +-
 arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h |  16 +-
 arch/arm64/kvm/hyp/nvhe/Makefile           |   2 +-
 arch/arm64/kvm/hyp/nvhe/host.S             | 156 +++++++++++++++++++
 arch/arm64/kvm/hyp/nvhe/hyp-init.S         |  80 ++++++----
 arch/arm64/kvm/hyp/nvhe/hyp-main.c         | 171 +++++++++++++++++++++
 arch/arm64/kvm/hyp/nvhe/switch.c           |  37 ++---
 arch/arm64/kvm/hyp/nvhe/tlb.c              |   2 -
 arch/arm64/kvm/hyp/vhe/switch.c            |  18 ++-
 arch/arm64/kvm/vgic/vgic-v3.c              |   4 +-
 include/linux/arm-smccc.h                  |  20 +--
 21 files changed, 606 insertions(+), 278 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

-- 
2.28.0.220.ged08abb693-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-08-20 10:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 10:34 Andrew Scull [this message]
2020-08-20 10:34 ` [PATCH v2 01/20] KVM: arm64: Remove __activate_vm wrapper Andrew Scull
2020-08-20 10:34 ` [PATCH v2 02/20] KVM: arm64: Remove hyp_panic arguments Andrew Scull
2020-08-20 10:34 ` [PATCH v2 03/20] KVM: arm64: Remove kvm_host_data_t typedef Andrew Scull
2020-08-20 10:34 ` [PATCH v2 04/20] KVM: arm64: Restrict symbol aliasing to outside nVHE Andrew Scull
2020-08-20 10:34 ` [PATCH v2 05/20] KVM: arm64: Save chosen hyp vector to a percpu variable Andrew Scull
2020-08-20 10:34 ` [PATCH v2 06/20] KVM: arm64: nVHE: Use separate vector for the host Andrew Scull
2020-08-20 10:34 ` [PATCH v2 07/20] KVM: arm64: nVHE: Don't consume host SErrors with ESB Andrew Scull
2020-08-20 10:34 ` [PATCH v2 08/20] KVM: arm64: Preserve host DISR_EL1 Andrew Scull
2020-08-20 10:34 ` [PATCH v2 09/20] KVM: arm64: Introduce hyp context Andrew Scull
2020-08-20 10:34 ` [PATCH v2 10/20] KVM: arm64: Update context references from host to hyp Andrew Scull
2020-08-20 10:34 ` [PATCH v2 11/20] KVM: arm64: Restore hyp when panicking in guest context Andrew Scull
2020-08-20 10:34 ` [PATCH v2 12/20] KVM: arm64: Share context save and restore macros Andrew Scull
2020-08-20 10:34 ` [PATCH v2 13/20] KVM: arm64: nVHE: Switch to hyp context for EL2 Andrew Scull
2020-08-20 10:34 ` [PATCH v2 14/20] KVM: arm64: nVHE: Handle hyp panics Andrew Scull
2020-08-20 10:34 ` [PATCH v2 15/20] smccc: Cast arguments to unsigned long Andrew Scull
2020-08-20 10:34 ` [PATCH v2 16/20] KVM: arm64: nVHE: Pass pointers consistently to hyp-init Andrew Scull
2020-08-20 10:34 ` [PATCH v2 17/20] KVM: arm64: nVHE: Migrate hyp interface to SMCCC Andrew Scull
2020-08-20 10:34 ` [PATCH v2 18/20] KVM: arm64: nVHE: Migrate hyp-init " Andrew Scull
2020-08-20 10:34 ` [PATCH v2 19/20] KVM: arm64: nVHE: Fix pointers during SMCCC convertion Andrew Scull
2020-08-20 10:34 ` [PATCH v2 20/20] KVM: arm64: nVHE: Handle stub HVCs in the host loop Andrew Scull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200820103446.959000-1-ascull@google.com \
    --to=ascull@google.com \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).