# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1234517818 0
# Node ID 9ac547ed9455a20a1d0385cfc1f4ab4862860df4
# Parent 766b3763ad1b9b9af67de41cebdcd14739da7b70
iommu: Fix interrupt setup.
Set vector_to_iommu[vector] before calling request_vector since null
pointer exceptions occur.
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
xen/drivers/passthrough/amd/iommu_init.c | 3 ++-
xen/drivers/passthrough/vtd/iommu.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff -r 766b3763ad1b -r 9ac547ed9455 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c Fri Feb 13 09:33:58 2009 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c Fri Feb 13 09:36:58 2009 +0000
@@ -487,11 +487,13 @@ static int set_iommu_interrupt_handler(s
}
irq_desc[vector].handler = &iommu_msi_type;
+ vector_to_iommu[vector] = iommu;
ret = request_irq_vector(vector, amd_iommu_page_fault, 0,
"amd_iommu", iommu);
if ( ret )
{
irq_desc[vector].handler = &no_irq_type;
+ vector_to_iommu[vector] = NULL;
free_irq_vector(vector);
amd_iov_error("can't request irq\n");
return 0;
@@ -499,7 +501,6 @@ static int set_iommu_interrupt_handler(s
/* Make sure that vector is never re-used. */
vector_irq[vector] = NEVER_ASSIGN_IRQ;
- vector_to_iommu[vector] = iommu;
iommu->vector = vector;
return vector;
}
diff -r 766b3763ad1b -r 9ac547ed9455 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Fri Feb 13 09:33:58 2009 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c Fri Feb 13 09:36:58 2009 +0000
@@ -870,7 +870,7 @@ static struct hw_interrupt_type dma_msi_
.set_affinity = dma_msi_set_affinity,
};
-int iommu_set_interrupt(struct iommu *iommu)
+static int iommu_set_interrupt(struct iommu *iommu)
{
int vector, ret;
@@ -882,10 +882,12 @@ int iommu_set_interrupt(struct iommu *io
}
irq_desc[vector].handler = &dma_msi_type;
+ vector_to_iommu[vector] = iommu;
ret = request_irq_vector(vector, iommu_page_fault, 0, "dmar", iommu);
if ( ret )
{
irq_desc[vector].handler = &no_irq_type;
+ vector_to_iommu[vector] = NULL;
free_irq_vector(vector);
gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: can't request irq\n");
return ret;
@@ -893,7 +895,6 @@ int iommu_set_interrupt(struct iommu *io
/* Make sure that vector is never re-used. */
vector_irq[vector] = NEVER_ASSIGN_IRQ;
- vector_to_iommu[vector] = iommu;
return vector;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|