From patchwork Wed Apr 10 15:25:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13624746 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 6CD9DCD11C2 for ; Wed, 10 Apr 2024 15:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=iQXw8tNsm4ePM5NRpOcA9wGW9XfflNFtcxfrcDIy46s=; b=EgRzZinIYg7WWu vZUioNQfmolvKIElC/YmNDZAQM4igW+2Y3s9R4lqvTzLqB3GKU/6WRW7Imn1UB+5bkltrHjFMHvdc qPhP0UbD9NYF3F3SRRdj3owGqT5ea/Gh/LojrMKS9zWBiWJZvwoh14tri0d4GzqPKx/CI6rUeJ1OK bcZthxSDGe3YgFAKD3W7epDFT2WwfxTmt2WH3Ed4cHARySfX/Cb0ZmjHJwv5uKcxClmkDKDDJY3eu 8PTxxC9dvGuOQh0p9ivnYgDlB9Gd2TGI5d9udixIdHovYBmTJwtHPn/HW0vfjwzaON7xWHL5Hwz55 yE9Rk7LNda+Je7sfNh3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruZp3-00000007lFI-3gUU; Wed, 10 Apr 2024 15:25:13 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruZp1-00000007lE3-0Qo0 for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2024 15:25:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 5E5B6CE2700; Wed, 10 Apr 2024 15:25:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BDA2C433F1; Wed, 10 Apr 2024 15:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712762708; bh=Hht44JLFsiMQUkvhytN6Eyj8nL8xWpQuS1dv81Yser4=; h=From:To:Cc:Subject:Date:From; b=Ex8KdBrWWR+0k4l/fi0Ad+Hft9ECV8sGHKXJquKjPbDeGB9+1DIJkU3WlCHY8rLyx blNSCddw0xY96kPzAKFRXiqlTGeH/v22Me7bqcwpCrANcEXtJgsGvBQkFO94UMSikN KLlyumuuLG/zmEn+JI9iX7KNniDJHyJ8/7dfc4/xPp6ncJVDfYwy7QtYPneof0dR+n jMgbumFlGRyLNtJZ16MpwBWbFJlXLa04CUEtXNfewTddZ/njC2rcuocM8GKksCNlC0 NMZ+hGcXvi4rTuLii6qjhFsds8WWo8HB5XMXIWNL0nBS3qJfsrwnxjnqGCgFDoukAh t1Q0tVtCyF8Ew== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ruZow-003CCn-LN; Wed, 10 Apr 2024 16:25:06 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH] KVM: arm64: Improve out-of-order sysreg table diagnostics Date: Wed, 10 Apr 2024 16:25:03 +0100 Message-Id: <20240410152503.3593890-1-maz@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com 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-20240410_082511_341846_C18CD405 X-CRM114-Status: GOOD ( 14.95 ) 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 Adding new entries to our system register tables is a painful exercise, as we require them to be ordered by Op0,Op1,CRn,CRm,Op2. If an entry is misordered, we output an error that indicates the pointer to the entry and the number *of the last valid one*. That's not very helpful, and would be much better if we printed the number of the *offending* entry as well as its name (which is present in the vast majority of the cases). This makes debugging new additions to the tables much easier. Signed-off-by: Marc Zyngier Reviewed-by: Zenghui Yu --- arch/arm64/kvm/sys_regs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index a23f4e935a2e..60f548d8572e 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -3920,12 +3920,14 @@ static bool check_sysreg_table(const struct sys_reg_desc *table, unsigned int n, for (i = 0; i < n; i++) { if (!is_32 && table[i].reg && !table[i].reset) { - kvm_err("sys_reg table %pS entry %d lacks reset\n", &table[i], i); + kvm_err("sys_reg table %pS entry %d (%s) lacks reset\n", + &table[i], i, table[i].name); return false; } if (i && cmp_sys_reg(&table[i-1], &table[i]) >= 0) { - kvm_err("sys_reg table %pS entry %d out of order\n", &table[i - 1], i - 1); + kvm_err("sys_reg table %pS entry %d (%s -> %s) out of order\n", + &table[i], i, table[i - 1].name, table[i].name); return false; } }