Debug info for nVHE hyp panics
cover Debug info for nVHE hyp panics
After being on the receiving end of an nVHE hyp panic and trying to figure out what is was trying to tell me, it seemed like a good excuse to add some debug info.
nVHE hyp has its own address space. Hyp VAs aren't much use for debugging but they can be converted into kimg addresses which are useful for looking up in vmlinux.
There are also a couple of invariant tests that call hyp_panic() but these would give the ELR_EL2 of the previous VM which isn't very meaningful. Converting these to use BUG() lets the correct hyp address be captured and the source file and line can even be logged!
This applied on top of the previous panic fix at
https://lore.kernel.org/r/[email protected]/
Andrew Scull (2):
KVM: arm64: Use BUG and BUG_ON in nVHE hyp
KVM: arm64: Log source when panicking from nVHE hyp
arch/arm64/include/asm/kvm_hyp.h | 1 - arch/arm64/include/asm/kvm_mmu.h | 2 ++ arch/arm64/kernel/image-vars.h | 3 +- arch/arm64/kvm/handle_exit.c | 38 +++++++++++++++++++++++++ arch/arm64/kvm/hyp/include/hyp/switch.h | 2 -- arch/arm64/kvm/hyp/nvhe/host.S | 18 ++++++------ arch/arm64/kvm/hyp/nvhe/hyp-main.c | 2 +- arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 6 ++-- arch/arm64/kvm/hyp/nvhe/psci-relay.c | 2 -- 9 files changed, 52 insertions(+), 22 deletions(-)
Signature · 6 lines
2.30.0.617.g56c4b15f3c-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH 1/2 KVM: arm64: Use BUG and BUG_ON in nVHE hyp
hyp_panic() reports the address of the panic by using ELR_EL2, but this isn't a useful address when hyp_panic() is called directly. Replace such direct calls with BUG() and BUG_ON() which use BRK to trigger and exception that then goes to hyp_panic() with the correct address. Also remove the hyp_panic() declaration from the header file to avoid accidental misuse.
--- arch/arm64/include/asm/kvm_hyp.h | 1 - arch/arm64/kvm/hyp/nvhe/hyp-main.c | 2 +- arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-)
arch/arm64/include/asm/kvm_hyp.h +0 -1
@@ -95,7 +95,6 @@ u64 __guest_enter(struct kvm_vcpu *vcpu);bool kvm_host_psci_handler (struct kvm_cpu_context *host_ctxt); -void __noreturn hyp_panic (void );#ifdef __KVM_NVHE_HYPERVISOR__void __noreturn __hyp_do_panic (struct kvm_cpu_context *host_ctxt,u64 spsr,u64 elr,u64 par);
arch/arm64/kvm/hyp/nvhe/hyp-main.c +1 -1
@@ -181,6 +181,6 @@ void handle_trap(struct kvm_cpu_context *host_ctxt)handle_host_smc (host_ctxt);break ;default : -hyp_panic (); +BUG (); } }
arch/arm64/kvm/hyp/nvhe/hyp-smp.c +2 -4
@@ -18,8 +18,7 @@ u64 __ro_after_init hyp_cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALIDu64 cpu_logical_map (unsigned int cpu) { -if (cpu >=ARRAY_SIZE (hyp_cpu_logical_map)) -hyp_panic (); +BUG_ON (cpu >=ARRAY_SIZE (hyp_cpu_logical_map));return hyp_cpu_logical_map[cpu]; }
@@ -30,8 +29,7 @@ unsigned long __hyp_per_cpu_offset(unsigned int cpu)unsigned long this_cpu_base;unsigned long elf_base; -if (cpu >=ARRAY_SIZE (kvm_arm_hyp_percpu_base)) -hyp_panic (); +BUG_ON (cpu >=ARRAY_SIZE (kvm_arm_hyp_percpu_base)); cpu_base_array = (unsigned long *)hyp_symbol_addr (kvm_arm_hyp_percpu_base); this_cpu_base =kern_hyp_va (cpu_base_array[cpu]);
Signature · 6 lines
2.30.0.617.g56c4b15f3c-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH 2/2 KVM: arm64: Log source when panicking from nVHE hyp
In reply to Andrew ScullTo aid with debugging, add details of the source of a panic. This is done by having nVHE hyp exit to nvhe_hyp_panic_handler() rather than directly to panic(). The handler will then add the extra details for debugging before panicking the kernel.
If the panic was due to a BUG(), look up the metadata to log the file and line, if available, otherwise log the kimg address that can be looked up in vmlinux.
--- arch/arm64/include/asm/kvm_mmu.h | 2 ++ arch/arm64/kernel/image-vars.h | 3 +- arch/arm64/kvm/handle_exit.c | 38 +++++++++++++++++++++++++ arch/arm64/kvm/hyp/include/hyp/switch.h | 2 -- arch/arm64/kvm/hyp/nvhe/host.S | 18 ++++++------ arch/arm64/kvm/hyp/nvhe/psci-relay.c | 2 -- 6 files changed, 49 insertions(+), 16 deletions(-)
arch/arm64/include/asm/kvm_mmu.h +2 -0
@@ -130,6 +130,8 @@ void kvm_update_va_mask(struct alt_instr *alt, __le32 *origptr, __le32 *updptr, int nr_inst);void kvm_compute_layout (void ); +#define __hyp_pa (x) ((phys_addr_t)((x)) + hyp_physvirt_offset) +static __always_inline unsigned long __kern_hyp_va (unsigned long v) { asm volatile(ALTERNATIVE_CB("and %0, %0, #1\n"
arch/arm64/kernel/image-vars.h +1 -2
@@ -71,8 +71,7 @@ KVM_NVHE_ALIAS(kvm_get_kimage_voffset);KVM_NVHE_ALIAS (kvm_vgic_global_state);/* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ -KVM_NVHE_ALIAS (__hyp_panic_string); -KVM_NVHE_ALIAS (panic); +KVM_NVHE_ALIAS (nvhe_hyp_panic_handler);/* Vectors installed by hyp-init on reset HVC. */ KVM_NVHE_ALIAS (__hyp_stub_vectors);
arch/arm64/kvm/handle_exit.c +38 -0
@@ -291,3 +291,41 @@ void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index)if (exception_index ==ARM_EXCEPTION_EL1_SERROR )kvm_handle_guest_serror (vcpu,kvm_vcpu_get_esr (vcpu)); } + +void __noreturn __cold nvhe_hyp_panic_handler (bool hyp,u64 spsr,u64 elr, +u64 par,uintptr_t vcpu, +u64 far,u64 hpfar,u64 esr) { +extern const char __hyp_panic_string[]; +u64 elr_in_kimg =__phys_to_kimg (__hyp_pa (elr)); + +if (!hyp) { +kvm_err ("Invalid host exception to nVHE hyp!\n" ); + }else if (ESR_ELx_EC (esr) == ESR_ELx_EC_BRK64 && + (esr & ESR_ELx_BRK64_ISS_COMMENT_MASK) ==BUG_BRK_IMM ) { +struct bug_entry *bug =find_bug (elr_in_kimg); +const char *file =NULL ; +unsigned line =0 ; + +/* All hyp bugs, including warnings, are treated as fatal. */ +if (bug) { +#ifdef CONFIG_DEBUG_BUGVERBOSE +#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS + file = bug->file; +#else + file = (const char *)bug + bug->file_disp; +#endif + line = bug->line; +#endif + } + +if (file) { +kvm_err ("nVHE hyp BUG at: %s:%u!\n" , file, line); + }else { +kvm_err ("nVHE hyp BUG at: %016llx!\n" , elr_in_kimg); + } + }else { +kvm_err ("nVHE hyp panic at: %016llx!\n" , elr_in_kimg); + } + +panic (__hyp_panic_string, spsr, elr, esr, far, hpfar, par, vcpu); +}
arch/arm64/kvm/hyp/include/hyp/switch.h +0 -2
@@ -30,8 +30,6 @@#include <asm/processor.h> #include <asm/thread_info.h> -extern const char __hyp_panic_string[]; -extern struct exception_table_entry __start___kvm_ex_table;extern struct exception_table_entry __stop___kvm_ex_table;
arch/arm64/kvm/hyp/nvhe/host.S +8 -10
@@ -77,21 +77,19 @@ SYM_FUNC_END(__host_enter) SYM_FUNC_START(__hyp_do_panic) mov x29, x0 - /* Load the format string into x0 and arguments into x1-7 */ - ldr x0, =__hyp_panic_string - - mov x6, x3 - get_vcpu_ptr x7, x3 - - mrs x3, esr_el2 - mrs x4, far_el2 - mrs x5, hpfar_el2 + /* Load the panic arguments into x0-7 */ + cmp x0, xzr + cset x0, ne + get_vcpu_ptr x4, x5 + mrs x5, far_el2 + mrs x6, hpfar_el2 + mrs x7, esr_el2 /* Prepare and exit to the host's panic funciton. */ mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\ PSR_MODE_EL1h) msr spsr_el2, lr - ldr lr, =panic + ldr lr, =nvhe_hyp_panic_handler msr elr_el2, lr /* Enter the host, restoring the host context if it was provided. */
arch/arm64/kvm/hyp/nvhe/psci-relay.c +0 -2
@@ -22,8 +22,6 @@ void __noreturn __host_enter(struct kvm_cpu_context *host_ctxt);struct kvm_host_psci_config __ro_after_init kvm_host_psci_config;s64 __ro_after_init hyp_physvirt_offset; -#define __hyp_pa (x) ((phys_addr_t)((x)) + hyp_physvirt_offset) -#define INVALID_CPU_ID UINT_MAXstruct psci_boot_args {
Signature · 6 lines
2.30.0.617.g56c4b15f3c-goog _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerRe: [PATCH 2/2] KVM: arm64: Log source when panicking from nVHE hyp
Hi Andrew,
Quoted 52 lines · Andrew Scull
To aid with debugging, add details of the source of a panic. This is done by having nVHE hyp exit to
nvhe_hyp_panic_handler()rather than directly topanic(). The handler will then add the extra details for debugging before panicking the kernel.If the panic was due to a
BUG(), look up the metadata to log the file and line, if available, otherwise log the kimg address that can be looked up in vmlinux.Signed-off-by Andrew Scull <[email protected]>--- arch/arm64/include/asm/kvm_mmu.h | 2 ++ arch/arm64/kernel/image-vars.h | 3 +- arch/arm64/kvm/handle_exit.c | 38 +++++++++++++++++++++++++ arch/arm64/kvm/hyp/include/hyp/switch.h | 2 -- arch/arm64/kvm/hyp/nvhe/host.S | 18 ++++++------ arch/arm64/kvm/hyp/nvhe/psci-relay.c | 2 -- 6 files changed, 49 insertions(+), 16 deletions(-)arch/arm64/include/asm/kvm_mmu.h +2
-0@@ -130,6 +130,8 @@ void kvm_update_va_mask(struct alt_instr *alt, __le32 *origptr, __le32 *updptr, int nr_inst);void kvm_compute_layout (void ); +#define __hyp_pa (x) ((phys_addr_t)((x)) + hyp_physvirt_offset) +static __always_inline unsigned long __kern_hyp_va (unsigned long v) { asm volatile(ALTERNATIVE_CB("and %0, %0, #1\n"arch/arm64/kernel/image-vars.h +1
-2@@ -71,8 +71,7 @@ KVM_NVHE_ALIAS(kvm_get_kimage_voffset);KVM_NVHE_ALIAS (kvm_vgic_global_state);/* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ -KVM_NVHE_ALIAS (__hyp_panic_string); -KVM_NVHE_ALIAS (panic); +KVM_NVHE_ALIAS (nvhe_hyp_panic_handler);/* Vectors installed by hyp-init on reset HVC. */ KVM_NVHE_ALIAS (__hyp_stub_vectors);arch/arm64/kvm/handle_exit.c +0
-0
arch/arm64/kvm/handle_exit.c void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index) · line 298
Quoted 8 lines
arch/arm64/kvm/handle_exit.c +5
-0@@ -291,3 +291,41 @@ void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index)if (exception_index ==ARM_EXCEPTION_EL1_SERROR )kvm_handle_guest_serror (vcpu,kvm_vcpu_get_esr (vcpu)); } + +void __noreturn __cold nvhe_hyp_panic_handler (bool hyp,u64 spsr,u64 elr, +u64 par,uintptr_t vcpu, +u64 far,u64 hpfar,u64 esr) { +extern const char __hyp_panic_string[];
Is there any reason left to not to make this a symbol at all, but instead to feed the string to the panic() call below?
arch/arm64/kvm/handle_exit.c void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index) · line 302
Quoted 4 lines
arch/arm64/kvm/handle_exit.c +4
-0+u64 elr_in_kimg =__phys_to_kimg (__hyp_pa (elr)); + +if (!hyp) { +kvm_err ("Invalid host exception to nVHE hyp!\n" );
Do we need to have hyp as a parameter? Can't we work that out from the SPSR passed as a parameter?
Quoted 6 lines
arch/arm64/kvm/handle_exit.c +6
-0+ }else if (ESR_ELx_EC (esr) == ESR_ELx_EC_BRK64 && + (esr & ESR_ELx_BRK64_ISS_COMMENT_MASK) ==BUG_BRK_IMM ) { +struct bug_entry *bug =find_bug (elr_in_kimg); +const char *file =NULL ; +unsigned line =0 ; +
arch/arm64/kvm/handle_exit.c void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index) · line 318
Quoted 10 lines
arch/arm64/kvm/handle_exit.c +10
-0+/* All hyp bugs, including warnings, are treated as fatal. */ +if (bug) { +#ifdef CONFIG_DEBUG_BUGVERBOSE +#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS + file = bug->file; +#else + file = (const char *)bug + bug->file_disp; +#endif + line = bug->line; +#endif
It looks like you have lifted this from lib/bugs.c. Would it be worth making it a helper that lives there? Something like
struct bug_entry *bug_get_entry(unsigned long pc, char **file,
unsigned int *line);
that hides the #ifdefery and the fund_bug() call away? The disable_trace_on_warning() call isn't a problem, as we're about to die anyway.
Quoted 77 lines
arch/arm64/kvm/handle_exit.c +13
-0+ } + +if (file) { +kvm_err ("nVHE hyp BUG at: %s:%u!\n" , file, line); + }else { +kvm_err ("nVHE hyp BUG at: %016llx!\n" , elr_in_kimg); + } + }else { +kvm_err ("nVHE hyp panic at: %016llx!\n" , elr_in_kimg); + } + +panic (__hyp_panic_string, spsr, elr, esr, far, hpfar, par, vcpu); +}arch/arm64/kvm/hyp/include/hyp/switch.h +0
-2@@ -30,8 +30,6 @@#include <asm/processor.h> #include <asm/thread_info.h> -extern const char __hyp_panic_string[]; -extern struct exception_table_entry __start___kvm_ex_table;extern struct exception_table_entry __stop___kvm_ex_table;arch/arm64/kvm/hyp/nvhe/host.S +8
-10@@ -77,21 +77,19 @@ SYM_FUNC_END(__host_enter) SYM_FUNC_START(__hyp_do_panic) mov x29, x0 - /* Load the format string into x0 and arguments into x1-7 */ - ldr x0, =__hyp_panic_string - - mov x6, x3 - get_vcpu_ptr x7, x3 - - mrs x3, esr_el2 - mrs x4, far_el2 - mrs x5, hpfar_el2 + /* Load the panic arguments into x0-7 */ + cmp x0, xzr + cset x0, ne + get_vcpu_ptr x4, x5 + mrs x5, far_el2 + mrs x6, hpfar_el2 + mrs x7, esr_el2 /* Prepare and exit to the host's panic funciton. */ mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\ PSR_MODE_EL1h) msr spsr_el2, lr - ldr lr, =panic + ldr lr, =nvhe_hyp_panic_handler msr elr_el2, lr /* Enter the host, restoring the host context if it was provided. */arch/arm64/kvm/hyp/nvhe/psci-relay.c +0
-2@@ -22,8 +22,6 @@ void __noreturn __host_enter(struct kvm_cpu_context *host_ctxt);struct kvm_host_psci_config __ro_after_init kvm_host_psci_config;s64 __ro_after_init hyp_physvirt_offset; -#define __hyp_pa (x) ((phys_addr_t)((x)) + hyp_physvirt_offset) -#define INVALID_CPU_ID UINT_MAXstruct psci_boot_args {Signature · 1 line
2.30.0.617.g56c4b15f3c-goog
Otherwise, I like the idea!
Thanks,
M.
Signature · 5 lines
Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH 2/2] KVM: arm64: Log source when panicking from nVHE hyp
Quoted 59 lines · Marc Zyngier
Hi Andrew,
Quoted 55 lines · Andrew Scull
To aid with debugging, add details of the source of a panic. This is done by having nVHE hyp exit to
nvhe_hyp_panic_handler()rather than directly topanic(). The handler will then add the extra details for debugging before panicking the kernel.If the panic was due to a
BUG(), look up the metadata to log the file and line, if available, otherwise log the kimg address that can be looked up in vmlinux.Signed-off-by Andrew Scull <[email protected]>--- arch/arm64/include/asm/kvm_mmu.h | 2 ++ arch/arm64/kernel/image-vars.h | 3 +- arch/arm64/kvm/handle_exit.c | 38 +++++++++++++++++++++++++ arch/arm64/kvm/hyp/include/hyp/switch.h | 2 -- arch/arm64/kvm/hyp/nvhe/host.S | 18 ++++++------ arch/arm64/kvm/hyp/nvhe/psci-relay.c | 2 -- 6 files changed, 49 insertions(+), 16 deletions(-)arch/arm64/include/asm/kvm_mmu.h +2
-0@@ -130,6 +130,8 @@ void kvm_update_va_mask(struct alt_instr *alt, __le32 *origptr, __le32 *updptr, int nr_inst);void kvm_compute_layout (void ); +#define __hyp_pa (x) ((phys_addr_t)((x)) + hyp_physvirt_offset) +static __always_inline unsigned long __kern_hyp_va (unsigned long v) { asm volatile(ALTERNATIVE_CB("and %0, %0, #1\n"arch/arm64/kernel/image-vars.h +1
-2@@ -71,8 +71,7 @@ KVM_NVHE_ALIAS(kvm_get_kimage_voffset);KVM_NVHE_ALIAS (kvm_vgic_global_state);/* Kernel symbols used to call panic() from nVHE hyp code (via ERET). */ -KVM_NVHE_ALIAS (__hyp_panic_string); -KVM_NVHE_ALIAS (panic); +KVM_NVHE_ALIAS (nvhe_hyp_panic_handler);/* Vectors installed by hyp-init on reset HVC. */ KVM_NVHE_ALIAS (__hyp_stub_vectors);arch/arm64/kvm/handle_exit.c +0
-0@@ -291,3 +291,41 @@ void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index)if (exception_index ==ARM_EXCEPTION_EL1_SERROR )kvm_handle_guest_serror (vcpu,kvm_vcpu_get_esr (vcpu)); }
Quoted 8 lines
arch/arm64/kvm/handle_exit.c void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index) · line 298
Quoted 5 lines
arch/arm64/kvm/handle_exit.c +5
-0+ +void __noreturn __cold nvhe_hyp_panic_handler (bool hyp,u64 spsr,u64 elr, +u64 par,uintptr_t vcpu, +u64 far,u64 hpfar,u64 esr) { +extern const char __hyp_panic_string[];Is there any reason left to not to make this a symbol at all, but instead to feed the string to the
panic()call below?
No, none. I guess it was only a symbol so nVHE hyp could point at it and doesn't matter any more. There doesn't seem to be a good reason for VHE and nVHE to have the same panic string.
Quoted 7 lines
arch/arm64/kvm/handle_exit.c void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index) · line 302
Quoted 4 lines
arch/arm64/kvm/handle_exit.c +4
-0+u64 elr_in_kimg =__phys_to_kimg (__hyp_pa (elr)); + +if (!hyp) { +kvm_err ("Invalid host exception to nVHE hyp!\n" );Do we need to have hyp as a parameter? Can't we work that out from the SPSR passed as a parameter?
You're right, that should have some useful information already. Didn't occur to me before, I'll play with it.
Quoted 10 lines
Quoted 10 lines
arch/arm64/kvm/handle_exit.c +10
-0+ }else if (ESR_ELx_EC (esr) == ESR_ELx_EC_BRK64 && + (esr & ESR_ELx_BRK64_ISS_COMMENT_MASK) ==BUG_BRK_IMM ) { +struct bug_entry *bug =find_bug (elr_in_kimg); +const char *file =NULL ; +unsigned line =0 ; + +/* All hyp bugs, including warnings, are treated as fatal. */ +if (bug) { +#ifdef CONFIG_DEBUG_BUGVERBOSE +#ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
Quoted 8 lines
arch/arm64/kvm/handle_exit.c void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index) · line 318
Quoted 6 lines
arch/arm64/kvm/handle_exit.c +6
-0+ file = bug->file; +#else + file = (const char *)bug + bug->file_disp; +#endif + line = bug->line; +#endif It looks like you have lifted this from
lib/bugs.c.
Bingo!
Quoted 9 lines
Would it be worth
making it a helper that lives there? Something likestruct
bug_entry*bug_get_entry(unsigned long pc, char **file,unsigned int *line);that hides the #ifdefery and the
fund_bug()call away? Thedisable_trace_on_warning()call isn't a problem, as we're about to die anyway.
Yeah, that'd make a lot of sense. Please protect me from the wrath of the community when I touch the common code..
Quoted 80 lines
Quoted 77 lines
arch/arm64/kvm/handle_exit.c +13
-0+ } + +if (file) { +kvm_err ("nVHE hyp BUG at: %s:%u!\n" , file, line); + }else { +kvm_err ("nVHE hyp BUG at: %016llx!\n" , elr_in_kimg); + } + }else { +kvm_err ("nVHE hyp panic at: %016llx!\n" , elr_in_kimg); + } + +panic (__hyp_panic_string, spsr, elr, esr, far, hpfar, par, vcpu); +}arch/arm64/kvm/hyp/include/hyp/switch.h +0
-2@@ -30,8 +30,6 @@#include <asm/processor.h> #include <asm/thread_info.h> -extern const char __hyp_panic_string[]; -extern struct exception_table_entry __start___kvm_ex_table;extern struct exception_table_entry __stop___kvm_ex_table;arch/arm64/kvm/hyp/nvhe/host.S +8
-10@@ -77,21 +77,19 @@ SYM_FUNC_END(__host_enter) SYM_FUNC_START(__hyp_do_panic) mov x29, x0 - /* Load the format string into x0 and arguments into x1-7 */ - ldr x0, =__hyp_panic_string - - mov x6, x3 - get_vcpu_ptr x7, x3 - - mrs x3, esr_el2 - mrs x4, far_el2 - mrs x5, hpfar_el2 + /* Load the panic arguments into x0-7 */ + cmp x0, xzr + cset x0, ne + get_vcpu_ptr x4, x5 + mrs x5, far_el2 + mrs x6, hpfar_el2 + mrs x7, esr_el2 /* Prepare and exit to the host's panic funciton. */ mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\ PSR_MODE_EL1h) msr spsr_el2, lr - ldr lr, =panic + ldr lr, =nvhe_hyp_panic_handler msr elr_el2, lr /* Enter the host, restoring the host context if it was provided. */arch/arm64/kvm/hyp/nvhe/psci-relay.c +0
-2@@ -22,8 +22,6 @@ void __noreturn __host_enter(struct kvm_cpu_context *host_ctxt);struct kvm_host_psci_config __ro_after_init kvm_host_psci_config;s64 __ro_after_init hyp_physvirt_offset; -#define __hyp_pa (x) ((phys_addr_t)((x)) + hyp_physvirt_offset) -#define INVALID_CPU_ID UINT_MAXstruct psci_boot_args {Signature · 1 line
2.30.0.617.g56c4b15f3c-googOtherwise, I like the idea!
Quoted 6 lines
Thanks,
M.Signature · 1 line
Without deviation from the norm, progress is not possible.
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerRe: [PATCH 2/2] KVM: arm64: Log source when panicking from nVHE hyp
Quoted 2 lines · Andrew Scull
On Tue, Feb 23, 2021 at 11:29:54AM +0000, Marc Zyngier wrote:
[...]
Quoted 6 lines
Quoted 6 lines
Would it be worth making it a helper that lives there? Something like
struct
bug_entry*bug_get_entry(unsigned long pc, char **file,unsigned int *line);
Quoted 6 lines
Quoted 3 lines
that hides the #ifdefery and the
fund_bug()call away? Thedisable_trace_on_warning()call isn't a problem, as we're about to die anyway.Yeah, that'd make a lot of sense. Please protect me from the wrath of the community when I touch the common code..
The community should be pleased if you gifted it with a piece of reusable code instead of some less palatable copy-paste! :-)
M.
Signature · 5 lines
Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm