From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Sebastian Ott <sebott@redhat.com>
Subject: Re: [PATCH v4 4/5] KVM: arm64: Allow userspace to change the implementation ID registers
Date: Tue, 25 Feb 2025 11:19:28 +0000 [thread overview]
Message-ID: <86frk2qnjz.wl-maz@kernel.org> (raw)
In-Reply-To: <20250225005401.679536-5-oliver.upton@linux.dev>
On Tue, 25 Feb 2025 00:54:00 +0000,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> From: Sebastian Ott <sebott@redhat.com>
>
> KVM's treatment of the ID registers that describe the implementation
> (MIDR, REVIDR, and AIDR) is interesting, to say the least. On the
> userspace-facing end of it, KVM presents the values of the boot CPU on
> all vCPUs and treats them as invariant. On the guest side of things KVM
> presents the hardware values of the local CPU, which can change during
> CPU migration in a big-little system.
>
> While one may call this fragile, there is at least some degree of
> predictability around it. For example, if a VMM wanted to present
> big-little to a guest, it could affine vCPUs accordingly to the correct
> clusters.
>
> All of this makes a giant mess out of adding support for making these
> implementation ID registers writable. Avoid breaking the rather subtle
> ABI around the old way of doing things by requiring opt-in from
> userspace to make the registers writable.
>
> When the cap is enabled, allow userspace to set MIDR, REVIDR, and AIDR
> to any non-reserved value and present those values consistently across
> all vCPUs.
>
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> [oliver: changelog, capability]
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
> Documentation/virt/kvm/api.rst | 18 +++++++++
> arch/arm64/include/asm/kvm_host.h | 2 +
> arch/arm64/kvm/arm.c | 9 +++++
> arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 8 +++-
> arch/arm64/kvm/sys_regs.c | 45 +++++++++++++++++++---
> include/uapi/linux/kvm.h | 1 +
> 6 files changed, 77 insertions(+), 6 deletions(-)
>
[...]
> @@ -2620,9 +2655,9 @@ static const struct sys_reg_desc sys_reg_descs[] = {
>
> { SYS_DESC(SYS_DBGVCR32_EL2), undef_access, reset_val, DBGVCR32_EL2, 0 },
>
> - IMPLEMENTATION_ID(MIDR_EL1),
> + IMPLEMENTATION_ID(MIDR_EL1, GENMASK_ULL(31, 0)),
> { SYS_DESC(SYS_MPIDR_EL1), NULL, reset_mpidr, MPIDR_EL1 },
> - IMPLEMENTATION_ID(REVIDR_EL1),
> + IMPLEMENTATION_ID(REVIDR_EL1, -1),
nit: using GENMASK_ULL() would be much nicer.
>
> /*
> * ID regs: all ID_SANITISED() entries here must have corresponding
> @@ -2894,7 +2929,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
> .set_user = set_clidr, .val = ~CLIDR_EL1_RES0 },
> { SYS_DESC(SYS_CCSIDR2_EL1), undef_access },
> { SYS_DESC(SYS_SMIDR_EL1), undef_access },
> - IMPLEMENTATION_ID(AIDR_EL1),
> + IMPLEMENTATION_ID(AIDR_EL1, -1),
Same thing here.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-02-25 11:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 0:53 [PATCH v4 0/5] KVM: arm64: Writable MIDR/REVIDR (and associated baggage) Oliver Upton
2025-02-25 0:53 ` [PATCH v4 1/5] KVM: arm64: Set HCR_EL2.TID1 unconditionally Oliver Upton
2025-02-25 11:09 ` Marc Zyngier
2025-02-25 0:53 ` [PATCH v4 2/5] KVM: arm64: Maintain per-VM copy of implementation ID regs Oliver Upton
2025-02-25 0:53 ` [PATCH v4 3/5] KVM: arm64: Load VPIDR_EL2 with the VM's MIDR_EL1 value Oliver Upton
2025-02-25 0:54 ` [PATCH v4 4/5] KVM: arm64: Allow userspace to change the implementation ID registers Oliver Upton
2025-02-25 11:19 ` Marc Zyngier [this message]
2025-02-25 0:54 ` [PATCH v4 5/5] KVM: selftests: arm64: Test writes to MIDR,REVIDR,AIDR Oliver Upton
2025-02-27 20:39 ` Mark Brown
2025-02-28 9:47 ` Sebastian Ott
2025-02-28 13:21 ` Sebastian Ott
2025-02-25 13:54 ` [PATCH v4 0/5] KVM: arm64: Writable MIDR/REVIDR (and associated baggage) Marc Zyngier
2025-02-26 9:49 ` Oliver Upton
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=86frk2qnjz.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=oliver.upton@linux.dev \
--cc=sebott@redhat.com \
--cc=suzuki.poulose@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.