From 9831cf40b3fdbf664b174c4a741b8725fb2cb781 Mon Sep 17 00:00:00 2001 From: Kamala Narasimhan Date: Fri, 31 Jul 2009 20:51:43 -0400 Subject: [PATCH] Move IGD command register restore workaround. Previously applied code path is not taken when domain save is called. Current one is hit irrespective of how the domain might be terminated. --- master/igd-cmd-reg-change-for-reboot | 53 ++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/master/igd-cmd-reg-change-for-reboot b/master/igd-cmd-reg-change-for-reboot index 4576501..b6e7d9b 100644 --- a/master/igd-cmd-reg-change-for-reboot +++ b/master/igd-cmd-reg-change-for-reboot @@ -1,11 +1,44 @@ -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); +diff --git a/xen/arch/x86/acpi/power.c b/xen/arch/x86/acpi/power.c +index cf6730a..67cebae 100644 +--- a/xen/arch/x86/acpi/power.c ++++ b/xen/arch/x86/acpi/power.c +@@ -193,6 +193,7 @@ static int enter_state(u32 state) + error = tboot_s3_resume(); + break; + case ACPI_STATE_S5: ++ restore_igd_cmd_register(); + acpi_enter_sleep_state(ACPI_STATE_S5); + break; + default: +diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c +index 18340e5..c8d7fb7 100644 +--- a/xen/arch/x86/shutdown.c ++++ b/xen/arch/x86/shutdown.c +@@ -320,6 +320,8 @@ void machine_restart(unsigned int delay_millisecs) + mdelay(delay_millisecs); + ++ restore_igd_cmd_register(); ++ + if ( tboot_in_measured_env() ) + tboot_shutdown(TB_SHUTDOWN_REBOOT); + +diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h +index b470492..f99c5aa 100644 +--- a/xen/include/xen/iommu.h ++++ b/xen/include/xen/iommu.h +@@ -118,4 +118,23 @@ void iommu_resume(void); + + void iommu_set_dom0_mapping(struct domain *d); + ++/* ++ * Note the below change is temporary and the logic to perform this ++ * will be moved to pciback in future. Reason why we are not ++ * particular about probing for the dev, checking if Intel and ++ * VGA compatible etc. before making the change. ++ */ ++static inline void restore_igd_cmd_register(void) ++{ + /* 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 @@ -15,6 +48,6 @@ index ff56a19..d8a5542 100644 + if ( pci_conf_read16(0x0, 0x2, 0x0, 0x4) == 0x0 ) + pci_conf_write16(0x0, 0x2, 0x0, 0x4, 0x7); + - iommu_domid_release(d); - } - ++} ++ + #endif /* _IOMMU_H_ */ -- 2.39.5