WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] IOMMU: Add two generic functions to vendo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] IOMMU: Add two generic functions to vendor neutral interface
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 19 Jun 2009 00:57:07 -0700
Delivery-date: Fri, 19 Jun 2009 01:10:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1245397310 -3600
# Node ID 78962f85c56279118b96f64f4042b591f5b85e26
# Parent  dc0d1200e3f3c1e06de2c8c15104e8c64ba56e0d
IOMMU: Add two generic functions to vendor neutral interface

Add 2 generic functions into the vendor neutral iommu interface, The
reason is that from changeset 19732, there is only one global flag
"iommu_enabled" that controls iommu enablement for both vtd and amd
systems, so we need different code paths for vtd and amd iommu systems
if this flag has been turned on. Also, the early checking of
"iommu_enabled" in iommu_setup() is removed to prevent iommu
functionalities from been disabled on amd systems.

Signed-off-by: Wei Wang <wei.wang2@xxxxxxx>
---
 xen/arch/x86/msi.c                            |    2 +-
 xen/drivers/passthrough/amd/iommu_intr.c      |   12 ++++++++++++
 xen/drivers/passthrough/amd/pci_amd_iommu.c   |    2 ++
 xen/drivers/passthrough/iommu.c               |   18 ++++++++++++++----
 xen/drivers/passthrough/vtd/iommu.c           |    2 ++
 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h |    4 ++++
 xen/include/asm-x86/io_apic.h                 |    2 +-
 xen/include/xen/iommu.h                       |    4 ++++
 8 files changed, 40 insertions(+), 6 deletions(-)

diff -r dc0d1200e3f3 -r 78962f85c562 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c        Thu Jun 18 15:32:48 2009 +0100
+++ b/xen/arch/x86/msi.c        Fri Jun 19 08:41:50 2009 +0100
@@ -192,7 +192,7 @@ static void read_msi_msg(struct msi_desc
     }
 
     if ( iommu_enabled )
-        msi_msg_read_remap_rte(entry, msg);
+        iommu_read_msi_from_ire(entry, msg);
 }
 
 static int set_vector_msi(struct msi_desc *entry)
diff -r dc0d1200e3f3 -r 78962f85c562 xen/drivers/passthrough/amd/iommu_intr.c
--- a/xen/drivers/passthrough/amd/iommu_intr.c  Thu Jun 18 15:32:48 2009 +0100
+++ b/xen/drivers/passthrough/amd/iommu_intr.c  Fri Jun 19 08:41:50 2009 +0100
@@ -231,6 +231,18 @@ void amd_iommu_msi_msg_update_ire(
     update_intremap_entry_from_msi_msg(iommu, pdev, msg);
 }
 
+unsigned int amd_iommu_read_ioapic_from_ire(
+    unsigned int apic, unsigned int reg)
+{
+    *IO_APIC_BASE(apic) = reg;
+    return *(IO_APIC_BASE(apic)+4);
+}
+
+void amd_iommu_read_msi_from_ire(
+    struct msi_desc *msi_desc, struct msi_msg *msg)
+{
+}
+
 int __init deallocate_intremap_table(void)
 {
     if ( int_remap_table )
diff -r dc0d1200e3f3 -r 78962f85c562 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c       Thu Jun 18 15:32:48 
2009 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c       Fri Jun 19 08:41:50 
2009 +0100
@@ -439,4 +439,6 @@ struct iommu_ops amd_iommu_ops = {
     .get_device_group_id = amd_iommu_group_id,
     .update_ire_from_apic = amd_iommu_ioapic_update_ire,
     .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,
 };
diff -r dc0d1200e3f3 -r 78962f85c562 xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c   Thu Jun 18 15:32:48 2009 +0100
+++ b/xen/drivers/passthrough/iommu.c   Fri Jun 19 08:41:50 2009 +0100
@@ -263,14 +263,10 @@ static int iommu_setup(void)
 {
     int rc = -ENODEV;
 
-    if ( !iommu_enabled )
-        goto out;
-
     rc = iommu_hardware_setup();
 
     iommu_enabled = (rc == 0);
 
- out:
     if ( force_iommu && !iommu_enabled )
         panic("IOMMU setup failed, crash Xen for security purpose!\n");
 
@@ -336,6 +332,20 @@ void iommu_update_ire_from_msi(
     struct iommu_ops *ops = iommu_get_ops();
     ops->update_ire_from_msi(msi_desc, msg);
 }
+
+void iommu_read_msi_from_ire(
+    struct msi_desc *msi_desc, struct msi_msg *msg)
+{
+    struct iommu_ops *ops = iommu_get_ops();
+    ops->read_msi_from_ire(msi_desc, msg);
+}
+
+unsigned int iommu_read_apic_from_ire(unsigned int apic, unsigned int reg)
+{
+    struct iommu_ops *ops = iommu_get_ops();
+    return ops->read_apic_from_ire(apic, reg);
+}
+
 /*
  * Local variables:
  * mode: C
diff -r dc0d1200e3f3 -r 78962f85c562 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c       Thu Jun 18 15:32:48 2009 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c       Fri Jun 19 08:41:50 2009 +0100
@@ -1989,6 +1989,8 @@ struct iommu_ops intel_iommu_ops = {
     .get_device_group_id = intel_iommu_group_id,
     .update_ire_from_apic = io_apic_write_remap_rte,
     .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,
 };
 
 /*
diff -r dc0d1200e3f3 -r 78962f85c562 
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Thu Jun 18 15:32:48 
2009 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h     Fri Jun 19 08:41:50 
2009 +0100
@@ -87,6 +87,10 @@ void amd_iommu_ioapic_update_ire(
     unsigned int apic, unsigned int reg, unsigned int value);
 void amd_iommu_msi_msg_update_ire(
     struct msi_desc *msi_desc, struct msi_msg *msg);
+void amd_iommu_read_msi_from_ire(
+    struct msi_desc *msi_desc, struct msi_msg *msg);
+unsigned int amd_iommu_read_ioapic_from_ire(
+    unsigned int apic, unsigned int reg);
 
 static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift)
 {
diff -r dc0d1200e3f3 -r 78962f85c562 xen/include/asm-x86/io_apic.h
--- a/xen/include/asm-x86/io_apic.h     Thu Jun 18 15:32:48 2009 +0100
+++ b/xen/include/asm-x86/io_apic.h     Fri Jun 19 08:41:50 2009 +0100
@@ -131,7 +131,7 @@ static inline unsigned int io_apic_read(
 static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
 {
        if (ioapic_reg_remapped(reg))
-               return io_apic_read_remap_rte(apic, reg);
+               return iommu_read_apic_from_ire(apic, reg);
        *IO_APIC_BASE(apic) = reg;
        return *(IO_APIC_BASE(apic)+4);
 }
diff -r dc0d1200e3f3 -r 78962f85c562 xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h   Thu Jun 18 15:32:48 2009 +0100
+++ b/xen/include/xen/iommu.h   Fri Jun 19 08:41:50 2009 +0100
@@ -107,10 +107,14 @@ struct iommu_ops {
     int (*get_device_group_id)(u8 bus, u8 devfn);
     void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned 
int value);
     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 iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned 
int value);
 void iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg);
+void iommu_read_msi_from_ire(struct msi_desc *msi_desc, struct msi_msg *msg);
+unsigned int iommu_read_apic_from_ire(unsigned int apic, unsigned int reg);
 
 void iommu_suspend(void);
 void iommu_resume(void);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] IOMMU: Add two generic functions to vendor neutral interface, Xen patchbot-unstable <=