1
0

Guarantee probe forward progress during LR storm

This commit is contained in:
Andrew Waterman 2017-04-14 01:09:13 -07:00 committed by Andrew Waterman
parent 71eaed7d60
commit 7871ec82c4
3 changed files with 7 additions and 6 deletions

View File

@ -198,15 +198,15 @@ class DCacheModule(outer: DCache) extends HellaCacheModule(outer) {
val s2_lr = Bool(usingAtomics) && s2_req.cmd === M_XLR val s2_lr = Bool(usingAtomics) && s2_req.cmd === M_XLR
val s2_sc = Bool(usingAtomics) && s2_req.cmd === M_XSC val s2_sc = Bool(usingAtomics) && s2_req.cmd === M_XSC
val lrscCount = Reg(init=UInt(0)) val lrscCount = Reg(init=UInt(0))
val lrscValid = lrscCount > 0 val lrscValid = lrscCount > lrscBackoff
val lrscAddr = Reg(UInt()) val lrscAddr = Reg(UInt())
val s2_sc_fail = s2_sc && !(lrscValid && lrscAddr === (s2_req.addr >> blockOffBits)) val s2_sc_fail = s2_sc && !(lrscValid && lrscAddr === (s2_req.addr >> blockOffBits))
when (s2_valid_hit && s2_lr) { when (s2_valid_hit && s2_lr) {
lrscCount := lrscCycles - 1 lrscCount := lrscCycles - 1
lrscAddr := s2_req.addr >> blockOffBits lrscAddr := s2_req.addr >> blockOffBits
} }
when (lrscValid) { lrscCount := lrscCount - 1 } when (lrscCount > 0) { lrscCount := lrscCount - 1 }
when ((s2_valid_masked && lrscValid) || io.cpu.invalidate_lr) { lrscCount := 0 } when ((s2_valid_masked && lrscCount > 0) || io.cpu.invalidate_lr) { lrscCount := 0 }
// pending store buffer // pending store buffer
val pstore1_cmd = RegEnable(s1_req.cmd, s1_valid_not_nacked && s1_write) val pstore1_cmd = RegEnable(s1_req.cmd, s1_valid_not_nacked && s1_write)

View File

@ -58,6 +58,7 @@ trait HasL1HellaCacheParameters extends HasL1CacheParameters with HasCoreParamet
def encDataBits = code.width(coreDataBits) def encDataBits = code.width(coreDataBits)
def encRowBits = encDataBits*rowWords def encRowBits = encDataBits*rowWords
def lrscCycles = 32 // ISA requires 16-insn LRSC sequences to succeed def lrscCycles = 32 // ISA requires 16-insn LRSC sequences to succeed
def lrscBackoff = 3 // disallow LRSC reacquisition briefly
def nIOMSHRs = cacheParams.nMMIOs def nIOMSHRs = cacheParams.nMMIOs
def maxUncachedInFlight = cacheParams.nMMIOs def maxUncachedInFlight = cacheParams.nMMIOs
def dataScratchpadSize = cacheParams.dataScratchpadBytes def dataScratchpadSize = cacheParams.dataScratchpadBytes

View File

@ -794,18 +794,18 @@ class NonBlockingDCacheModule(outer: NonBlockingDCache) extends HellaCacheModule
// load-reserved/store-conditional // load-reserved/store-conditional
val lrsc_count = Reg(init=UInt(0)) val lrsc_count = Reg(init=UInt(0))
val lrsc_valid = lrsc_count.orR val lrsc_valid = lrsc_count > lrscBackoff
val lrsc_addr = Reg(UInt()) val lrsc_addr = Reg(UInt())
val (s2_lr, s2_sc) = (s2_req.cmd === M_XLR, s2_req.cmd === M_XSC) val (s2_lr, s2_sc) = (s2_req.cmd === M_XLR, s2_req.cmd === M_XSC)
val s2_lrsc_addr_match = lrsc_valid && lrsc_addr === (s2_req.addr >> blockOffBits) val s2_lrsc_addr_match = lrsc_valid && lrsc_addr === (s2_req.addr >> blockOffBits)
val s2_sc_fail = s2_sc && !s2_lrsc_addr_match val s2_sc_fail = s2_sc && !s2_lrsc_addr_match
when (lrsc_valid) { lrsc_count := lrsc_count - 1 } when (lrsc_count > 0) { lrsc_count := lrsc_count - 1 }
when (s2_valid_masked && s2_hit || s2_replay) { when (s2_valid_masked && s2_hit || s2_replay) {
when (s2_lr) { when (s2_lr) {
lrsc_count := lrscCycles - 1 lrsc_count := lrscCycles - 1
lrsc_addr := s2_req.addr >> blockOffBits lrsc_addr := s2_req.addr >> blockOffBits
} }
when (lrsc_valid) { when (lrsc_count > 0) {
lrsc_count := 0 lrsc_count := 0
} }
} }