arch-power: Added Doorbell interrupt Handler
authorKajol Jain <kajoljain797@gmail.com>
Wed, 12 Jun 2019 06:05:32 +0000 (11:35 +0530)
committerKajol Jain <kajoljain797@gmail.com>
Wed, 12 Jun 2019 08:53:15 +0000 (14:23 +0530)
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 206f8c643611b65bce8664421a0e1b8170638e86..60881d7832c2a3a613df2174ec2b2e669002c809 100644 (file)
@@ -50,7 +50,9 @@ enum pcSet
     SystemCallPCSet = 0xC00,
     ProgramPCSet = 0x700,
     DataStoragePCSet = 0x300,
-    InstrStoragePCSet = 0x400
+    InstrStoragePCSet = 0x400,
+    PriDoorbellPCSet = 0xA00,
+    HypDoorbellPCSet = 0xe80
 };
 
 namespace PowerISA
@@ -148,6 +150,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.