From: Marc Zyngier <maz@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: oupton@kernel.org, joey.gouly@arm.com, suzuki.poulose@arm.com,
yuzenghui@huawei.com, qperret@google.com, will@kernel.org,
tabba@google.com, linux-arm-kernel@lists.infradead.org,
kvmarm@lists.linux.dev
Subject: Re: [PATCH v2 2/4] KVM: arm64: Print register encoding if there's no accessor
Date: Mon, 15 Dec 2025 13:58:40 +0000 [thread overview]
Message-ID: <86ike7onhr.wl-maz@kernel.org> (raw)
In-Reply-To: <20251215114409.212512-3-alexandru.elisei@arm.com>
On Mon, 15 Dec 2025 11:44:07 +0000,
Alexandru Elisei <alexandru.elisei@arm.com> wrote:
>
> Configuring a register trap without specifying an accessor function is
> abviously a bug. Instead of calling die() when that happens, let's be a bit
> more helpful and print the register encoding and kill the virtual machine
> instead.
>
> Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
> ---
> arch/arm64/kvm/sys_regs.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index c8fd7c6a12a1..d669f6fef177 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -4668,7 +4668,13 @@ static void perform_access(struct kvm_vcpu *vcpu,
> * that we don't know how to handle. This certainly qualifies
> * as a gross bug that should be fixed right away.
> */
> - BUG_ON(!r->access);
> + if (!r->access) {
> + KVM_BUG(1, vcpu->kvm,
> + "Unexpected access to register: { Op0(%2u), Op1(%2u), CRn(%2u), CRm(%2u), Op2(%2u) } (%s)",
> + params->Op0, params->Op1, params->CRn, params->CRm, params->Op2,
> + str_write_read(params->is_write));
> + return;
> + }
Why not writing
if (KVM_BUG(!r>access, ...))
return;
instead? And you could reuse the format that's already defined in
print_sys_reg_msg().
You could instead consider injecting an UNDEF in the guest, which I
find more palatable than this "vm_bugged" stuff. It would at least be
consistent with the "register does not exist in the sysreg table"
approach that we already have.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2025-12-15 13:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-15 11:44 [PATCH v2 0/4] KVM: arm64: pKVM fixes Alexandru Elisei
2025-12-15 11:44 ` [PATCH v2 1/4] KVM: arm64: Copy FGT traps to unprotected pKVM VCPU on VCPU load Alexandru Elisei
2025-12-15 11:44 ` [PATCH v2 2/4] KVM: arm64: Print register encoding if there's no accessor Alexandru Elisei
2025-12-15 13:58 ` Marc Zyngier [this message]
2025-12-15 15:17 ` Alexandru Elisei
2025-12-15 15:39 ` Marc Zyngier
2025-12-15 11:44 ` [PATCH v2 3/4] KVM: arm64: Remove extra argument for __pvkm_host_{share,unshare}_hyp() Alexandru Elisei
2025-12-15 13:43 ` Fuad Tabba
2025-12-15 11:44 ` [PATCH v2 4/4] KVM: arm64: Remove unused parameter in synchronize_vcpu_pstate() Alexandru Elisei
2025-12-15 13:42 ` 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=86ike7onhr.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=alexandru.elisei@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=oupton@kernel.org \
--cc=qperret@google.com \
--cc=suzuki.poulose@arm.com \
--cc=tabba@google.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;
as well as URLs for NNTP newsgroup(s).