Using new-style return values for spci_yield.
Bug: 132395846
Change-Id: I6af4343c3f84e90e1fee608988585e9eaf2ee6d4
diff --git a/src/api.c b/src/api.c
index a605ac4..b803cf5 100644
--- a/src/api.c
+++ b/src/api.c
@@ -149,23 +149,20 @@
/**
* Returns to the primary vm to allow this cpu to be used for other tasks as the
* vcpu does not have work to do at this moment. The current vcpu is marked as
- * ready to be scheduled again. This SPCI function always returns SPCI_SUCCESS.
+ * ready to be scheduled again.
*/
-int32_t api_spci_yield(struct vcpu *current, struct vcpu **next)
+void api_yield(struct vcpu *current, struct vcpu **next)
{
- struct hf_vcpu_run_return ret = {
+ struct hf_vcpu_run_return primary_ret = {
.code = HF_VCPU_RUN_YIELD,
};
if (current->vm->id == HF_PRIMARY_VM_ID) {
/* Noop on the primary as it makes the scheduling decisions. */
- return SPCI_SUCCESS;
+ return;
}
- *next = api_switch_to_primary(current, ret, VCPU_STATE_READY);
-
- /* SPCI_YIELD always returns SPCI_SUCCESS. */
- return SPCI_SUCCESS;
+ *next = api_switch_to_primary(current, primary_ret, VCPU_STATE_READY);
}
/**
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
index 154610a..440cd66 100644
--- a/src/arch/aarch64/hypervisor/handler.c
+++ b/src/arch/aarch64/hypervisor/handler.c
@@ -310,7 +310,11 @@
*args = api_spci_version();
return true;
case SPCI_YIELD_32:
- args->func = api_spci_yield(current(), next);
+ api_yield(current(), next);
+
+ /* SPCI_YIELD always returns SPCI_SUCCESS. */
+ *args = (struct spci_value){.func = SPCI_SUCCESS_32};
+
return true;
case SPCI_MSG_SEND_32:
args->func = api_spci_msg_send(args->arg1, current(), next);
@@ -552,7 +556,7 @@
* TODO: consider giving the scheduler more context,
* somehow.
*/
- api_spci_yield(vcpu, &new_vcpu);
+ api_yield(vcpu, &new_vcpu);
return new_vcpu;
}
/* WFI */