diff mbox

[kvm-unit-tests,7/8] intel-iommu: allow setup trigger mode for irte

Message ID 1483088160-6714-8-git-send-email-peterx@redhat.com
State New
Headers show

Commit Message

Peter Xu Dec. 30, 2016, 8:55 a.m. UTC
IOAPIC interrupts need this. Let's be prepared.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 lib/x86/intel-iommu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/lib/x86/intel-iommu.c b/lib/x86/intel-iommu.c
index a3ce678..0585248 100644
--- a/lib/x86/intel-iommu.c
+++ b/lib/x86/intel-iommu.c
@@ -250,13 +250,13 @@  static uint16_t vtd_intr_index_alloc(void)
 }
 
 static void vtd_setup_irte(struct pci_dev *dev, vtd_irte_t *irte,
-			   int vector, int dest_id)
+			   int vector, int dest_id, trigger_mode_t trigger)
 {
 	assert(sizeof(vtd_irte_t) == 16);
 	memset(irte, 0, sizeof(*irte));
 	irte->fault_disable = 1;
 	irte->dest_mode = 0;	 /* physical */
-	irte->trigger_mode = 0;	 /* edge */
+	irte->trigger_mode = trigger;
 	irte->delivery_mode = 0; /* fixed */
 	irte->irte_mode = 0;	 /* remapped */
 	irte->vector = vector;
@@ -301,7 +301,9 @@  bool vtd_setup_msi(struct pci_dev *dev, int vector, int dest_id)
 	assert(sizeof(vtd_msi_addr_t) == 8);
 	assert(sizeof(vtd_msi_data_t) == 4);
 
-	vtd_setup_irte(dev, irte + index, vector, dest_id);
+	/* Use edge irq as default */
+	vtd_setup_irte(dev, irte + index, vector,
+		       dest_id, TRIGGER_EDGE);
 
 	msi_addr.handle_15 = index >> 15 & 1;
 	msi_addr.shv = 0;