VT-d: Separate VT-d page table from P2M table

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Keir Fraser committed 2008-05-01 09:53:26 +01:00
1 parent 2023e7a5c4
commit 65bdbfa43a
3 files changed
+26 -21

No files matched your search

+6 -1
View File
@@ -2135,8 +2135,13 @@ class XendDomainInfo:
# set memory limit
xc.domain_setmaxmem(self.domid, maxmem)
# Reserve 1 page per MiB of RAM for separate VT-d page table.
vtd_mem = 4 * (self.info['memory_static_max'] / 1024 / 1024)
# Round vtd_mem up to a multiple of a MiB.
vtd_mem = ((vtd_mem + 1023) / 1024) * 1024
# Make sure there's enough RAM available for the domain
balloon.free(memory + shadow)
balloon.free(memory + shadow + vtd_mem)
# Set up the shadow memory
shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024)
+4 -17
View File
@@ -259,18 +259,10 @@ p2m_set_entry(struct domain *d, unsigned long gfn, mfn_t mfn, p2m_type_t p2mt)
if ( iommu_enabled && is_hvm_domain(d) )
{
if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
{
if ( (p2mt == p2m_mmio_direct) )
iommu_flush(d, gfn, (u64*)p2m_entry);
}
else if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
{
if ( p2mt == p2m_ram_rw )
iommu_map_page(d, gfn, mfn_x(mfn));
else
iommu_unmap_page(d, gfn);
}
if ( p2mt == p2m_ram_rw )
iommu_map_page(d, gfn, mfn_x(mfn));
else
iommu_unmap_page(d, gfn);
}
/* Success */
@@ -529,11 +521,6 @@ int p2m_alloc_table(struct domain *d,
goto error;
}
#if CONFIG_PAGING_LEVELS >= 3
if (vtd_enabled && is_hvm_domain(d))
iommu_set_pgd(d);
#endif
P2M_PRINTK("p2m table initialised (%u pages)\n", page_count);
p2m_unlock(p2m);
return 0;
+16 -3
View File
@@ -671,13 +671,26 @@ void dma_pte_free_pagetable(struct domain *domain, u64 start, u64 end)
}
/* free pgd */
if ( start == 0 && end == ((((u64)1) << addr_width) - 1) )
if ( start == 0 && end >= ((((u64)1) << addr_width) - 1) )
{
free_pgtable_maddr(hd->pgd_maddr);
hd->pgd_maddr = 0;
}
}
/* free all VT-d page tables when shut down or destroy domain. */
static void iommu_free_pagetable(struct domain *domain)
{
struct hvm_iommu *hd = domain_hvm_iommu(domain);
int addr_width = agaw_to_width(hd->agaw);
u64 start, end;
start = 0;
end = (((u64)1) << addr_width) - 1;
dma_pte_free_pagetable(domain, start, end);
}
static int iommu_set_root_entry(struct iommu *iommu)
{
u32 cmd, sts;
@@ -1472,9 +1485,9 @@ void iommu_domain_teardown(struct domain *d)
if ( list_empty(&acpi_drhd_units) )
return;
iommu_domid_release(d);
iommu_free_pgd(d);
iommu_free_pagetable(d);
return_devices_to_dom0(d);
iommu_domid_release(d);
}
static int domain_context_mapped(struct pci_dev *pdev)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.