From bc52d886a864d467592f642ced40300bc2478b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20M=C3=BCck?= Date: Thu, 1 Jun 2023 18:38:50 -0500 Subject: [PATCH] mem-ruby: add CHI SnpRespData_SD_Fwded_SC message This snoop reponse is not generated internally by the SLICC implementation, but is required for compatibility with classic caches which may remain in SD state while returning SC data upon receiving a converted SnpShared. Change-Id: I5270b29c8863c7afd8abc39b3c7978b95330c183 --- src/mem/ruby/protocol/chi/CHI-cache-actions.sm | 14 +++++++++++--- src/mem/ruby/protocol/chi/CHI-cache-funcs.sm | 3 +++ src/mem/ruby/protocol/chi/CHI-cache-transitions.sm | 1 + src/mem/ruby/protocol/chi/CHI-cache.sm | 1 + src/mem/ruby/protocol/chi/CHI-msg.sm | 2 ++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/mem/ruby/protocol/chi/CHI-cache-actions.sm b/src/mem/ruby/protocol/chi/CHI-cache-actions.sm index 4f7c03bde4..175eeb10ad 100644 --- a/src/mem/ruby/protocol/chi/CHI-cache-actions.sm +++ b/src/mem/ruby/protocol/chi/CHI-cache-actions.sm @@ -1950,6 +1950,7 @@ action(Send_SnpSharedFwd_ToOwner, desc="") { if (retToSrc) { tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_SC_Fwded_SC); tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_SC_Fwded_SD_PD); + tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_SD_Fwded_SC); tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_I_Fwded_SC); tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_I_Fwded_SD_PD); } else { @@ -1964,6 +1965,7 @@ action(Send_SnpSharedFwd_ToOwner, desc="") { tbe.expected_snp_resp.addExpectedRespType(CHIResponseType:SnpResp_SC_Fwded_SC); } tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_SC_PD_Fwded_SC); + tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_SD_Fwded_SC); tbe.expected_snp_resp.addExpectedDataType(CHIDataType:SnpRespData_I_PD_Fwded_SC); } tbe.expected_snp_resp.addExpectedCount(1); @@ -2304,7 +2306,8 @@ action(UpdateDirState_FromSnpDataResp, desc="") { (in_msg.type == CHIDataType:SnpRespData_SC) || (in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SC) || (in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SD_PD) || - (in_msg.type == CHIDataType:SnpRespData_SC_PD_Fwded_SC)) { + (in_msg.type == CHIDataType:SnpRespData_SC_PD_Fwded_SC) || + (in_msg.type == CHIDataType:SnpRespData_SD_Fwded_SC)) { // the owner must have been the responder, if there was one assert((tbe.dir_ownerExists == false) || (tbe.dir_ownerExists && (tbe.dir_owner == in_msg.responder))); @@ -2313,12 +2316,16 @@ action(UpdateDirState_FromSnpDataResp, desc="") { tbe.dir_ownerIsExcl := false; if ((in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SC) || (in_msg.type == CHIDataType:SnpRespData_SC_PD_Fwded_SC) || - (in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SD_PD)) { + (in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SD_PD) || + (in_msg.type == CHIDataType:SnpRespData_SD_Fwded_SC)) { tbe.dir_sharers.add(tbe.requestor); } if (in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SD_PD) { tbe.dir_ownerExists := true; tbe.dir_owner := tbe.requestor; + } else if (in_msg.type == CHIDataType:SnpRespData_SD_Fwded_SC) { + tbe.dir_ownerExists := true; + tbe.dir_owner := in_msg.responder; } } else if ((in_msg.type == CHIDataType:SnpRespData_I_Fwded_SD_PD) || @@ -2507,7 +2514,8 @@ action(UpdateDataState_FromSnpDataResp, desc="") { } else if ((in_msg.type == CHIDataType:SnpRespData_SD) || (in_msg.type == CHIDataType:SnpRespData_SC_Fwded_SD_PD) || - (in_msg.type == CHIDataType:SnpRespData_I_Fwded_SD_PD)) { + (in_msg.type == CHIDataType:SnpRespData_I_Fwded_SD_PD) || + (in_msg.type == CHIDataType:SnpRespData_SD_Fwded_SC)) { tbe.dataDirty := true; tbe.dataValid := true; tbe.dataMaybeDirtyUpstream := true; diff --git a/src/mem/ruby/protocol/chi/CHI-cache-funcs.sm b/src/mem/ruby/protocol/chi/CHI-cache-funcs.sm index 10e0f85aa3..93b12d6ece 100644 --- a/src/mem/ruby/protocol/chi/CHI-cache-funcs.sm +++ b/src/mem/ruby/protocol/chi/CHI-cache-funcs.sm @@ -229,6 +229,7 @@ void functionalRead(Addr addr, Packet *pkt, WriteMask &mask) { tbe.expected_snp_resp.receivedDataType(CHIDataType:SnpRespData_UD) || tbe.expected_snp_resp.receivedDataType(CHIDataType:SnpRespData_SC_Fwded_SD_PD) || tbe.expected_snp_resp.receivedDataType(CHIDataType:SnpRespData_SC_PD_Fwded_SC) || + tbe.expected_snp_resp.receivedDataType(CHIDataType:SnpRespData_SD_Fwded_SC) || tbe.expected_snp_resp.receivedDataType(CHIDataType:SnpRespData_I_Fwded_SD_PD) || tbe.expected_snp_resp.receivedDataType(CHIDataType:SnpRespData_I_PD_Fwded_SC); } @@ -1420,6 +1421,8 @@ Event dataToEvent (CHIDataType type) { return Event:SnpRespData_SC_Fwded_SC; } else if (type == CHIDataType:SnpRespData_SC_Fwded_SD_PD) { return Event:SnpRespData_SC_Fwded_SD_PD; + } else if (type == CHIDataType:SnpRespData_SD_Fwded_SC) { + return Event:SnpRespData_SD_Fwded_SC; } else if (type == CHIDataType:SnpRespData_SC_PD_Fwded_SC) { return Event:SnpRespData_SC_PD_Fwded_SC; } else if (type == CHIDataType:SnpRespData_I_Fwded_SD_PD) { diff --git a/src/mem/ruby/protocol/chi/CHI-cache-transitions.sm b/src/mem/ruby/protocol/chi/CHI-cache-transitions.sm index 2e19245d36..89adc928dd 100644 --- a/src/mem/ruby/protocol/chi/CHI-cache-transitions.sm +++ b/src/mem/ruby/protocol/chi/CHI-cache-transitions.sm @@ -1426,6 +1426,7 @@ transition(BUSY_BLKD, {SnpRespData_I_PD,SnpRespData_I,SnpRespData_SC_PD, SnpRespData_SC,SnpRespData_SD,SnpRespData_UC,SnpRespData_UD, SnpRespData_SC_Fwded_SC,SnpRespData_SC_Fwded_SD_PD, + SnpRespData_SD_Fwded_SC, SnpRespData_SC_PD_Fwded_SC,SnpRespData_I_Fwded_SD_PD, SnpRespData_I_PD_Fwded_SC,SnpRespData_I_Fwded_SC}) { Receive_SnpDataResp; diff --git a/src/mem/ruby/protocol/chi/CHI-cache.sm b/src/mem/ruby/protocol/chi/CHI-cache.sm index a644bbe506..4d48198985 100644 --- a/src/mem/ruby/protocol/chi/CHI-cache.sm +++ b/src/mem/ruby/protocol/chi/CHI-cache.sm @@ -406,6 +406,7 @@ machine(MachineType:Cache, "Cache coherency protocol") : SnpRespData_UD, desc=""; SnpRespData_SC_Fwded_SC, desc=""; SnpRespData_SC_Fwded_SD_PD, desc=""; + SnpRespData_SD_Fwded_SC, desc=""; SnpRespData_SC_PD_Fwded_SC, desc=""; SnpRespData_I_Fwded_SD_PD, desc=""; SnpRespData_I_PD_Fwded_SC, desc=""; diff --git a/src/mem/ruby/protocol/chi/CHI-msg.sm b/src/mem/ruby/protocol/chi/CHI-msg.sm index 0c2d542d77..05e1b768c6 100644 --- a/src/mem/ruby/protocol/chi/CHI-msg.sm +++ b/src/mem/ruby/protocol/chi/CHI-msg.sm @@ -205,6 +205,7 @@ enumeration(CHIDataType, desc="...") { SnpRespData_SC_Fwded_SC; SnpRespData_SC_Fwded_SD_PD; SnpRespData_SC_PD_Fwded_SC; + SnpRespData_SD_Fwded_SC; SnpRespData_I_Fwded_SD_PD; SnpRespData_I_PD_Fwded_SC; SnpRespData_I_Fwded_SC; @@ -243,6 +244,7 @@ structure(CHIDataMsg, desc="", interface="Message") { (type == CHIDataType:SnpRespData_SD) || (type == CHIDataType:SnpRespData_UD) || (type == CHIDataType:SnpRespData_SC_Fwded_SD_PD) || + (type == CHIDataType:SnpRespData_SD_Fwded_SC) || (type == CHIDataType:SnpRespData_SC_PD_Fwded_SC) || (type == CHIDataType:SnpRespData_I_Fwded_SD_PD) || (type == CHIDataType:SnpRespData_I_PD_Fwded_SC);