Add a generic layer on top of intel and amd iommu code
PATCH 1/4 Add a generic layer on top of intel and amd iommu code
Signed-off-by Wei Wang <[email protected]>
Signature · 12 lines
AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Geschäftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplementär: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Geschäftsführer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
xen/arch/x86/domctl.c +3 -3
@@ -530,7 +530,7 @@ long arch_do_domctl(u8 bus, devfn; ret = -EINVAL ; -if ( !vtd_enabled ) +if ( !iommu_enabled )break ; bus = (domctl->u.assign_device.machine_bdf >>16 ) &0xff ;
@@ -553,7 +553,7 @@ long arch_do_domctl(u8 bus, devfn; ret = -EINVAL ; -if ( !vtd_enabled ) +if ( !iommu_enabled )break ;if (unlikely ((d =get_domain_by_id (domctl->domain)) ==NULL ) )
@@ -589,7 +589,7 @@ long arch_do_domctl(if ( (d =rcu_lock_domain_by_id (domctl->domain)) ==NULL )break ; bind = &(domctl->u.bind_pt_irq); -if (vtd_enabled) +if (iommu_enabled) ret =pt_irq_create_bind_vtd (d, bind);if (ret <0 )gdprintk (XENLOG_ERR ,"pt_irq_create_bind failed!\n" );
xen/arch/x86/hvm/Makefile +1 -0
@@ -18,3 +18,4 @@ obj-y += vpic.o obj-y += vpic.o obj-y += save.o obj-y += stdvga.o +obj-y += iommu.o
xen/arch/x86/hvm/vioapic.c +1 -1
@@ -458,7 +458,7 @@ void vioapic_update_EOI(struct domain *d ent->fields.remote_irr =0 ; -if ( vtd_enabled ) +if ( iommu_enabled ) {spin_unlock (&d->arch.hvm_domain.irq_lock);hvm_dpci_eoi (current->domain, gsi, ent);
xen/arch/x86/hvm/vmx/vtd/io.c +3 -50
74 lines not on this page · raw message
xen/include/asm-x86/hvm/iommu.h +3 -0
@@ -48,6 +48,9 @@ struct hvm_iommu {int domain_id;int paging_mode;void *root_table; + +/* iommu_ops */ + struct iommu_ops *platform_ops; };#endif // __ASM_X86_HVM_IOMMU_H__
xen/include/asm-x86/iommu.h +11 -0
@@ -28,7 +28,9 @@#include <public/domctl.h> extern int vtd_enabled; +extern int amd_iommu_enabled; +#define iommu_enabled ( amd_iommu_enabled || vtd_enabled )#define domain_hvm_iommu (d) (&d->arch.hvm_domain.hvm_iommu)#define domain_vmx_iommu (d) (&d->arch.hvm_domain.hvm_iommu.vmx_iommu)#define iommu_qi_ctrl (iommu) (&(iommu->intel.qi_ctrl));
@@ -89,4 +91,13 @@ void io_apic_write_remap_rte(unsigned in#define PT_IRQ_TIME_OUT MILLISECS(8)#define VTDPREFIX "[VT-D]" +/* iommu interface */ +struct iommu_ops { +int (*init ) (struct domain *d); +int (*assign_device) (struct domain *d,u8 bus,u8 devfn); +void (*teardown) (struct domain *d); +int (*map_page) (struct domain *d,dma_addr_t gfn,dma_addr_t mfn); +int (*unmap_page) (struct domain *d,dma_addr_t gfn); +}; +#endif /* _IOMMU_H_ */
xen/arch/x86/hvm/iommu.c new file +132 -0
132 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel