x86: Move local APIC initialization out of initCPU.
authorGabe Black <gabeblack@google.com>
Thu, 9 Jan 2020 09:00:55 +0000 (01:00 -0800)
committerGabe Black <gabeblack@google.com>
Tue, 14 Jan 2020 02:19:19 +0000 (02:19 +0000)
The APIC can (and probably should) set its version register on its
own. Also it already configures its CPUID register when associated
with a CPU and doesn't need initCPU to do that.

Change-Id: I4611563668d197c48caf2f23fcde9ec2ec101fe7
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24186
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/arch/x86/interrupts.cc
src/arch/x86/utility.cc

index 06bf41bd19989c09906cbde406bfe5409a192906..b447216d9d88dec974813e0116b925904ee550fb 100644 (file)
@@ -614,6 +614,8 @@ X86ISA::Interrupts::Interrupts(Params * p)
     regs[APIC_DESTINATION_FORMAT] = (uint32_t)(-1);
     ISRV = 0;
     IRRV = 0;
+
+    regs[APIC_VERSION] = (5 << 16) | 0x14;
 }
 
 
index 13019e90eca9740aa1fa39a51f355e8a4ea85b0c..b00e6867fb69477ec4c9881b8cf42f37b8462905 100644 (file)
@@ -84,14 +84,6 @@ initCPU(ThreadContext *tc, int cpuId)
     // passed. No BIST actually runs, but software may still check this
     // register for errors.
     tc->setIntReg(INTREG_RAX, 0);
-
-    Interrupts * interrupts = dynamic_cast<Interrupts *>(
-            tc->getCpuPtr()->getInterruptController(0));
-    assert(interrupts);
-
-    interrupts->setRegNoEffect(APIC_ID, cpuId << 24);
-
-    interrupts->setRegNoEffect(APIC_VERSION, (5 << 16) | 0x14);
 }
 
 void startupCPU(ThreadContext *tc, int cpuId)