From: Ross Philipson Date: Wed, 4 Mar 2009 15:12:44 +0000 (-0500) Subject: Modification to RMRR workaround to include all 4GB when X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e8f0738ee222290343f60068ee80e3e14bcb7396;p=xenclient%2Fxen.git Modification to RMRR workaround to include all 4GB when iommu_inclusive_mapping=1. This handles cases where max usable RAM is potentially less than some reserved ranges. modified: xen/drivers/passthrough/vtd/iommu.c --- diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 5bfedbb..bb1ec8d 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1029,6 +1029,7 @@ static int intel_iommu_domain_init(struct domain *d) struct hvm_iommu *hd = domain_hvm_iommu(d); struct iommu *iommu = NULL; struct acpi_drhd_unit *drhd; + unsigned long max_pfn; u64 i; drhd = list_entry(acpi_drhd_units.next, typeof(*drhd), list); @@ -1036,6 +1037,11 @@ static int intel_iommu_domain_init(struct domain *d) hd->agaw = width_to_agaw(DEFAULT_DOMAIN_ADDRESS_WIDTH); + if (!iommu_inclusive_mapping) + max_pfn = max_page; + else + max_pfn = max(max_page, (unsigned long)(0x100000000 >> PAGE_SHIFT)); + if ( d->domain_id == 0 ) { extern int xen_in_range(paddr_t start, paddr_t end); @@ -1044,7 +1050,7 @@ static int intel_iommu_domain_init(struct domain *d) * Set up 1:1 page table for dom0 except the critical segments * like Xen and tboot. */ - for ( i = 0; i < max_page; i++ ) + for ( i = 0; i < max_pfn; i++ ) { /* Set up 1:1 mapping for dom0 */ if ( !page_is_ram_type(i, RAM_TYPE_CONVENTIONAL) ) @@ -1053,7 +1059,7 @@ static int intel_iommu_domain_init(struct domain *d) if (iommu_inclusive_mapping) { /* When set, the inclusive mapping maps in everything below 4GB except unusable ranges */ - if ( (i >= 0x100000) || page_is_ram_type(i, RAM_TYPE_UNUSABLE) ) + if ( page_is_ram_type(i, RAM_TYPE_UNUSABLE) ) continue; } else