# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1194426828 0
# Node ID b544448502a40d510d3ee678c85e7db6b9f9474c
# Parent 14faf0a9412314c028b55b3f6a25b3495cf20eb3
vt-d: Disable PMR on every vt-d engine.
Signed-off-by Gang Wei (Jimmy) <gang.wei@xxxxxxxxx>
Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>
---
xen/arch/x86/hvm/vmx/vtd/intel-iommu.c | 9 ++++-----
xen/arch/x86/hvm/vmx/vtd/utils.c | 15 ++++++++++-----
2 files changed, 14 insertions(+), 10 deletions(-)
diff -r 14faf0a94123 -r b544448502a4 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
--- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Tue Nov 06 16:04:13 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c Wed Nov 07 09:13:48 2007 +0000
@@ -688,6 +688,9 @@ static int iommu_enable_translation(stru
break;
cpu_relax();
}
+
+ /* Disable PMRs when VT-d engine takes effect per spec definition */
+ disable_pmr(iommu);
spin_unlock_irqrestore(&iommu->register_lock, flags);
return 0;
}
@@ -1767,7 +1770,7 @@ int iommu_setup(void)
struct hvm_iommu *hd = domain_hvm_iommu(dom0);
struct acpi_drhd_unit *drhd;
struct iommu *iommu;
- unsigned long i, status;
+ unsigned long i;
if ( !vtd_enabled )
return 0;
@@ -1796,10 +1799,6 @@ int iommu_setup(void)
setup_dom0_rmrr();
if ( enable_vtd_translation() )
goto error;
-
- status = dmar_readl(iommu->reg, DMAR_PMEN_REG);
- if (status & DMA_PMEN_PRS)
- disable_pmr(iommu);
return 0;
diff -r 14faf0a94123 -r b544448502a4 xen/arch/x86/hvm/vmx/vtd/utils.c
--- a/xen/arch/x86/hvm/vmx/vtd/utils.c Tue Nov 06 16:04:13 2007 +0000
+++ b/xen/arch/x86/hvm/vmx/vtd/utils.c Wed Nov 07 09:13:48 2007 +0000
@@ -67,25 +67,30 @@ int vtd_hw_check(void)
/* Disable vt-d protected memory registers. */
void disable_pmr(struct iommu *iommu)
{
- unsigned long start_time, status;
+ unsigned long start_time;
unsigned int val;
val = dmar_readl(iommu->reg, DMAR_PMEN_REG);
+ if ( !(val & DMA_PMEN_PRS) )
+ return;
+
dmar_writel(iommu->reg, DMAR_PMEN_REG, val & ~DMA_PMEN_EPM);
start_time = jiffies;
for ( ; ; )
{
- status = dmar_readl(iommu->reg, DMAR_PMEN_REG);
- if ( (status & DMA_PMEN_PRS) == 0 )
+ val = dmar_readl(iommu->reg, DMAR_PMEN_REG);
+ if ( (val & DMA_PMEN_PRS) == 0 )
break;
+
if ( time_after(jiffies, start_time + DMAR_OPERATION_TIMEOUT) )
- panic("Cannot set QIE field for queue invalidation\n");
+ panic("Disable PMRs timeout\n");
+
cpu_relax();
}
dprintk(XENLOG_INFO VTDPREFIX,
- "disabled protected memory registers\n");
+ "Disabled protected memory registers\n");
}
#if defined(__x86_64__)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|