dynamic VTd page table for HVM guest
PATCH 1/1 dynamic VTd page table for HVM guest
This patch makes HVM's VTd page table dynamic just like what PV guest does, so that avoid the overhead of maintaining page table until a PCI device is truly assigned to the HVM guest.
Signed-off-by Zhai, Edwin <[email protected]>
Wei,
This patch also remove some duplicated codes on your side, and is safe in theory. You can have a check.
Thanks,
Signature · 2 lines
best rgds, edwin
xen/arch/ia64/xen/domain.c +1 -1
@@ -669,7 +669,7 @@ void arch_domain_destroy(struct domain *free_xenheap_pages (d->shared_info,get_order_from_shift (XSI_SHIFT )); -if ( iommu_enabled && (is_hvm_domain (d) ||need_iommu (d)) ) { +if ( iommu_enabled &&need_iommu (d) ) {pci_release_devices (d);iommu_domain_destroy (d); }
xen/arch/ia64/xen/mm.c +2 -2
@@ -1479,7 +1479,7 @@ zap_domain_page_one(struct domain *d, unif (!mfn_valid (mfn))return ; -if ( iommu_enabled && (is_hvm_domain (d) ||need_iommu (d)) ){ +if ( iommu_enabled &&need_iommu (d) ){int i, j; j =1 << (PAGE_SHIFT -PAGE_SHIFT_4K );for (i =0 ; i < j; i++)
@@ -2885,7 +2885,7 @@ __guest_physmap_add_page(struct domain *smp_mb ();assign_domain_page_replace (d, gpfn <<PAGE_SHIFT , mfn, ASSIGN_writable | ASSIGN_pgc_allocated); -if ( iommu_enabled && (is_hvm_domain (d) ||need_iommu (d)) ){ +if ( iommu_enabled &&need_iommu (d) ){int i, j; j =1 << (PAGE_SHIFT -PAGE_SHIFT_4K );for (i =0 ; i < j; i++)
xen/arch/x86/mm/hap/p2m-ept.c +1 -1
@@ -282,7 +282,7 @@ out:ept_sync_domain (d);/* Now the p2m table is not shared with vt-d page table */ -if ( iommu_enabled &&is_hvm_domain (d) && need_modify_vtd_table ) +if ( iommu_enabled &&need_iommu (d) && need_modify_vtd_table ) {if ( p2mt == p2m_ram_rw ) {
xen/arch/x86/mm/p2m.c +1 -1
@@ -1199,7 +1199,7 @@ p2m_set_entry(struct domain *d, unsigned && (gfn + (1UL << page_order) - 1 > d->arch.p2m->max_mapped_pfn) ) d->arch.p2m->max_mapped_pfn = gfn + (1UL << page_order) - 1; -if ( iommu_enabled && (is_hvm_domain (d) ||need_iommu (d)) ) +if ( iommu_enabled &&need_iommu (d) ) {if ( p2mt == p2m_ram_rw )for ( i =0 ; i < (1UL << page_order); i++ )
xen/drivers/passthrough/amd/iommu_map.c +0 -52
58 lines not on this page · raw message
xen/drivers/passthrough/amd/pci_amd_iommu.c +0 -2
@@ -311,8 +311,6 @@ static int amd_iommu_assign_device(strucint bdf = (bus <<8 ) | devfn;int req_id = ivrs_mappings[bdf].dte_requestor_id; -amd_iommu_sync_p2m (d); -if ( ivrs_mappings[req_id].unity_map_enable ) { amd_iommu_reserve_domain_unity_map(
xen/drivers/passthrough/iommu.c +2 -2
@@ -137,7 +137,7 @@ int assign_device(struct domain *d, u8 bif ( (rc = hd->platform_ops->assign_device (d, bus, devfn)) ) goto done; -if (has_arch_pdevs (d) && !is_hvm_domain (d) && !need_iommu (d) ) +if (has_arch_pdevs (d) && !need_iommu (d) ) { d->need_iommu =1 ; rc =iommu_populate_page_table (d);
@@ -184,7 +184,7 @@ void iommu_domain_destroy(struct domainif ( !iommu_enabled || !hd->platform_ops )return ; -if ( !is_hvm_domain (d) && !need_iommu (d) ) +if ( !need_iommu (d) )return ;if (need_iommu (d) )
xen/drivers/passthrough/pci.c +1 -1
@@ -202,7 +202,7 @@ static void pci_clean_dpci_irqs(struct dif ( !iommu_enabled )return ; -if ( !is_hvm_domain (d) && !need_iommu (d) ) +if ( !need_iommu (d) )return ;spin_lock (&d->event_lock);
xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +0 -1
@@ -63,7 +63,6 @@ int amd_iommu_unmap_page(struct domain *u64 amd_iommu_get_next_table_from_pte (u32 *entry);int amd_iommu_reserve_domain_unity_map (struct domain *domain,unsigned long phys_addr,unsigned long size,int iw,int ir); -int amd_iommu_sync_p2m (struct domain *d);void invalidate_all_iommu_pages (struct domain *d);/* device table functions */
xen/include/xen/sched.h +1 -1
@@ -557,7 +557,7 @@ uint64_t get_cpu_idle_time(unsigned int#define is_hvm_domain (d) ((d)->is_hvm)#define is_hvm_vcpu (v) (is_hvm_domain(v->domain)) -#define need_iommu (d) ((d)->need_iommu && !(d)->is_hvm) +#define need_iommu (d) ((d)->need_iommu)void set_vcpu_migration_delay (unsigned int delay);unsigned int get_vcpu_migration_delay (void );
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel