arch-power: Added Doorbell interrupt Handler
authorKajol Jain <kajoljain797@gmail.com>
Wed, 12 Jun 2019 06:05:32 +0000 (11:35 +0530)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 24 Jan 2021 04:01:07 +0000 (04:01 +0000)
Added doorbell interrupt handler of type :

* Directed Hypervisor Doorbell Interrupt.
* Directed Privileged Doorbell Interrupt.

Change-Id: I2b2d8c07a0bbe353bf7a8279f5a02f1fe3acba87
Signed-off-by: Kajol Jain <kajoljain797@gmail.com>
src/arch/power/faults.hh

index fc021edf682ea23acf90cd722411b28642f06f85..24cfea7ecb1f2b9ffbf0292baf626bab7e9f45ea 100644 (file)
@@ -47,7 +47,9 @@ enum pcSet
     SystemCallPCSet = 0xC00,
     ProgramPCSet = 0x700,
     DataStoragePCSet = 0x300,
-    InstrStoragePCSet = 0x400
+    InstrStoragePCSet = 0x400,
+    PriDoorbellPCSet = 0xA00,
+    HypDoorbellPCSet = 0xe80
 };
 
 namespace PowerISA
@@ -145,6 +147,42 @@ class PowerInterrupt : public PowerFaultBase
     }
 };
 
+class PriDoorbellInterrupt : public PowerInterrupt
+{
+  public:
+    PriDoorbellInterrupt()
+    {
+    }
+    virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+                       StaticInst::nullStaticInstPtr)
+    {
+      tc->setIntReg(INTREG_SRR0 , tc->instAddr());
+      PowerInterrupt::updateSRR1(tc);
+      PowerInterrupt::updateMsr(tc);
+      tc->pcState(PriDoorbellPCSet);
+    }
+};
+
+class HypDoorbellInterrupt : public PowerInterrupt
+{
+  public:
+    HypDoorbellInterrupt()
+    {
+    }
+    virtual void invoke(ThreadContext * tc, const StaticInstPtr &inst =
+                       StaticInst::nullStaticInstPtr)
+    {
+      printf("In Hypervisor interrupt\n");
+      tc->setIntReg(INTREG_HSRR0 , tc->instAddr());
+      PowerInterrupt::updateHSRR1(tc);
+      PowerInterrupt::updateMsr(tc);
+      Msr msr = tc->readIntReg(INTREG_MSR);
+      msr.hv = 1;
+      tc->setIntReg(INTREG_MSR, msr);
+      tc->pcState(HypDoorbellPCSet);
+    }
+};
+
 //SRR1 value is correctly set by the entity raising
 //Instruction Storage Interrupt. So, no need to
 //Update here.