From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19970D5B174 for ; Mon, 15 Dec 2025 13:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: References:In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UnNN3NmfowoEI8Yxg4VH5T8VsRGkvk4yK86LBA/umVc=; b=xi0yDWIjBx3IBm2pKbPQYp9R/4 IHGQ7xz66WBeqgHQQzB4nniqiNYOKlgWIEDAsMUKThT6LLCjDIHYhCDsUtVVVgTIr6Vezu3upYyQ8 xV91jn9tbmN1fz2hGIsSo2B5oV0InElvBd0zMhhDnYVjGJxzjwSCXu8aysApTGvMQS1jdT6uK+VYF MH0eeDMr2xIHCkbYfLtQ6at+h3PCr+u5M1fhai98SrGsuAnl1ovZJy+CwC4QaaCsY18iBNF5cYvwF 0cui8IdAdlsBf8os7paXB1yB1laUqG2MNqevLyjmg6doQdG5fw/jcCWMa0mTAqfFI+h6smjZxbzW1 r9Lxg8TQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vV966-00000003inQ-0lwt; Mon, 15 Dec 2025 13:58:46 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vV963-00000003ilY-2fvf for linux-arm-kernel@lists.infradead.org; Mon, 15 Dec 2025 13:58:44 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id B34954447C; Mon, 15 Dec 2025 13:58:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89DE6C19422; Mon, 15 Dec 2025 13:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765807122; bh=Vf7zzfbdgRtZPUqHyBBRLu76rSNg6wAlAZK53fZzzFg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cnbLA2cwn8H3e2IBVbpalCppTh31oS4ZiC8fAiVQTPlsu9X4xkBuHNZVQXZADAq4Y geMSuM4BtA6v3ooxtHahHPamDBOe/sdvw+GRwF6Tizy6rVwR+EQ0s+LXlZs2u+SjfO OyEnoPSby3qTEe1DJlkx7zvnGml0u8j4tlejuLzOh1ERUHPFNMAcK/wfMbm/G4Cvrt QMlp9PY1kUpCeIuwh8hOsR0ylxavOgJT7nZEpTgRFtQ5mWIE4Y6oT3kw3XjU5sz85H q7E4fd4AXfuNqZaQZsPjKfUkoE2zFQHuvKTsZ5FAAerJ1FUzajU5PsY1DzKfGyHsQx PIPEzB24Ar9cQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vV960-0000000CmOD-2TH6; Mon, 15 Dec 2025 13:58:40 +0000 Date: Mon, 15 Dec 2025 13:58:40 +0000 Message-ID: <86ike7onhr.wl-maz@kernel.org> From: Marc Zyngier To: Alexandru Elisei 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 In-Reply-To: <20251215114409.212512-3-alexandru.elisei@arm.com> References: <20251215114409.212512-1-alexandru.elisei@arm.com> <20251215114409.212512-3-alexandru.elisei@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: alexandru.elisei@arm.com, 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 X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251215_055843_744605_572666FD X-CRM114-Status: GOOD ( 22.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 15 Dec 2025 11:44:07 +0000, Alexandru Elisei 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 > --- > 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.