From 4b0c6a14c99afe74d7edb65bd5fde746f5c5ffde Mon Sep 17 00:00:00 2001
From: Gabe Black <gblack@eecs.umich.edu>
Date: Sun, 19 Apr 2009 03:56:36 -0700
Subject: [PATCH] X86: Only recognize the first startup IPI after INIT or
 reset.

---
 src/arch/x86/interrupts.cc | 7 +++++--
 src/arch/x86/interrupts.hh | 1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/arch/x86/interrupts.cc b/src/arch/x86/interrupts.cc
index c247d9ebc6..e51fef6231 100644
--- a/src/arch/x86/interrupts.cc
+++ b/src/arch/x86/interrupts.cc
@@ -282,7 +282,8 @@ X86ISA::Interrupts::requestInterrupt(uint8_t vector,
         } else if (deliveryMode == DeliveryMode::INIT && !pendingInit) {
             pendingUnmaskableInt = pendingInit = true;
             initVector = vector;
-        } else if (deliveryMode == DeliveryMode::SIPI && !pendingStartup) {
+        } else if (deliveryMode == DeliveryMode::SIPI &&
+                !pendingStartup && !startedUp) {
             pendingUnmaskableInt = pendingStartup = true;
             startupVector = vector;
         }
@@ -562,7 +563,7 @@ X86ISA::Interrupts::Interrupts(Params * p) :
     pendingExtInt(false), extIntVector(0),
     pendingInit(false), initVector(0),
     pendingStartup(false), startupVector(0),
-    pendingUnmaskableInt(false)
+    startedUp(false), pendingUnmaskableInt(false)
 {
     pioSize = PageBytes;
     memset(regs, 0, sizeof(regs));
@@ -643,9 +644,11 @@ X86ISA::Interrupts::updateIntrInfo(ThreadContext *tc)
         } else if (pendingInit) {
             DPRINTF(LocalApic, "Init sent to core.\n");
             pendingInit = false;
+            startedUp = false;
         } else if (pendingStartup) {
             DPRINTF(LocalApic, "SIPI sent to core.\n");
             pendingStartup = false;
+            startedUp = true;
         }
         if (!(pendingSmi || pendingNmi || pendingInit || pendingStartup))
             pendingUnmaskableInt = false;
diff --git a/src/arch/x86/interrupts.hh b/src/arch/x86/interrupts.hh
index ba92c77d6a..6ae77d7e36 100644
--- a/src/arch/x86/interrupts.hh
+++ b/src/arch/x86/interrupts.hh
@@ -131,6 +131,7 @@ class Interrupts : public BasicPioDevice, IntDev
     uint8_t initVector;
     bool pendingStartup;
     uint8_t startupVector;
+    bool startedUp;
 
     // This is a quick check whether any of the above (except ExtInt) are set.
     bool pendingUnmaskableInt;
-- 
GitLab