diff options
author | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2011-08-30 17:02:33 +0100 |
---|---|---|
committer | Ian Jackson <Ian.Jackson@eu.citrix.com> | 2011-08-30 17:02:33 +0100 |
commit | ddb832668d9e5c33b2175c76bf559f574e8813e6 (patch) | |
tree | 94c6f487dfad9182fad9a20c256dc0c7dc3958a7 | |
parent | a4141cdc781445314189874771929a6bd1dc89b0 (diff) | |
parent | eacb075f65ca88c0ef17d672527733257ba96589 (diff) | |
download | xen-ddb832668d9e5c33b2175c76bf559f574e8813e6.tar.gz xen-ddb832668d9e5c33b2175c76bf559f574e8813e6.tar.bz2 xen-ddb832668d9e5c33b2175c76bf559f574e8813e6.zip |
Merge
-rw-r--r-- | xen/Makefile | 2 | ||||
-rw-r--r-- | xen/drivers/passthrough/iommu.c | 4 | ||||
-rw-r--r-- | xen/drivers/passthrough/vtd/iommu.c | 18 | ||||
-rw-r--r-- | xen/include/xen/iommu.h | 3 |
4 files changed, 16 insertions, 11 deletions
diff --git a/xen/Makefile b/xen/Makefile index 572cfc8f5c..ec94a114fa 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -2,7 +2,7 @@ # All other places this is stored (eg. compile.h) should be autogenerated. export XEN_VERSION = 4 export XEN_SUBVERSION = 1 -export XEN_EXTRAVERSION ?= .2-rc1$(XEN_VENDORVERSION) +export XEN_EXTRAVERSION ?= .2-rc2-pre$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 793aa8225a..9ac0d4e081 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -82,6 +82,8 @@ static void __init parse_iommu_param(char *s) iommu_passthrough = 1; else if ( !strcmp(s, "dom0-strict") ) iommu_dom0_strict = 1; + else if ( !strcmp(s, "sharept") ) + iommu_hap_pt_share = 1; s = ss + 1; } while ( ss ); @@ -175,7 +177,7 @@ int assign_device(struct domain *d, u8 bus, u8 devfn) if ( has_arch_pdevs(d) && !need_iommu(d) ) { d->need_iommu = 1; - if ( !iommu_hap_pt_share ) + if ( !iommu_use_hap_pt(d) ) rc = iommu_populate_page_table(d); goto done; } diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index b299495e54..d614a1a725 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1622,7 +1622,7 @@ void iommu_domain_teardown(struct domain *d) if ( list_empty(&acpi_drhd_units) ) return; - if ( iommu_hap_pt_share ) + if ( iommu_use_hap_pt(d) ) return; spin_lock(&hd->mapping_lock); @@ -1644,7 +1644,7 @@ static int intel_iommu_map_page( int iommu_domid; /* Do nothing if VT-d shares EPT page table */ - if ( iommu_hap_pt_share ) + if ( iommu_use_hap_pt(d) ) return 0; /* do nothing if dom0 and iommu supports pass thru */ @@ -1748,15 +1748,15 @@ void iommu_pte_flush(struct domain *d, u64 gfn, u64 *pte, static int vtd_ept_page_compatible(struct iommu *iommu) { - u64 cap = iommu->cap; + u64 ept_cap, vtd_cap = iommu->cap; - if ( ept_has_2mb(cpu_has_vmx_ept_2mb) != cap_sps_2mb(cap) ) + /* EPT is not initialised yet, so we must check the capability in + * the MSR explicitly rather than use cpu_has_vmx_ept_*() */ + if ( rdmsr_safe(MSR_IA32_VMX_EPT_VPID_CAP, ept_cap) != 0 ) return 0; - if ( ept_has_1gb(cpu_has_vmx_ept_1gb) != cap_sps_1gb(cap) ) - return 0; - - return 1; + return ( ept_has_2mb(ept_cap) == cap_sps_2mb(vtd_cap) + && ept_has_1gb(ept_cap) == cap_sps_1gb(vtd_cap) ); } /* @@ -1769,7 +1769,7 @@ void iommu_set_pgd(struct domain *d) ASSERT( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled ); - if ( !iommu_hap_pt_share ) + if ( !iommu_use_hap_pt(d) ) return; pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d))); diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 76925b28f1..d6099d92ec 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -34,6 +34,9 @@ extern bool_t iommu_hap_pt_share; extern bool_t amd_iommu_debug; extern bool_t amd_iommu_perdev_intremap; +/* Does this domain have a P2M table we can use as its IOMMU pagetable? */ +#define iommu_use_hap_pt(d) (hap_enabled(d) && iommu_hap_pt_share) + extern struct rangeset *mmio_ro_ranges; #define domain_hvm_iommu(d) (&d->arch.hvm_domain.hvm_iommu) |