hv: Restrain several hypercalls which may impact target VM

Some hypercalls to a target VM are only acceptable in some certain
states, else it impacts target VM. Add some restrictive status checks to
avoid that.

Tracked-On: #5208
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Shuo A Liu 2020-08-17 15:36:17 +08:00 committed by wenlingz
parent e587f029de
commit 902ed60806
1 changed files with 3 additions and 3 deletions

View File

@ -985,7 +985,7 @@ int32_t hcall_set_ptdev_intr_info(struct acrn_vm *vm, struct acrn_vm *target_vm,
{
int32_t ret = -1;
if (!is_poweroff_vm(target_vm)) {
if (is_created_vm(target_vm)) {
struct hc_ptdev_irq irq;
if (copy_from_gpa(vm, &irq, param2, sizeof(irq)) == 0) {
@ -1036,7 +1036,7 @@ int32_t hcall_reset_ptdev_intr_info(struct acrn_vm *vm, struct acrn_vm *target_v
{
int32_t ret = -1;
if (!is_poweroff_vm(target_vm)) {
if (is_created_vm(target_vm) || is_paused_vm(target_vm)) {
struct hc_ptdev_irq irq;
if (copy_from_gpa(vm, &irq, param2, sizeof(irq)) == 0) {
@ -1087,7 +1087,7 @@ int32_t hcall_get_cpu_pm_state(struct acrn_vm *vm, struct acrn_vm *target_vm, ui
int32_t ret = -1;
uint64_t cmd = param1;
if (!is_poweroff_vm(target_vm)) {
if (is_created_vm(target_vm)) {
switch (cmd & PMCMD_TYPE_MASK) {
case PMCMD_GET_PX_CNT: {
if (target_vm->pm.px_cnt != 0U) {