ia64/xen-unstable

changeset 16261:03b006b02995

x86, vt-d: Move out isa irq mapping from hvm_do_IRQ_dpci()

Setting isa irq mapping in hvm_do_IRQ_dpci() costs time when each
interrupt occurs, and it doesn't update isa irq mapping when pci_link
is updated.

Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
author Keir Fraser <keir@xensource.com>
date Mon Oct 29 09:16:59 2007 +0000 (2007-10-29)
parents 752d6e94a4c0
children 63bfed7b662b
files xen/arch/x86/hvm/irq.c xen/arch/x86/hvm/vmx/vtd/io.c
line diff
     1.1 --- a/xen/arch/x86/hvm/irq.c	Mon Oct 29 08:46:34 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/irq.c	Mon Oct 29 09:16:59 2007 +0000
     1.3 @@ -191,6 +191,18 @@ void hvm_set_pci_link_route(struct domai
     1.4          goto out;
     1.5      hvm_irq->pci_link.route[link] = isa_irq;
     1.6  
     1.7 +    /* PCI pass-through fixup. */
     1.8 +    if ( hvm_irq->dpci && hvm_irq->dpci->girq[old_isa_irq].valid )
     1.9 +    {
    1.10 +        uint32_t device = hvm_irq->dpci->girq[old_isa_irq].device;
    1.11 +        uint32_t intx = hvm_irq->dpci->girq[old_isa_irq].intx;
    1.12 +        if ( link == hvm_pci_intx_link(device, intx) )
    1.13 +        {
    1.14 +            hvm_irq->dpci->girq[isa_irq] = hvm_irq->dpci->girq[old_isa_irq];
    1.15 +            hvm_irq->dpci->girq[old_isa_irq].valid = 0;
    1.16 +        }
    1.17 +    }
    1.18 +
    1.19      if ( hvm_irq->pci_link_assert_count[link] == 0 )
    1.20          goto out;
    1.21  
     2.1 --- a/xen/arch/x86/hvm/vmx/vtd/io.c	Mon Oct 29 08:46:34 2007 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmx/vtd/io.c	Mon Oct 29 09:16:59 2007 +0000
     2.3 @@ -63,6 +63,7 @@ int pt_irq_create_bind_vtd(
     2.4      struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
     2.5      uint32_t machine_gsi, guest_gsi;
     2.6      uint32_t device, intx;
     2.7 +    uint32_t link, isa_irq;
     2.8  
     2.9      if ( hvm_irq_dpci == NULL )
    2.10      {
    2.11 @@ -83,6 +84,8 @@ int pt_irq_create_bind_vtd(
    2.12      device = pt_irq_bind->u.pci.device;
    2.13      intx = pt_irq_bind->u.pci.intx;
    2.14      guest_gsi = hvm_pci_intx_gsi(device, intx);
    2.15 +    link = hvm_pci_intx_link(device, intx);
    2.16 +    isa_irq = d->arch.hvm_domain.irq.pci_link.route[link];
    2.17  
    2.18      hvm_irq_dpci->mirq[machine_gsi].valid = 1;
    2.19      hvm_irq_dpci->mirq[machine_gsi].device = device;
    2.20 @@ -96,6 +99,12 @@ int pt_irq_create_bind_vtd(
    2.21      hvm_irq_dpci->girq[guest_gsi].machine_gsi = machine_gsi;
    2.22      hvm_irq_dpci->girq[guest_gsi].dom = d;
    2.23  
    2.24 +    hvm_irq_dpci->girq[isa_irq].valid = 1;
    2.25 +    hvm_irq_dpci->girq[isa_irq].device = device;
    2.26 +    hvm_irq_dpci->girq[isa_irq].intx = intx;
    2.27 +    hvm_irq_dpci->girq[isa_irq].machine_gsi = machine_gsi;
    2.28 +    hvm_irq_dpci->girq[isa_irq].dom = d;
    2.29 +
    2.30      init_timer(&hvm_irq_dpci->hvm_timer[irq_to_vector(machine_gsi)],
    2.31                 pt_irq_time_out, &hvm_irq_dpci->mirq[machine_gsi], 0);
    2.32  
    2.33 @@ -110,27 +119,12 @@ int pt_irq_create_bind_vtd(
    2.34  
    2.35  int hvm_do_IRQ_dpci(struct domain *d, unsigned int mirq)
    2.36  {
    2.37 -    uint32_t device, intx;
    2.38 -    uint32_t link, isa_irq;
    2.39      struct hvm_irq *hvm_irq = &d->arch.hvm_domain.irq;
    2.40  
    2.41      if ( !vtd_enabled || (d == dom0) || (hvm_irq->dpci == NULL) ||
    2.42           !hvm_irq->dpci->mirq[mirq].valid )
    2.43          return 0;
    2.44  
    2.45 -    device = hvm_irq->dpci->mirq[mirq].device;
    2.46 -    intx = hvm_irq->dpci->mirq[mirq].intx;
    2.47 -    link = hvm_pci_intx_link(device, intx);
    2.48 -    isa_irq = hvm_irq->pci_link.route[link];
    2.49 -
    2.50 -    if ( !hvm_irq->dpci->girq[isa_irq].valid )
    2.51 -    {
    2.52 -        hvm_irq->dpci->girq[isa_irq].valid = 1;
    2.53 -        hvm_irq->dpci->girq[isa_irq].device = device;
    2.54 -        hvm_irq->dpci->girq[isa_irq].intx = intx;
    2.55 -        hvm_irq->dpci->girq[isa_irq].machine_gsi = mirq;
    2.56 -    }
    2.57 -
    2.58      /*
    2.59       * Set a timer here to avoid situations where the IRQ line is shared, and
    2.60       * the device belonging to the pass-through guest is not yet active. In