On 10/12/23 02:42, Akihiko Odaki wrote:
It is initialized with a simple assignment and there is little room for
error. In fact, the validation is even more complex.

Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com>
---
  target/riscv/cpu.c | 13 ++-----------
  1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index f5572704de..550b357fb7 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -1042,7 +1042,7 @@ static void riscv_cpu_disable_priv_spec_isa_exts(RISCVCPU 
*cpu)
      }
  }
-static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, Error **errp)
+static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu)
  {
      RISCVCPUClass *mcc = RISCV_CPU_GET_CLASS(cpu);
      CPUClass *cc = CPU_CLASS(mcc);
@@ -1062,11 +1062,6 @@ static void riscv_cpu_validate_misa_mxl(RISCVCPU *cpu, 
Error **errp)
      default:
          g_assert_not_reached();
      }
-
-    if (env->misa_mxl_max != env->misa_mxl) {
-        error_setg(errp, "misa_mxl_max must be equal to misa_mxl");
-        return;
-    }
  }


Note that this patch isn't applicable anymore due to recent changes on master. 
These changes
are intended to be in target/riscv/tcg/tcg-cpu.c.

The changes LGTM since env->misa_mxl will always be == env->misa_mxl_max at 
this point. We do
not have any instance in the code where they'll differ.

I'd rename the helper to riscv_cpu_set_gdb_core() or similar given that there's 
no more
validation happening in the function.


Thanks,


Daniel

/*
@@ -1447,11 +1442,7 @@ static void riscv_cpu_realize_tcg(DeviceState *dev, 
Error **errp)
          return;
      }
- riscv_cpu_validate_misa_mxl(cpu, &local_err);
-    if (local_err != NULL) {
-        error_propagate(errp, local_err);
-        return;
-    }
+    riscv_cpu_validate_misa_mxl(cpu);
riscv_cpu_validate_priv_spec(cpu, &local_err);
      if (local_err != NULL) {

Reply via email to