From: Wei Wang2 Subject: [PATCH] AMD IOMMU: Enable MSI for hvm guest Date: Wed, 11 Jun 2008 16:16:21 +0200 Message-ID: <1213193781.26611.81.camel@gran.amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-gAy/teqUHNbbOcxwbX5y" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org --=-gAy/teqUHNbbOcxwbX5y Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Attached patch enables MSI interrupt mode for hvm guest on AMD IOMMU systems. -Wei Signed-off-by: Wei Wang --=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=C3=A4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=C3=A4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=C3=A4ftsf=C3=BChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy=20 --=-gAy/teqUHNbbOcxwbX5y Content-Disposition: attachment; filename=iommu_msi.patch Content-Type: text/x-patch; name=iommu_msi.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit diff -r fea8582fc8a1 xen/arch/x86/hvm/svm/intr.c --- a/xen/arch/x86/hvm/svm/intr.c Wed Jun 11 16:05:41 2008 +0200 +++ b/xen/arch/x86/hvm/svm/intr.c Wed Jun 11 16:05:55 2008 +0200 @@ -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); } } --=-gAy/teqUHNbbOcxwbX5y Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-gAy/teqUHNbbOcxwbX5y--