On 17/6/25 18:33, Alex Bennée wrote:
For now just deal with the basic version probe we see during startup.
Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
---
target/arm/kvm.c | 44 +++++++++++++++++++++++++++++++++++++++++
target/arm/trace-events | 1 +
2 files changed, 45 insertions(+)
+/*
+ * The guest is making a hypercall or firmware call. We can handle a
+ * limited number of them (e.g. PSCI) but we can't emulate a true
+ * firmware. This is an abbreviated version of
+ * kvm_smccc_call_handler() in the kernel and the TCG only
arm_handle_psci_call().
+ *
+ * In the SplitAccel case we would be transitioning to execute EL2+
+ * under TCG.
+ */
+static int kvm_arm_handle_hypercall(ARMCPU *cpu,
+ int esr_ec)
+{
+ CPUARMState *env = &cpu->env;
+ int32_t ret = 0;
+
+ trace_kvm_hypercall(esr_ec, env->xregs[0]);
+
Should we make arm_is_psci_call() generic to be able to use it here?
+ switch (env->xregs[0]) {
+ case QEMU_PSCI_0_2_FN_PSCI_VERSION:
+ ret = QEMU_PSCI_VERSION_1_1;
+ break;
+ case QEMU_PSCI_0_2_FN_MIGRATE_INFO_TYPE:
+ ret = QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED; /* No trusted OS */
+ break;
+ case QEMU_PSCI_1_0_FN_PSCI_FEATURES:
+ ret = QEMU_PSCI_RET_NOT_SUPPORTED;
+ break;
+ default:
+ qemu_log_mask(LOG_UNIMP, "%s: unhandled hypercall %"PRIx64"\n",
+ __func__, env->xregs[0]);
+ return -1;
+ }
+
+ env->xregs[0] = ret;
+ return 0;
+}