# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1197633351 0
# Node ID 2a466f253a04b1f49cb29da52b610cca3048352a
# Parent 56ffd5555ad599c9bdd22eb56fd245c2bb3d6077
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@xxxxxxxxxx>
xen-unstable changeset: 16615:3ee37b6279b76c58f49a056c44f413bf8cc030a9
xen-unstable date: Fri Dec 14 10:48:18 2007 +0000
---
xen/arch/x86/hvm/vlapic.c | 43 +++++++++++++++----------------------------
1 files changed, 15 insertions(+), 28 deletions(-)
diff -r 56ffd5555ad5 -r 2a466f253a04 xen/arch/x86/hvm/vlapic.c
--- a/xen/arch/x86/hvm/vlapic.c Fri Dec 14 11:52:01 2007 +0000
+++ b/xen/arch/x86/hvm/vlapic.c Fri Dec 14 11:55:51 2007 +0000
@@ -124,12 +124,7 @@ static void vlapic_clear_irr(int vector,
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)
@@ -144,14 +139,9 @@ int vlapic_set_irq(struct vlapic *vlapic
return ret;
}
-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;
+static int vlapic_find_highest_isr(struct vlapic *vlapic)
+{
+ return vlapic_find_highest_vector(&vlapic->regs->data[APIC_ISR]);
}
uint32_t vlapic_get_ppr(struct vlapic *vlapic)
@@ -455,11 +445,9 @@ static void vlapic_set_tdcr(struct vlapi
"timer_divisor: %d", vlapic->hw.timer_divisor);
}
-static void vlapic_read_aligned(struct vlapic *vlapic, unsigned int offset,
- unsigned int len, unsigned int *result)
-{
- ASSERT((len == 4) && (offset >= 0) && (offset <= APIC_TDCR));
-
+static void vlapic_read_aligned(
+ struct vlapic *vlapic, unsigned int offset, unsigned int *result)
+{
switch ( offset )
{
case APIC_PROCPRI:
@@ -488,15 +476,9 @@ static unsigned long vlapic_read(struct
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:
@@ -504,12 +486,14 @@ static unsigned long vlapic_read(struct
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;
@@ -524,6 +508,9 @@ static unsigned long vlapic_read(struct
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;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|