提交 75981010 编写于 作者: Z Zengruan Ye 提交者: Yang Yingliang

KVM: arm64: Add SMCCC PV-sched to kick cpu

euleros inclusion
category: feature
bugzilla: NA
CVE: NA

--------------------------------

A new hypercall interface function is provided for the guest to kick WFI
state vCPU.
Signed-off-by: NZengruan Ye <yezengruan@huawei.com>
Reviewed-by: Nzhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ebf090fd
...@@ -9,6 +9,7 @@ Some SMCCC compatible hypercalls are defined: ...@@ -9,6 +9,7 @@ Some SMCCC compatible hypercalls are defined:
* PV_SCHED_FEATURES: 0xC5000090 * PV_SCHED_FEATURES: 0xC5000090
* PV_SCHED_IPA_INIT: 0xC5000091 * PV_SCHED_IPA_INIT: 0xC5000091
* PV_SCHED_IPA_RELEASE: 0xC5000092 * PV_SCHED_IPA_RELEASE: 0xC5000092
* PV_SCHED_KICK_CPU: 0xC5000093
The existence of the PV_SCHED hypercall should be probed using the SMCCC 1.1 The existence of the PV_SCHED hypercall should be probed using the SMCCC 1.1
ARCH_FEATURES mechanism before calling it. ARCH_FEATURES mechanism before calling it.
...@@ -36,6 +37,13 @@ PV_SCHED_IPA_RELEASE ...@@ -36,6 +37,13 @@ PV_SCHED_IPA_RELEASE
this vCPU's PV data structure is released. this vCPU's PV data structure is released.
============= ======== ========== ============= ======== ==========
PV_SCHED_KICK_CPU
============= ======== ==========
Function ID: (uint32) 0xC5000093
Return value: (int64) NOT_SUPPORTED (-1) or SUCCESS (0) if the vCPU is
kicked by the hypervisor.
============= ======== ==========
PV sched state PV sched state
-------------- --------------
...@@ -54,3 +62,11 @@ The structure pointed to by the PV_SCHED_IPA hypercall is as follows: ...@@ -54,3 +62,11 @@ The structure pointed to by the PV_SCHED_IPA hypercall is as follows:
The preempted field will be updated to 0 by the hypervisor prior to scheduling The preempted field will be updated to 0 by the hypervisor prior to scheduling
a vCPU. When the vCPU is scheduled out, the preempted field will be updated a vCPU. When the vCPU is scheduled out, the preempted field will be updated
to 1 by the hypervisor. to 1 by the hypervisor.
A vCPU of a paravirtualized guest that is busywaiting in guest kernel mode for
an event to occur (ex: a spinlock to become available) can execute WFI
instruction once it has busy-waited for more than a threshold time-interval.
Execution of WFI instruction would cause the hypervisor to put the vCPU to sleep
until occurrence of an appropriate event. Another vCPU of the same guest can
wakeup the sleeping vCPU by issuing PV_SCHED_KICK_CPU hypercall, specifying CPU
id (reg1) of the vCPU to be woken up.
...@@ -376,5 +376,11 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1, ...@@ -376,5 +376,11 @@ asmlinkage void __arm_smccc_hvc(unsigned long a0, unsigned long a1,
ARM_SMCCC_OWNER_STANDARD_HYP, \ ARM_SMCCC_OWNER_STANDARD_HYP, \
0x92) 0x92)
#define ARM_SMCCC_HV_PV_SCHED_KICK_CPU \
ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \
ARM_SMCCC_SMC_64, \
ARM_SMCCC_OWNER_STANDARD_HYP, \
0x93)
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
#endif /*__LINUX_ARM_SMCCC_H*/ #endif /*__LINUX_ARM_SMCCC_H*/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册