ia64/xen-unstable
changeset 18660:6eb23f7ece78
Add some necessary files to build IA64 VT-d.
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Mon Oct 20 15:15:19 2008 +0100 (2008-10-20) |
parents | d752eaa7c1db |
children | 6ca065624051 |
files | xen/drivers/Makefile xen/drivers/passthrough/Makefile xen/drivers/passthrough/vtd/Makefile xen/drivers/passthrough/vtd/ia64/Makefile xen/drivers/passthrough/vtd/ia64/vtd.c |
line diff
1.1 --- a/xen/drivers/Makefile Mon Oct 20 15:14:55 2008 +0100 1.2 +++ b/xen/drivers/Makefile Mon Oct 20 15:15:19 2008 +0100 1.3 @@ -1,6 +1,6 @@ 1.4 subdir-y += char 1.5 subdir-y += cpufreq 1.6 subdir-y += pci 1.7 -subdir-$(x86) += passthrough 1.8 +subdir-y += passthrough 1.9 subdir-$(HAS_ACPI) += acpi 1.10 subdir-$(HAS_VGA) += video
2.1 --- a/xen/drivers/passthrough/Makefile Mon Oct 20 15:14:55 2008 +0100 2.2 +++ b/xen/drivers/passthrough/Makefile Mon Oct 20 15:15:19 2008 +0100 2.3 @@ -1,4 +1,5 @@ 2.4 subdir-$(x86) += vtd 2.5 +subdir-$(ia64) += vtd 2.6 subdir-$(x86) += amd 2.7 2.8 obj-y += iommu.o
3.1 --- a/xen/drivers/passthrough/vtd/Makefile Mon Oct 20 15:14:55 2008 +0100 3.2 +++ b/xen/drivers/passthrough/vtd/Makefile Mon Oct 20 15:15:19 2008 +0100 3.3 @@ -1,4 +1,5 @@ 3.4 subdir-$(x86) += x86 3.5 +subdir-$(ia64) += ia64 3.6 3.7 obj-y += iommu.o 3.8 obj-y += dmar.o
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/xen/drivers/passthrough/vtd/ia64/Makefile Mon Oct 20 15:15:19 2008 +0100 4.3 @@ -0,0 +1,1 @@ 4.4 +obj-y += vtd.o
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/xen/drivers/passthrough/vtd/ia64/vtd.c Mon Oct 20 15:15:19 2008 +0100 5.3 @@ -0,0 +1,112 @@ 5.4 +/* 5.5 + * Copyright (c) 2008, Intel Corporation. 5.6 + * 5.7 + * This program is free software; you can redistribute it and/or modify it 5.8 + * under the terms and conditions of the GNU General Public License, 5.9 + * version 2, as published by the Free Software Foundation. 5.10 + * 5.11 + * This program is distributed in the hope it will be useful, but WITHOUT 5.12 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 5.14 + * more details. 5.15 + * 5.16 + * You should have received a copy of the GNU General Public License along with 5.17 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 5.18 + * Place - Suite 330, Boston, MA 02111-1307 USA. 5.19 + * 5.20 + * Copyright (C) Allen Kay <allen.m.kay@intel.com> 5.21 + * Copyright (C) Weidong Han <weidong.han@intel.com> 5.22 + */ 5.23 + 5.24 +#include <xen/sched.h> 5.25 +#include <xen/domain_page.h> 5.26 +#include <xen/iommu.h> 5.27 +#include <asm/xensystem.h> 5.28 +#include <asm/sal.h> 5.29 +#include "../iommu.h" 5.30 +#include "../dmar.h" 5.31 +#include "../vtd.h" 5.32 + 5.33 + 5.34 +int vector_irq[NR_VECTORS] __read_mostly = { [0 ... NR_VECTORS - 1] = -1}; 5.35 +/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */ 5.36 +u8 irq_vector[NR_IRQ_VECTORS] __read_mostly; 5.37 + 5.38 +void *map_vtd_domain_page(u64 maddr) 5.39 +{ 5.40 + return (void *)((u64)map_domain_page(maddr >> PAGE_SHIFT) | 5.41 + (maddr & (PAGE_SIZE - PAGE_SIZE_4K))); 5.42 +} 5.43 + 5.44 +void unmap_vtd_domain_page(void *va) 5.45 +{ 5.46 + unmap_domain_page(va); 5.47 +} 5.48 + 5.49 +/* Allocate page table, return its machine address */ 5.50 +u64 alloc_pgtable_maddr(void) 5.51 +{ 5.52 + struct page_info *pg; 5.53 + u64 *vaddr; 5.54 + 5.55 + pg = alloc_domheap_page(NULL, 0); 5.56 + vaddr = map_domain_page(page_to_mfn(pg)); 5.57 + if ( !vaddr ) 5.58 + return 0; 5.59 + memset(vaddr, 0, PAGE_SIZE); 5.60 + 5.61 + iommu_flush_cache_page(vaddr); 5.62 + unmap_domain_page(vaddr); 5.63 + 5.64 + return page_to_maddr(pg); 5.65 +} 5.66 + 5.67 +void free_pgtable_maddr(u64 maddr) 5.68 +{ 5.69 + if ( maddr != 0 ) 5.70 + free_domheap_page(maddr_to_page(maddr)); 5.71 +} 5.72 + 5.73 +unsigned int get_cache_line_size(void) 5.74 +{ 5.75 + return L1_CACHE_BYTES; 5.76 +} 5.77 + 5.78 +void cacheline_flush(char * addr) 5.79 +{ 5.80 + ia64_fc(addr); 5.81 + ia64_sync_i(); 5.82 + ia64_srlz_i(); 5.83 +} 5.84 + 5.85 +void flush_all_cache() 5.86 +{ 5.87 + ia64_sal_cache_flush(3); 5.88 +} 5.89 + 5.90 +void * map_to_nocache_virt(int nr_iommus, u64 maddr) 5.91 +{ 5.92 + return (void *) ( maddr + __IA64_UNCACHED_OFFSET); 5.93 +} 5.94 + 5.95 +struct hvm_irq_dpci *domain_get_irq_dpci(struct domain *domain) 5.96 +{ 5.97 + if ( !domain ) 5.98 + return NULL; 5.99 + 5.100 + return domain->arch.hvm_domain.irq.dpci; 5.101 +} 5.102 + 5.103 +int domain_set_irq_dpci(struct domain *domain, struct hvm_irq_dpci *dpci) 5.104 +{ 5.105 + if ( !domain || !dpci ) 5.106 + return 0; 5.107 + 5.108 + domain->arch.hvm_domain.irq.dpci = dpci; 5.109 + return 1; 5.110 +} 5.111 + 5.112 +void hvm_dpci_isairq_eoi(struct domain *d, unsigned int isairq) 5.113 +{ 5.114 + /* dummy */ 5.115 +}