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 A3EEAC4345F for ; Fri, 19 Apr 2024 10:30: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=B2+7ATXzgm9AbG3NeLVEvtb+0LJMmVLXODmr4vWkN+s=; b=v6tbiTgr48eQP+ cVkR1IX4+SCq8Z1XYq5ybYthcEeGynCCAWH0lZx5R5boz6uAjBkDxqklsTg+vY0Yqy02gMix1IJbf NfA3wB6RGp0B4mUkzSX8yKLcGki2NJhxxFT+fJ3S7kddb/RP4mjM42T09/jdsbSv0Qzx3BuPXfFhM zXQ1eXbQpYN9q24OjuCleDozxumiUDX98wr4a5341wWSD1hR8Hgrj8J9088fkY0Ths5woBSoVRKQO Q9CR/Osun7fwUQiHlU4bLQQ+DQU6LnLNymLgIJzi8+DXR6vRUrR743etm1dbnS550UBErZZu4v+80 tA8sFAwtZIXBdOwCekTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rxlVa-00000005J7F-17It; Fri, 19 Apr 2024 10:30:18 +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 1rxlVD-00000005Iqu-47aV for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2024 10:29:58 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id CA80C61977; Fri, 19 Apr 2024 10:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9448DC3277B; Fri, 19 Apr 2024 10:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713522592; bh=PcLim/KmKXgvfK0zZahv5eoT9zsPnsz7Cs5wQESJbb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfVa3ZqFVVai07mBnhGDCE0D8AzVON7uUb5tZ5fBY5Lz1wn7am8guF2RxitqfucQu QCROhze7GpJTSc3Y1q5HbqEoeb/wmfBitkTSN3+yBERMOHZHnWH5ZB4Q4fhKVY5qKl TL/N5Xqgg+H9b8cPspSvynuj3tcIbafsqO1ndyUz8RWvG2g+ZH+0wkBT/3k2FvxDe4 Xqr3jAGGjhHJCHXz5RfR8HQ7XKo9SF7EfArUpeaNIgYOebsj7IUDolx8U6k7pH3D6u pXk5ZhQ0903Af+/rWFH9MhmdMDmDFaExhFFzn8DSR2QQNOIT6BDpeOFGxlxpmvow/P L/v2/QaA7QdPw== 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 1rxlV8-00636W-O0; Fri, 19 Apr 2024 11:29:50 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Fuad Tabba , Mostafa Saleh , Will Deacon , Catalin Marinas Subject: [PATCH v4 08/15] KVM: arm64: nv: Honor HFGITR_EL2.ERET being set Date: Fri, 19 Apr 2024 11:29:28 +0100 Message-Id: <20240419102935.1935571-9-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240419102935.1935571-1-maz@kernel.org> References: <20240419102935.1935571-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, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, tabba@google.com, smostafa@google.com, will@kernel.org, catalin.marinas@arm.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-20240419_032956_446445_F18D41CE X-CRM114-Status: GOOD ( 12.09 ) 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 If the L1 hypervisor decides to trap ERETs while running L2, make sure we don't try to emulate it, just like we wouldn't if it had its NV bit set. The exception will be reinjected from the core handler. Reviewed-by: Joey Gouly Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/vhe/switch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c index 390c7d99f617..26395171621b 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -220,7 +220,8 @@ static bool kvm_hyp_handle_eret(struct kvm_vcpu *vcpu, u64 *exit_code) * Unless the trap has to be forwarded further down the line, * of course... */ - if (__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_NV) + if ((__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_NV) || + (__vcpu_sys_reg(vcpu, HFGITR_EL2) & HFGITR_EL2_ERET)) return false; spsr = read_sysreg_el1(SYS_SPSR); -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B704E78276; Fri, 19 Apr 2024 10:29:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713522592; cv=none; b=KjSHXCaUV3tYWD/45PQGXoEq5PctkG8JieJ4yFmBUDbgjQ5vopz4S/fJgcTEQnydOeEFpgA50tYytDzx2zOCJ9etuLyanJrC9wIz274kBNjBP8HCUHGkj367GPkxnB9QG39YDCovVRqNCkN4/mzx81rYS9kfCCm8CT+uWHBZ8zM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713522592; c=relaxed/simple; bh=PcLim/KmKXgvfK0zZahv5eoT9zsPnsz7Cs5wQESJbb0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iyqjq/64mfvlV1YVeBjPsJw4uFMjIPYn8j5CyRxRzs0ZGbqtloaI/L01d2zOI01q5/2s0y7RtUo9zu1tcdgBSAsmkP7rPrqux4ffutnVkTCVT+xvm14X82IlXRnksWla3l487qY2KxjGbb8+kO214iNjzp/hgVRfnfCiEhTXuRU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UfVa3ZqF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UfVa3ZqF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9448DC3277B; Fri, 19 Apr 2024 10:29:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713522592; bh=PcLim/KmKXgvfK0zZahv5eoT9zsPnsz7Cs5wQESJbb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UfVa3ZqFVVai07mBnhGDCE0D8AzVON7uUb5tZ5fBY5Lz1wn7am8guF2RxitqfucQu QCROhze7GpJTSc3Y1q5HbqEoeb/wmfBitkTSN3+yBERMOHZHnWH5ZB4Q4fhKVY5qKl TL/N5Xqgg+H9b8cPspSvynuj3tcIbafsqO1ndyUz8RWvG2g+ZH+0wkBT/3k2FvxDe4 Xqr3jAGGjhHJCHXz5RfR8HQ7XKo9SF7EfArUpeaNIgYOebsj7IUDolx8U6k7pH3D6u pXk5ZhQ0903Af+/rWFH9MhmdMDmDFaExhFFzn8DSR2QQNOIT6BDpeOFGxlxpmvow/P L/v2/QaA7QdPw== 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 1rxlV8-00636W-O0; Fri, 19 Apr 2024 11:29:50 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Fuad Tabba , Mostafa Saleh , Will Deacon , Catalin Marinas Subject: [PATCH v4 08/15] KVM: arm64: nv: Honor HFGITR_EL2.ERET being set Date: Fri, 19 Apr 2024 11:29:28 +0100 Message-Id: <20240419102935.1935571-9-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240419102935.1935571-1-maz@kernel.org> References: <20240419102935.1935571-1-maz@kernel.org> Precedence: bulk X-Mailing-List: kvmarm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, tabba@google.com, smostafa@google.com, will@kernel.org, catalin.marinas@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false If the L1 hypervisor decides to trap ERETs while running L2, make sure we don't try to emulate it, just like we wouldn't if it had its NV bit set. The exception will be reinjected from the core handler. Reviewed-by: Joey Gouly Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/vhe/switch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switch.c index 390c7d99f617..26395171621b 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -220,7 +220,8 @@ static bool kvm_hyp_handle_eret(struct kvm_vcpu *vcpu, u64 *exit_code) * Unless the trap has to be forwarded further down the line, * of course... */ - if (__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_NV) + if ((__vcpu_sys_reg(vcpu, HCR_EL2) & HCR_NV) || + (__vcpu_sys_reg(vcpu, HFGITR_EL2) & HFGITR_EL2_ERET)) return false; spsr = read_sysreg_el1(SYS_SPSR); -- 2.39.2