Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138785
b: refs/heads/master
c: 1531a6a
h: refs/heads/master
i:
  138783: d3e0bee
v: v3
  • Loading branch information
Suresh Siddha authored and H. Peter Anvin committed Mar 17, 2009
1 parent a7eb87c commit e554461
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 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: eba67e5da6e971993b2899d2cdf459ce77d3dbc5
refs/heads/master: 1531a6a6b81a4e6f9eec9a5608758a6ea14b96e0
5 changes: 1 addition & 4 deletions trunk/drivers/pci/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,
}

#define PRIMARY_FAULT_REG_LEN (16)
static irqreturn_t dmar_fault(int irq, void *dev_id)
irqreturn_t dmar_fault(int irq, void *dev_id)
{
struct intel_iommu *iommu = dev_id;
int reg, fault_index;
Expand Down Expand Up @@ -1074,9 +1074,6 @@ int dmar_set_interrupt(struct intel_iommu *iommu)
return 0;
}

/* Force fault register is cleared */
dmar_fault(irq, iommu);

ret = request_irq(irq, dmar_fault, 0, iommu->name, iommu);
if (ret)
printk(KERN_ERR "IOMMU: can't request irq\n");
Expand Down
29 changes: 29 additions & 0 deletions trunk/drivers/pci/intel-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1855,11 +1855,40 @@ static int __init init_dmars(void)
}
}

/*
* Start from the sane iommu hardware state.
*/
for_each_drhd_unit(drhd) {
if (drhd->ignored)
continue;

iommu = drhd->iommu;

/*
* If the queued invalidation is already initialized by us
* (for example, while enabling interrupt-remapping) then
* we got the things already rolling from a sane state.
*/
if (iommu->qi)
continue;

/*
* Clear any previous faults.
*/
dmar_fault(-1, iommu);
/*
* Disable queued invalidation if supported and already enabled
* before OS handover.
*/
dmar_disable_qi(iommu);
}

for_each_drhd_unit(drhd) {
if (drhd->ignored)
continue;

iommu = drhd->iommu;

if (dmar_enable_qi(iommu)) {
/*
* Queued Invalidate not enabled, use Register Based
Expand Down
17 changes: 17 additions & 0 deletions trunk/drivers/pci/intr_remapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,23 @@ int __init enable_intr_remapping(int eim)
struct dmar_drhd_unit *drhd;
int setup = 0;

for_each_drhd_unit(drhd) {
struct intel_iommu *iommu = drhd->iommu;

/*
* Clear previous faults.
*/
dmar_fault(-1, iommu);

/*
* Disable intr remapping and queued invalidation, if already
* enabled prior to OS handover.
*/
disable_intr_remapping(iommu);

dmar_disable_qi(iommu);
}

/*
* check for the Interrupt-remapping support
*/
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/dmar.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/acpi.h>
#include <linux/types.h>
#include <linux/msi.h>
#include <linux/irqreturn.h>

#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
struct intel_iommu;
Expand Down Expand Up @@ -125,6 +126,7 @@ extern void dmar_msi_mask(unsigned int irq);
extern void dmar_msi_read(int irq, struct msi_msg *msg);
extern void dmar_msi_write(int irq, struct msi_msg *msg);
extern int dmar_set_interrupt(struct intel_iommu *iommu);
extern irqreturn_t dmar_fault(int irq, void *dev_id);
extern int arch_setup_dmar_msi(unsigned int irq);

#ifdef CONFIG_DMAR
Expand Down

0 comments on commit e554461

Please sign in to comment.