ia64/xen-unstable

changeset 15929:45548c83daef

PCI passthru various Xen changes.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Guy Zana <guy@neocleus.com>
author kfraser@localhost.localdomain
date Wed Sep 19 09:24:20 2007 +0100 (2007-09-19)
parents aad813d8a8ad
children 6146bea9e67f
files xen/arch/x86/acpi/boot.c xen/arch/x86/hvm/hvm.c xen/arch/x86/hvm/vmx/vtd/intel-iommu.c xen/arch/x86/irq.c xen/arch/x86/setup.c xen/include/xen/irq.h
line diff
     1.1 --- a/xen/arch/x86/acpi/boot.c	Wed Sep 19 09:12:06 2007 +0100
     1.2 +++ b/xen/arch/x86/acpi/boot.c	Wed Sep 19 09:24:20 2007 +0100
     1.3 @@ -1017,5 +1017,7 @@ int __init acpi_boot_init(void)
     1.4  
     1.5  	acpi_table_parse(ACPI_HPET, acpi_parse_hpet);
     1.6  
     1.7 +	acpi_dmar_init();
     1.8 +
     1.9  	return 0;
    1.10  }
     2.1 --- a/xen/arch/x86/hvm/hvm.c	Wed Sep 19 09:12:06 2007 +0100
     2.2 +++ b/xen/arch/x86/hvm/hvm.c	Wed Sep 19 09:24:20 2007 +0100
     2.3 @@ -216,11 +216,11 @@ int hvm_domain_initialise(struct domain 
     2.4      spin_lock_init(&d->arch.hvm_domain.pbuf_lock);
     2.5      spin_lock_init(&d->arch.hvm_domain.irq_lock);
     2.6  
     2.7 -    rc = iommu_domain_init(d);
     2.8 +    rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
     2.9      if ( rc != 0 )
    2.10          return rc;
    2.11  
    2.12 -    rc = paging_enable(d, PG_refcounts|PG_translate|PG_external);
    2.13 +    rc = iommu_domain_init(d);
    2.14      if ( rc != 0 )
    2.15          return rc;
    2.16  
    2.17 @@ -230,7 +230,11 @@ int hvm_domain_initialise(struct domain 
    2.18      hvm_init_ioreq_page(d, &d->arch.hvm_domain.ioreq);
    2.19      hvm_init_ioreq_page(d, &d->arch.hvm_domain.buf_ioreq);
    2.20  
    2.21 -    return hvm_funcs.domain_initialise(d);
    2.22 +    rc = hvm_funcs.domain_initialise(d);
    2.23 +    if ( rc != 0 )
    2.24 +        release_devices(d);
    2.25 +
    2.26 +    return rc;
    2.27  }
    2.28  
    2.29  void hvm_domain_relinquish_resources(struct domain *d)
    2.30 @@ -246,6 +250,7 @@ void hvm_domain_relinquish_resources(str
    2.31  
    2.32  void hvm_domain_destroy(struct domain *d)
    2.33  {
    2.34 +    release_devices(d);
    2.35      hvm_funcs.domain_destroy(d);
    2.36  }
    2.37  
     3.1 --- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c	Wed Sep 19 09:12:06 2007 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c	Wed Sep 19 09:24:20 2007 +0100
     3.3 @@ -35,12 +35,6 @@
     3.4  #include "msi.h"
     3.5  
     3.6  #define VTDPREFIX
     3.7 -static inline int request_irq(int vector, void *func,
     3.8 -                              int flags, char *name, void *data)
     3.9 -{
    3.10 -    return -ENOSYS;
    3.11 -}
    3.12 -
    3.13  extern void print_iommu_regs(struct acpi_drhd_unit *drhd);
    3.14  extern void print_vtd_entries(struct domain *d, int bus, int devfn,
    3.15                         unsigned long gmfn);
    3.16 @@ -1676,7 +1670,7 @@ int iommu_setup(void)
    3.17      struct acpi_drhd_unit *drhd;
    3.18      struct iommu *iommu;
    3.19  
    3.20 -    if (list_empty(&acpi_drhd_units))
    3.21 +    if (!vtd_enabled)
    3.22          return 0;
    3.23  
    3.24      INIT_LIST_HEAD(&hd->pdev_list);
     4.1 --- a/xen/arch/x86/irq.c	Wed Sep 19 09:12:06 2007 +0100
     4.2 +++ b/xen/arch/x86/irq.c	Wed Sep 19 09:24:20 2007 +0100
     4.3 @@ -16,6 +16,7 @@
     4.4  #include <xen/compat.h>
     4.5  #include <asm/current.h>
     4.6  #include <asm/smpboot.h>
     4.7 +#include <asm/iommu.h>
     4.8  
     4.9  /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
    4.10  int opt_noirqbalance = 0;
    4.11 @@ -98,6 +99,39 @@ asmlinkage void do_IRQ(struct cpu_user_r
    4.12      spin_unlock(&desc->lock);
    4.13  }
    4.14  
    4.15 +int request_irq(unsigned int irq,
    4.16 +        void (*handler)(int, void *, struct cpu_user_regs *),
    4.17 +        unsigned long irqflags, const char * devname, void *dev_id)
    4.18 +{
    4.19 +    struct irqaction * action;
    4.20 +    int retval;
    4.21 +
    4.22 +    /*
    4.23 +     * Sanity-check: shared interrupts must pass in a real dev-ID,
    4.24 +     * otherwise we'll have trouble later trying to figure out
    4.25 +     * which interrupt is which (messes up the interrupt freeing
    4.26 +     * logic etc).
    4.27 +     */
    4.28 +    if (irq >= NR_IRQS)
    4.29 +        return -EINVAL;
    4.30 +    if (!handler)
    4.31 +        return -EINVAL;
    4.32 +
    4.33 +    action = xmalloc(struct irqaction);
    4.34 +    if (!action)
    4.35 +        return -ENOMEM;
    4.36 +
    4.37 +    action->handler = handler;
    4.38 +    action->name = devname;
    4.39 +    action->dev_id = dev_id;
    4.40 +
    4.41 +    retval = setup_irq(irq, action);
    4.42 +    if (retval)
    4.43 +        xfree(action);
    4.44 +
    4.45 +    return retval;
    4.46 +}
    4.47 +
    4.48  void free_irq(unsigned int irq)
    4.49  {
    4.50      unsigned int  vector = irq_to_vector(irq);
    4.51 @@ -203,7 +237,9 @@ static void __do_IRQ_guest(int vector)
    4.52          if ( (action->ack_type != ACKTYPE_NONE) &&
    4.53               !test_and_set_bit(irq, d->pirq_mask) )
    4.54              action->in_flight++;
    4.55 -        send_guest_pirq(d, irq);
    4.56 +        if (!hvm_do_IRQ_dpci(d, irq))
    4.57 +            send_guest_pirq(d, irq);
    4.58 +
    4.59      }
    4.60  }
    4.61  
     5.1 --- a/xen/arch/x86/setup.c	Wed Sep 19 09:12:06 2007 +0100
     5.2 +++ b/xen/arch/x86/setup.c	Wed Sep 19 09:24:20 2007 +0100
     5.3 @@ -1038,6 +1038,8 @@ void __init __start_xen(unsigned long mb
     5.4          _initrd_len   = mod[initrdidx].mod_end - mod[initrdidx].mod_start;
     5.5      }
     5.6  
     5.7 +    iommu_setup();
     5.8 +
     5.9      /*
    5.10       * We're going to setup domain0 using the module(s) that we stashed safely
    5.11       * above our heap. The second module, if present, is an initrd ramdisk.
     6.1 --- a/xen/include/xen/irq.h	Wed Sep 19 09:12:06 2007 +0100
     6.2 +++ b/xen/include/xen/irq.h	Wed Sep 19 09:24:20 2007 +0100
     6.3 @@ -64,6 +64,9 @@ extern irq_desc_t irq_desc[NR_IRQS];
     6.4  
     6.5  extern int setup_irq(unsigned int, struct irqaction *);
     6.6  extern void free_irq(unsigned int);
     6.7 +extern int request_irq(unsigned int irq,
     6.8 +               void (*handler)(int, void *, struct cpu_user_regs *),
     6.9 +               unsigned long irqflags, const char * devname, void *dev_id);
    6.10  
    6.11  extern hw_irq_controller no_irq_type;
    6.12  extern void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs);