AMD IOMMU: add support for PV guest
PATCH 1/1 AMD IOMMU: add support for PV guest
Attached patch enables AMD IOMMU for PV guest. It has been tested with PV guest being configured as both passthru domain and backend domain. Assumingiommu_populate_page_table() is only used for PV guest, a new check is added into assign_device() to avoid duplicating the work done by amd_iommu_sync_p2m() for hvm guest.
Wei
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/drivers/passthrough/iommu.c +13 -3
@@ -68,7 +68,7 @@ int assign_device(struct domain *d, u8 bif ( (rc = hd->platform_ops->assign_device (d, bus, devfn)) )return rc; -if (has_iommu_pdevs (d) && !need_iommu (d) ) +if (has_iommu_pdevs (d) && !is_hvm_domain (d) && !need_iommu (d) ) { d->need_iommu =1 ;return iommu_populate_page_table (d);
@@ -114,6 +114,16 @@ void iommu_domain_destroy(struct domainif ( !iommu_enabled || !hd->platform_ops )return ; +if ( !is_hvm_domain (d) && !need_iommu (d) ) +return ; + +if (need_iommu (d) ) + { + d->need_iommu =0 ; + hd->platform_ops->teardown (d); +return ; + } +if ( hvm_irq_dpci !=NULL ) {for ( i =0 ; i <NR_IRQS ; i++ )
@@ -207,10 +217,10 @@ static int iommu_setup(void) iommu_enabled = (rc ==0 ); out: -if ( !iommu_enabled || !vtd_enabled ) +if ( !iommu_enabled ) iommu_pv_enabled =0 ;printk ("I/O virtualisation %sabled\n" , iommu_enabled ?"en" :"dis" ); -if (iommu_enabled) +if ( iommu_enabled )printk ("I/O virtualisation for PV guests %sabled\n" , iommu_pv_enabled ?"en" :"dis" );return rc;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel