From patchwork Wed Apr 27 17:13:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12829270 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 C8DB8C433EF for ; Wed, 27 Apr 2022 17:29:11 +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=7g5O8hpDoATSPRDOp+j5t2XIVRymu67aVaBJisRdd9s=; b=porKCvcOvKSayR L8M5NivkR/bVJdYHstoLGBafiJYOgC/FIluzFMo59C8emwNVegtagHKjUBLnxLkwpcfHya77K6ZQH gqAvUM9JKS3Fjq0iclH9EGhKW6lVO2zyiMcZtH7pWjzPezVmTtDBfFxFpHpUezd6XTZNTr/+DRPu+ viSTNqUH76lnaN+p4UA+Z6YW0zaKb8W0fOD5B9ge5vE5SwsmcCELzNKdrQfa7J1t+caKSQhHSzGbd xirE+/z4Zhw0G4PIzwkYUnQkawhE66Q55qWgcye1qUJ0JoT5nbgHaRYzRTzEcsiIZoZmtVkEX3s6O MOGfAskBFaa8OCVLoQQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1njlSN-002fAL-52; Wed, 27 Apr 2022 17:28:03 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1njlET-002ZT2-Vg for linux-arm-kernel@lists.infradead.org; Wed, 27 Apr 2022 17:13:43 +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 1EE0B61E1D; Wed, 27 Apr 2022 17:13:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55DC2C385A9; Wed, 27 Apr 2022 17:13:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651079619; bh=jCQ4ed5g1jH8+UOzgePNId4Yf7INSGT/zK7v6/9e+9g=; h=From:To:Cc:Subject:Date:From; b=SsKGu30uRXelUsR7XtMCw9T6Y92aD6V9aBUgF/54DTKqduhUPzVVun3/G1Rze2dju a+HUalk7XZc/6rQq5dnwIVmh+8GhwC0nzMdUjazbk1fqGwGiURSNfLo0WqTb8uAKJi 1Mu5qG2WklVoIVmg7oRubOEL+QdpvPMY+HpU2AyppjUPwWYA0V+fsZpEcS6naS5Ks2 7BYOC1aE3TA+ea74i9LJmbMaV9HYfVXEitzrBKF0MrySQB1SAu1qqvNkbtxK8JbpIK lClfKSPp/4zOXNMXxNSTqbHx48jrPhhHlNEO1Fy45IWv5hnUjg8CWB10KLbX699tvo Gxo0lEhKaHaag== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Quentin Perret , Marc Zyngier Subject: [PATCH] KVM: arm64: Handle host stage-2 faults from 32-bit EL0 Date: Wed, 27 Apr 2022 18:13:32 +0100 Message-Id: <20220427171332.13635-1-will@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220427_101342_136596_1572A28B X-CRM114-Status: GOOD ( 10.05 ) 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 When pKVM is enabled, host memory accesses are translated by an identity mapping at stage-2, which is populated lazily in response to synchronous exceptions from 64-bit EL1 and EL0. Extend this handling to cover exceptions originating from 32-bit EL0 as well. Although these are very unlikely to occur in practice, as the kernel typically ensures that user pages are initialised before mapping them in, drivers could still map previously untouched device pages into userspace and expect things to work rather than panic the system. Cc: Quentin Perret Cc: Marc Zyngier Signed-off-by: Will Deacon --- arch/arm64/kvm/hyp/nvhe/host.S | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S index 3d613e721a75..727c979b2b69 100644 --- a/arch/arm64/kvm/hyp/nvhe/host.S +++ b/arch/arm64/kvm/hyp/nvhe/host.S @@ -198,15 +198,15 @@ SYM_CODE_START(__kvm_hyp_host_vector) invalid_host_el2_vect // FIQ EL2h invalid_host_el2_vect // Error EL2h - host_el1_sync_vect // Synchronous 64-bit EL1 - invalid_host_el1_vect // IRQ 64-bit EL1 - invalid_host_el1_vect // FIQ 64-bit EL1 - invalid_host_el1_vect // Error 64-bit EL1 - - invalid_host_el1_vect // Synchronous 32-bit EL1 - invalid_host_el1_vect // IRQ 32-bit EL1 - invalid_host_el1_vect // FIQ 32-bit EL1 - invalid_host_el1_vect // Error 32-bit EL1 + host_el1_sync_vect // Synchronous 64-bit EL1/EL0 + invalid_host_el1_vect // IRQ 64-bit EL1/EL0 + invalid_host_el1_vect // FIQ 64-bit EL1/EL0 + invalid_host_el1_vect // Error 64-bit EL1/EL0 + + host_el1_sync_vect // Synchronous 32-bit EL1/EL0 + invalid_host_el1_vect // IRQ 32-bit EL1/EL0 + invalid_host_el1_vect // FIQ 32-bit EL1/EL0 + invalid_host_el1_vect // Error 32-bit EL1/EL0 SYM_CODE_END(__kvm_hyp_host_vector) /*