ia64/xen-unstable

changeset 19211:9ac547ed9455

iommu: Fix interrupt setup.

Set vector_to_iommu[vector] before calling request_vector since null
pointer exceptions occur.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Feb 13 09:36:58 2009 +0000 (2009-02-13)
parents 766b3763ad1b
children 5ae8ed54e2cd
files xen/drivers/passthrough/amd/iommu_init.c xen/drivers/passthrough/vtd/iommu.c
line diff
     1.1 --- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Feb 13 09:33:58 2009 +0000
     1.2 +++ b/xen/drivers/passthrough/amd/iommu_init.c	Fri Feb 13 09:36:58 2009 +0000
     1.3 @@ -487,11 +487,13 @@ static int set_iommu_interrupt_handler(s
     1.4      }
     1.5  
     1.6      irq_desc[vector].handler = &iommu_msi_type;
     1.7 +    vector_to_iommu[vector] = iommu;
     1.8      ret = request_irq_vector(vector, amd_iommu_page_fault, 0,
     1.9                               "amd_iommu", iommu);
    1.10      if ( ret )
    1.11      {
    1.12          irq_desc[vector].handler = &no_irq_type;
    1.13 +        vector_to_iommu[vector] = NULL;
    1.14          free_irq_vector(vector);
    1.15          amd_iov_error("can't request irq\n");
    1.16          return 0;
    1.17 @@ -499,7 +501,6 @@ static int set_iommu_interrupt_handler(s
    1.18  
    1.19      /* Make sure that vector is never re-used. */
    1.20      vector_irq[vector] = NEVER_ASSIGN_IRQ;
    1.21 -    vector_to_iommu[vector] = iommu;
    1.22      iommu->vector = vector;
    1.23      return vector;
    1.24  }
     2.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Fri Feb 13 09:33:58 2009 +0000
     2.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Fri Feb 13 09:36:58 2009 +0000
     2.3 @@ -870,7 +870,7 @@ static struct hw_interrupt_type dma_msi_
     2.4      .set_affinity = dma_msi_set_affinity,
     2.5  };
     2.6  
     2.7 -int iommu_set_interrupt(struct iommu *iommu)
     2.8 +static int iommu_set_interrupt(struct iommu *iommu)
     2.9  {
    2.10      int vector, ret;
    2.11  
    2.12 @@ -882,10 +882,12 @@ int iommu_set_interrupt(struct iommu *io
    2.13      }
    2.14  
    2.15      irq_desc[vector].handler = &dma_msi_type;
    2.16 +    vector_to_iommu[vector] = iommu;
    2.17      ret = request_irq_vector(vector, iommu_page_fault, 0, "dmar", iommu);
    2.18      if ( ret )
    2.19      {
    2.20          irq_desc[vector].handler = &no_irq_type;
    2.21 +        vector_to_iommu[vector] = NULL;
    2.22          free_irq_vector(vector);
    2.23          gdprintk(XENLOG_ERR VTDPREFIX, "IOMMU: can't request irq\n");
    2.24          return ret;
    2.25 @@ -893,7 +895,6 @@ int iommu_set_interrupt(struct iommu *io
    2.26  
    2.27      /* Make sure that vector is never re-used. */
    2.28      vector_irq[vector] = NEVER_ASSIGN_IRQ;
    2.29 -    vector_to_iommu[vector] = iommu;
    2.30  
    2.31      return vector;
    2.32  }