ia64/xen-unstable

changeset 17834:0331bfd8b5d2

MSI: Fix msi delivery for hvm guest

Some parameters like "dest_mode", "delivery_mode" and "trig_mode"
seem to have been miscalculated before delivering MSI interrupt into
hvm passthru guest. This will cause guest driver to roll back to
legacy interrupt mode.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jun 11 15:19:42 2008 +0100 (2008-06-11)
parents 54c6fc432763
children a0561bcf9333
files xen/arch/x86/hvm/vmsi.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmsi.c	Wed Jun 11 15:18:26 2008 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmsi.c	Wed Jun 11 15:19:42 2008 +0100
     1.3 @@ -110,15 +110,21 @@ static void vmsi_inj_irq(
     1.4  #define VMSI_DELIV_MASK   0x7000
     1.5  #define VMSI_TRIG_MODE    0x8000
     1.6  
     1.7 +#define GFLAGS_SHIFT_DEST_ID        0
     1.8 +#define GFLAGS_SHIFT_RH             8
     1.9 +#define GFLAGS_SHIFT_DM             9
    1.10 +#define GLFAGS_SHIFT_DELIV_MODE     12
    1.11 +#define GLFAGS_SHIFT_TRG_MODE       15
    1.12 +
    1.13  int vmsi_deliver(struct domain *d, int pirq)
    1.14  {
    1.15      struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
    1.16      uint32_t flags = hvm_irq_dpci->mirq[pirq].gmsi.gflags;
    1.17      int vector = hvm_irq_dpci->mirq[pirq].gmsi.gvec;
    1.18 -    uint16_t dest = flags & VMSI_DEST_ID_MASK;
    1.19 -    uint8_t dest_mode = flags & VMSI_DM_MASK;
    1.20 -    uint8_t delivery_mode = flags & VMSI_DELIV_MASK;
    1.21 -    uint8_t trig_mode = flags & VMSI_TRIG_MODE;
    1.22 +    uint16_t dest = (flags & VMSI_DEST_ID_MASK) >> GFLAGS_SHIFT_DEST_ID;
    1.23 +    uint8_t dest_mode = (flags & VMSI_DM_MASK) >> GFLAGS_SHIFT_DM;
    1.24 +    uint8_t delivery_mode = (flags & VMSI_DELIV_MASK) >> GLFAGS_SHIFT_DELIV_MODE;
    1.25 +    uint8_t trig_mode = (flags & VMSI_TRIG_MODE) >> GLFAGS_SHIFT_TRG_MODE;
    1.26      uint32_t deliver_bitmask;
    1.27      struct vlapic *target;
    1.28      struct vcpu *v;