Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 154087
b: refs/heads/master
c: c4658b4
h: refs/heads/master
i:
  154085: 3f53d09
  154083: 25de567
  154079: 236a767
v: v3
  • Loading branch information
Weidong Han authored and David Woodhouse committed Jun 23, 2009
1 parent a214951 commit f1c9ba2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 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: 2c2e2c389d03bb16b8cdf9db3ac615385fac100f
refs/heads/master: c4658b4e777bebf69884f4884a9bfb2f84dd71d9
40 changes: 26 additions & 14 deletions trunk/drivers/pci/intr_remapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ int modify_irte(int irq, struct irte *irte_modified)
index = irq_iommu->irte_index + irq_iommu->sub_handle;
irte = &iommu->ir_table->base[index];

set_64bit((unsigned long *)irte, irte_modified->low);
set_64bit((unsigned long *)&irte->low, irte_modified->low);
set_64bit((unsigned long *)&irte->high, irte_modified->high);
__iommu_flush_cache(iommu, irte, sizeof(*irte));

rc = qi_flush_iec(iommu, index, 0);
Expand Down Expand Up @@ -369,12 +370,32 @@ struct intel_iommu *map_dev_to_ir(struct pci_dev *dev)
return drhd->iommu;
}

static int clear_entries(struct irq_2_iommu *irq_iommu)
{
struct irte *start, *entry, *end;
struct intel_iommu *iommu;
int index;

if (irq_iommu->sub_handle)
return 0;

iommu = irq_iommu->iommu;
index = irq_iommu->irte_index + irq_iommu->sub_handle;

start = iommu->ir_table->base + index;
end = start + (1 << irq_iommu->irte_mask);

for (entry = start; entry < end; entry++) {
set_64bit((unsigned long *)&entry->low, 0);
set_64bit((unsigned long *)&entry->high, 0);
}

return qi_flush_iec(iommu, index, irq_iommu->irte_mask);
}

int free_irte(int irq)
{
int rc = 0;
int index, i;
struct irte *irte;
struct intel_iommu *iommu;
struct irq_2_iommu *irq_iommu;
unsigned long flags;

Expand All @@ -385,16 +406,7 @@ int free_irte(int irq)
return -1;
}

iommu = irq_iommu->iommu;

index = irq_iommu->irte_index + irq_iommu->sub_handle;
irte = &iommu->ir_table->base[index];

if (!irq_iommu->sub_handle) {
for (i = 0; i < (1 << irq_iommu->irte_mask); i++)
set_64bit((unsigned long *)(irte + i), 0);
rc = qi_flush_iec(iommu, index, irq_iommu->irte_mask);
}
rc = clear_entries(irq_iommu);

irq_iommu->iommu = NULL;
irq_iommu->irte_index = 0;
Expand Down

0 comments on commit f1c9ba2

Please sign in to comment.