From 374ffcd5c7e38fb1c40ac5ff94aca180518c5b24 Mon Sep 17 00:00:00 2001 From: kajoljain379 Date: Wed, 20 Feb 2019 11:28:03 +0530 Subject: [PATCH] arch-power: Add support for timebase updates * Added support to update INTREG_TB on checkInterrupt * Initialize TB register * Add support for decrementer interrupt to check for ee bit to handle nested interrupt. Change-Id: I2e1f37871879bb9370eba17ddb5d23562665b138 Signed-off-by: kajoljain379 --- src/arch/power/interrupts.hh | 8 ++++++-- src/arch/power/system.cc | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/arch/power/interrupts.hh b/src/arch/power/interrupts.hh index ead82dd70..7770a6c9d 100644 --- a/src/arch/power/interrupts.hh +++ b/src/arch/power/interrupts.hh @@ -79,11 +79,15 @@ class Interrupts : public BaseInterrupts checkInterrupts(ThreadContext *tc) { //panic("Interrupts::checkInterrupts not implemented.\n"); - if ( tc->readIntReg(INTREG_DEC) == 0) { + Msr msr = tc->readIntReg(INTREG_MSR); + tc->setIntReg(INTREG_TB , tc->readIntReg(INTREG_TB)+1); + if ( tc->readIntReg(INTREG_DEC) == 0 && msr.ee) { si = true; return true; } - else { + else if (tc->readIntReg(INTREG_DEC) == 0 && !msr.ee) { + return false; + } else { tc->setIntReg(INTREG_DEC , tc->readIntReg(INTREG_DEC)-1); return false; } diff --git a/src/arch/power/system.cc b/src/arch/power/system.cc index 389bc625b..1df07a506 100644 --- a/src/arch/power/system.cc +++ b/src/arch/power/system.cc @@ -73,11 +73,11 @@ PowerSystem::initState() Msr msr = 0x9000000000000001; tc->setIntReg(INTREG_DEC , 0xffffffffffffffff); // This PVR is specific to power9 + // Setting TB register to 0 + tc->setIntReg(INTREG_TB , 0x0); tc->setIntReg(INTREG_PVR , 0x004e1100); tc->setIntReg(INTREG_MSR , msr); //ArgumentReg0 is initialized with 0xc00000 because in linux/system.cc //dtb is loaded at 0xc00000 tc->setIntReg(ArgumentReg0, 0x1800000); - /* Perform a system reset */ - tc->pcState(0x100); } -- 2.30.2