Commit 4c095252 authored by Vincent Donnefort's avatar Vincent Donnefort
Browse files

ANDROID: KVM: arm64: Add tracing support for the nVHE hyp



Running at EL2, the host has very close to no way to know what's
happening in the hypervisor, which is great from a security point of
view, a bit less when it turns to debug it. With the introduction of the
protected mode, this piece of code is getting more responsibilities,
which we would like to debug and profile, hence the need to trace
"things" that are happening in the hypervisor.

There's no way the hypervisor could log things directly into the host
tracing interface. So instead let's use a separated per-CPU ring buffer
compliant with the host so the latter can decode the events.

The tracing interface is composed of 4 HVCs:

 __pkvm_start_tracing: Gets a hyp_trace_pack describing the ring
buffers, the backing storage that'll support the internal structures and
some clock init values.

 __pkvm_stop_tracing: Disable writing to the ring buffers and teardown.

 __pkvm_rb_swap_reader_page: Request the writer to swap the head with
the reader page. This enables consuming read of the read buffer. See
kernel/ring_buffer.c (*ext_writer_swap_reader)() callback.

 __pkvm_rb_update_footers: Request the writer to update the pages
footers.  Those informations are then used to update the reader view on
the ring buffer. See kernel/ring_buffer.c (*ext_writer_update_footers)()
callback.

Bug: 229972309
Change-Id: I0e32223795de435aee8546af368672f0e67637b3
Signed-off-by: default avatarVincent Donnefort <vdonnefort@google.com>
parent 022b2198
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment