ANDROID: gunyah: vcpu_mgr: Add trace_hooks in the gunyah_vcpu driver

As QTVMs use Gunyah emulated watchdog instead of vcpu_stall detector,
provide trace_hooks to manage the watchdog of the QTVM.

Bug: 399219478
Change-Id: I6ec8a0236835dcc20c66681a747eae09c0c1a32d
Signed-off-by: Prakruthi Deepak Heragu <quic_pheragu@quicinc.com>
This commit is contained in:
Prakruthi Deepak Heragu
2025-02-24 15:02:59 -08:00
committed by Todd Kjos
parent 8f5870302b
commit b41a7537a4
3 changed files with 31 additions and 0 deletions
+3
View File
@@ -39,6 +39,7 @@
#include <trace/hooks/syscall_check.h>
#include <trace/hooks/gic.h>
#include <trace/hooks/gic_v3.h>
#include <trace/hooks/gunyah.h>
#include <trace/hooks/remoteproc.h>
#include <trace/hooks/reboot.h>
#include <trace/hooks/psci.h>
@@ -160,6 +161,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_enter);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpufreq_transition);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_gic_v3_set_affinity);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_gh_before_vcpu_run);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_gh_after_vcpu_run);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction_finish);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_select_special_worklist);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sync_txn_recvd);
+8
View File
@@ -16,6 +16,7 @@
#include "vm_mgr.h"
#include <uapi/linux/gunyah.h>
#include <trace/hooks/gunyah.h>
#define MAX_VCPU_NAME 20 /* gh-vcpu:strlen(U32::MAX)+NUL */
@@ -259,6 +260,7 @@ static int gunyah_vcpu_run(struct gunyah_vcpu *vcpu)
unsigned long resume_data[3] = { 0 };
enum gunyah_error gunyah_error;
int ret = 0;
u32 vcpu_id;
if (!vcpu->f)
return -ENODEV;
@@ -271,6 +273,7 @@ static int gunyah_vcpu_run(struct gunyah_vcpu *vcpu)
goto out;
}
vcpu_id = vcpu->ticket.label;
switch (vcpu->state) {
case GUNYAH_VCPU_RUN_STATE_UNKNOWN:
if (vcpu->ghvm->vm_status != GUNYAH_RM_VM_STATUS_RUNNING) {
@@ -308,10 +311,15 @@ static int gunyah_vcpu_run(struct gunyah_vcpu *vcpu)
goto out;
}
trace_android_rvh_gh_before_vcpu_run(vcpu->ghvm->vmid, vcpu_id);
gh_guest_accounting_enter();
gunyah_error = gunyah_hypercall_vcpu_run(
vcpu->rsc->capid, resume_data, &vcpu_run_resp);
gh_guest_accounting_exit();
trace_android_rvh_gh_after_vcpu_run(vcpu->ghvm->vmid,
vcpu_id, gunyah_error,
(const struct gunyah_hypercall_vcpu_run_resp *)&vcpu_run_resp);
if (gunyah_error == GUNYAH_ERROR_OK) {
memset(resume_data, 0, sizeof(resume_data));
switch (vcpu_run_resp.state) {
+20
View File
@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM gunyah
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_GUNYAH_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_GUNYAH_H
#include <trace/hooks/vendor_hooks.h>
struct gunyah_hypercall_vcpu_run_resp;
DECLARE_RESTRICTED_HOOK(android_rvh_gh_before_vcpu_run,
TP_PROTO(u16 vmid, u32 vcpu_id),
TP_ARGS(vmid, vcpu_id), 1);
DECLARE_RESTRICTED_HOOK(android_rvh_gh_after_vcpu_run,
TP_PROTO(u16 vmid, u32 vcpu_id, int hcall_ret,
const struct gunyah_hypercall_vcpu_run_resp *resp),
TP_ARGS(vmid, vcpu_id, hcall_ret, resp), 1);
#endif /* _TRACE_HOOK_GUNYAH_H */
/* This part must be outside protection */
#include <trace/define_trace.h>