0007-apic-fixup-fallthrough-to-PIC.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From a59a98d100123030a4145e7efe3b8a001920a9f1 Mon Sep 17 00:00:00 2001
  2. From: Mark Asselstine <mark.asselstine@windriver.com>
  3. Date: Tue, 26 Feb 2013 11:43:28 -0500
  4. Subject: [PATCH] apic: fixup fallthrough to PIC
  5. Commit 0e21e12bb311c4c1095d0269dc2ef81196ccb60a [Don't route PIC
  6. interrupts through the local APIC if the local APIC config says so.]
  7. missed a check to ensure the local APIC is enabled. Since if the local
  8. APIC is disabled it doesn't matter what the local APIC config says.
  9. If this check isn't done and the guest has disabled the local APIC the
  10. guest will receive a general protection fault, similar to what is seen
  11. here:
  12. https://lists.gnu.org/archive/html/qemu-devel/2012-12/msg02304.html
  13. The GPF is caused by an attempt to service interrupt 0xffffffff. This
  14. comes about since cpu_get_pic_interrupt() calls apic_accept_pic_intr()
  15. (with the local APIC disabled apic_get_interrupt() returns -1).
  16. apic_accept_pic_intr() returns 0 and thus the interrupt number which
  17. is returned from cpu_get_pic_interrupt(), and which is attempted to be
  18. serviced, is -1.
  19. Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
  20. Upstream-Status: Submitted [https://lists.gnu.org/archive/html/qemu-devel/2013-04/msg00878.html]
  21. Signed-off-by: He Zhe <zhe.he@windriver.com>
  22. ---
  23. hw/intc/apic.c | 2 +-
  24. 1 file changed, 1 insertion(+), 1 deletion(-)
  25. Index: qemu-6.0.0/hw/intc/apic.c
  26. ===================================================================
  27. --- qemu-6.0.0.orig/hw/intc/apic.c
  28. +++ qemu-6.0.0/hw/intc/apic.c
  29. @@ -606,7 +606,7 @@ int apic_accept_pic_intr(DeviceState *de
  30. APICCommonState *s = APIC(dev);
  31. uint32_t lvt0;
  32. - if (!s)
  33. + if (!s || !(s->spurious_vec & APIC_SV_ENABLE))
  34. return -1;
  35. lvt0 = s->lvt[APIC_LVT_LINT0];