Encode run return values in an SPCI compatible way.
Bug: 141469322
Change-Id: I269a7797b72e1e7d36c153cd41050584db8415b3
diff --git a/src/api.c b/src/api.c
index d009538..f20dc19 100644
--- a/src/api.c
+++ b/src/api.c
@@ -62,8 +62,7 @@
* Switches the physical CPU back to the corresponding vcpu of the primary VM.
*
* This triggers the scheduling logic to run. Run in the context of secondary VM
- * to cause HF_VCPU_RUN to return and the primary VM to regain control of the
- * cpu.
+ * to cause SPCI_RUN to return and the primary VM to regain control of the CPU.
*/
static struct vcpu *api_switch_to_primary(struct vcpu *current,
struct hf_vcpu_run_return primary_ret,
@@ -91,10 +90,9 @@
}
/* Set the return value for the primary VM's call to HF_VCPU_RUN. */
- arch_regs_set_retval(
- &next->regs,
- (struct spci_value){
- .func = hf_vcpu_run_return_encode(primary_ret)});
+ arch_regs_set_retval(&next->regs, hf_vcpu_run_return_encode(
+ primary_ret, current->vm->id,
+ vcpu_index(current)));
/* Mark the current vcpu as waiting. */
sl_lock(¤t->lock);