[PATCH kvm-unit-tests 2/5] x86/intel-iommu: properly ack edu interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Writing zero to EDU_REG_INTR_RAISE doesn't clear the status, because
the value is ORed in. The edu spec says that to clear the interrupt,
regardless of using MSI or not, one should write the value of the
interrupt status register to the interrupt acknowledge register from
the interrupt handler.

Cc: Peter Xu <peterx@xxxxxxxxxx>
Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 lib/pci-edu.h     | 2 ++
 x86/intel-iommu.c | 5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/pci-edu.h b/lib/pci-edu.h
index 9fe32c640eee..44b4ba168768 100644
--- a/lib/pci-edu.h
+++ b/lib/pci-edu.h
@@ -32,7 +32,9 @@
 #define EDU_REG_ALIVE               0x4
 #define EDU_REG_FACTORIAL           0x8
 #define EDU_REG_STATUS              0x20
+#define EDU_REG_INTR_STATUS         0x24
 #define EDU_REG_INTR_RAISE          0x60
+#define EDU_REG_INTR_ACK            0x64
 #define EDU_REG_DMA_SRC             0x80
 #define EDU_REG_DMA_DST             0x88
 #define EDU_REG_DMA_COUNT           0x90
diff --git a/x86/intel-iommu.c b/x86/intel-iommu.c
index fa77914524b5..d1fa420aab9e 100644
--- a/x86/intel-iommu.c
+++ b/x86/intel-iommu.c
@@ -67,6 +67,8 @@ static void edu_isr(isr_regs_t *regs)
 {
 	edu_intr_recved = true;
 	eoi();
+	edu_reg_writel(&edu_dev, EDU_REG_INTR_ACK,
+			edu_reg_readl(&edu_dev, EDU_REG_INTR_STATUS));
 }
 
 static void vtd_test_ir(void)
@@ -120,9 +122,6 @@ static void vtd_test_ir(void)
 	while (!edu_intr_recved)
 		cpu_relax();
 
-	/* Clear INTR bits */
-	edu_reg_writel(dev, EDU_REG_INTR_RAISE, 0);
-
 	/* We are good as long as we reach here */
 	report(VTD_TEST_IR_MSI, edu_intr_recved == true);
 
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux