[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220726073750.3219117-15-kaleshsingh@google.com>
Date: Tue, 26 Jul 2022 00:37:47 -0700
From: Kalesh Singh <kaleshsingh@...gle.com>
To: maz@...nel.org, mark.rutland@....com, broonie@...nel.org,
madvenka@...ux.microsoft.com, tabba@...gle.com,
oliver.upton@...ux.dev
Cc: will@...nel.org, qperret@...gle.com, kaleshsingh@...gle.com,
james.morse@....com, alexandru.elisei@....com,
suzuki.poulose@....com, catalin.marinas@....com,
andreyknvl@...il.com, vincenzo.frascino@....com,
mhiramat@...nel.org, ast@...nel.org, wangkefeng.wang@...wei.com,
elver@...gle.com, keirf@...gle.com, yuzenghui@...wei.com,
ardb@...nel.org, oupton@...gle.com,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-kernel@...r.kernel.org, android-mm@...gle.com,
kernel-team@...roid.com
Subject: [PATCH v6 14/17] KVM: arm64: Stub implementation of pKVM HYP stack unwinder
Add some stub implementations of protected nVHE stack unwinder, for
building. These are implemented later in this series.
Signed-off-by: Kalesh Singh <kaleshsingh@...gle.com>
Reviewed-by: Fuad Tabba <tabba@...gle.com>
Tested-by: Fuad Tabba <tabba@...gle.com>
---
Changes in v6:
- Add Fuad’s Reviewed-by and Tested-by tags
Changes in v5:
- Mark unwind_next() as inline, per Marc
arch/arm64/include/asm/stacktrace/nvhe.h | 35 ++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/include/asm/stacktrace/nvhe.h b/arch/arm64/include/asm/stacktrace/nvhe.h
index 170fe7459f7c..2ce59c058806 100644
--- a/arch/arm64/include/asm/stacktrace/nvhe.h
+++ b/arch/arm64/include/asm/stacktrace/nvhe.h
@@ -9,6 +9,10 @@
* to allocate shared buffers for the host to read the unwinded
* stacktrace.
*
+ * 2) pKVM (protected nVHE) mode - the host cannot directly access
+ * the HYP memory. The stack is unwinded in EL2 and dumped to a shared
+ * buffer where the host can read and print the stacktrace.
+ *
* Copyright (C) 2022 Google LLC
*/
#ifndef __ASM_STACKTRACE_NVHE_H
@@ -49,7 +53,34 @@ static inline bool on_accessible_stack(const struct task_struct *tsk,
return false;
}
-#ifndef __KVM_NVHE_HYPERVISOR__
+#ifdef __KVM_NVHE_HYPERVISOR__
+/*
+ * Protected nVHE HYP stack unwinder
+ *
+ * In protected mode, the unwinding is done by the hypervisor in EL2.
+ */
+
+#ifdef CONFIG_PROTECTED_NVHE_STACKTRACE
+static inline bool on_overflow_stack(unsigned long sp, unsigned long size,
+ struct stack_info *info)
+{
+ return false;
+}
+
+static inline bool on_hyp_stack(unsigned long sp, unsigned long size,
+ struct stack_info *info)
+{
+ return false;
+}
+
+static inline int notrace unwind_next(struct unwind_state *state)
+{
+ return 0;
+}
+NOKPROBE_SYMBOL(unwind_next);
+#endif /* CONFIG_PROTECTED_NVHE_STACKTRACE */
+
+#else /* !__KVM_NVHE_HYPERVISOR__ */
/*
* Conventional (non-protected) nVHE HYP stack unwinder
*
@@ -132,5 +163,5 @@ static inline int notrace unwind_next(struct unwind_state *state)
}
NOKPROBE_SYMBOL(unwind_next);
-#endif /* !__KVM_NVHE_HYPERVISOR__ */
+#endif /* __KVM_NVHE_HYPERVISOR__ */
#endif /* __ASM_STACKTRACE_NVHE_H */
--
2.37.1.359.gd136c6c3e2-goog
Powered by blists - more mailing lists