From d5865632ec73e71246d07b4c31e9e02e78e18bf5 Mon Sep 17 00:00:00 2001 From: Binbin Wu Date: Wed, 19 Dec 2018 11:25:45 +0800 Subject: [PATCH] hv: assign: remove added ptirq entries if fails to add all When adding ptirq entries, either successes with all number of entries added or fails with none entries addes. So remove added ptirq entries if error occurs during the process. Tracked-On: #861 Signed-off-by: Binbin Wu Acked-by: Eddie Dong --- hypervisor/arch/x86/assign.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hypervisor/arch/x86/assign.c b/hypervisor/arch/x86/assign.c index 8a4c181c3..ead05529c 100644 --- a/hypervisor/arch/x86/assign.c +++ b/hypervisor/arch/x86/assign.c @@ -755,6 +755,10 @@ int32_t ptirq_add_msix_remapping(struct acrn_vm *vm, uint16_t virt_bdf, vector_added++; } + if (vector_added != vector_count) { + ptirq_remove_msix_remapping(vm, virt_bdf, vector_added); + } + return (vector_added == vector_count) ? 0 : -ENODEV; }