Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373555
b: refs/heads/master
c: 3a93c84
h: refs/heads/master
i:
  373553: 58e6f46
  373551: 212879f
v: v3
  • Loading branch information
Takao Indoh authored and Joerg Roedel committed Apr 23, 2013
1 parent 60452fa commit 99a1836
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35d3d814cbd46a85bed97cd74ba97fbbb51e0ccd
refs/heads/master: 3a93c841c2b3b14824f7728dd74bd00a1cedb806
11 changes: 10 additions & 1 deletion trunk/drivers/iommu/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ static int map_iommu(struct intel_iommu *iommu, u64 phys_addr)
int alloc_iommu(struct dmar_drhd_unit *drhd)
{
struct intel_iommu *iommu;
u32 ver;
u32 ver, sts;
static int iommu_allocated = 0;
int agaw = 0;
int msagaw = 0;
Expand Down Expand Up @@ -695,6 +695,15 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
(unsigned long long)iommu->cap,
(unsigned long long)iommu->ecap);

/* Reflect status in gcmd */
sts = readl(iommu->reg + DMAR_GSTS_REG);
if (sts & DMA_GSTS_IRES)
iommu->gcmd |= DMA_GCMD_IRE;
if (sts & DMA_GSTS_TES)
iommu->gcmd |= DMA_GCMD_TE;
if (sts & DMA_GSTS_QIES)
iommu->gcmd |= DMA_GCMD_QIE;

raw_spin_lock_init(&iommu->register_lock);

drhd->iommu = iommu;
Expand Down
15 changes: 15 additions & 0 deletions trunk/drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3665,6 +3665,7 @@ static struct notifier_block device_nb = {
int __init intel_iommu_init(void)
{
int ret = 0;
struct dmar_drhd_unit *drhd;

/* VT-d is required for a TXT/tboot launch, so enforce that */
force_on = tboot_force_iommu();
Expand All @@ -3675,6 +3676,20 @@ int __init intel_iommu_init(void)
return -ENODEV;
}

/*
* Disable translation if already enabled prior to OS handover.
*/
for_each_drhd_unit(drhd) {
struct intel_iommu *iommu;

if (drhd->ignored)
continue;

iommu = drhd->iommu;
if (iommu->gcmd & DMA_GCMD_TE)
iommu_disable_translation(iommu);
}

if (dmar_dev_scope_init() < 0) {
if (force_on)
panic("tboot: Failed to initialize DMAR device scope\n");
Expand Down

0 comments on commit 99a1836

Please sign in to comment.