From: Mark Rutland <mark.rutland@arm.com>
To: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, broonie@kernel.org,
catalin.marinas@arm.com, eauger@redhat.com,
eric.auger@redhat.com, fweimer@redhat.com, jeremy.linton@arm.com,
maz@kernel.org, oliver.upton@linux.dev, pbonzini@redhat.com,
stable@vger.kernel.org, tabba@google.com, wilco.dijkstra@arm.com
Subject: Re: [PATCH v2 2/8] KVM: arm64: Remove host FPSIMD saving for non-protected KVM
Date: Mon, 10 Feb 2025 20:03:04 +0000 [thread overview]
Message-ID: <Z6pbeIsIMWexiDta@J2N7QTR9R3> (raw)
In-Reply-To: <20250210180637.GA7926@willie-the-truck>
On Mon, Feb 10, 2025 at 06:06:38PM +0000, Will Deacon wrote:
> On Mon, Feb 10, 2025 at 04:59:56PM +0000, Mark Rutland wrote:
> > On Mon, Feb 10, 2025 at 04:12:43PM +0000, Will Deacon wrote:
> > > On Thu, Feb 06, 2025 at 02:10:56PM +0000, Mark Rutland wrote:
> > | static inline bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)
> > | {
> > | ...
> > |
> > | /* Valid trap */
> > |
> > | /*
> > | * Enable everything EL2 might need to save/restore state.
> > | * Maybe each of the bits should depend on system_has_xxx()
> > | */
> > | cpacr_clear_set(0, CPACR_EL1_FPEN | CPACR_EL1_ZEN | CPACR_EL1_SMEN */
> > | isb();
> > |
> > | ...
> > |
> > | /* Write out the host state if it's in the registers */
> > | if (is_protected_kvm_enabled() && host_owns_fp_regs())
> > | kvm_hyp_save_fpsimd_host(vcpu);
> > |
> > | /* Restore guest state */
> > |
> > | ...
> > |
> > | /*
> > | * Enable traps for the VCPU. The ERET will cause the traps to
> > | * take effect in the guest, so no ISB is necessary.
> > | */
> > | cpacr_guest = CPACR_EL1_FPEN;
> > | if (vcpu_has_sve(vcpu))
> > | cpacr_guest |= CPACR_EL1_ZEN;
> > | if (vcpu_has_sme(vcpu)) // whenever we add this
> > | cpacr_guest |= CPACR_EL1_SMEN;
> > | cpacr_clear_set(CPACR_EL1_FPEN | CPACR_EL1_ZEN | CPACR_EL1_SMEN,
> > | cpacr_guest);
> > |
> > | return true;
> > | }
> >
> > ... where we'd still have the CPACR write to re-enable traps, but it'd
> > be unconditional, and wouldn't need an extra ISB.
> >
> > If that makes sense to you, I can go spin that as a subsequent cleanup
> > atop this series.
>
> That looks very clean, yes please! Don't forget to drop the part from
> kvm_hyp_save_fpsimd_host() too.
Yep, that was the idea!
To avoid confusion: I've sent out v3 of this series *without* the
change, and I'll prepare that as a follow-up.
Mark.
next prev parent reply other threads:[~2025-02-10 20:07 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 14:10 [PATCH v2 0/8] KVM: arm64: FPSIMD/SVE/SME fixes Mark Rutland
2025-02-06 14:10 ` [PATCH v2 1/8] KVM: arm64: Unconditionally save+flush host FPSIMD/SVE/SME state Mark Rutland
2025-02-07 12:27 ` Will Deacon
2025-02-07 13:21 ` Mark Rutland
2025-02-10 10:53 ` Marc Zyngier
2025-02-10 15:05 ` Will Deacon
2025-02-06 14:10 ` [PATCH v2 2/8] KVM: arm64: Remove host FPSIMD saving for non-protected KVM Mark Rutland
2025-02-10 16:12 ` Will Deacon
2025-02-10 16:59 ` Mark Rutland
2025-02-10 18:06 ` Will Deacon
2025-02-10 20:03 ` Mark Rutland [this message]
2025-02-11 19:08 ` Mark Rutland
2025-02-06 14:10 ` [PATCH v2 3/8] KVM: arm64: Remove VHE host restore of CPACR_EL1.ZEN Mark Rutland
2025-02-10 16:14 ` Will Deacon
2025-02-06 14:10 ` [PATCH v2 4/8] KVM: arm64: Remove VHE host restore of CPACR_EL1.SMEN Mark Rutland
2025-02-10 16:16 ` Will Deacon
2025-02-06 14:10 ` [PATCH v2 5/8] KVM: arm64: Refactor CPTR trap deactivation Mark Rutland
2025-02-10 16:34 ` Will Deacon
2025-02-06 14:11 ` [PATCH v2 6/8] KVM: arm64: Refactor exit handlers Mark Rutland
2025-02-10 16:37 ` Will Deacon
2025-02-06 14:11 ` [PATCH v2 7/8] KVM: arm64: Mark some header functions as inline Mark Rutland
2025-02-10 16:39 ` Will Deacon
2025-02-06 14:11 ` [PATCH v2 8/8] KVM: arm64: Eagerly switch ZCR_EL{1,2} Mark Rutland
2025-02-06 19:12 ` Mark Brown
2025-02-07 9:34 ` Mark Rutland
2025-02-10 16:53 ` Will Deacon
2025-02-10 17:21 ` Mark Rutland
2025-02-10 18:20 ` Will Deacon
2025-02-10 18:56 ` Mark Rutland
2025-02-11 10:29 ` Will Deacon
2025-02-08 0:27 ` [PATCH v2 0/8] KVM: arm64: FPSIMD/SVE/SME fixes Mark Brown
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=Z6pbeIsIMWexiDta@J2N7QTR9R3 \
--to=mark.rutland@arm.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=eauger@redhat.com \
--cc=eric.auger@redhat.com \
--cc=fweimer@redhat.com \
--cc=jeremy.linton@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=oliver.upton@linux.dev \
--cc=pbonzini@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tabba@google.com \
--cc=wilco.dijkstra@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