KVM: arm64: Add a silly hyp tracing event to blow the stack
We can use this to demo both the stack guard page handling and the
unwinder.
Signed-off-by: Will Deacon <will@kernel.org>
diff --git a/arch/arm64/include/asm/kvm_hypevents.h b/arch/arm64/include/asm/kvm_hypevents.h
index bbd1d04..af22feb 100644
--- a/arch/arm64/include/asm/kvm_hypevents.h
+++ b/arch/arm64/include/asm/kvm_hypevents.h
@@ -19,6 +19,7 @@
HYP_EVT_POP_MEMCACHE,
HYP_EVT_PUSH_MEMCACHE,
HYP_EVT_COALESCED_BLOCK,
+ HYP_DO_NOT_PRESS,
__NUM_HYP_EVENTS,
};
#endif
diff --git a/arch/arm64/kvm/hyp/nvhe/trace_events.c b/arch/arm64/kvm/hyp/nvhe/trace_events.c
index 6043a2b..aecdf78 100644
--- a/arch/arm64/kvm/hyp/nvhe/trace_events.c
+++ b/arch/arm64/kvm/hyp/nvhe/trace_events.c
@@ -33,6 +33,9 @@
if (err)
return err;
+ if (args->events & (1 << HYP_DO_NOT_PRESS))
+ asm volatile("sub sp, sp, #4096\n");
+
enable_hyp_events(args->events);
return __hyp_trace_rb_start(args);
diff --git a/arch/arm64/kvm/hyp_trace.c b/arch/arm64/kvm/hyp_trace.c
index cb48e5e9..1fe2de6 100644
--- a/arch/arm64/kvm/hyp_trace.c
+++ b/arch/arm64/kvm/hyp_trace.c
@@ -532,6 +532,8 @@
#define HYP_EVENT(__name, __id, __proto, __struct, __assign) \
debugfs_create_file(#__name, 0700, d, (void *)__id, &hyp_events_fops)
+ debugfs_create_file("do_not_press", 0700, d, (void *)HYP_DO_NOT_PRESS, &hyp_events_fops);
+
#include <asm/kvm_hypevents.h>
}