From patchwork Tue Aug 6 14:24:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13755026 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 7E266C3DA64 for ; Tue, 6 Aug 2024 14:40:15 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C/eqNnfq+5tNGmrZJLwhQoTmAWx6fl94LGyVSWgEwSs=; b=c7a1BjLDdiOtHRsHGSZXrsrqrG hvOOxt88p1Hpg9cbVQWbSWwL9cgRQkNY/HME5v62xXaHOB4tDB1H2SZETRPPwfNMr0rPmmL/6yzNG X+unrnnf6q4MWmY7i4rmGbyGtPBHgj/jt7NbexyawSh6Ksfrw6Siws79YLpvfWxWQbCdgIGLa1DZ9 JuMYBvvxYsre52YCJyvJAjI+GIEvTSfP551omHJ9/cyamPjgXtqpEpJqY0amv2braS8tkE//UXLwu Uh6g9rQVzOjX2QfC2+lxbo8GO5WnObg7dMtcyNHV8M0mfA1d0h7gDc3y0+b/lAzg0Mt3wUVzHktDD H70Uj3XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbLM4-000000020ER-3JsZ; Tue, 06 Aug 2024 14:40:04 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sbLK3-00000001zOu-3F1U for linux-arm-kernel@lists.infradead.org; Tue, 06 Aug 2024 14:38:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1A8E960F7E; Tue, 6 Aug 2024 14:37:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43055C4AF0C; Tue, 6 Aug 2024 14:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722955078; bh=ZJGUtbKdmJO4/kaSi2X+uwqBREkxPub2iqn4Ks8jUWY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UN3u66td2a3xT4FHO9kEEZAfysQFQZgBgWAwhY0p90E933WyUpHlM1Xxqxv+448Y0 X5mp1wFJYT7LgAqACS4yeLLtUxTMYLo2WscWxdHDvWuM6BE40CWwa4fdWmMfKoLWcl 9tXnEtsHWDFWqeL9G6cC+4yX6Ty+e1pLY5KERBBO7/EU2hF6oNi177reEyPYcVJmVj Fux4a/u5axaUbtoKQ0QD8LItFOVWBbYuOTW/+qABsdg5rUSDmRBjl+7OLGPS2cuOXu hrH1Y5sCFic0UOeSBjuNRIcvPA+c6BgCfYToc9Buv7sTvP6xcgosIAbTBteAULK243 P77Wv/jKAEvMg== From: Mark Brown Date: Tue, 06 Aug 2024 15:24:23 +0100 Subject: [PATCH v2 2/3] KVM: selftests: arm64: Use symbolic definitions for incorrect encodings MIME-Version: 1.0 Message-Id: <20240806-kvm-arm64-get-reg-list-v2-2-1d3fbc7b6844@kernel.org> References: <20240806-kvm-arm64-get-reg-list-v2-0-1d3fbc7b6844@kernel.org> In-Reply-To: <20240806-kvm-arm64-get-reg-list-v2-0-1d3fbc7b6844@kernel.org> To: Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Paolo Bonzini , Shuah Khan , Catalin Marinas , Joey Gouly Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1728; i=broonie@kernel.org; h=from:subject:message-id; bh=ZJGUtbKdmJO4/kaSi2X+uwqBREkxPub2iqn4Ks8jUWY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBmsjU8dXUg7lGFksSHERCDxBnP8Pe9J8hRxOLsDsUB 0f0GL6OJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZrI1PAAKCRAk1otyXVSH0AYYB/ 49VjmSrFbyL0Vd79stbnQwFBeLryXd4VLBMN4mYhYBBuZFLCMGq5lA8ZvaQ0tYlcdrbNuc3zV2f1R5 oyefG/NdVWrbhNpBTiQKR5q+cpth5nflyd55Ylw2qdE9XXfXunkKOxS1dhGOtGZwUGV+/DSBsblswB LqgEv6xyuEFJG9XZkLk6G06knNkMhuqLmaFvdBuiLTy8RMMqTSddeiz3/uyP6l5bsoXaDWC8qRh+32 8JIEGIeZ0aXHiax8JQCSaFTzw3BbedsiGuqTA77SGe31reeSMBO/2rChz+Kmd/4DhehhQPm+iv8yuO tnVb+/XXVhzosYnxf6ZHky3CsdhzLX X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240806_073800_082009_CC8BDB41 X-CRM114-Status: GOOD ( 12.76 ) 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 Unfortunately incorrect encodings for CNTV_CTL_EL0 and CNTV_CVAL_EL0 made their way into the KVM ABI, the encodings were swapped. The UAPI provides custom KVM sysreg definitions with the incorrect encodings so let's update get-reg-list to use them. Also add a comment explaining the situation to help anyone looking at the test. This will avoid these registers being picked up by further work to automatically convert the test to use symbolic definitions rather than manually repeating the encodings in the test. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c index 97ac3f6b5c4b..a270287a4c88 100644 --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c @@ -313,8 +313,15 @@ static __u64 base_regs[] = { KVM_REG_ARM_FW_FEAT_BMAP_REG(0), /* KVM_REG_ARM_STD_BMAP */ KVM_REG_ARM_FW_FEAT_BMAP_REG(1), /* KVM_REG_ARM_STD_HYP_BMAP */ KVM_REG_ARM_FW_FEAT_BMAP_REG(2), /* KVM_REG_ARM_VENDOR_HYP_BMAP */ - ARM64_SYS_REG(3, 3, 14, 3, 1), /* CNTV_CTL_EL0 */ - ARM64_SYS_REG(3, 3, 14, 3, 2), /* CNTV_CVAL_EL0 */ + + /* + * Incorrect encodings for CNTV_CTL_EL0 and CNTV_CVAL_EL0 made + * it into the KVM ABI so we have custom encodings for them + * that do not align with the architecture. + */ + KVM_REG_ARM_TIMER_CTL, + KVM_REG_ARM_TIMER_CVAL, + ARM64_SYS_REG(3, 3, 14, 0, 2), ARM64_SYS_REG(3, 0, 0, 0, 0), /* MIDR_EL1 */ ARM64_SYS_REG(3, 0, 0, 0, 6), /* REVIDR_EL1 */