aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/hyp/nvhe/stacktrace.c
diff options
context:
space:
mode:
authorKalesh Singh <kaleshsingh@google.com>2022-07-26 00:37:46 -0700
committerMarc Zyngier <maz@kernel.org>2022-07-26 10:50:12 +0100
commit6928bcc84bc4bd9a24a1cb1986418c3de76e1d99 (patch)
tree998aa50f0f6d9954e2155c5ef20a2b19e46f25c3 /arch/arm64/kvm/hyp/nvhe/stacktrace.c
parentKVM: arm64: Add PROTECTED_NVHE_STACKTRACE Kconfig (diff)
downloadlinux-dev-6928bcc84bc4bd9a24a1cb1986418c3de76e1d99.tar.xz
linux-dev-6928bcc84bc4bd9a24a1cb1986418c3de76e1d99.zip
KVM: arm64: Allocate shared pKVM hyp stacktrace buffers
In protected nVHE mode the host cannot directly access hypervisor memory, so we will dump the hypervisor stacktrace to a shared buffer with the host. The minimum size for the buffer required, assuming the min frame size of [x29, x30] (2 * sizeof(long)), is half the combined size of the hypervisor and overflow stacks plus an additional entry to delimit the end of the stacktrace. The stacktrace buffers are used later in the series to dump the nVHE hypervisor stacktrace when using protected-mode. Signed-off-by: Kalesh Singh <kaleshsingh@google.com> Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220726073750.3219117-14-kaleshsingh@google.com
Diffstat (limited to 'arch/arm64/kvm/hyp/nvhe/stacktrace.c')
-rw-r--r--arch/arm64/kvm/hyp/nvhe/stacktrace.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/kvm/hyp/nvhe/stacktrace.c b/arch/arm64/kvm/hyp/nvhe/stacktrace.c
index b8a280aa026a..e2edda92a108 100644
--- a/arch/arm64/kvm/hyp/nvhe/stacktrace.c
+++ b/arch/arm64/kvm/hyp/nvhe/stacktrace.c
@@ -34,6 +34,10 @@ static void hyp_prepare_backtrace(unsigned long fp, unsigned long pc)
stacktrace_info->pc = pc;
}
+#ifdef CONFIG_PROTECTED_NVHE_STACKTRACE
+DEFINE_PER_CPU(unsigned long [NVHE_STACKTRACE_SIZE/sizeof(long)], pkvm_stacktrace);
+#endif /* CONFIG_PROTECTED_NVHE_STACKTRACE */
+
/*
* kvm_nvhe_prepare_backtrace - prepare to dump the nVHE backtrace
*