Skip to contentSkip to conversation

AMD IOMMU: Enable MSI for hvm guest

PATCH New Wei Wang2 1 participant 1 message Jun 11, 2008

lore
Share & tools
lore

Wei Wang2

author
#0 lore raw

PATCH 1/1 AMD IOMMU: Enable MSI for hvm guest

Attached patch enables MSI interrupt mode for hvm guest on AMD IOMMU systems.

-Wei

Signature · 12 lines
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy 
xen/arch/x86/hvm/svm/intr.c +14 -2
diff -r fea8582fc8a1 xen/arch/x86/hvm/svm/intr.c
@@ -100,6 +100,12 @@ static void enable_intr_window(struct vc
     vmcb->general1_intercepts |= GENERAL1_INTERCEPT_VINTR;
 }
 
+extern int vmsi_deliver(struct domain *d, int pirq);
+static int hvm_pci_msi_assert(struct domain *d, int pirq)
+{
+    return vmsi_deliver(d, pirq);
+}
+
 static void svm_dirq_assist(struct vcpu *v)
 {
     unsigned int irq;
@@ -118,7 +124,13 @@ static void svm_dirq_assist(struct vcpu 
         if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
             continue;
 
-        stop_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(irq)]);
+        if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) )
+        {
+            hvm_pci_msi_assert(d, irq);
+            continue;
+        }
+
+        stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]);
 
         list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list )
         {
@@ -137,7 +149,7 @@ static void svm_dirq_assist(struct vcpu 
          * guest will never deal with the irq, then the physical interrupt line
          * will never be deasserted.
          */
-        set_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(irq)],
+        set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)],
                   NOW() + PT_IRQ_TIME_OUT);
     }
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel