From: Fuad Tabba <tabba@google.com>
To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Cc: maz@kernel.org, will@kernel.org, qperret@google.com,
tabba@google.com, seanjc@google.com, alexandru.elisei@arm.com,
catalin.marinas@arm.com, philmd@linaro.org, james.morse@arm.com,
suzuki.poulose@arm.com, oliver.upton@linux.dev,
mark.rutland@arm.com, broonie@kernel.org, joey.gouly@arm.com,
rananta@google.com, yuzenghui@huawei.com
Subject: [PATCH v1 0/7] KVM: arm64: Fix handling of host fpsimd/sve state in protected mode
Date: Fri, 17 May 2024 14:18:07 +0100 [thread overview]
Message-ID: <20240517131814.719933-1-tabba@google.com> (raw)
With the KVM host data rework [1], handling of fpsimd and sve
state in protected mode is done at hyp. For protected VMs, we
don't want to leak any guest state to the host, including whether
a guest has used fpsimd/sve.
To complete the work started with the host data rework, in
regards to protected mode, ensure that the host's fpsimd context
and its sve context are restored on guest exit, since the rework
has hidden the fpsimd/sve state from the host.
This patch series eagerly restores the host fpsimd/sve state on
guest exit when running in protected mode, which happens only if
the guest has used fpsimd/sve. This means that the saving of the
state is lazy, similar to the behavior of KVM in other modes, but
the restoration of the host state is eager.
This series is based on kvmarm-6.10-1 (kvmarm/next). It should
not have any effect on modes other than protected mode.
Tested on qemu, with the kernel sve stress tests.
Cheers,
/fuad
[1] https://lore.kernel.org/all/20240322170945.3292593-1-maz@kernel.org/
Fuad Tabba (7):
KVM: arm64: Reintroduce __sve_save_state
KVM: arm64: Specialize deactivate fpsimd/sve traps on guest trap
KVM: arm64: Specialize handling of host fpsimd state on trap
KVM: arm64: Store the maximum sve vector length at hyp
KVM: arm64: Allocate memory at hyp for host sve state in pKVM
KVM: arm64: Eagerly restore host fpsimd/sve state in pKVM
KVM: arm64: Consolidate initializing the host data's fpsimd_state/sve
in pKVM
arch/arm64/include/asm/kvm_host.h | 11 +++-
arch/arm64/include/asm/kvm_hyp.h | 2 +
arch/arm64/include/asm/kvm_pkvm.h | 9 +++
arch/arm64/include/uapi/asm/ptrace.h | 14 +++++
arch/arm64/kvm/arm.c | 75 +++++++++++++++++++++++++
arch/arm64/kvm/hyp/fpsimd.S | 6 ++
arch/arm64/kvm/hyp/include/hyp/switch.h | 31 +++++-----
arch/arm64/kvm/hyp/include/nvhe/pkvm.h | 1 -
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 57 ++++++++++++++++++-
arch/arm64/kvm/hyp/nvhe/pkvm.c | 15 ++---
arch/arm64/kvm/hyp/nvhe/setup.c | 25 ++++++++-
arch/arm64/kvm/hyp/nvhe/switch.c | 40 +++++++++++++
arch/arm64/kvm/hyp/vhe/switch.c | 16 ++++++
arch/arm64/kvm/reset.c | 2 +
14 files changed, 271 insertions(+), 33 deletions(-)
base-commit: eaa46a28d59655aa89a8fb885affa6fc0de44376
--
2.45.0.rc1.225.g2a3ae87e7f-goog
next reply other threads:[~2024-05-17 13:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 13:18 Fuad Tabba [this message]
2024-05-17 13:18 ` [PATCH v1 1/7] KVM: arm64: Reintroduce __sve_save_state Fuad Tabba
2024-05-17 13:18 ` [PATCH v1 2/7] KVM: arm64: Specialize deactivate fpsimd/sve traps on guest trap Fuad Tabba
2024-05-17 13:18 ` [PATCH v1 3/7] KVM: arm64: Specialize handling of host fpsimd state on trap Fuad Tabba
2024-05-17 13:18 ` [PATCH v1 4/7] KVM: arm64: Store the maximum sve vector length at hyp Fuad Tabba
2024-05-17 13:18 ` [PATCH v1 5/7] KVM: arm64: Allocate memory at hyp for host sve state in pKVM Fuad Tabba
2024-05-17 13:18 ` [PATCH v1 6/7] KVM: arm64: Eagerly restore host fpsimd/sve " Fuad Tabba
2024-05-17 17:09 ` Oliver Upton
2024-05-20 7:37 ` Fuad Tabba
2024-05-20 8:05 ` Marc Zyngier
2024-05-20 8:53 ` Fuad Tabba
2024-05-20 17:08 ` Oliver Upton
2024-05-17 13:18 ` [PATCH v1 7/7] KVM: arm64: Consolidate initializing the host data's fpsimd_state/sve " Fuad Tabba
2024-05-17 17:30 ` [PATCH v1 0/7] KVM: arm64: Fix handling of host fpsimd/sve state in protected mode Oliver Upton
2024-05-17 18:19 ` Mark Brown
2024-05-20 7:35 ` Fuad Tabba
2024-05-20 8:11 ` Marc Zyngier
2024-05-20 17:37 ` Oliver Upton
2024-05-20 17:53 ` Mark Brown
2024-05-20 17:59 ` Fuad Tabba
2024-05-20 17:57 ` Fuad Tabba
2024-05-20 20:53 ` Oliver Upton
2024-05-21 12:27 ` 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=20240517131814.719933-1-tabba@google.com \
--to=tabba@google.com \
--cc=alexandru.elisei@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=philmd@linaro.org \
--cc=qperret@google.com \
--cc=rananta@google.com \
--cc=seanjc@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