From: Marc Zyngier <maz@kernel.org>
To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Cc: Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Oliver Upton <oliver.upton@linux.dev>,
Zenghui Yu <yuzenghui@huawei.com>
Subject: [RFC PATCH 0/4] KVM: arm64: vcpu sysreg accessor rework
Date: Mon, 13 Jan 2025 18:35:20 +0000 [thread overview]
Message-ID: <20250113183524.1378778-1-maz@kernel.org> (raw)
As a follow-up to this series[1] fixing bugs around the RESx
behaviours, here's another that tries to bring some additional sanity
to the way the RESx masks are applied.
Currently, we have *one* accessor (__vcpu_sys_reg()) that can either
be used as a rvalue or lvalue while that applies the RESx masks behind
the scenes.
However, when used as a lvalue, it does the wrong thing, as it only
sanitises the value we're about to overwrite. This is pointless work
and potentially hides bugs.
Instead, I propose that we move to a set of store-specific accessors
(for assignments and RMW) instead of the lvalue hack. This then allows
the legacy accessor to be converted to rvalue-only.
Note that these patches are on top of the NV series, so not suitable
for the current set of upstream. But assuming I'm getting positive
feedback, I'm happy to rebase that on something less bleeding edge.
Thanks,
M.
[1] https://lore.kernel.org/r/20250112165029.1181056-1-maz@kernel.org
Marc Zyngier (4):
KVM: arm64: Add assignment-specific sysreg accessor
KVM: arm64: Add RMW specific sysreg accessor
KVM: arm64: Don't use __vcpu_sys_reg() to get the address of a sysreg
KVM: arm64: Make __vcpu_sys_reg() a pure rvalue operand
arch/arm64/include/asm/kvm_host.h | 31 ++++++++++--
arch/arm64/kvm/arch_timer.c | 20 ++++----
arch/arm64/kvm/debug.c | 4 +-
arch/arm64/kvm/fpsimd.c | 6 +--
arch/arm64/kvm/hyp/exception.c | 4 +-
arch/arm64/kvm/hyp/include/hyp/switch.h | 2 +-
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 6 +--
arch/arm64/kvm/hyp/nvhe/hyp-main.c | 4 +-
arch/arm64/kvm/hyp/vhe/switch.c | 4 +-
arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 48 +++++++++---------
arch/arm64/kvm/nested.c | 2 +-
arch/arm64/kvm/pmu-emul.c | 20 ++++----
arch/arm64/kvm/sys_regs.c | 58 +++++++++++-----------
arch/arm64/kvm/sys_regs.h | 4 +-
arch/arm64/kvm/vgic/vgic-v3-nested.c | 10 ++--
15 files changed, 123 insertions(+), 100 deletions(-)
--
2.39.2
next reply other threads:[~2025-01-13 18:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-13 18:35 Marc Zyngier [this message]
2025-01-13 18:35 ` [RFC PATCH 1/4] KVM: arm64: Add assignment-specific sysreg accessor Marc Zyngier
2025-01-13 18:35 ` [RFC PATCH 2/4] KVM: arm64: Add RMW specific " Marc Zyngier
2025-01-13 18:35 ` [RFC PATCH 3/4] KVM: arm64: Don't use __vcpu_sys_reg() to get the address of a sysreg Marc Zyngier
2025-01-13 18:35 ` [RFC PATCH 4/4] KVM: arm64: Make __vcpu_sys_reg() a pure rvalue operand Marc Zyngier
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=20250113183524.1378778-1-maz@kernel.org \
--to=maz@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oliver.upton@linux.dev \
--cc=suzuki.poulose@arm.com \
--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