arch-arm: Create helper for sending events (SEV)

Events can be generated by devices, so we need an interface devices
can use to notify events to PEs.

Change-Id: I330575e7d116388d5f9260ef4400b0feaa861f3e
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/21301
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2019-09-19 14:43:36 +01:00
parent f469ee610f
commit a25954a9d9
3 changed files with 16 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
// -*- mode:c++ -*-
// Copyright (c) 2010-2013,2017-2018 ARM Limited
// Copyright (c) 2010-2013,2017-2019 ARM Limited
// All rights reserved
//
// The license below extends only to copyright in the software and shall
@@ -784,11 +784,9 @@ let {{
ThreadContext *oc = sys->getThreadContext(x);
if (oc == xc->tcBase())
continue;
// Wake CPU with interrupt if they were sleeping
if (oc->readMiscReg(MISCREG_SEV_MAILBOX) == 0) {
// Post Interrupt and wake cpu if needed
oc->getCpuPtr()->postInterrupt(oc->threadId(), INT_SEV, 0);
}
sendEvent(oc);
}
'''
sevIop = InstObjParams("sev", "SevInst", "PredOp", \

View File

@@ -192,6 +192,15 @@ copyRegs(ThreadContext *src, ThreadContext *dest)
dynamic_cast<TLB *>(dest->getDTBPtr())->invalidateMiscReg();
}
void
sendEvent(ThreadContext *tc)
{
if (tc->readMiscReg(MISCREG_SEV_MAILBOX) == 0) {
// Post Interrupt and wake cpu if needed
tc->getCpuPtr()->postInterrupt(tc->threadId(), INT_SEV, 0);
}
}
bool
inSecureState(ThreadContext *tc)
{

View File

@@ -117,6 +117,10 @@ copyMiscRegs(ThreadContext *src, ThreadContext *dest)
void initCPU(ThreadContext *tc, int cpuId);
/** Send an event (SEV) to a specific PE if there isn't
* already a pending event */
void sendEvent(ThreadContext *tc);
static inline bool
inUserMode(CPSR cpsr)
{