From patchwork Fri May 10 11:26:34 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: 13661436 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 C3437C25B74 for ; Fri, 10 May 2024 11:28: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=Q2dnU3Fd16Di75PWtFYK9mATfWSF1Eo5Ck2GBz5b4oM=; b=eoU+bbpbzsOlT+R/37XNUWjbJX ssMHP1E3WkxWyVZMs1RjXrFd1hgoo/iB8afxMhpW4kH9Y2jJJuhQLqC5njkb/aUURScjbVRuZ/G04 ELtR2aDsL6Zx6BjVIvbuP8HxFdZ2525YZTjZlqR+pSm3HOQM9IQ5T8zKs/+S5KWWV/Wt+QKxrvshg X0LW/F8hss9negHB2e51NilJDpCnRo8ehfVOdzrJUPGPd0icqPASFH1PoNV2DYTJdwRqzh9WEH+YV 1z16sAoQ4fOZfSaLloYX5Icxty0JT9QI5ZEhOADSyRozJUlmT6BPg3BprpV97I0RBN596xiHTYQp1 Di4z9GxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5OPh-000000053BO-0dAn; Fri, 10 May 2024 11:27:45 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s5OPX-0000000532U-12yD for linux-arm-kernel@lists.infradead.org; Fri, 10 May 2024 11:27:36 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-61dfa4090c1so27381707b3.3 for ; Fri, 10 May 2024 04:27:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715340450; x=1715945250; 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=qcEzQNh9dWuFIVjzg9t8TylWGTumh3MZGtqI9gQXfso=; b=rqliXSwBBAjls1HBFP/R3yiHpYmgkElOwg+//u2QHwex37L9ZBZbuzoGSetik1ufhD H4NLC+t3bfhj7iygTO3IgN/WAEoHUPl5gt58ccjE4x66cA/Od+drfJ0dOmp6uO0Wt0Nj dVEGl8bT9pzbnTEF0+rfMaYa6c73tc6EfA+C7ZlMjFVhrl9k8jBd/iBspa36n/0fF37H Bvo+vVlMJq+5k5voOwxiCJwR9ZovTrZy6mM9pKgZVrfRMLcJxQaQr9TSdYFlHTftniiG +Hjvrpeo0riNdAZhInfy3ElyS6dYRKPXF5f0zszpmrGCyY0a/OMdxBLJQ3SQETWuhSes +bcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715340450; x=1715945250; 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=qcEzQNh9dWuFIVjzg9t8TylWGTumh3MZGtqI9gQXfso=; b=UZx3+Xi7XwJ9PGE2K/6KmkPyzyqvKFTDo1kt4naeF6bHpANnDnSNweR7ZjnAXTl4nk VRenMouGdx/lzQaCr4SOSi7uSidodyf/AA1dEN2oocd65Y5hfuKjdAZjw0vPDH4OvR28 0U8jh/GqQ3RAj3+af5xizFCG9LEz9rTl+pP3WbXf55ljXCueHcKIvx+9nzaZj7mVBW+Z GgPK7AfA0CaJWidUaSEokmjDw8TIbyWL25xW1nODKyegV40uBad3ieTLwyN9p5ieu92E SGk+gQgW0X3kHBmZZnVrPILYQ4RocJvm8FAvckInCjD/AzRk5Cd+e0FGUOlRBYlgZAcz lFjA== X-Forwarded-Encrypted: i=1; AJvYcCVSQBcgujxsrH9mOPQ4nvwiGy51PsMi62Vd6aS8vwnqfETnxzrMCa/DY/ds75rWZTaZFzuVHmtVwraRa11S914+ab0o4hjYXbEfjvGPtaPvzQlEWtY= X-Gm-Message-State: AOJu0Yw13Y1d2rzC33qt3zQEd3AhOyZIsv2WWZNj02tcVOph4ZizDDci X4K+HlsTa4rSQod7uX2wCFYli54IWwkqlXWjZprSfzWENzB92WKfkt50tENZYSkrZQCB+PS3og= = X-Google-Smtp-Source: AGHT+IF00DsgRNr4wMWPoZLxFG4BzAtNHmn3WH+94RNNB3FGneRo+0N3ZZ2Yl4THjXTnNjJION1G71wXVw== X-Received: from ptosi.c.googlers.com ([fda3:e722:ac3:cc00:31:98fb:c0a8:11ec]) (user=ptosi job=sendgmr) by 2002:a05:690c:4507:b0:61b:3b02:6901 with SMTP id 00721157ae682-622b001dd60mr5562717b3.9.1715340450084; Fri, 10 May 2024 04:27:30 -0700 (PDT) Date: Fri, 10 May 2024 12:26:34 +0100 In-Reply-To: <20240510112645.3625702-1-ptosi@google.com> Mime-Version: 1.0 References: <20240510112645.3625702-1-ptosi@google.com> X-Mailer: git-send-email 2.45.0.118.g7fe29c98d7-goog Message-ID: <20240510112645.3625702-6-ptosi@google.com> Subject: [PATCH v3 05/12] 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-20240510_042735_414759_920460A9 X-CRM114-Status: GOOD ( 12.21 ) 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 --- 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 7397b4f1838a..0613b6e35137 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 /* @@ -202,7 +202,7 @@ SYM_FUNC_END(__host_hvc) * context has been saved by __host_exit or after the hyp context has * been partially clobbered by __host_enter. */ - b __hyp_panic + b \handler .L__hyp_sp_overflow\@: /* Switch to the overflow stack */ @@ -212,6 +212,10 @@ SYM_FUNC_END(__host_hvc) ASM_BUG() .endm +.macro host_el2_sync_vect + __host_el2_vect __hyp_panic +.endm + .macro invalid_host_el1_vect .align 7 mov x0, xzr /* restore_host = false */ @@ -221,6 +225,10 @@ SYM_FUNC_END(__host_hvc) b __hyp_do_panic .endm +.macro invalid_host_el2_vect + __host_el2_vect __hyp_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 @@ -238,7 +246,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