debuggers.hg
changeset 18073:bcef824afe1a
iommu: make interrupt remapping more generic
Signed-off-by: Wei Wang <wei.wang2@amd.com>
Signed-off-by: Wei Wang <wei.wang2@amd.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Jul 11 12:49:14 2008 +0100 (2008-07-11) |
parents | 1e24033fb775 |
children | f40c310dca31 |
files | xen/arch/x86/msi.c xen/drivers/passthrough/amd/pci_amd_iommu.c xen/drivers/passthrough/iommu.c xen/drivers/passthrough/vtd/iommu.c xen/include/asm-x86/io_apic.h xen/include/xen/iommu.h |
line diff
1.1 --- a/xen/arch/x86/msi.c Fri Jul 11 12:48:45 2008 +0100 1.2 +++ b/xen/arch/x86/msi.c Fri Jul 11 12:49:14 2008 +0100 1.3 @@ -173,8 +173,8 @@ static int unset_vector_msi(int vector) 1.4 1.5 static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) 1.6 { 1.7 - if ( vtd_enabled ) 1.8 - msi_msg_write_remap_rte(entry, msg); 1.9 + if ( iommu_enabled ) 1.10 + iommu_update_ire_from_msi(entry, msg); 1.11 1.12 switch ( entry->msi_attrib.type ) 1.13 {
2.1 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c Fri Jul 11 12:48:45 2008 +0100 2.2 +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c Fri Jul 11 12:49:14 2008 +0100 2.3 @@ -649,4 +649,6 @@ struct iommu_ops amd_iommu_ops = { 2.4 .unmap_page = amd_iommu_unmap_page, 2.5 .reassign_device = amd_iommu_return_device, 2.6 .get_device_group_id = amd_iommu_group_id, 2.7 + .update_ire_from_apic = amd_iommu_ioapic_update_ire, 2.8 + .update_ire_from_msi = amd_iommu_msi_msg_update_ire, 2.9 };
3.1 --- a/xen/drivers/passthrough/iommu.c Fri Jul 11 12:48:45 2008 +0100 3.2 +++ b/xen/drivers/passthrough/iommu.c Fri Jul 11 12:49:14 2008 +0100 3.3 @@ -290,6 +290,43 @@ int iommu_get_device_group(struct domain 3.4 3.5 return i; 3.6 } 3.7 + 3.8 +void iommu_update_ire_from_apic( 3.9 + unsigned int apic, unsigned int reg, unsigned int value) 3.10 +{ 3.11 + struct iommu_ops *ops = NULL; 3.12 + 3.13 + switch ( boot_cpu_data.x86_vendor ) 3.14 + { 3.15 + case X86_VENDOR_INTEL: 3.16 + ops = &intel_iommu_ops; 3.17 + break; 3.18 + case X86_VENDOR_AMD: 3.19 + ops = &amd_iommu_ops; 3.20 + break; 3.21 + default: 3.22 + BUG(); 3.23 + } 3.24 + ops->update_ire_from_apic(apic, reg, value); 3.25 +} 3.26 +void iommu_update_ire_from_msi( 3.27 + struct msi_desc *msi_desc, struct msi_msg *msg) 3.28 +{ 3.29 + struct iommu_ops *ops = NULL; 3.30 + 3.31 + switch ( boot_cpu_data.x86_vendor ) 3.32 + { 3.33 + case X86_VENDOR_INTEL: 3.34 + ops = &intel_iommu_ops; 3.35 + break; 3.36 + case X86_VENDOR_AMD: 3.37 + ops = &amd_iommu_ops; 3.38 + break; 3.39 + default: 3.40 + BUG(); 3.41 + } 3.42 + ops->update_ire_from_msi(msi_desc, msg); 3.43 +} 3.44 /* 3.45 * Local variables: 3.46 * mode: C
4.1 --- a/xen/drivers/passthrough/vtd/iommu.c Fri Jul 11 12:48:45 2008 +0100 4.2 +++ b/xen/drivers/passthrough/vtd/iommu.c Fri Jul 11 12:49:14 2008 +0100 4.3 @@ -1883,6 +1883,8 @@ struct iommu_ops intel_iommu_ops = { 4.4 .unmap_page = intel_iommu_unmap_page, 4.5 .reassign_device = reassign_device_ownership, 4.6 .get_device_group_id = intel_iommu_group_id, 4.7 + .update_ire_from_apic = io_apic_write_remap_rte, 4.8 + .update_ire_from_msi = msi_msg_write_remap_rte, 4.9 }; 4.10 4.11 /*
5.1 --- a/xen/include/asm-x86/io_apic.h Fri Jul 11 12:48:45 2008 +0100 5.2 +++ b/xen/include/asm-x86/io_apic.h Fri Jul 11 12:49:14 2008 +0100 5.3 @@ -133,8 +133,8 @@ static inline unsigned int io_apic_read( 5.4 5.5 static inline void io_apic_write(unsigned int apic, unsigned int reg, unsigned int value) 5.6 { 5.7 - if (vtd_enabled) 5.8 - return io_apic_write_remap_rte(apic, reg, value); 5.9 + if (iommu_enabled) 5.10 + return iommu_update_ire_from_apic(apic, reg, value); 5.11 *IO_APIC_BASE(apic) = reg; 5.12 *(IO_APIC_BASE(apic)+4) = value; 5.13 }
6.1 --- a/xen/include/xen/iommu.h Fri Jul 11 12:48:45 2008 +0100 6.2 +++ b/xen/include/xen/iommu.h Fri Jul 11 12:49:14 2008 +0100 6.3 @@ -103,6 +103,10 @@ struct iommu_ops { 6.4 int (*reassign_device)(struct domain *s, struct domain *t, 6.5 u8 bus, u8 devfn); 6.6 int (*get_device_group_id)(u8 bus, u8 devfn); 6.7 + void (*update_ire_from_apic)(unsigned int apic, unsigned int reg, unsigned int value); 6.8 + void (*update_ire_from_msi)(struct msi_desc *msi_desc, struct msi_msg *msg); 6.9 }; 6.10 6.11 +void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned int value); 6.12 +void iommu_update_ire_from_msi(struct msi_desc *msi_desc, struct msi_msg *msg); 6.13 #endif /* _IOMMU_H_ */