Add HVC/SMC call for debug logging.
Bug: 115484857
Change-Id: I253adf03ebde97d4b620be9d3f2cc05f5265f45d
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index d84f7f1..c8e2d90 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -247,6 +247,23 @@
write_msr(hcr_el2, hcr_el2);
}
+static bool smc_handler(struct vcpu *vcpu, uint32_t func, uintreg_t arg0,
+ uintreg_t arg1, uintreg_t arg2, uintreg_t *ret,
+ struct vcpu **next)
+{
+ if (psci_handler(vcpu, func, arg0, arg1, arg2, ret, next)) {
+ return true;
+ }
+
+ switch (func & ~SMCCC_CONVENTION_MASK) {
+ case HF_DEBUG_LOG:
+ *ret = api_debug_log(arg0, vcpu);
+ return true;
+ }
+
+ return false;
+}
+
struct hvc_handler_return hvc_handler(uintreg_t arg0, uintreg_t arg1,
uintreg_t arg2, uintreg_t arg3)
{
@@ -329,6 +346,10 @@
arg1 & 0xffffffff, current());
break;
+ case HF_DEBUG_LOG:
+ ret.user_ret = api_debug_log(arg1, current());
+ break;
+
default:
ret.user_ret = -1;
}
@@ -453,9 +474,9 @@
uintreg_t ret;
struct vcpu *next = NULL;
- if (!psci_handler(vcpu, vcpu->regs.r[0], vcpu->regs.r[1],
- vcpu->regs.r[2], vcpu->regs.r[3], &ret,
- &next)) {
+ if (!smc_handler(vcpu, vcpu->regs.r[0], vcpu->regs.r[1],
+ vcpu->regs.r[2], vcpu->regs.r[3], &ret,
+ &next)) {
dlog("Unsupported SMC call: 0x%x\n", vcpu->regs.r[0]);
ret = PSCI_ERROR_NOT_SUPPORTED;
}