Skip to contentSkip to conversation

RISC-V: Allow both Zmmul and M

PATCH Applied Palmer Dabbelt 2 participants 3 messages Jul 14, 2022 – Jul 18, 2022 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RISC-V: Allow both Zmmul and M

We got to talking about how Zmmul and M interact with each other
https://github.com/riscv/riscv-isa-manual/issues/869 , and it turns out that QEMU's behavior is slightly wrong: having Zmmul and M is a legal combination, it just means that the multiplication instructions are supported even when M is disabled at runtime via misa.

This just stops overriding M from Zmmul, with that the other checks for the multiplication instructions work as per the ISA.

---
 target/riscv/cpu.c | 5 -----
 1 file changed, 5 deletions(-)
target/riscv/cpu.c +0 -5
index db2b8e4d30..cab74faaca 100644
@@ -709,11 +709,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
             cpu->cfg.ext_ifencei = true;
         }
 
-        if (cpu->cfg.ext_m && cpu->cfg.ext_zmmul) {
-            warn_report("Zmmul will override M");
-            cpu->cfg.ext_m = false;
-        }
-
         if (cpu->cfg.ext_i && cpu->cfg.ext_e) {
             error_setg(errp,
                        "I and E extensions are incompatible");
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Palmer Dabbelt

We got to talking about how Zmmul and M interact with each other
https://github.com/riscv/riscv-isa-manual/issues/869 , and it turns out that QEMU's behavior is slightly wrong: having Zmmul and M is a legal combination, it just means that the multiplication instructions are supported even when M is disabled at runtime via misa.

This just stops overriding M from Zmmul, with that the other checks for the multiplication instructions work as per the ISA.

Alistair

Quoted 24 lines
---
 target/riscv/cpu.c | 5 -----
 1 file changed, 5 deletions(-)
target/riscv/cpu.c +0 -6
index db2b8e4d30..cab74faaca 100644
@@ -709,11 +709,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
             cpu->cfg.ext_ifencei = true;
         }
 
-        if (cpu->cfg.ext_m && cpu->cfg.ext_zmmul) {
-            warn_report("Zmmul will override M");
-            cpu->cfg.ext_m = false;
-        }
-
         if (cpu->cfg.ext_i && cpu->cfg.ext_e) {
             error_setg(errp,
                        "I and E extensions are incompatible");
--

2.34.1

#2 lore raw
In reply to Palmer Dabbelt
Quoted 11 lines · Palmer Dabbelt

We got to talking about how Zmmul and M interact with each other
https://github.com/riscv/riscv-isa-manual/issues/869 , and it turns out that QEMU's behavior is slightly wrong: having Zmmul and M is a legal combination, it just means that the multiplication instructions are supported even when M is disabled at runtime via misa.

This just stops overriding M from Zmmul, with that the other checks for the multiplication instructions work as per the ISA.

Thanks!

Applied to riscv-to-apply.next

Alistair

Quoted 24 lines
---
 target/riscv/cpu.c | 5 -----
 1 file changed, 5 deletions(-)
target/riscv/cpu.c +0 -6
index db2b8e4d30..cab74faaca 100644
@@ -709,11 +709,6 @@ static void riscv_cpu_realize(DeviceState *dev, Error **errp)
             cpu->cfg.ext_ifencei = true;
         }
 
-        if (cpu->cfg.ext_m && cpu->cfg.ext_zmmul) {
-            warn_report("Zmmul will override M");
-            cpu->cfg.ext_m = false;
-        }
-
         if (cpu->cfg.ext_i && cpu->cfg.ext_e) {
             error_setg(errp,
                        "I and E extensions are incompatible");
--

2.34.1