Skip to content

Commit 64bf4fb

Browse files
lifeixwenlingz
authored andcommitted
dm: don't deassign pass through PCIe device in DM
Let the ACRN HV to do this in shutdown sequence. In this case, the RTVM could be still alive if something wrong happened to cause the DM died. Tracked-On: #4428 Signed-off-by: Li Fei1 <fei1.li@intel.com>
1 parent 67cb102 commit 64bf4fb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

devicemodel/core/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ vm_loop(struct vmctx *ctx)
686686
break;
687687
}
688688

689-
if (VM_SUSPEND_SYSTEM_RESET == vm_get_suspend_mode()) {
689+
/* RTVM can't be reset */
690+
if ((VM_SUSPEND_SYSTEM_RESET == vm_get_suspend_mode()) && (!is_rtvm)) {
690691
vm_system_reset(ctx);
691692
}
692693

devicemodel/hw/pci/passthrough.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "pciio.h"
4646
#include "pci_core.h"
4747
#include "acpi.h"
48+
#include "dm.h"
4849

4950

5051
/* Some audio drivers get topology data from ACPI NHLT table.
@@ -558,7 +559,13 @@ passthru_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
558559
pcidev.phys_bdf = ptdev->phys_bdf;
559560
pciaccess_cleanup();
560561
free(ptdev);
561-
vm_deassign_pcidev(ctx, &pcidev);
562+
563+
if (!is_rtvm) {
564+
/* Let the HV to deassign the pt device for RTVM, In this case, the RTVM
565+
* could still be alive if DM died.
566+
*/
567+
vm_deassign_pcidev(ctx, &pcidev);
568+
}
562569
}
563570

564571
/* bind pin info for pass-through device */

0 commit comments

Comments
 (0)