public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Pierre-Clément Tosi" <ptosi@google.com>
To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	 kvm@vger.kernel.org
Cc: "Pierre-Clément Tosi" <ptosi@google.com>,
	"Marc Zyngier" <maz@kernel.org>,
	"Oliver Upton" <oliver.upton@linux.dev>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	"Vincent Donnefort" <vdonnefort@google.com>
Subject: [PATCH v4 05/13] KVM: arm64: Rename __guest_exit_panic __hyp_panic
Date: Wed, 29 May 2024 13:12:11 +0100	[thread overview]
Message-ID: <20240529121251.1993135-6-ptosi@google.com> (raw)
In-Reply-To: <20240529121251.1993135-1-ptosi@google.com>

Use a name that expresses the fact that the routine might not exit
through the guest but will always (directly or indirectly) end up
executing hyp_panic().

Use CPU_LR_OFFSET to clarify that the routine returns to hyp_panic().

Signed-off-by: Pierre-Clément Tosi <ptosi@google.com>
---
 arch/arm64/kvm/hyp/entry.S              | 6 +++---
 arch/arm64/kvm/hyp/hyp-entry.S          | 2 +-
 arch/arm64/kvm/hyp/include/hyp/switch.h | 4 ++--
 arch/arm64/kvm/hyp/nvhe/host.S          | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index 4433a234aa9b..343851c17373 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -83,7 +83,7 @@ alternative_else_nop_endif
 	eret
 	sb
 
-SYM_INNER_LABEL(__guest_exit_restore_elr_and_panic, SYM_L_GLOBAL)
+SYM_INNER_LABEL(__hyp_restore_elr_and_panic, SYM_L_GLOBAL)
 	// x2-x29,lr: vcpu regs
 	// vcpu x0-x1 on the stack
 
