ia64/xen-unstable

changeset 16617:3ee37b6279b7

hvm: Remove guest-triggerable assertions from vlapic emulation.

Currently our VLAPIC will happily deliver interrupts on vectors <
16. This could be emulated better, but probably does not matter.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Dec 14 10:48:18 2007 +0000 (2007-12-14)
parents 301507ac350a
children 136f80d21958
files xen/arch/x86/hvm/vlapic.c xen/include/asm-x86/hvm/vlapic.h
line diff
     1.1 --- a/xen/arch/x86/hvm/vlapic.c	Fri Dec 14 10:34:22 2007 +0000
     1.2 +++ b/xen/arch/x86/hvm/vlapic.c	Fri Dec 14 10:48:18 2007 +0000
     1.3 @@ -120,14 +120,9 @@ static void vlapic_clear_irr(int vector,
     1.4      vlapic_clear_vector(vector, &vlapic->regs->data[APIC_IRR]);
     1.5  }
     1.6  
     1.7 -int vlapic_find_highest_irr(struct vlapic *vlapic)
     1.8 +static int vlapic_find_highest_irr(struct vlapic *vlapic)
     1.9  {
    1.10 -    int result;
    1.11 -
    1.12 -    result = vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]);
    1.13 -    ASSERT((result == -1) || (result >= 16));
    1.14 -
    1.15 -    return result;
    1.16 +    return vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]);
    1.17  }
    1.18  
    1.19  int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig)
    1.20 @@ -142,14 +137,9 @@ int vlapic_set_irq(struct vlapic *vlapic
    1.21      return ret;
    1.22  }
    1.23  
    1.24 -int vlapic_find_highest_isr(struct vlapic *vlapic)
    1.25 +static int vlapic_find_highest_isr(struct vlapic *vlapic)
    1.26  {
    1.27 -    int result;
    1.28 -
    1.29 -    result = vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]);
    1.30 -    ASSERT((result == -1) || (result >= 16));
    1.31 -
    1.32 -    return result;
    1.33 +    return vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]);
    1.34  }
    1.35  
    1.36  uint32_t vlapic_get_ppr(struct vlapic *vlapic)
    1.37 @@ -454,11 +444,9 @@ static void vlapic_set_tdcr(struct vlapi
    1.38                  "timer_divisor: %d", vlapic->hw.timer_divisor);
    1.39  }
    1.40  
    1.41 -static void vlapic_read_aligned(struct vlapic *vlapic, unsigned int offset,
    1.42 -                         unsigned int len, unsigned int *result)
    1.43 +static void vlapic_read_aligned(
    1.44 +    struct vlapic *vlapic, unsigned int offset, unsigned int *result)
    1.45  {
    1.46 -    ASSERT((len == 4) && (offset >= 0) && (offset <= APIC_TDCR));
    1.47 -
    1.48      switch ( offset )
    1.49      {
    1.50      case APIC_PROCPRI:
    1.51 @@ -487,15 +475,9 @@ static unsigned long vlapic_read(struct 
    1.52      if ( offset > APIC_TDCR )
    1.53          return 0;
    1.54  
    1.55 -    /* some bugs on kernel cause read this with byte*/
    1.56 -    if ( len != 4 )
    1.57 -        HVM_DBG_LOG(DBG_LEVEL_VLAPIC,
    1.58 -                    "read with len=0x%lx, should be 4 instead",
    1.59 -                    len);
    1.60 -
    1.61      alignment = offset & 0x3;
    1.62  
    1.63 -    vlapic_read_aligned(vlapic, offset & ~0x3, 4, &tmp);
    1.64 +    vlapic_read_aligned(vlapic, offset & ~0x3, &tmp);
    1.65      switch ( len )
    1.66      {
    1.67      case 1:
    1.68 @@ -503,12 +485,14 @@ static unsigned long vlapic_read(struct 
    1.69          break;
    1.70  
    1.71      case 2:
    1.72 -        ASSERT( alignment != 3 );
    1.73 +        if ( alignment == 3 )
    1.74 +            goto unaligned_exit_and_crash;
    1.75          result = *(unsigned short *)((unsigned char *)&tmp + alignment);
    1.76          break;
    1.77  
    1.78      case 4:
    1.79 -        ASSERT( alignment == 0 );
    1.80 +        if ( alignment != 0 )
    1.81 +            goto unaligned_exit_and_crash;
    1.82          result = *(unsigned int *)((unsigned char *)&tmp + alignment);
    1.83          break;
    1.84  
    1.85 @@ -523,6 +507,9 @@ static unsigned long vlapic_read(struct 
    1.86  
    1.87      return result;
    1.88  
    1.89 + unaligned_exit_and_crash:
    1.90 +    gdprintk(XENLOG_ERR, "Unaligned LAPIC read len=0x%lx at offset=0x%x.\n",
    1.91 +             len, offset);
    1.92   exit_and_crash:
    1.93      domain_crash(v->domain);
    1.94      return 0;
     2.1 --- a/xen/include/asm-x86/hvm/vlapic.h	Fri Dec 14 10:34:22 2007 +0000
     2.2 +++ b/xen/include/asm-x86/hvm/vlapic.h	Fri Dec 14 10:48:18 2007 +0000
     2.3 @@ -73,8 +73,6 @@ static inline void vlapic_set_reg(
     2.4  
     2.5  int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig);
     2.6  
     2.7 -int vlapic_find_highest_irr(struct vlapic *vlapic);
     2.8 -
     2.9  int vlapic_has_pending_irq(struct vcpu *v);
    2.10  int vlapic_ack_pending_irq(struct vcpu *v, int vector);
    2.11