ia64/xen-unstable

changeset 19548:3e64dfebabd7

passthrough: allow pt_bind_irq for msi update

Extend pt_bind_irq to handle the update of msi guest
vector and flag.

Unbind and rebind using separate hypercalls may not be viable
sometime.
For example, the guest may update MSI address/data on fly without
disabling it first (e.g. change delivery/destination), implement these
updates in such a way may result in interrupt loss.

Signed-off-by: Qing He <qing.he@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Apr 15 15:38:57 2009 +0100 (2009-04-15)
parents b2c43b0fba71
children 573e6673e9e0
files xen/drivers/passthrough/io.c
line diff
     1.1 --- a/xen/drivers/passthrough/io.c	Wed Apr 15 11:25:07 2009 +0100
     1.2 +++ b/xen/drivers/passthrough/io.c	Wed Apr 15 15:38:57 2009 +0100
     1.3 @@ -148,12 +148,23 @@ int pt_irq_create_bind_vtd(
     1.4                  return rc;
     1.5              }
     1.6          }
     1.7 -        else if (hvm_irq_dpci->mirq[pirq].gmsi.gvec != pt_irq_bind->u.msi.gvec
     1.8 -                ||hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] != pirq)
     1.9 +        else
    1.10 +        {
    1.11 +            uint32_t mask = HVM_IRQ_DPCI_MACH_MSI | HVM_IRQ_DPCI_GUEST_MSI;
    1.12 +            uint32_t old_gvec;
    1.13  
    1.14 -        {
    1.15 -            spin_unlock(&d->event_lock);
    1.16 -            return -EBUSY;
    1.17 +            if ( (hvm_irq_dpci->mirq[pirq].flags & mask) != mask)
    1.18 +            {
    1.19 +	            spin_unlock(&d->event_lock);
    1.20 +        	    return -EBUSY;
    1.21 +            }
    1.22 + 
    1.23 +            /* if pirq is already mapped as vmsi, update the guest data/addr */
    1.24 +            old_gvec = hvm_irq_dpci->mirq[pirq].gmsi.gvec;
    1.25 +            hvm_irq_dpci->msi_gvec_pirq[old_gvec] = 0;
    1.26 +            hvm_irq_dpci->mirq[pirq].gmsi.gvec = pt_irq_bind->u.msi.gvec;
    1.27 +            hvm_irq_dpci->mirq[pirq].gmsi.gflags = pt_irq_bind->u.msi.gflags;
    1.28 +            hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = pirq;
    1.29          }
    1.30      }
    1.31      else