AMD IOMMU: Allocate I/O pagetable from domheap instead of xenheap
PATCH 3/3 AMD IOMMU: Allocate I/O pagetable from domheap instead of xenheap
cleanup device table, cmd buffer and event log allocation.
Thanks,
-Wei
Signed-off-by Wei Wang <[email protected]>
(reviewed by Wei Huang<[email protected]>)
Signature · 11 lines
AMD GmbH, Germany Operating System Research Center Legal Information: Advanced Micro Devices GmbH Karl-Hammerschmidt-Str. 34 85609 Dornach b. München Geschäftsführer: Jochen Polster, Thomas M. McCoy, Giuliano Meroni Sitz: Dornach, Gemeinde Aschheim, Landkreis München Registergericht München, HRB Nr. 43632
xen/drivers/passthrough/amd/iommu_init.c +16 -12
@@ -535,10 +535,11 @@ static void __init deallocate_iommu_tablstatic void __init deallocate_iommu_table_struct (struct table_struct *table) { +int order =0 ;if ( table->buffer ) { -free_xenheap_pages (table->buffer, -get_order_from_bytes (table->alloc_size)); + order =get_order_from_bytes (table->alloc_size); +__free_amd_iommu_tables (table->buffer, order); table->buffer =NULL ; } }
@@ -552,16 +553,19 @@ static int __init allocate_iommu_table_sstatic int __init allocate_iommu_table_struct (struct table_struct *table,const char *name) { - table->buffer = (void *)alloc_xenheap_pages ( -get_order_from_bytes (table->alloc_size)); - -if ( !table->buffer ) - { -amd_iov_error ("Error allocating %s\n" , name); -return -ENOMEM ; - } - -memset (table->buffer,0 , table->alloc_size); +int order =0 ; +if ( table->buffer ==NULL ) + { + order =get_order_from_bytes (table->alloc_size); + table->buffer =__alloc_amd_iommu_tables (order); + +if ( table->buffer ==NULL ) + { +amd_iov_error ("Error allocating %s\n" , name); +return -ENOMEM ; + } +memset (table->buffer,0 ,PAGE_SIZE * (1UL << order)); + }return 0 ; }
xen/drivers/passthrough/amd/iommu_intr.c +12 -8
@@ -22,6 +22,7 @@#include <asm/amd-iommu.h> #include <asm/hvm/svm/amd-iommu-proto.h> +#define INTREMAP_TABLE_ORDER 1DEFINE_SPINLOCK (int_remap_table_lock);void *int_remap_table =NULL ;
@@ -112,14 +113,17 @@ int __init amd_iommu_setup_intremap_tablunsigned long flags;spin_lock_irqsave (&int_remap_table_lock, flags); +if ( int_remap_table ==NULL ) - int_remap_table = (void *)alloc_xenheap_pages (1 ); -if ( !int_remap_table ) - { -spin_unlock_irqrestore (&int_remap_table_lock, flags); -return -ENOMEM ; - } -memset ((u8 *)int_remap_table,0 ,PAGE_SIZE *2 ); + { + int_remap_table =__alloc_amd_iommu_tables (INTREMAP_TABLE_ORDER ); +if ( int_remap_table ==NULL ) + { +spin_unlock_irqrestore (&int_remap_table_lock, flags); +return -ENOMEM ; + } +memset (int_remap_table,0 ,PAGE_SIZE * (1UL <<INTREMAP_TABLE_ORDER )); + }spin_unlock_irqrestore (&int_remap_table_lock, flags);return 0 ;
@@ -211,7 +215,7 @@ int __init deallocate_intremap_table(voispin_lock_irqsave (&int_remap_table_lock, flags);if ( int_remap_table ) { -free_xenheap_pages (int_remap_table,1 ); +__free_amd_iommu_tables (int_remap_table,INTREMAP_TABLE_ORDER ); int_remap_table =NULL ; }spin_unlock_irqrestore (&int_remap_table_lock, flags);
xen/drivers/passthrough/amd/pci_amd_iommu.c +52 -75
202 lines not on this page · raw message
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel