[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] vtd: move some x86-dependent functions into x86-specific directory.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1223888949 -3600 # Node ID e4bddd01cb3ebe0c4a72603c722889b22d3943fd # Parent 98d5370fec1a1f8438a62b51117207f1d40b8256 vtd: move some x86-dependent functions into x86-specific directory. Signed-off-by: Anthony Xu <anthony.xu@xxxxxxxxx> Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx> --- xen/drivers/passthrough/vtd/iommu.c | 9 ++++----- xen/drivers/passthrough/vtd/vtd.h | 5 ++++- xen/drivers/passthrough/vtd/x86/vtd.c | 18 +++++++++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff -r 98d5370fec1a -r e4bddd01cb3e xen/drivers/passthrough/vtd/iommu.c --- a/xen/drivers/passthrough/vtd/iommu.c Mon Oct 13 10:08:36 2008 +0100 +++ b/xen/drivers/passthrough/vtd/iommu.c Mon Oct 13 10:09:09 2008 +0100 @@ -123,7 +123,7 @@ static void __iommu_flush_cache(void *ad return; for ( i = 0; i < size; i += clflush_size ) - clflush((char *)addr + i); + cacheline_flush((char *)addr + i); } void iommu_flush_cache_entry(void *addr) @@ -525,7 +525,7 @@ void iommu_flush_all(void) struct acpi_drhd_unit *drhd; struct iommu *iommu; - wbinvd(); + flush_all_cache(); for_each_drhd_unit ( drhd ) { iommu = drhd->iommu; @@ -962,8 +962,7 @@ static int iommu_alloc(struct acpi_drhd_ return -ENOMEM; } - set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, drhd->address); - iommu->reg = (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus); + iommu->reg = map_to_nocache_virt(nr_iommus, drhd->address); iommu->index = nr_iommus++; iommu->cap = dmar_readq(iommu->reg, DMAR_CAP_REG); @@ -1768,7 +1767,7 @@ int intel_vtd_setup(void) return -ENODEV; spin_lock_init(&domid_bitmap_lock); - clflush_size = get_clflush_size(); + clflush_size = get_cache_line_size(); for_each_drhd_unit ( drhd ) if ( iommu_alloc(drhd) != 0 ) diff -r 98d5370fec1a -r e4bddd01cb3e xen/drivers/passthrough/vtd/vtd.h --- a/xen/drivers/passthrough/vtd/vtd.h Mon Oct 13 10:08:36 2008 +0100 +++ b/xen/drivers/passthrough/vtd/vtd.h Mon Oct 13 10:09:09 2008 +0100 @@ -97,7 +97,10 @@ struct msi_msg_remap_entry { u32 data; /* msi message data */ }; -unsigned int get_clflush_size(void); +unsigned int get_cache_line_size(void); +void cacheline_flush(char *); +void flush_all_cache(void); +void *map_to_nocache_virt(int nr_iommus, u64 maddr); u64 alloc_pgtable_maddr(void); void free_pgtable_maddr(u64 maddr); void *map_vtd_domain_page(u64 maddr); diff -r 98d5370fec1a -r e4bddd01cb3e xen/drivers/passthrough/vtd/x86/vtd.c --- a/xen/drivers/passthrough/vtd/x86/vtd.c Mon Oct 13 10:08:36 2008 +0100 +++ b/xen/drivers/passthrough/vtd/x86/vtd.c Mon Oct 13 10:09:09 2008 +0100 @@ -60,9 +60,25 @@ void free_pgtable_maddr(u64 maddr) free_domheap_page(maddr_to_page(maddr)); } -unsigned int get_clflush_size(void) +unsigned int get_cache_line_size(void) { return ((cpuid_ebx(1) >> 8) & 0xff) * 8; +} + +void cacheline_flush(char * addr) +{ + clflush(addr); +} + +void flush_all_cache() +{ + wbinvd(); +} + +void *map_to_nocache_virt(int nr_iommus, u64 maddr) +{ + set_fixmap_nocache(FIX_IOMMU_REGS_BASE_0 + nr_iommus, maddr); + return (void *)fix_to_virt(FIX_IOMMU_REGS_BASE_0 + nr_iommus); } struct hvm_irq_dpci *domain_get_irq_dpci(struct domain *domain) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |