From patchwork Wed Jul 31 19:40:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13749136 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 463FCC3DA7F for ; Wed, 31 Jul 2024 19:45:45 +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-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Lm+LkFD2ROu65aZEA0kr1XJYugt3aMKpd8KSK7twDEY=; b=fnBKJXIUMLGEhOW30lO7p9lYXK xrEDhEKCqEi0+lodBlreD75qeW4XAKd75KDnPFgTcGG0ciu+JPIjykHWJ+gQOgHxlZTCsmJ3NXHSW 8qawCRDMlPc/nwSUDN3sJ2DBNQPIwK3/QbYwghOaqGfrEvhJoIVOwoj+gNoyeGxgo/wYx4C2KrUoD DWsXW3k8hApbdIcbyhByPOseChFYWshqFNVDLqK9T6mVtbfgb9CslMmzBGDClpv/lGcEt+a+ta6C0 GuCXUAPosfXawZE2oM4Jbfleyl2xc6cjcWwaygx2ZEHrZ2EWCxAVBJdt1698i1TxFG0X9G2AEgpJx SWhR/EaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZFGQ-00000002LI9-1tuy; Wed, 31 Jul 2024 19:45:34 +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 1sZFBy-00000002Jhi-2msP for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 19:41:00 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id E91A7CE1802; Wed, 31 Jul 2024 19:40:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36863C4AF0B; Wed, 31 Jul 2024 19:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722454856; bh=Mpd41u/OQb/mH4vQMFgyLtSbBnfY5mHwiO+lMECYSFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a0xMjMiBQY39gzExvuTNIBbwOxuKOpoIs6rZQTjU2hxWMhAgFfbi6y8YZvlGnBrew 3ZYL6r8O09Cmc/XWetL+AmHoBysCF/2T/Ra2wFGUpDnnGJxO9tjoWjZ/wq5UqffQky kBWRWSHxDm8uUMq8EuoiGr6TWLkiw3hBgouSYZ4zCWLWrRuQ1kJ7/uff7aOYVVF/O6 zX3iO4+RBd/6bjWvguSBBvRCxSx+Qta2xyKz+DKhRg5SbtszX7NmP8WoVuxiJCZccB u31nRlTw81AoKJDvZZ6Bcz8kF4rQ7ty64cAp6JbIkdI/GBurlHjGIWeO5NAEZEOY2h qmU9D/XAO6fDQ== 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 1sZFBu-00H6Gh-FC; Wed, 31 Jul 2024 20:40:54 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Alexandru Elisei , Anshuman Khandual , Przemyslaw Gaj Subject: [PATCH v2 07/17] KVM: arm64: nv: Honor absence of FEAT_PAN2 Date: Wed, 31 Jul 2024 20:40:20 +0100 Message-Id: <20240731194030.1991237-8-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240731194030.1991237-1-maz@kernel.org> References: <20240731194030.1991237-1-maz@kernel.org> 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, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, alexandru.elisei@arm.com, anshuman.khandual@arm.com, pgaj@cadence.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-20240731_124059_053504_BA9215EF X-CRM114-Status: GOOD ( 10.02 ) 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 If our guest has been configured without PAN2, make sure that AT S1E1{R,W}P will generate an UNDEF. Reviewed-by: Anshuman Khandual Signed-off-by: Marc Zyngier --- arch/arm64/kvm/sys_regs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index c90324060436..e7e5e0df119e 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c @@ -4600,6 +4600,10 @@ void kvm_calculate_traps(struct kvm_vcpu *vcpu) HFGITR_EL2_TLBIRVAAE1OS | HFGITR_EL2_TLBIRVAE1OS); + if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, PAN, PAN2)) + kvm->arch.fgu[HFGITR_GROUP] |= (HFGITR_EL2_ATS1E1RP | + HFGITR_EL2_ATS1E1WP); + if (!kvm_has_feat(kvm, ID_AA64MMFR3_EL1, S1PIE, IMP)) kvm->arch.fgu[HFGxTR_GROUP] |= (HFGxTR_EL2_nPIRE0_EL1 | HFGxTR_EL2_nPIR_EL1);