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 A8161C7EE24 for ; Mon, 15 May 2023 20:46:35 +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:References:In-Reply-To: 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: List-Owner; bh=SrlpKPT0sdTPJnj1ETYRrkvS4bnSjNzs+N3iW0Dx2JY=; b=AfGdAzP8AI8oRq zIoiojZc6/+yRnOhnXARj1A+/jvCmHia0mQUM1xCucH/6AgreHB0hM67tZgbj0HE8WoNSarqkGb9p qjcpDDij7imPYpge1HQKwtkY2LQyJYtqe4ikGeL07IHtjXIVkc3/n8j9kOwfu/Ty6ZB1n/CVPvRaC SKMmxzRIfavRR3eHiXmUNlQ/5+0/DAt7mTbV12DuXEyH2i4npXgJDIgnsB9JxyE94zOb4Lb/SrZdE e98n+8+fNHtM5olX4Ql+3rWWyd87f/PhMAk4YSrk9G0nlgwNobHUgKr+s+a3MDHC8zM3+GmN2AWwR NC40oisHzMu9lHnHu8eQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyf5C-003Ss8-2F; Mon, 15 May 2023 20:46:14 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyf56-003SpJ-18 for linux-arm-kernel@lists.infradead.org; Mon, 15 May 2023 20:46:10 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 438F061535; Mon, 15 May 2023 20:46:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A951AC4339B; Mon, 15 May 2023 20:46:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684183566; bh=fxToMJPXBRwBImuWVs5OjxsfYe0QdWmMyVn4i/4v4BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o5G04jrCHJKBpu/EONUAdL8S1KrONbGXuhaWrZ6bwd674MNCf8TlMAAXFUQbWvSsq /mHiP1E5YCWaTYPvJfQK+icVi1uKpPYRalw0NNRXWCgX3zXtH/utHlBQx2SBqTYkh8 v1RRn/WG8j8AWW5Kpz45ql/hOgCyTAFTmnpbDhzGw9VzbZXq7YI1/M0ZpmaQTZn1cC PSG0dD6lBOAR0uU1f0FZJgB3myKNi0dkqRY363jbz/nX781n8qQjUusJ+GpGxGHZhS 0Okf+z/L9OfpFBFQHWYQtwENi1J8DT+RNHF7qMO3WOKk7TPJp7uJTfOwAyZoM7OoKU yv/P7ZeZvmM6g== 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 1pyf52-00FM0a-PL; Mon, 15 May 2023 21:46:04 +0100 From: Marc Zyngier To: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Cc: Catalin Marinas , steven.price@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Subject: [PATCH 2/2] KVM: arm64: Handle trap of tagged Set/Way CMOs Date: Mon, 15 May 2023 21:46:01 +0100 Message-Id: <20230515204601.1270428-3-maz@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230515204601.1270428-1-maz@kernel.org> References: <20230515204601.1270428-1-maz@kernel.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, catalin.marinas@arm.com, steven.price@arm.com, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org 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-20230515_134608_459461_64DD8527 X-CRM114-Status: GOOD ( 13.98 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We appear to have missed the Set/Way CMOs when adding MTE support. Not that we really expect anyone to use them, but you never know what stupidity some people can come up with... Treat these mostly like we deal with the classic S/W CMOs, only with an additional check that MTE really is enabled. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/sys_regs.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 71b12094d613..753aa7418149 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -211,6 +211,19 @@ static bool access_dcsw(struct kvm_vcpu *vcpu, return true; } +static bool access_dcgsw(struct kvm_vcpu *vcpu, + struct sys_reg_params *p, + const struct sys_reg_desc *r) +{ + if (!kvm_has_mte(vcpu->kvm)) { + kvm_inject_undefined(vcpu); + return false; + } + + /* Treat MTE S/W ops as we treat the classic ones: with contempt */ + return access_dcsw(vcpu, p, r); +} + static void get_access_mask(const struct sys_reg_desc *r, u64 *mask, u64 *shift) { switch (r->aarch32_map) { @@ -1756,8 +1769,14 @@ static bool access_spsr(struct kvm_vcpu *vcpu, */ static const struct sys_reg_desc sys_reg_descs[] = { { SYS_DESC(SYS_DC_ISW), access_dcsw }, + { SYS_DESC(SYS_DC_IGSW), access_dcgsw }, + { SYS_DESC(SYS_DC_IGDSW), access_dcgsw }, { SYS_DESC(SYS_DC_CSW), access_dcsw }, + { SYS_DESC(SYS_DC_CGSW), access_dcgsw }, + { SYS_DESC(SYS_DC_CGDSW), access_dcgsw }, { SYS_DESC(SYS_DC_CISW), access_dcsw }, + { SYS_DESC(SYS_DC_CIGSW), access_dcgsw }, + { SYS_DESC(SYS_DC_CIGDSW), access_dcgsw }, DBG_BCR_BVR_WCR_WVR_EL1(0), DBG_BCR_BVR_WCR_WVR_EL1(1), -- 2.34.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel