diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2007-12-14 10:48:18 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2007-12-14 10:48:18 +0000 |
commit | 0a953b774b4053b15aadb9bd7b3123fb116889f8 (patch) | |
tree | 8e2dd882b6535fad91e8a4bf0880c8a1b41105c9 | |
parent | e20250f070772b6cdfa8309e9acad14ef0dfc10c (diff) | |
download | xen-0a953b774b4053b15aadb9bd7b3123fb116889f8.tar.gz xen-0a953b774b4053b15aadb9bd7b3123fb116889f8.tar.bz2 xen-0a953b774b4053b15aadb9bd7b3123fb116889f8.zip |
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>
-rw-r--r-- | xen/arch/x86/hvm/vlapic.c | 41 | ||||
-rw-r--r-- | xen/include/asm-x86/hvm/vlapic.h | 2 |
2 files changed, 14 insertions, 29 deletions
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 059b64538d..000cbbfc04 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -120,14 +120,9 @@ static void vlapic_clear_irr(int vector, struct vlapic *vlapic) vlapic_clear_vector(vector, &vlapic->regs->data[APIC_IRR]); } -int vlapic_find_highest_irr(struct vlapic *vlapic) +static int vlapic_find_highest_irr(struct vlapic *vlapic) { - int result; - - result = vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]); - ASSERT((result == -1) || (result >= 16)); - - return result; + return vlapic_find_highest_vector(&vlapic->regs->data[APIC_IRR]); } int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig) @@ -142,14 +137,9 @@ int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig) return ret; } -int vlapic_find_highest_isr(struct vlapic *vlapic) +static int vlapic_find_highest_isr(struct vlapic *vlapic) { - int result; - - result = vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]); - ASSERT((result == -1) || (result >= 16)); - - return result; + return vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]); } uint32_t vlapic_get_ppr(struct vlapic *vlapic) @@ -454,11 +444,9 @@ static void vlapic_set_tdcr(struct vlapic *vlapic, unsigned int val) "timer_divisor: %d", vlapic->hw.timer_divisor); } -static void vlapic_read_aligned(struct vlapic *vlapic, unsigned int offset, - unsigned int len, unsigned int *result) +static void vlapic_read_aligned( + struct vlapic *vlapic, unsigned int offset, unsigned int *result) { - ASSERT((len == 4) && (offset >= 0) && (offset <= APIC_TDCR)); - switch ( offset ) { case APIC_PROCPRI: @@ -487,15 +475,9 @@ static unsigned long vlapic_read(struct vcpu *v, unsigned long address, if ( offset > APIC_TDCR ) return 0; - /* some bugs on kernel cause read this with byte*/ - if ( len != 4 ) - HVM_DBG_LOG(DBG_LEVEL_VLAPIC, - "read with len=0x%lx, should be 4 instead", - len); - alignment = offset & 0x3; - vlapic_read_aligned(vlapic, offset & ~0x3, 4, &tmp); + vlapic_read_aligned(vlapic, offset & ~0x3, &tmp); switch ( len ) { case 1: @@ -503,12 +485,14 @@ static unsigned long vlapic_read(struct vcpu *v, unsigned long address, break; case 2: - ASSERT( alignment != 3 ); + if ( alignment == 3 ) + goto unaligned_exit_and_crash; result = *(unsigned short *)((unsigned char *)&tmp + alignment); break; case 4: - ASSERT( alignment == 0 ); + if ( alignment != 0 ) + goto unaligned_exit_and_crash; result = *(unsigned int *)((unsigned char *)&tmp + alignment); break; @@ -523,6 +507,9 @@ static unsigned long vlapic_read(struct vcpu *v, unsigned long address, return result; + unaligned_exit_and_crash: + gdprintk(XENLOG_ERR, "Unaligned LAPIC read len=0x%lx at offset=0x%x.\n", + len, offset); exit_and_crash: domain_crash(v->domain); return 0; diff --git a/xen/include/asm-x86/hvm/vlapic.h b/xen/include/asm-x86/hvm/vlapic.h index d20a627882..edefa2c055 100644 --- a/xen/include/asm-x86/hvm/vlapic.h +++ b/xen/include/asm-x86/hvm/vlapic.h @@ -73,8 +73,6 @@ static inline void vlapic_set_reg( int vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, uint8_t trig); -int vlapic_find_highest_irr(struct vlapic *vlapic); - int vlapic_has_pending_irq(struct vcpu *v); int vlapic_ack_pending_irq(struct vcpu *v, int vector); |