[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] AMD IOMMU: Make iommu suspend & resume functions more generic.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1246877811 -3600
# Node ID ff5bc91d0057f4a37076f2393bbedfd62bdb1f0e
# Parent  7d5433600932a5c56fb23d6c0996df99e5e7c57f
AMD IOMMU: Make iommu suspend & resume functions more generic.

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/drivers/passthrough/amd/pci_amd_iommu.c   |    2 ++
 xen/drivers/passthrough/iommu.c               |   14 ++++++++++++++
 xen/drivers/passthrough/vtd/iommu.c           |    6 ++++--
 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |    4 ++++
 xen/include/xen/iommu.h                       |    2 ++
 5 files changed, 26 insertions(+), 2 deletions(-)

diff -r 7d5433600932 -r ff5bc91d0057 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Mon Jul 06 11:56:17 
2009 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Mon Jul 06 11:56:51 
2009 +0100
@@ -441,4 +441,6 @@ struct iommu_ops amd_iommu_ops = {
     .update_ire_from_msi = amd_iommu_msi_msg_update_ire,
     .read_apic_from_ire = amd_iommu_read_ioapic_from_ire,
     .read_msi_from_ire = amd_iommu_read_msi_from_ire,
+    .suspend = amd_iommu_suspend,
+    .resume = amd_iommu_resume,
 };
diff -r 7d5433600932 -r ff5bc91d0057 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c   Mon Jul 06 11:56:17 2009 +0100
+++ b/xen/drivers/passthrough/iommu.c   Mon Jul 06 11:56:51 2009 +0100
@@ -346,6 +346,20 @@ unsigned int iommu_read_apic_from_ire(un
     return ops->read_apic_from_ire(apic, reg);
 }
 
+void iommu_resume()
+{
+    struct iommu_ops *ops = iommu_get_ops();
+    if ( iommu_enabled )
+        ops->resume();
+}
+
+void iommu_suspend()
+{
+    struct iommu_ops *ops = iommu_get_ops();
+    if ( iommu_enabled )
+        ops->suspend();
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 7d5433600932 -r ff5bc91d0057 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Mon Jul 06 11:56:17 2009 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c       Mon Jul 06 11:56:51 2009 +0100
@@ -1848,7 +1848,7 @@ static int intel_iommu_group_id(u8 bus, 
 }
 
 static u32 iommu_state[MAX_IOMMUS][MAX_IOMMU_REGS];
-void iommu_suspend(void)
+void vtd_suspend(void)
 {
     struct acpi_drhd_unit *drhd;
     struct iommu *iommu;
@@ -1887,7 +1887,7 @@ void iommu_suspend(void)
     }
 }
 
-void iommu_resume(void)
+void vtd_resume(void)
 {
     struct acpi_drhd_unit *drhd;
     struct iommu *iommu;
@@ -1934,6 +1934,8 @@ struct iommu_ops intel_iommu_ops = {
     .update_ire_from_msi = msi_msg_write_remap_rte,
     .read_apic_from_ire = io_apic_read_remap_rte,
     .read_msi_from_ire = msi_msg_read_remap_rte,
+    .suspend = vtd_suspend,
+    .resume = vtd_resume,
 };
 
 /*
diff -r 7d5433600932 -r ff5bc91d0057 
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Mon Jul 06 11:56:17 
2009 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Mon Jul 06 11:56:51 
2009 +0100
@@ -92,6 +92,10 @@ unsigned int amd_iommu_read_ioapic_from_
 unsigned int amd_iommu_read_ioapic_from_ire(
     unsigned int apic, unsigned int reg);
 
+/* power management support */
+void amd_iommu_resume(void);
+void amd_iommu_suspend(void);
+
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
     u32 field;
diff -r 7d5433600932 -r ff5bc91d0057 xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h   Mon Jul 06 11:56:17 2009 +0100
+++ b/xen/include/xen/iommu.h   Mon Jul 06 11:56:51 2009 +0100
@@ -109,6 +109,8 @@ struct iommu_ops {
     void (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg 
*msg);
     void (*read_msi_from_ire)(struct msi_desc *msi_desc, struct msi_msg *msg);
     unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg);
+    void (*suspend)(void);
+    void (*resume)(void);
 };
 
 void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned 
int value);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.