dev-arm: Setup TC/ISA at construction time of Gicv3CPUInterface
We should initialize them as soon as possible to make sure any Gicv3CPUInterface method uses a valid reference Change-Id: I8fffebdab9136a9027c4f61bb9413e97031e1969 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65291 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
@@ -530,9 +530,6 @@ ISA::setupThreadContext()
|
|||||||
|
|
||||||
if (!gicv3CpuInterface)
|
if (!gicv3CpuInterface)
|
||||||
gicv3CpuInterface.reset(gicv3->getCPUInterface(tc->contextId()));
|
gicv3CpuInterface.reset(gicv3->getCPUInterface(tc->contextId()));
|
||||||
|
|
||||||
gicv3CpuInterface->setISA(this);
|
|
||||||
gicv3CpuInterface->setThreadContext(tc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ Gicv3::init()
|
|||||||
|
|
||||||
for (int i = 0; i < threads; i++) {
|
for (int i = 0; i < threads; i++) {
|
||||||
redistributors[i] = new Gicv3Redistributor(this, i);
|
redistributors[i] = new Gicv3Redistributor(this, i);
|
||||||
cpuInterfaces[i] = new Gicv3CPUInterface(this, i);
|
cpuInterfaces[i] = new Gicv3CPUInterface(this, sys->threads[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
distRange = RangeSize(params().dist_addr,
|
distRange = RangeSize(params().dist_addr,
|
||||||
|
|||||||
@@ -55,15 +55,19 @@ using namespace ArmISA;
|
|||||||
const uint8_t Gicv3CPUInterface::GIC_MIN_BPR;
|
const uint8_t Gicv3CPUInterface::GIC_MIN_BPR;
|
||||||
const uint8_t Gicv3CPUInterface::GIC_MIN_BPR_NS;
|
const uint8_t Gicv3CPUInterface::GIC_MIN_BPR_NS;
|
||||||
|
|
||||||
Gicv3CPUInterface::Gicv3CPUInterface(Gicv3 * gic, uint32_t cpu_id)
|
Gicv3CPUInterface::Gicv3CPUInterface(Gicv3 * gic, ThreadContext *_tc)
|
||||||
: BaseISADevice(),
|
: BaseISADevice(),
|
||||||
gic(gic),
|
gic(gic),
|
||||||
redistributor(nullptr),
|
redistributor(nullptr),
|
||||||
distributor(nullptr),
|
distributor(nullptr),
|
||||||
cpuId(cpu_id)
|
tc(_tc),
|
||||||
|
maintenanceInterrupt(gic->params().maint_int->get(tc)),
|
||||||
|
cpuId(tc->contextId())
|
||||||
{
|
{
|
||||||
hppi.prio = 0xff;
|
hppi.prio = 0xff;
|
||||||
hppi.intid = Gicv3::INTID_SPURIOUS;
|
hppi.intid = Gicv3::INTID_SPURIOUS;
|
||||||
|
|
||||||
|
setISA(static_cast<ISA*>(tc->getIsaPtr()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -80,15 +84,6 @@ Gicv3CPUInterface::resetHppi(uint32_t intid)
|
|||||||
hppi.prio = 0xff;
|
hppi.prio = 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
Gicv3CPUInterface::setThreadContext(ThreadContext *_tc)
|
|
||||||
{
|
|
||||||
tc = _tc;
|
|
||||||
maintenanceInterrupt = gic->params().maint_int->get(tc);
|
|
||||||
fatal_if(maintenanceInterrupt->num() >= redistributor->irqPending.size(),
|
|
||||||
"Invalid maintenance interrupt number\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Gicv3CPUInterface::getHCREL2FMO() const
|
Gicv3CPUInterface::getHCREL2FMO() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ class Gicv3CPUInterface : public ArmISA::BaseISADevice, public Serializable
|
|||||||
Gicv3 * gic;
|
Gicv3 * gic;
|
||||||
Gicv3Redistributor * redistributor;
|
Gicv3Redistributor * redistributor;
|
||||||
Gicv3Distributor * distributor;
|
Gicv3Distributor * distributor;
|
||||||
uint32_t cpuId;
|
|
||||||
|
|
||||||
ArmInterruptPin *maintenanceInterrupt;
|
|
||||||
ThreadContext *tc;
|
ThreadContext *tc;
|
||||||
|
ArmInterruptPin *maintenanceInterrupt;
|
||||||
|
uint32_t cpuId;
|
||||||
|
|
||||||
BitUnion64(ICC_CTLR_EL1)
|
BitUnion64(ICC_CTLR_EL1)
|
||||||
Bitfield<63, 20> res0_3;
|
Bitfield<63, 20> res0_3;
|
||||||
@@ -359,7 +359,7 @@ class Gicv3CPUInterface : public ArmISA::BaseISADevice, public Serializable
|
|||||||
void setBankedMiscReg(ArmISA::MiscRegIndex misc_reg, RegVal val) const;
|
void setBankedMiscReg(ArmISA::MiscRegIndex misc_reg, RegVal val) const;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Gicv3CPUInterface(Gicv3 * gic, uint32_t cpu_id);
|
Gicv3CPUInterface(Gicv3 * gic, ThreadContext *tc);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
@@ -369,7 +369,6 @@ class Gicv3CPUInterface : public ArmISA::BaseISADevice, public Serializable
|
|||||||
public: // BaseISADevice
|
public: // BaseISADevice
|
||||||
RegVal readMiscReg(int misc_reg) override;
|
RegVal readMiscReg(int misc_reg) override;
|
||||||
void setMiscReg(int misc_reg, RegVal val) override;
|
void setMiscReg(int misc_reg, RegVal val) override;
|
||||||
void setThreadContext(ThreadContext *tc) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gem5
|
} // namespace gem5
|
||||||
|
|||||||
Reference in New Issue
Block a user