@@ -91,7 +91,7 @@ SYM_INNER_LABEL(__guest_exit_restore_elr_and_panic, SYM_L_GLOBAL)
 	ldr	x0, [x0, #CPU_ELR_EL2]
 	msr	elr_el2, x0
 
-SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
+SYM_INNER_LABEL(__hyp_panic, SYM_L_GLOBAL)
 	// x2-x29,lr: vcpu regs
 	// vcpu x0-x1 on the stack
 
@@ -109,7 +109,7 @@ SYM_INNER_LABEL(__guest_exit_panic, SYM_L_GLOBAL)
 	// accurate if the guest had been completely restored.
 	adr_this_cpu x0, kvm_hyp_ctxt, x1
 	adr_l	x1, hyp_panic
-	str	x1, [x0, #CPU_XREG_OFFSET(30)]
+	str	x1, [x0, #CPU_LR_OFFSET]
 
 	get_vcpu_ptr	x1, x0
 
diff --git a/arch/arm64/kvm/hyp/hyp-entry.S b/arch/arm64/kvm/hyp/hyp-entry.S
index 03f97d71984c..7e65ef738ec9 100644
--- a/arch/arm64/kvm/hyp/hyp-entry.S
+++ b/arch/arm64/kvm/hyp/hyp-entry.S
@@ -122,7 +122,7 @@ el2_error:
 	eret
 	sb
 
-.macro invalid_vector	label, target = __guest_exit_panic
+.macro invalid_vector	label, target = __hyp_panic
 	.align	2
 SYM_CODE_START_LOCAL(\label)
 	b \target
diff --git a/arch/arm64/kvm/hyp/include/hyp/switch.h b/arch/arm64/kvm/hyp/include/hyp/switch.h
index ed9a63f1f7bf..d9931abf14c2 100644
--- a/arch/arm64/kvm/hyp/include/hyp/switch.h
+++ b/arch/arm64/kvm/hyp/include/hyp/switch.h
@@ -689,7 +689,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
 
 static inline void __kvm_unexpected_el2_exception(void)
 {
-	extern char __guest_exit_restore_elr_and_panic[];
+	extern char __hyp_restore_elr_and_panic[];
 	unsigned long addr, fixup;
 	struct kvm_exception_table_entry *entry, *end;
 	unsigned long elr_el2 = read_sysreg(elr_el2);
@@ -712,7 +712,7 @@ static inline void __kvm_unexpected_el2_exception(void)
 
 	/* Trigger a panic after restoring the hyp context. */
 	this_cpu_ptr(&kvm_hyp_ctxt)->sys_regs[ELR_EL2] = elr_el2;
-	write_sysreg(__guest_exit_restore_elr_and_panic, elr_el2);
+	write_sysreg(__hyp_restore_elr_and_panic, elr_el2);
 }
 
 #endif /* __ARM64_KVM_HYP_SWITCH_H__ */
diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S
index bc0a73d9fcd0..a7db40a51e4a 100644
--- a/arch/arm64/kvm/hyp/nvhe/host.S
+++ b/arch/arm64/kvm/hyp/nvhe/host.S
@@ -214,7 +214,7 @@ SYM_FUNC_END(__host_hvc)
 .endm
 
 .macro host_el2_sync_vect
-	__host_el2_vect __guest_exit_panic
+	__host_el2_vect __hyp_panic
 .endm
 
 .macro invalid_host_el1_vect
@@ -227,7 +227,7 @@ SYM_FUNC_END(__host_hvc)
 .endm
 
 .macro invalid_host_el2_vect
-	__host_el2_vect __guest_exit_panic
+	__host_el2_vect __hyp_panic
 .endm
 
 /*
-- 
2.45.1.288.g0e0cd299f1-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2024-05-29 12:15 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 12:12 [PATCH v4 00/13] KVM: arm64: Add support for hypervisor kCFI Pierre-Clément Tosi
2024-05-29 12:12 ` [PATCH v4 01/13] KVM: arm64: Fix clobbered ELR in sync abort/SError Pierre-Clément Tosi
2024-06-03 14:05   ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 02/13] KVM: arm64: Fix __pkvm_init_switch_pgd call ABI Pierre-Clément Tosi
2024-06-03 14:22   ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 03/13] KVM: arm64: nVHE: Simplify __guest_exit_panic path Pierre-Clément Tosi
2024-06-03 14:30   ` Will Deacon
2024-06-04 15:48     ` Pierre-Clément Tosi
2024-06-05 16:02       ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 04/13] KVM: arm64: nVHE: Add EL2h sync exception handler Pierre-Clément Tosi
2024-06-03 14:32   ` Will Deacon
2024-05-29 12:12 ` Pierre-Clément Tosi [this message]
2024-06-03 14:34   ` [PATCH v4 05/13] KVM: arm64: Rename __guest_exit_panic __hyp_panic Will Deacon
2024-06-04 15:51     ` Pierre-Clément Tosi
2024-06-05 16:10       ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 06/13] KVM: arm64: nVHE: gen-hyprel: Skip R_AARCH64_ABS32 Pierre-Clément Tosi
2024-06-03 14:35   ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 07/13] KVM: arm64: VHE: Mark __hyp_call_panic __noreturn Pierre-Clément Tosi
2024-06-03 14:36   ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 08/13] arm64: Introduce esr_comment() & esr_is_cfi_brk() Pierre-Clément Tosi
2024-06-03 14:42   ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 09/13] KVM: arm64: Introduce print_nvhe_hyp_panic helper Pierre-Clément Tosi
2024-06-03 14:43   ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 10/13] KVM: arm64: nVHE: Support CONFIG_CFI_CLANG at EL2 Pierre-Clément Tosi
2024-06-03 14:45   ` Will Deacon
2024-06-04 16:04     ` Pierre-Clément Tosi
2024-06-05 16:11       ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 11/13] KVM: arm64: Improve CONFIG_CFI_CLANG error message Pierre-Clément Tosi
2024-06-03 14:48   ` Will Deacon
2024-06-04 16:05     ` Pierre-Clément Tosi
2024-06-06 16:22       ` Will Deacon
2024-05-29 12:12 ` [PATCH v4 12/13] KVM: arm64: VHE: Add test module for hyp kCFI Pierre-Clément Tosi
2024-05-29 12:12 ` [PATCH v4 13/13] KVM: arm64: nVHE: Support " Pierre-Clément Tosi
2024-06-03 13:59 ` [PATCH v4 00/13] KVM: arm64: Add support for hypervisor kCFI Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240529121251.1993135-6-ptosi@google.com \
    --to=ptosi@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=suzuki.poulose@arm.com \
    --cc=vdonnefort@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox