From dacded4c24a7ae7c4764b708b5c9451e5cd9ef7f Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Fri, 25 Oct 2024 09:12:40 -0700 Subject: [PATCH 1/5] Make support for menvcfg.CBIE == 01 optional --- arch/csr/menvcfg.yaml | 4 +++- arch/ext/Zicbom.yaml | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/csr/menvcfg.yaml b/arch/csr/menvcfg.yaml index 96dda31664..dae6f87d2c 100644 --- a/arch/csr/menvcfg.yaml +++ b/arch/csr/menvcfg.yaml @@ -246,7 +246,9 @@ menvcfg: definedBy: Zicbom type: RW-R sw_write(csr_value): | - if (csr_value.CBIE == 0 || csr_value.CBIE == 1 || csr_value.CBIE == 3) { + if ((csr_value.CBIE == 0) || + ((ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH && (csr_value.CBIE == 1)) || + (csr_value.CBIE == 3)) { return csr_value.CBIE; } else { return CSR[menvcfg].CBIE; diff --git a/arch/ext/Zicbom.yaml b/arch/ext/Zicbom.yaml index 0250477e8c..1b49859d9c 100644 --- a/arch/ext/Zicbom.yaml +++ b/arch/ext/Zicbom.yaml @@ -14,4 +14,13 @@ Zicbom: The observable size of a cache block, in bytes also_defined_in: [Zicboz, Zicbop] schema: - type: integer \ No newline at end of file + type: integer + ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH: + description: | + When true, an implementation can (when `menvcfg.CBIE` == `01`) upgrade a `cbo.inval` + instruction to a `cbo.flush`. + + When false, an implementation does not support the upgrade, and the value '01' cannot be + written to `menvcfg.CBIE`. + schema: + type: boolean From f13ab14f28dae7fbba42b021ba3192e0b5a376a5 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Fri, 25 Oct 2024 09:18:49 -0700 Subject: [PATCH 2/5] Added new parameter to generic_rv64 params.yaml --- cfgs/generic_rv64/params.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/cfgs/generic_rv64/params.yaml b/cfgs/generic_rv64/params.yaml index 2917763e1c..8c896bce80 100644 --- a/cfgs/generic_rv64/params.yaml +++ b/cfgs/generic_rv64/params.yaml @@ -514,3 +514,4 @@ params: MSTATUS_FS_WRITEABLE: true MSTATUS_TVM_IMPLEMENTED: true HW_MSTATUS_FS_DIRTY_UPDATE: precise + ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH: true From d4e46a948f7c34aca4c2beb6bde99bdd839c494f Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Fri, 25 Oct 2024 09:30:56 -0700 Subject: [PATCH 3/5] Fix typo --- arch/csr/menvcfg.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/csr/menvcfg.yaml b/arch/csr/menvcfg.yaml index dae6f87d2c..2ed28c7b14 100644 --- a/arch/csr/menvcfg.yaml +++ b/arch/csr/menvcfg.yaml @@ -247,7 +247,7 @@ menvcfg: type: RW-R sw_write(csr_value): | if ((csr_value.CBIE == 0) || - ((ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH && (csr_value.CBIE == 1)) || + (ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH && (csr_value.CBIE == 1)) || (csr_value.CBIE == 3)) { return csr_value.CBIE; } else { From 4bdbbb5082f1366c3149455a2920b3654aed2756 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Fri, 25 Oct 2024 13:09:08 -0700 Subject: [PATCH 4/5] Take #2 on envcfg.CBIE WARL --- arch/csr/menvcfg.yaml | 4 ++-- arch/ext/Zicbom.yaml | 10 +++++----- cfgs/generic_rv64/params.yaml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/csr/menvcfg.yaml b/arch/csr/menvcfg.yaml index 2ed28c7b14..bfd84b3f8c 100644 --- a/arch/csr/menvcfg.yaml +++ b/arch/csr/menvcfg.yaml @@ -247,8 +247,8 @@ menvcfg: type: RW-R sw_write(csr_value): | if ((csr_value.CBIE == 0) || - (ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH && (csr_value.CBIE == 1)) || - (csr_value.CBIE == 3)) { + (csr_value.CBIE == 1) || + ((!FORCE_UPGRADE_CBO_INVAL_TO_FLUSH) && (csr_value.CBIE == 3)) { return csr_value.CBIE; } else { return CSR[menvcfg].CBIE; diff --git a/arch/ext/Zicbom.yaml b/arch/ext/Zicbom.yaml index 1b49859d9c..8bdaa67eb0 100644 --- a/arch/ext/Zicbom.yaml +++ b/arch/ext/Zicbom.yaml @@ -15,12 +15,12 @@ Zicbom: also_defined_in: [Zicboz, Zicbop] schema: type: integer - ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH: + FORCE_UPGRADE_CBO_INVAL_TO_FLUSH: description: | - When true, an implementation can (when `menvcfg.CBIE` == `01`) upgrade a `cbo.inval` - instruction to a `cbo.flush`. + When true, an implementation prohibits setting `menvcfg.CBIE` == `11` such that all `cbo.inval` + instructions either trap (when `menvcfg.CBIE` == '00') or flush (when `menvcfg.CBIE` == '01'). - When false, an implementation does not support the upgrade, and the value '01' cannot be - written to `menvcfg.CBIE`. + When false, an implementation allows a true INVAL operation for `cbo.inval`, and thus supports + the setting `menvcfg.CBIE` == `11`. schema: type: boolean diff --git a/cfgs/generic_rv64/params.yaml b/cfgs/generic_rv64/params.yaml index 8c896bce80..27a7f7e957 100644 --- a/cfgs/generic_rv64/params.yaml +++ b/cfgs/generic_rv64/params.yaml @@ -514,4 +514,4 @@ params: MSTATUS_FS_WRITEABLE: true MSTATUS_TVM_IMPLEMENTED: true HW_MSTATUS_FS_DIRTY_UPDATE: precise - ALLOW_CBO_INVAL_UPGRADE_TO_FLUSH: true + FORCE_UPGRADE_CBO_INVAL_TO_FLUSH: true From 790cde652e632b00225fc995eb40b94565d15459 Mon Sep 17 00:00:00 2001 From: Derek Hower Date: Fri, 25 Oct 2024 13:21:38 -0700 Subject: [PATCH 5/5] Fix parens --- arch/csr/menvcfg.yaml | 2 +- ext/riscv-isa-manual | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/csr/menvcfg.yaml b/arch/csr/menvcfg.yaml index bfd84b3f8c..32ecf268ea 100644 --- a/arch/csr/menvcfg.yaml +++ b/arch/csr/menvcfg.yaml @@ -248,7 +248,7 @@ menvcfg: sw_write(csr_value): | if ((csr_value.CBIE == 0) || (csr_value.CBIE == 1) || - ((!FORCE_UPGRADE_CBO_INVAL_TO_FLUSH) && (csr_value.CBIE == 3)) { + ((!FORCE_UPGRADE_CBO_INVAL_TO_FLUSH) && (csr_value.CBIE == 3))) { return csr_value.CBIE; } else { return CSR[menvcfg].CBIE; diff --git a/ext/riscv-isa-manual b/ext/riscv-isa-manual index 3539eff338..084b690ef0 160000 --- a/ext/riscv-isa-manual +++ b/ext/riscv-isa-manual @@ -1 +1 @@ -Subproject commit 3539eff338352aba83dbae9e7b310d6a7d9a7d56 +Subproject commit 084b690ef08e8abbf3c4f886a430d51a5895f089