Skip to content

Commit c700de3

Browse files
committed
Fix: loads to an MMIO region triggers a resync and does not read
(loads were assumed to be idempotent, but have a case where it is not in data caching)
1 parent 7b884a9 commit c700de3

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

components/uArch/CoreModel/cycle.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,8 +1659,11 @@ CoreImpl::valuePredictAtomic()
16591659
++theValuePredictions;
16601660

16611661
if (theSpeculateOnAtomicValuePerfect) {
1662-
lsq_head->theExtendedValue =
1663-
ValueTracker::valueTracker(theNode).load(theNode, lsq_head->thePaddr, lsq_head->theSize);
1662+
bits val = ValueTracker::valueTracker(theNode).load(theNode, lsq_head->thePaddr, lsq_head->theSize);
1663+
lsq_head->theExtendedValue = val;
1664+
if (val == -1) {
1665+
lsq_head->theInstruction->forceResync(true);
1666+
}
16641667
} else {
16651668
if (lsq_head->theOperation == kCAS) {
16661669
lsq_head->theExtendedValue = lsq_head->theCompareValue;

components/uArch/ValueTracker.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ struct ValueTracker
527527
DBG_Assert(aSize <= 16 && aSize >= 1);
528528
DBG_Assert(anAddress < 0x40000000000LL);
529529
DBG_(Iface, (<< "CPU[" << aCPU << "] Load " << anAddress << "[" << aSize << "]"));
530+
531+
// mmio
532+
// higher region of MMIO starts at 0x40_0000_0000 for RAM less than 256GB
533+
if (anAddress < 0x40000000 || anAddress >= 0x4000000000) return -1;
530534

531535
Flexus::Qemu::Processor cpu = Flexus::Qemu::Processor::getProcessor(aCPU);
532536

components/uArch/microArch.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ class microArchImpl : public microArch
154154
if (op->theOperation == kLoadReply || op->theOperation == kAtomicPreloadReply) {
155155

156156
bits val = ValueTracker::valueTracker(theCPU.id()).load(theCPU.id(), op->thePAddr, op->theSize);
157+
if (val == -1) {
158+
op->theInstruction->forceResync(true);
159+
}
157160
op->theValue = val;
158161
// }
159162
} else if (op->theOperation == kRMWReply || op->theOperation == kCASReply) {

0 commit comments

Comments
 (0)