debuggers.hg

changeset 20900:cb0375fcec23

x86: Revert Cset 20334:dcc5d5d954e9

Recording old MSI info doesn't solve all the corner cases
when guest's irq migration occurs.

Signed-off-by : Xiantao Zhang <xiantao.zhang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 26 15:52:30 2010 +0000 (2010-01-26)
parents efeef2c5e96d
children 58b45bb15137
files xen/arch/x86/hvm/vmsi.c xen/drivers/passthrough/io.c xen/include/xen/hvm/irq.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vmsi.c	Tue Jan 26 15:51:53 2010 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmsi.c	Tue Jan 26 15:52:30 2010 +0000
     1.3 @@ -92,11 +92,8 @@ int vmsi_deliver(struct domain *d, int p
     1.4      case dest_LowestPrio:
     1.5      {
     1.6          target = vlapic_lowest_prio(d, NULL, 0, dest, dest_mode);
     1.7 -        if ( target != NULL ) {
     1.8 +        if ( target != NULL )
     1.9              vmsi_inj_irq(d, target, vector, trig_mode, delivery_mode);
    1.10 -            hvm_irq_dpci->mirq[pirq].gmsi.old_gvec =
    1.11 -                                    hvm_irq_dpci->mirq[pirq].gmsi.gvec;
    1.12 -        }
    1.13          else
    1.14              HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "null round robin: "
    1.15                          "vector=%x delivery_mode=%x\n",
    1.16 @@ -109,12 +106,9 @@ int vmsi_deliver(struct domain *d, int p
    1.17      {
    1.18          for_each_vcpu ( d, v )
    1.19              if ( vlapic_match_dest(vcpu_vlapic(v), NULL,
    1.20 -                                   0, dest, dest_mode) ) {
    1.21 +                                   0, dest, dest_mode) )
    1.22                  vmsi_inj_irq(d, vcpu_vlapic(v),
    1.23                               vector, trig_mode, delivery_mode);
    1.24 -                hvm_irq_dpci->mirq[pirq].gmsi.old_gvec =
    1.25 -                                    hvm_irq_dpci->mirq[pirq].gmsi.gvec;
    1.26 -            }
    1.27          break;
    1.28      }
    1.29  
     2.1 --- a/xen/drivers/passthrough/io.c	Tue Jan 26 15:51:53 2010 +0000
     2.2 +++ b/xen/drivers/passthrough/io.c	Tue Jan 26 15:52:30 2010 +0000
     2.3 @@ -164,9 +164,7 @@ int pt_irq_create_bind_vtd(
     2.4          {
     2.5              hvm_irq_dpci->mirq[pirq].flags = HVM_IRQ_DPCI_MACH_MSI |
     2.6                                               HVM_IRQ_DPCI_GUEST_MSI;
     2.7 -            hvm_irq_dpci->mirq[pirq].gmsi.old_gvec = pt_irq_bind->u.msi.gvec;
     2.8              hvm_irq_dpci->mirq[pirq].gmsi.gvec = pt_irq_bind->u.msi.gvec;
     2.9 -            hvm_irq_dpci->mirq[pirq].gmsi.old_gflags = pt_irq_bind->u.msi.gflags;
    2.10              hvm_irq_dpci->mirq[pirq].gmsi.gflags = pt_irq_bind->u.msi.gflags;
    2.11              /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
    2.12              rc = pirq_guest_bind(d->vcpu[0], pirq, 0);
    2.13 @@ -180,8 +178,6 @@ int pt_irq_create_bind_vtd(
    2.14              {
    2.15                  hvm_irq_dpci->mirq[pirq].gmsi.gflags = 0;
    2.16                  hvm_irq_dpci->mirq[pirq].gmsi.gvec = 0;
    2.17 -                hvm_irq_dpci->mirq[pirq].gmsi.old_gvec = 0;
    2.18 -                hvm_irq_dpci->mirq[pirq].gmsi.old_gflags = 0;
    2.19                  hvm_irq_dpci->mirq[pirq].flags = 0;
    2.20                  clear_bit(pirq, hvm_irq_dpci->mapping);
    2.21                  spin_unlock(&d->event_lock);
    2.22 @@ -200,11 +196,8 @@ int pt_irq_create_bind_vtd(
    2.23  
    2.24              /* if pirq is already mapped as vmsi, update the guest data/addr */
    2.25              if ( hvm_irq_dpci->mirq[pirq].gmsi.gvec != pt_irq_bind->u.msi.gvec ||
    2.26 -                hvm_irq_dpci->mirq[pirq].gmsi.gflags != pt_irq_bind->u.msi.gflags) {
    2.27 -                hvm_irq_dpci->mirq[pirq].gmsi.old_gvec =
    2.28 -                                    hvm_irq_dpci->mirq[pirq].gmsi.gvec;
    2.29 -                hvm_irq_dpci->mirq[pirq].gmsi.old_gflags =
    2.30 -                                    hvm_irq_dpci->mirq[pirq].gmsi.gflags;
    2.31 +                    hvm_irq_dpci->mirq[pirq].gmsi.gflags != pt_irq_bind->u.msi.gflags) {
    2.32 +
    2.33                  hvm_irq_dpci->mirq[pirq].gmsi.gvec = pt_irq_bind->u.msi.gvec;
    2.34                  hvm_irq_dpci->mirq[pirq].gmsi.gflags = pt_irq_bind->u.msi.gflags;
    2.35              }
    2.36 @@ -435,21 +428,14 @@ void hvm_dpci_msi_eoi(struct domain *d, 
    2.37            pirq = find_next_bit(hvm_irq_dpci->mapping, d->nr_pirqs, pirq + 1) )
    2.38      {
    2.39          if ( (!(hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_MACH_MSI)) ||
    2.40 -                (hvm_irq_dpci->mirq[pirq].gmsi.gvec != vector &&
    2.41 -                 hvm_irq_dpci->mirq[pirq].gmsi.old_gvec != vector) )
    2.42 +                (hvm_irq_dpci->mirq[pirq].gmsi.gvec != vector) )
    2.43              continue;
    2.44  
    2.45 -        if ( hvm_irq_dpci->mirq[pirq].gmsi.gvec == vector ) {
    2.46 -            dest = hvm_irq_dpci->mirq[pirq].gmsi.gflags & VMSI_DEST_ID_MASK;
    2.47 -            dest_mode = !!(hvm_irq_dpci->mirq[pirq].gmsi.gflags & VMSI_DM_MASK);
    2.48 -        } else {
    2.49 -            dest = hvm_irq_dpci->mirq[pirq].gmsi.old_gflags & VMSI_DEST_ID_MASK;
    2.50 -            dest_mode = !!(hvm_irq_dpci->mirq[pirq].gmsi.old_gflags & VMSI_DM_MASK);
    2.51 -        }
    2.52 +        dest = hvm_irq_dpci->mirq[pirq].gmsi.gflags & VMSI_DEST_ID_MASK;
    2.53 +        dest_mode = !!(hvm_irq_dpci->mirq[pirq].gmsi.gflags & VMSI_DM_MASK);
    2.54          if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest, dest_mode) )
    2.55              break;
    2.56      }
    2.57 -
    2.58      if ( pirq < d->nr_pirqs )
    2.59          __msi_pirq_eoi(d, pirq);
    2.60      spin_unlock(&d->event_lock);
     3.1 --- a/xen/include/xen/hvm/irq.h	Tue Jan 26 15:51:53 2010 +0000
     3.2 +++ b/xen/include/xen/hvm/irq.h	Tue Jan 26 15:52:30 2010 +0000
     3.3 @@ -58,10 +58,8 @@ struct dev_intx_gsi_link {
     3.4  #define GLFAGS_SHIFT_TRG_MODE       15
     3.5  
     3.6  struct hvm_gmsi_info {
     3.7 -    uint16_t gvec;
     3.8 -    uint16_t old_gvec;
     3.9 +    uint32_t gvec;
    3.10      uint32_t gflags;
    3.11 -    uint32_t old_gflags;
    3.12      int dest_vcpu_id; /* -1 :multi-dest, non-negative: dest_vcpu_id */
    3.13  };
    3.14