From 1d64342a15c0c972f87d17bf39178d62aeb47aa2 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 31 Jul 2009 01:15:40 -0400 Subject: [PATCH] Fix reboot/shutdown issue observed on certain systems. After spawning a VM with display passed through to it, the system may not shutdown completely or reboot. This patch fix those issues. --- master/igd-cmd-reg-change-for-reboot | 20 ++++++++++++++++++++ master/series | 1 + 2 files changed, 21 insertions(+) create mode 100644 master/igd-cmd-reg-change-for-reboot diff --git a/master/igd-cmd-reg-change-for-reboot b/master/igd-cmd-reg-change-for-reboot new file mode 100644 index 0000000..4576501 --- /dev/null +++ b/master/igd-cmd-reg-change-for-reboot @@ -0,0 +1,20 @@ +diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c +index ff56a19..d8a5542 100644 +--- a/xen/drivers/passthrough/vtd/iommu.c ++++ b/xen/drivers/passthrough/vtd/iommu.c +@@ -1451,6 +1451,15 @@ void iommu_domain_teardown(struct domain *d) + hd->pgd_maddr = 0; + spin_unlock(&hd->mapping_lock); + ++ /* Make sure I/O, memory access and bus master enable bits are set ++ for PCI command register (b:d.f - 00:02.0, offset - 0x4. ++ Passing through display could end up resulting in PCI command register ++ getting reset and thus failing shutdown/reboot on some systems (like ++ Dell E4300, E6500 etc). ++ */ ++ if ( pci_conf_read16(0x0, 0x2, 0x0, 0x4) == 0x0 ) ++ pci_conf_write16(0x0, 0x2, 0x0, 0x4, 0x7); ++ + iommu_domid_release(d); + } + diff --git a/master/series b/master/series index cd54ddc..d2dc79e 100644 --- a/master/series +++ b/master/series @@ -16,3 +16,4 @@ tools-hvm-info disable-abr default-iommu-inclusive-mapping cx-initialize-safe-state +igd-cmd-reg-change-for-reboot -- 2.39.5