Enable PCI passthru for HVM guest
PATCH 2/4 Enable PCI passthru for HVM guest
2-passthru-amd.patch: passthru support, modifications to amd-iommu codes
Signed-off-by Wei Wang <[email protected]>
xen/arch/x86/hvm/svm/amd_iommu/amd-iommu-map.c +20 -0
@@ -468,3 +468,23 @@ int amd_iommu_unmap_page(struct domain *return -ENOMEM ; } } + +void amd_iommu_unmap_all_domain_pages (struct domain *d) +{ +unsigned long flags; +u64 io_addr; +int domain_id; +struct amd_iommu *iommu; +struct hvm_iommu *hd =domain_hvm_iommu (d); + + domain_id = hd->domain_id; + io_addr =0x7FFFFFFFFFFF ;/* flush entire cache*/ + +for_each_amd_iommu (iommu) + { +spin_lock_irqsave (&iommu->lock, flags); +invalidate_iommu_page (iommu, io_addr, domain_id); +flush_command_buffer (iommu); +spin_unlock_irqrestore (&iommu->lock, flags); + } +}
xen/arch/x86/hvm/svm/amd_iommu/pci-amd-iommu.c +196 -0
199 lines not on this page · raw message
xen/include/asm-x86/amd-iommu.h +2 -0
@@ -33,6 +33,8 @@ extern struct list_head amd_iommu_head;extern int __init amd_iommu_detect (void );extern int amd_iommu_domain_init (struct domain *domain); +extern int amd_iommu_assign_device (struct domain *d,u8 bus,u8 devfn); +extern void amd_iommu_domain_destroy (struct domain *d);extern int amd_iommu_map_page (struct domain *d,unsigned long gfn,unsigned long mfn);extern int amd_iommu_unmap_page (struct domain *d,unsigned long gfn);
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +1 -0
@@ -63,6 +63,7 @@ void __init enable_iommu(struct amd_iommvoid __init enable_iommu (struct amd_iommu *iommu);/* mapping functions */ +void amd_iommu_unmap_all_domain_pages (struct domain *d);void *amd_iommu_get_vptr_from_page_table_entry (u32 *entry);/* device table functions */
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel