Hi,
Attached patch may help. This is extracted from my previous patch.
- set vector_to_iommu[vector] before calling request_vector
since null pointer exceptions occurs
Thanks,
Kouya
Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
diff -r 32b154137492 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c Thu Feb 12 10:54:17 2009 +0000
+++ b/xen/drivers/passthrough/amd/iommu_init.c Fri Feb 13 09:22:41 2009 +0900
@@ -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 32b154137492 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c Thu Feb 12 10:54:17 2009 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c Fri Feb 13 09:22:41 2009 +0900
@@ -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;
}
Kay, Allen M writes:
> Interrupt handling cleanup in changeset 19195 is causing following failure on
> my system:
>
> (XEN) ----[ Xen-3.4-unstable x86_64 debug=y Not tainted ]----
> (XEN) CPU: 0
> (XEN) RIP: e008:[<ffff828c8011b591>] check_lock+0x19/0x4e
> (XEN) RFLAGS: 0000000000010046 CONTEXT: hypervisor
> (XEN) rax: 0000000000000001 rbx: 0000000000000040 rcx: 0000000000000001
> (XEN) rdx: 0000000000000082 rsi: 0000000000000001 rdi: 0000000000000044
> (XEN) rbp: ffff828c80277c58 rsp: ffff828c80277c58 r8: 0000000000000005
> (XEN) r9: 0000000000000001 r10: 0000000000000001 r11: 0000000000000000
> (XEN) r12: 0000000000000082 r13: 0000000000000282 r14: 0000000000000090
> (XEN) r15: ffff83007f2c4160 cr0: 000000008005003b cr4: 00000000000026f0
> (XEN) cr3: 000000007f47c000 cr2: 0000000000000044
> (XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: 0000 cs: e008
> (XEN) Xen stack trace from rsp=ffff828c80277c58:
> (XEN) ffff828c80277c78 ffff828c8011b70c 0000000000000000 0000000000000040
> (XEN) ffff828c80277c98 ffff828c8012df24 ffff828c802a1c00 ffff828c802a1c24
> (XEN) ffff828c80277ca8 ffff828c8012df83 ffff828c80277ce8 ffff828c80147cc0
> (XEN) ffff828c80277ce8 00000000fffffff4 0000000000000090 ffff828c8012e639
> (XEN) ffff828c801e2191 ffff83007f4d9df0 ffff828c80277d28 ffff828c801481fa
> (XEN) ffff83007f2c4160 0000000000000090 ffff83007f4d9df0 0000000000004800
> (XEN) ffff83007f4d9df0 ffff828c8029d400 ffff828c80277d68 ffff828c8012e2f0
> (XEN) ffff828c80277d48 0000000000000000 ffff83007f4d9df0 0000000000000282
> (XEN) ffff83007f6df130 0000000000100000 ffff828c80277d98 ffff828c8012e4a2
> (XEN) 0000000000000000 ffff83007f4d9df0 ffff828c8020b8b0 0000000000000020
> (XEN) ffff828c80277de8 ffff828c8012fb38 ffff828c80277dd8 ffff828c8012a183
> (XEN) 0000000000000004 00010001802093c0 0001000100010001 00000000ffffffed
> (XEN) ffff828c8022ec08 0000000000000017 ffff828c80277e08 ffff828c8012be18
> (XEN) ffff828c80277e08 ffff828c8022eaf8 ffff828c80277f18 ffff828c80222ca8
> (XEN) 0000000000000000 0000000000000000 0000000000000000 ffff828c8020e675
> (XEN) ffffffffc0270000 ffff83007f47cff8 ffff83007f47dff8 000000000020e610
> (XEN) 000000000008bf60 0000000000000000 0000000000000000 0000000000000000
> (XEN) ffff83000008bfc0 ffff83000008bf60 0000000000b0c800 0000000000000000
> (XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> (XEN) 0000000000000000 0000000000000000 0000000800000000 000000010000006e
> (XEN) Xen call trace:
> (XEN) [<ffff828c8011b591>] check_lock+0x19/0x4e
> (XEN) [<ffff828c8011b70c>] _spin_lock_irqsave+0x21/0x3f
> (XEN) [<ffff828c8012df24>] dma_msi_unmask+0x2a/0x4b
> (XEN) [<ffff828c8012df83>] dma_msi_startup+0x9/0x10
> (XEN) [<ffff828c80147cc0>] setup_irq_vector+0x73/0x99
> (XEN) [<ffff828c801481fa>] request_irq_vector+0x6c/0x9a
> (XEN) [<ffff828c8012e2f0>] iommu_set_interrupt+0x97/0x10f
> (XEN) [<ffff828c8012e4a2>] init_vtd_hw+0x13a/0x2d1
> (XEN) [<ffff828c8012fb38>] intel_vtd_setup+0x332/0x4bd
> (XEN) [<ffff828c8012be18>] iommu_setup+0x2d/0xf5
> (XEN) [<ffff828c80222ca8>] __start_xen+0x457d/0x4895
> (XEN)
> (XEN) Pagetable walk from 0000000000000044:
> (XEN) L4[0x000] = 000000007f706063 5555555555555555
> (XEN) L3[0x000] = 000000007e6f1063 5555555555555555
> (XEN) L2[0x000] = 000000007e6f0063 5555555555555555
> (XEN) L1[0x000] = 0000000000000000 ffffffffffffffff
> (XEN)
> (XEN) ****************************************
> (XEN) Panic on CPU 0:
> (XEN) FATAL PAGE FAULT
> (XEN) [error_code=0000]
> (XEN) Faulting linear address: 0000000000000044
> (XEN) ****************************************
> (XEN)
> (XEN) Reboot in five seconds...
>
> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Kouya Shimura
> Sent: Wednesday, February 11, 2009 7:00 PM
> To: xen-devel@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-devel] [PATCH] fix iommu interrupt setup
>
> iommu is disabled since cset 19175:ab514cfbcdc5 with the following message:
>
> (XEN) [VT-D]iommu.c:890:d32767 IOMMU: can't request irq
> (XEN) [VT-D]iommu.c:1686:d32767 IOMMU: interrupt setup failed
> (XEN) I/O virtualisation disabled
>
> This patch fixes it.
> - rename request_irq to request_vector, no conversion by irq_to_vector(irq)
> - set vector_to_iommu[vector] before calling request_vector
> since null pointer exceptions occurs
> - some cleanups
>
> Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|