Differentiate preemption from yielding.
Yielding is voluntary and indicates something else should be given the
chance to run. Preemption is involuntary and indicates the vCPU still
wants to run.
Change-Id: I9ba2445c3d67ea140bf33005a08084b29457e42f
diff --git a/inc/vmapi/hf/abi.h b/inc/vmapi/hf/abi.h
index 218d4ee..2e4ec7b 100644
--- a/inc/vmapi/hf/abi.h
+++ b/inc/vmapi/hf/abi.h
@@ -20,22 +20,30 @@
enum hf_vcpu_run_code {
/**
- * The vCPU has yielded, forcibly or voluntarily. The scheduler should
- * call `hf_vcpu_run` again sometime soon.
+ * The vCPU has been preempted but still has work to do. If the
+ * scheduling quantum has not expired, the scheduler MUST call
+ * `hf_vcpu_run` on the vCPU to allow it to continue.
+ */
+ HF_VCPU_RUN_PREEMPTED,
+
+ /**
+ * The vCPU has voluntarily yielded the CPU. The scheduler SHOULD take a
+ * scheduling decision to give cycles to those that need them but MUST
+ * call `hf_vcpu_run` on the vCPU at a later point.
*/
HF_VCPU_RUN_YIELD,
/**
- * The vCPU is blocked waiting for an interrupt. The scheduler should
- * take it off the run queue and not call `hf_vcpu_run` until it has
- * injected an interrupt, sent it a message, or got a
+ * The vCPU is blocked waiting for an interrupt. The scheduler MUST take
+ * it off the run queue and not call `hf_vcpu_run` on the vCPU until it
+ * has injected an interrupt, sent it a message, or got a
* `HF_VCPU_RUN_WAKE_UP` for it from another vCPU.
*/
HF_VCPU_RUN_WAIT_FOR_INTERRUPT,
/**
* The vCPU would like `hf_vcpu_run` to be called on another vCPU,
- * specified by `hf_vcpu_run_return.wake_up`. The scheduler should
+ * specified by `hf_vcpu_run_return.wake_up`. The scheduler MUST
* either wake the vCPU in question up if it is blocked, or preempt and
* re-run it if it is already running somewhere. This gives Hafnium a
* chance to update any CPU state which might have changed.
@@ -52,7 +60,7 @@
* Like `HF_VCPU_RUN_WAIT_FOR_INTERRUPT`, but for a limited amount of
* time, specified by `hf_vcpu_run_return.sleep`. After at least that
* amount of time has passed, or any of the events listed for
- * `HF_VCPU_RUN_WAIT_FOR_INTERRUPT` occur, the scheduler should call
+ * `HF_VCPU_RUN_WAIT_FOR_INTERRUPT` occur, the scheduler MUST call
* `hf_vcpu_run` on it again.
*/
HF_VCPU_RUN_SLEEP,