cpu: Add a sendFunctional function to the ThreadContext.

This can be used to send a functional packet from the perspective of a
thread context. Currently this will not consider targets within the CPU
like the local APIC on x86. The default implementation sends a packet
using the port on the way out of the CPU.

Change-Id: Idb311e156a416ad51b585794c1e9fa75711d61f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45861
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
Gabe Black
2021-05-22 17:06:16 -07:00
parent 85d1e1f803
commit 3c84bb7a77
2 changed files with 14 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
#include "cpu/base.hh"
#include "debug/Context.hh"
#include "debug/Quiesce.hh"
#include "mem/port.hh"
#include "params/BaseCPU.hh"
#include "sim/full_system.hh"
@@ -127,6 +128,15 @@ ThreadContext::compare(ThreadContext *one, ThreadContext *two)
}
void
ThreadContext::sendFunctional(PacketPtr pkt)
{
const auto *port =
dynamic_cast<const RequestPort *>(&getCpuPtr()->getDataPort());
assert(port);
port->sendFunctional(pkt);
}
void
ThreadContext::quiesce()
{

View File

@@ -68,6 +68,8 @@ class Checkpoint;
class PortProxy;
class Process;
class System;
class Packet;
using PacketPtr = Packet *;
/**
* ThreadContext is the external interface to all thread state for
@@ -146,6 +148,8 @@ class ThreadContext : public PCEventScope
virtual PortProxy &getVirtProxy() = 0;
virtual void sendFunctional(PacketPtr pkt);
/**
* Initialise the physical and virtual port proxies and tie them to
* the data port of the CPU.