From patchwork Wed May 29 12:12:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pierre-Cl=C3=A9ment_Tosi?= X-Patchwork-Id: 13678766 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 C7BDEC25B75 for ; Wed, 29 May 2024 12:15:02 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=euK5Axvj4cqQQKVkJaAXlHMFo3EiHxaRl73wDM27v88=; b=McPg6NJkOiEAzFqtoaTpkyT2hh 4yqmFJ1mbL7FgZWIppI5BfG6Aak5Qdz520pJ9gMRxH0lvrc2/eEP2rGwYXp8G8DkpS++wrqRaHLdU 4z6ud7VRuT738ppmg86bZLX08mca25XGDZGO7r+RQ8phFfVY7HoDcbuU4oh0Y9lnDLZn9Daj3VlDF yQmpKgYvTGbY6QpjdsePElSJEO5xICDBDZEYV9mFqPVvkogZifEqb0DefSFCmGVOW88vdxWqxW0X2 2onkHCrpieZzW/KcztncvgLakR+wIw992Z8oY7prZmqA9V2neIZ7KANTGgmJ8T3i7kR090IZcZL+I TuRXKUQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCICi-0000000439f-0AIv; Wed, 29 May 2024 12:14:52 +0000 Received: from mail-ej1-x64a.google.com ([2a00:1450:4864:20::64a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sCICX-0000000431g-19i1 for linux-arm-kernel@lists.infradead.org; Wed, 29 May 2024 12:14:42 +0000 Received: by mail-ej1-x64a.google.com with SMTP id a640c23a62f3a-a6265d3cc76so111540266b.0 for ; Wed, 29 May 2024 05:14:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716984878; x=1717589678; darn=lists.infradead.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=QLEJ3O4kV4RVdclClpDnM/s5WQUclK7m/dX1iG4Slsk=; b=y1Vcz1p3iR7WDKNnZY/xsqXgsEhWpujOYPtPMDzQlaLvTqbDot2VJ7BtjJGFtweNFD jMiFDBpvWlm51TWjKBuAktbXie5HmiXkmGugFPjcpbZ3xgOB/dVnTWLBFYMIdrJYe8a5 ugsDQ4gZg9lL3W/1+Ldy4PMbuvBtvGxnKfq6H7NyBzHSFX7I37Zx4yytYYiZ9DaPauJl EfjGAhE4AkW6Xa1T0UhvE0ij4p4y+FU2tXL60MRHpzAqc/5gFucJCs8hEwU74fX+aVjg NSYNHfCm7mu/R8rdNBLkSvlby7K7U7QGrCwMXhAyJSbY9SHsAaJnxJP6ilCMrFmrOjbW 64Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716984878; x=1717589678; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=QLEJ3O4kV4RVdclClpDnM/s5WQUclK7m/dX1iG4Slsk=; b=cCXUs/j/TNIu05B/E4eG3Xekm0tfm9/nOGX++BkB2RVoZM4W8HoCLiUP8d92FmMuSK XVrOqOOcr7ApsDktTUr0wdoxP1Rh6JHh0Pg2TewlHfENGYcrMdti/CcHzoWObcb8vBrB i4/U+C33qE0EUfg9NORp7mxBJIw0VEHxJdHxFb2iW9MPFul+qiU3y+Si+9qt3JgZp4xi z4a+O2KWtVblOMF6uJD4Oh7FacSjmujKtCRO43c60s1wV9IKX2fWf0PXNiqnKKTcjIEn egvEGW/b6/Dtg97aMPDgr8KeJ6WjueoqnPNFXnHrh3Ba9uMgIDLnAuIlZuArhlNZaU3X 7YYA== X-Forwarded-Encrypted: i=1; AJvYcCX8/sBun11rkNj+647U8sRoS+y96aAbHQHa8btbWf1LMQvXnrA5aQ4WyCNwHLy3w4Xi0uN+Ly5BE9HcktRS6tki8jHM98SE2YQ1Nv5l2nloKOcvsYE= X-Gm-Message-State: AOJu0YzCE24SqfKAMnLsMcUHntFG8Ne88LPiPc8ejoNH7xgCvekodrWR T1zkPU4KJTP0XvnREMMccNF3C1jJO/Mzr3BjGvG4iCf1pyJQ98PiZDa4Nalo8fhLa+Fa0ax0Ww= = X-Google-Smtp-Source: AGHT+IHcGsvak0IaIBaJRsxrOxRAaw1LTq+hg6b9qMn9Z3a3+Nx+yXco9WUVoWIw3Nxf0/WiUp16udA02A== X-Received: from ptosi.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:11ec]) (user=ptosi job=sendgmr) by 2002:a17:906:1991:b0:a5c:e96f:6022 with SMTP id a640c23a62f3a-a62642e4314mr1531066b.3.1716984878101; Wed, 29 May 2024 05:14:38 -0700 (PDT) Date: Wed, 29 May 2024 13:12:10 +0100 In-Reply-To: <20240529121251.1993135-1-ptosi@google.com> Mime-Version: 1.0 References: <20240529121251.1993135-1-ptosi@google.com> X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog Message-ID: <20240529121251.1993135-5-ptosi@google.com> Subject: [PATCH v4 04/13] KVM: arm64: nVHE: Add EL2h sync exception handler From: " =?utf-8?q?Pierre-Cl=C3=A9ment_Tosi?= " To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: " =?utf-8?q?Pierre-Cl=C3=A9ment_Tosi?= " , Marc Zyngier , Oliver Upton , Suzuki K Poulose , Vincent Donnefort X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240529_051441_419359_7B87F11B X-CRM114-Status: GOOD ( 12.24 ) 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 Introduce a handler for EL2h synchronous exceptions distinct from handlers for other "invalid" exceptions when running with the nVHE host vector. This will allow a future patch to handle kCFI (synchronous) errors without affecting other classes of exceptions. Signed-off-by: Pierre-Clément Tosi Acked-by: Will Deacon --- arch/arm64/kvm/hyp/nvhe/host.S | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S index 71fb311b4c0e..bc0a73d9fcd0 100644 --- a/arch/arm64/kvm/hyp/nvhe/host.S +++ b/arch/arm64/kvm/hyp/nvhe/host.S @@ -183,7 +183,7 @@ SYM_FUNC_END(__host_hvc) .endif .endm -.macro invalid_host_el2_vect +.macro __host_el2_vect handler:req .align 7 /* @@ -203,7 +203,7 @@ SYM_FUNC_END(__host_hvc) * been partially clobbered by __host_enter. */ stp x0, x1, [sp, #-16]! - b __guest_exit_panic + b \handler .L__hyp_sp_overflow\@: /* Switch to the overflow stack */ @@ -213,6 +213,10 @@ SYM_FUNC_END(__host_hvc) ASM_BUG() .endm +.macro host_el2_sync_vect + __host_el2_vect __guest_exit_panic +.endm + .macro invalid_host_el1_vect .align 7 mov x0, xzr /* restore_host = false */ @@ -222,6 +226,10 @@ SYM_FUNC_END(__host_hvc) b __hyp_do_panic .endm +.macro invalid_host_el2_vect + __host_el2_vect __guest_exit_panic +.endm + /* * The host vector does not use an ESB instruction in order to avoid consuming * SErrors that should only be consumed by the host. Guest entry is deferred by @@ -239,7 +247,7 @@ SYM_CODE_START(__kvm_hyp_host_vector) invalid_host_el2_vect // FIQ EL2t invalid_host_el2_vect // Error EL2t - invalid_host_el2_vect // Synchronous EL2h + host_el2_sync_vect // Synchronous EL2h invalid_host_el2_vect // IRQ EL2h invalid_host_el2_vect // FIQ EL2h invalid_host_el2_vect // Error EL2h