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

[Xen-changelog] [xen-unstable] PCI passthru various Xen changes.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1190190260 -3600
# Node ID 45548c83daef3c0fce6b9d4dedc39f9422bcc4a0
# Parent  aad813d8a8ad6f9d7d4f0d04a14fe088dd671e96
PCI passthru various Xen changes.
Signed-off-by: Allen Kay <allen.m.kay@xxxxxxxxx>
Signed-off-by: Guy Zana <guy@xxxxxxxxxxxx>
---
 xen/arch/x86/acpi/boot.c               |    6 +++--
 xen/arch/x86/hvm/hvm.c                 |   15 ++++++++-----
 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c |    8 ------
 xen/arch/x86/irq.c                     |   38 ++++++++++++++++++++++++++++++++-
 xen/arch/x86/setup.c                   |    2 +
 xen/include/xen/irq.h                  |    3 ++
 6 files changed, 57 insertions(+), 15 deletions(-)

diff -r aad813d8a8ad -r 45548c83daef xen/arch/x86/acpi/boot.c
--- a/xen/arch/x86/acpi/boot.c  Wed Sep 19 09:12:06 2007 +0100
+++ b/xen/arch/x86/acpi/boot.c  Wed Sep 19 09:24:20 2007 +0100
@@ -1017,5 +1017,7 @@ int __init acpi_boot_init(void)
 
        acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
 
-       return 0;
-}
+       acpi_dmar_init();
+
+       return 0;
+}
diff -r aad813d8a8ad -r 45548c83daef xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Wed Sep 19 09:12:06 2007 +0100
+++ b/xen/arch/x86/hvm/hvm.c    Wed Sep 19 09:24:20 2007 +0100
@@ -216,21 +216,25 @@ int hvm_domain_initialise(struct domain 
     spin_lock_init(&d->arch.hvm_domain.pbuf_lock);
     spin_lock_init(&d->arch.hvm_domain.irq_lock);
 
+    rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
+    if ( rc != 0 )
+        return rc;
+
     rc = iommu_domain_init(d);
     if ( rc != 0 )
         return rc;
 
-    rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
-    if ( rc != 0 )
-        return rc;
-
     vpic_init(d);
     vioapic_init(d);
 
     hvm_init_ioreq_page(d, &d->arch.hvm_domain.ioreq);
     hvm_init_ioreq_page(d, &d->arch.hvm_domain.buf_ioreq);
 
-    return hvm_funcs.domain_initialise(d);
+    rc = hvm_funcs.domain_initialise(d);
+    if ( rc != 0 )
+        release_devices(d);
+
+    return rc;
 }
 
 void hvm_domain_relinquish_resources(struct domain *d)
@@ -246,6 +250,7 @@ void hvm_domain_relinquish_resources(str
 
 void hvm_domain_destroy(struct domain *d)
 {
+    release_devices(d);
     hvm_funcs.domain_destroy(d);
 }
 
diff -r aad813d8a8ad -r 45548c83daef xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
--- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    Wed Sep 19 09:12:06 2007 +0100
+++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    Wed Sep 19 09:24:20 2007 +0100
@@ -35,12 +35,6 @@
 #include "msi.h"
 
 #define VTDPREFIX
-static inline int request_irq(int vector, void *func,
-                              int flags, char *name, void *data)
-{
-    return -ENOSYS;
-}
-
 extern void print_iommu_regs(struct acpi_drhd_unit *drhd);
 extern void print_vtd_entries(struct domain *d, int bus, int devfn,
                        unsigned long gmfn);
@@ -1676,7 +1670,7 @@ int iommu_setup(void)
     struct acpi_drhd_unit *drhd;
     struct iommu *iommu;
 
-    if (list_empty(&acpi_drhd_units))
+    if (!vtd_enabled)
         return 0;
 
     INIT_LIST_HEAD(&hd->pdev_list);
diff -r aad813d8a8ad -r 45548c83daef xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Wed Sep 19 09:12:06 2007 +0100
+++ b/xen/arch/x86/irq.c        Wed Sep 19 09:24:20 2007 +0100
@@ -16,6 +16,7 @@
 #include <xen/compat.h>
 #include <asm/current.h>
 #include <asm/smpboot.h>
+#include <asm/iommu.h>
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
 int opt_noirqbalance = 0;
@@ -96,6 +97,39 @@ asmlinkage void do_IRQ(struct cpu_user_r
  out:
     desc->handler->end(vector);
     spin_unlock(&desc->lock);
+}
+
+int request_irq(unsigned int irq,
+        void (*handler)(int, void *, struct cpu_user_regs *),
+        unsigned long irqflags, const char * devname, void *dev_id)
+{
+    struct irqaction * action;
+    int retval;
+
+    /*
+     * Sanity-check: shared interrupts must pass in a real dev-ID,
+     * otherwise we'll have trouble later trying to figure out
+     * which interrupt is which (messes up the interrupt freeing
+     * logic etc).
+     */
+    if (irq >= NR_IRQS)
+        return -EINVAL;
+    if (!handler)
+        return -EINVAL;
+
+    action = xmalloc(struct irqaction);
+    if (!action)
+        return -ENOMEM;
+
+    action->handler = handler;
+    action->name = devname;
+    action->dev_id = dev_id;
+
+    retval = setup_irq(irq, action);
+    if (retval)
+        xfree(action);
+
+    return retval;
 }
 
 void free_irq(unsigned int irq)
@@ -203,7 +237,9 @@ static void __do_IRQ_guest(int vector)
         if ( (action->ack_type != ACKTYPE_NONE) &&
              !test_and_set_bit(irq, d->pirq_mask) )
             action->in_flight++;
-        send_guest_pirq(d, irq);
+        if (!hvm_do_IRQ_dpci(d, irq))
+            send_guest_pirq(d, irq);
+
     }
 }
 
diff -r aad813d8a8ad -r 45548c83daef xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Wed Sep 19 09:12:06 2007 +0100
+++ b/xen/arch/x86/setup.c      Wed Sep 19 09:24:20 2007 +0100
@@ -1038,6 +1038,8 @@ void __init __start_xen(unsigned long mb
         _initrd_len   = mod[initrdidx].mod_end - mod[initrdidx].mod_start;
     }
 
+    iommu_setup();
+
     /*
      * We're going to setup domain0 using the module(s) that we stashed safely
      * above our heap. The second module, if present, is an initrd ramdisk.
diff -r aad813d8a8ad -r 45548c83daef xen/include/xen/irq.h
--- a/xen/include/xen/irq.h     Wed Sep 19 09:12:06 2007 +0100
+++ b/xen/include/xen/irq.h     Wed Sep 19 09:24:20 2007 +0100
@@ -64,6 +64,9 @@ extern irq_desc_t irq_desc[NR_IRQS];
 
 extern int setup_irq(unsigned int, struct irqaction *);
 extern void free_irq(unsigned int);
+extern int request_irq(unsigned int irq,
+               void (*handler)(int, void *, struct cpu_user_regs *),
+               unsigned long irqflags, const char * devname, void *dev_id);
 
 extern hw_irq_controller no_irq_type;
 extern void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.