From: Fuad Tabba <tabba@google.com>
To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Cc: maz@kernel.org, oliver.upton@linux.dev, james.clark@linaro.org,
will@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com,
yuzenghui@huawei.com, catalin.marinas@arm.com,
broonie@kernel.org, qperret@google.com,
kristina.martsenko@arm.com, tabba@google.com
Subject: [PATCH v4 00/14] KVM: arm64: Rework guest VM fixed feature handling and trapping in pKVM
Date: Mon, 2 Dec 2024 15:47:27 +0000 [thread overview]
Message-ID: <20241202154742.3611749-1-tabba@google.com> (raw)
Changes from v3 (Marc):
- Reduce churn from patch reworking SVE checks
- Fold in vcpu config flag renumbering patch
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.
For protected VMs, some features should be trapped if the guest
tries to use them because they are not supported (e.g., SME), or
if they are not enabled for the particular VM (e.g., SVE).
Initially, pKVM took the approach of specifying these features
using macros and grouping their handling by feature id register.
This proved to be difficult to maintainbug prone. Moreover, since
the nested virt work there is a framework in KVM for storing
feature id register values per vm, as well as how to handle traps
based on these values.
This patch series uses the vm's feature id registers to track the
supported features, a framework similar to nested virt to set the
trap values, and removes the need to store cptr_el2 per vcpu in
favor of setting its value when traps are activated, as VHE mode
does.
The changes should not affect the behavior of non-protected VMs
nor the behavior of VMs outside of protected mode in general.
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/20241128123515.1709777-1-tabba@google.com/
[2] https://lore.kernel.org/all/20241018074833.2563674-1-tabba@google.com/
Fuad Tabba (14):
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: Use KVM extension checks for allowed protected VM
capabilities
KVM: arm64: Initialize feature id registers 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
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 | 5 +
arch/arm64/kvm/hyp/nvhe/pkvm.c | 335 +++++----------
arch/arm64/kvm/hyp/nvhe/setup.c | 1 -
arch/arm64/kvm/hyp/nvhe/switch.c | 52 ++-
arch/arm64/kvm/hyp/nvhe/sys_regs.c | 402 ++++++++++--------
arch/arm64/kvm/reset.c | 6 +-
12 files changed, 435 insertions(+), 700 deletions(-)
delete mode 100644 arch/arm64/kvm/hyp/include/nvhe/fixed_config.h
base-commit: 60ad25e14ab5a4e56c8bf7f7d6846eacb9cd53df
--
2.47.0.338.g60cca15819-goog
next reply other threads:[~2024-12-02 15:47 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 15:47 Fuad Tabba [this message]
2024-12-02 15:47 ` [PATCH v4 01/14] KVM: arm64: Consolidate allowed and restricted VM feature checks Fuad Tabba
2024-12-06 16:12 ` Quentin Perret
2024-12-09 8:03 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 02/14] KVM: arm64: Group setting traps for protected VMs by control register Fuad Tabba
2024-12-06 16:44 ` Quentin Perret
2024-12-09 8:06 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 03/14] KVM: arm64: Move checking protected vcpu features to a separate function Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 04/14] KVM: arm64: Use KVM extension checks for allowed protected VM capabilities Fuad Tabba
2024-12-06 17:10 ` Quentin Perret
2024-12-09 8:14 ` Fuad Tabba
2024-12-11 13:29 ` Quentin Perret
2024-12-11 13:30 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 05/14] KVM: arm64: Initialize feature id registers for protected VMs Fuad Tabba
2024-12-06 1:02 ` Oliver Upton
2024-12-06 10:04 ` Fuad Tabba
2024-12-06 17:13 ` Quentin Perret
2024-12-09 8:09 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 06/14] KVM: arm64: Set protected VM traps based on its view of feature registers Fuad Tabba
2024-12-06 17:31 ` Quentin Perret
2024-12-06 17:43 ` Mark Brown
2024-12-06 18:22 ` Marc Zyngier
2024-12-09 8:11 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 07/14] KVM: arm64: Rework specifying restricted features for protected VMs Fuad Tabba
2024-12-11 12:34 ` Quentin Perret
2024-12-11 13:11 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 08/14] KVM: arm64: Remove fixed_config.h header Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 09/14] KVM: arm64: Remove redundant setting of HCR_EL2 trap bit Fuad Tabba
2024-12-11 12:38 ` Quentin Perret
2024-12-11 12:52 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 10/14] KVM: arm64: Calculate cptr_el2 traps on activating traps Fuad Tabba
2024-12-11 12:46 ` Quentin Perret
2024-12-11 12:55 ` Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 11/14] KVM: arm64: Refactor kvm_reset_cptr_el2() Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 12/14] KVM: arm64: Fix the value of the CPTR_EL2 RES1 bitmask for nVHE Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 13/14] KVM: arm64: Remove PtrAuth guest vcpu flag Fuad Tabba
2024-12-02 15:47 ` [PATCH v4 14/14] KVM: arm64: Convert the SVE guest vcpu flag to a vm flag Fuad Tabba
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=20241202154742.3611749-1-tabba@google.com \
--to=tabba@google.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.clark@linaro.org \
--cc=joey.gouly@arm.com \
--cc=kristina.martsenko@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=qperret@google.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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