From a2dc13669a3001f5024426eda36ed4c4df8b7ceb Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Mon, 2 Oct 2017 14:49:25 -0700 Subject: [PATCH] Error grants (#1025) * CacheCork: an error Grant still says 'toT' even though it is transient Grants with errors must be handled by a client as though no actual permissions were obtained, so that two clients do not both end up believing that they own a block which is only temporarily offline. However, the Grant MESSAGE should still match the request; ie. if you did Acquire.NtoT, the response must be Grant.toT, even though the 'error' bit signals that the Grant actually grants no permissions. This keeps the implementation of request-response tracking in interstitial adapters and FSMs simple, consistent with the way multibeat errors must include all their beats. * Error: handle permissions properly --- src/main/scala/devices/tilelink/Error.scala | 4 ++-- src/main/scala/tilelink/CacheCork.scala | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/scala/devices/tilelink/Error.scala b/src/main/scala/devices/tilelink/Error.scala index a1a4d945..cdbb95e0 100644 --- a/src/main/scala/devices/tilelink/Error.scala +++ b/src/main/scala/devices/tilelink/Error.scala @@ -59,7 +59,7 @@ class TLError(params: ErrorParams, beatBytes: Int = 4)(implicit p: Parameters) e val a_opcodes = Vec(AccessAck, AccessAck, AccessAckData, AccessAckData, AccessAckData, HintAck, Grant) da.bits.opcode := a_opcodes(a.bits.opcode) - da.bits.param := UInt(0) + da.bits.param := UInt(0) // toT, but error grants must be handled transiently (ie: you don't keep permissions) da.bits.size := a.bits.size da.bits.source := a.bits.source da.bits.sink := UInt(0) @@ -70,7 +70,7 @@ class TLError(params: ErrorParams, beatBytes: Int = 4)(implicit p: Parameters) e dc.valid := c.valid && c_last dc.bits.opcode := ReleaseAck - dc.bits.param := Vec(toN, toN, toB)(c.bits.param) + dc.bits.param := Vec(toB, toN, toN)(c.bits.param) dc.bits.size := c.bits.size dc.bits.source := c.bits.source dc.bits.sink := UInt(0) diff --git a/src/main/scala/tilelink/CacheCork.scala b/src/main/scala/tilelink/CacheCork.scala index 9503e97d..de52286f 100644 --- a/src/main/scala/tilelink/CacheCork.scala +++ b/src/main/scala/tilelink/CacheCork.scala @@ -100,10 +100,7 @@ class TLCacheCork(unsafe: Boolean = false)(implicit p: Parameters) extends LazyM when (out.d.bits.opcode === AccessAckData && out.d.bits.source(0)) { d_d.bits.opcode := GrantData - // On Grant error, you do NOT get the permissions you asked for. - // We only enter this case from NtoT or NtoB, so that means use toN. - // (the BtoT case was handled by a_d) - d_d.bits.param := Mux(out.d.bits.error, TLPermissions.toN, TLPermissions.toT) + d_d.bits.param := TLPermissions.toT } when (out.d.bits.opcode === AccessAck && !out.d.bits.source(0)) { d_d.bits.opcode := ReleaseAck