From 902ed60806a5163966f3e595060f5b1831ea7807 Mon Sep 17 00:00:00 2001 From: Shuo A Liu Date: Mon, 17 Aug 2020 15:36:17 +0800 Subject: [PATCH] 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 Acked-by: Eddie Dong --- hypervisor/common/hypercall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 60aa6ab15..0cc2cab3f 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -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) {