diff mbox series

[15/71] target/riscv: Constify VMState in machine.c

Message ID 20231106065827.543129-16-richard.henderson@linaro.org
State Superseded
Headers show
Series *: Constify VMState | expand

Commit Message

Richard Henderson Nov. 6, 2023, 6:57 a.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/riscv/machine.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Alistair Francis Nov. 6, 2023, 9:28 a.m. UTC | #1
On Mon, Nov 6, 2023 at 6:16 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Acked-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  target/riscv/machine.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/target/riscv/machine.c b/target/riscv/machine.c
> index c7c862cdd3..7d857f479b 100644
> --- a/target/riscv/machine.c
> +++ b/target/riscv/machine.c
> @@ -49,7 +49,7 @@ static const VMStateDescription vmstate_pmp_entry = {
>      .name = "cpu/pmp/entry",
>      .version_id = 1,
>      .minimum_version_id = 1,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL(addr_reg, pmp_entry_t),
>          VMSTATE_UINT8(cfg_reg, pmp_entry_t),
>          VMSTATE_END_OF_LIST()
> @@ -62,7 +62,7 @@ static const VMStateDescription vmstate_pmp = {
>      .minimum_version_id = 1,
>      .needed = pmp_needed,
>      .post_load = pmp_post_load,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_STRUCT_ARRAY(env.pmp_state.pmp, RISCVCPU, MAX_RISCV_PMPS,
>                               0, vmstate_pmp_entry, pmp_entry_t),
>          VMSTATE_END_OF_LIST()
> @@ -82,7 +82,7 @@ static const VMStateDescription vmstate_hyper = {
>      .version_id = 2,
>      .minimum_version_id = 2,
>      .needed = hyper_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL(env.hstatus, RISCVCPU),
>          VMSTATE_UINTTL(env.hedeleg, RISCVCPU),
>          VMSTATE_UINT64(env.hideleg, RISCVCPU),
> @@ -135,7 +135,7 @@ static const VMStateDescription vmstate_vector = {
>      .version_id = 2,
>      .minimum_version_id = 2,
>      .needed = vector_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINT64_ARRAY(env.vreg, RISCVCPU, 32 * RV_VLEN_MAX / 64),
>          VMSTATE_UINTTL(env.vxrm, RISCVCPU),
>          VMSTATE_UINTTL(env.vxsat, RISCVCPU),
> @@ -160,7 +160,7 @@ static const VMStateDescription vmstate_pointermasking = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .needed = pointermasking_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL(env.mmte, RISCVCPU),
>          VMSTATE_UINTTL(env.mpmmask, RISCVCPU),
>          VMSTATE_UINTTL(env.mpmbase, RISCVCPU),
> @@ -186,7 +186,7 @@ static const VMStateDescription vmstate_rv128 = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .needed = rv128_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL_ARRAY(env.gprh, RISCVCPU, 32),
>          VMSTATE_UINT64(env.mscratchh, RISCVCPU),
>          VMSTATE_UINT64(env.sscratchh, RISCVCPU),
> @@ -215,7 +215,7 @@ static const VMStateDescription vmstate_kvmtimer = {
>      .minimum_version_id = 1,
>      .needed = kvmtimer_needed,
>      .post_load = cpu_kvmtimer_post_load,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU),
>          VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU),
>          VMSTATE_UINT64(env.kvm_timer_state, RISCVCPU),
> @@ -249,7 +249,7 @@ static const VMStateDescription vmstate_debug = {
>      .minimum_version_id = 2,
>      .needed = debug_needed,
>      .post_load = debug_post_load,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL(env.trigger_cur, RISCVCPU),
>          VMSTATE_UINTTL_ARRAY(env.tdata1, RISCVCPU, RV_MAX_TRIGGERS),
>          VMSTATE_UINTTL_ARRAY(env.tdata2, RISCVCPU, RV_MAX_TRIGGERS),
> @@ -280,7 +280,7 @@ static const VMStateDescription vmstate_smstateen = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .needed = smstateen_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINT64_ARRAY(env.mstateen, RISCVCPU, 4),
>          VMSTATE_UINT64_ARRAY(env.hstateen, RISCVCPU, 4),
>          VMSTATE_UINT64_ARRAY(env.sstateen, RISCVCPU, 4),
> @@ -301,7 +301,7 @@ static const VMStateDescription vmstate_envcfg = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .needed = envcfg_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINT64(env.menvcfg, RISCVCPU),
>          VMSTATE_UINTTL(env.senvcfg, RISCVCPU),
>          VMSTATE_UINT64(env.henvcfg, RISCVCPU),
> @@ -321,7 +321,7 @@ static const VMStateDescription vmstate_pmu_ctr_state = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .needed = pmu_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL(mhpmcounter_val, PMUCTRState),
>          VMSTATE_UINTTL(mhpmcounterh_val, PMUCTRState),
>          VMSTATE_UINTTL(mhpmcounter_prev, PMUCTRState),
> @@ -343,7 +343,7 @@ static const VMStateDescription vmstate_jvt = {
>      .version_id = 1,
>      .minimum_version_id = 1,
>      .needed = jvt_needed,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL(env.jvt, RISCVCPU),
>          VMSTATE_END_OF_LIST()
>      }
> @@ -354,7 +354,7 @@ const VMStateDescription vmstate_riscv_cpu = {
>      .version_id = 8,
>      .minimum_version_id = 8,
>      .post_load = riscv_cpu_post_load,
> -    .fields = (VMStateField[]) {
> +    .fields = (const VMStateField[]) {
>          VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32),
>          VMSTATE_UINT64_ARRAY(env.fpr, RISCVCPU, 32),
>          VMSTATE_UINT8_ARRAY(env.miprio, RISCVCPU, 64),
> @@ -405,7 +405,7 @@ const VMStateDescription vmstate_riscv_cpu = {
>
>          VMSTATE_END_OF_LIST()
>      },
> -    .subsections = (const VMStateDescription * []) {
> +    .subsections = (const VMStateDescription * const []) {
>          &vmstate_pmp,
>          &vmstate_hyper,
>          &vmstate_vector,
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/target/riscv/machine.c b/target/riscv/machine.c
index c7c862cdd3..7d857f479b 100644
--- a/target/riscv/machine.c
+++ b/target/riscv/machine.c
@@ -49,7 +49,7 @@  static const VMStateDescription vmstate_pmp_entry = {
     .name = "cpu/pmp/entry",
     .version_id = 1,
     .minimum_version_id = 1,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL(addr_reg, pmp_entry_t),
         VMSTATE_UINT8(cfg_reg, pmp_entry_t),
         VMSTATE_END_OF_LIST()
@@ -62,7 +62,7 @@  static const VMStateDescription vmstate_pmp = {
     .minimum_version_id = 1,
     .needed = pmp_needed,
     .post_load = pmp_post_load,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_STRUCT_ARRAY(env.pmp_state.pmp, RISCVCPU, MAX_RISCV_PMPS,
                              0, vmstate_pmp_entry, pmp_entry_t),
         VMSTATE_END_OF_LIST()
@@ -82,7 +82,7 @@  static const VMStateDescription vmstate_hyper = {
     .version_id = 2,
     .minimum_version_id = 2,
     .needed = hyper_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL(env.hstatus, RISCVCPU),
         VMSTATE_UINTTL(env.hedeleg, RISCVCPU),
         VMSTATE_UINT64(env.hideleg, RISCVCPU),
@@ -135,7 +135,7 @@  static const VMStateDescription vmstate_vector = {
     .version_id = 2,
     .minimum_version_id = 2,
     .needed = vector_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINT64_ARRAY(env.vreg, RISCVCPU, 32 * RV_VLEN_MAX / 64),
         VMSTATE_UINTTL(env.vxrm, RISCVCPU),
         VMSTATE_UINTTL(env.vxsat, RISCVCPU),
@@ -160,7 +160,7 @@  static const VMStateDescription vmstate_pointermasking = {
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = pointermasking_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL(env.mmte, RISCVCPU),
         VMSTATE_UINTTL(env.mpmmask, RISCVCPU),
         VMSTATE_UINTTL(env.mpmbase, RISCVCPU),
@@ -186,7 +186,7 @@  static const VMStateDescription vmstate_rv128 = {
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = rv128_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL_ARRAY(env.gprh, RISCVCPU, 32),
         VMSTATE_UINT64(env.mscratchh, RISCVCPU),
         VMSTATE_UINT64(env.sscratchh, RISCVCPU),
@@ -215,7 +215,7 @@  static const VMStateDescription vmstate_kvmtimer = {
     .minimum_version_id = 1,
     .needed = kvmtimer_needed,
     .post_load = cpu_kvmtimer_post_load,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINT64(env.kvm_timer_time, RISCVCPU),
         VMSTATE_UINT64(env.kvm_timer_compare, RISCVCPU),
         VMSTATE_UINT64(env.kvm_timer_state, RISCVCPU),
@@ -249,7 +249,7 @@  static const VMStateDescription vmstate_debug = {
     .minimum_version_id = 2,
     .needed = debug_needed,
     .post_load = debug_post_load,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL(env.trigger_cur, RISCVCPU),
         VMSTATE_UINTTL_ARRAY(env.tdata1, RISCVCPU, RV_MAX_TRIGGERS),
         VMSTATE_UINTTL_ARRAY(env.tdata2, RISCVCPU, RV_MAX_TRIGGERS),
@@ -280,7 +280,7 @@  static const VMStateDescription vmstate_smstateen = {
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = smstateen_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINT64_ARRAY(env.mstateen, RISCVCPU, 4),
         VMSTATE_UINT64_ARRAY(env.hstateen, RISCVCPU, 4),
         VMSTATE_UINT64_ARRAY(env.sstateen, RISCVCPU, 4),
@@ -301,7 +301,7 @@  static const VMStateDescription vmstate_envcfg = {
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = envcfg_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINT64(env.menvcfg, RISCVCPU),
         VMSTATE_UINTTL(env.senvcfg, RISCVCPU),
         VMSTATE_UINT64(env.henvcfg, RISCVCPU),
@@ -321,7 +321,7 @@  static const VMStateDescription vmstate_pmu_ctr_state = {
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = pmu_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL(mhpmcounter_val, PMUCTRState),
         VMSTATE_UINTTL(mhpmcounterh_val, PMUCTRState),
         VMSTATE_UINTTL(mhpmcounter_prev, PMUCTRState),
@@ -343,7 +343,7 @@  static const VMStateDescription vmstate_jvt = {
     .version_id = 1,
     .minimum_version_id = 1,
     .needed = jvt_needed,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL(env.jvt, RISCVCPU),
         VMSTATE_END_OF_LIST()
     }
@@ -354,7 +354,7 @@  const VMStateDescription vmstate_riscv_cpu = {
     .version_id = 8,
     .minimum_version_id = 8,
     .post_load = riscv_cpu_post_load,
-    .fields = (VMStateField[]) {
+    .fields = (const VMStateField[]) {
         VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32),
         VMSTATE_UINT64_ARRAY(env.fpr, RISCVCPU, 32),
         VMSTATE_UINT8_ARRAY(env.miprio, RISCVCPU, 64),
@@ -405,7 +405,7 @@  const VMStateDescription vmstate_riscv_cpu = {
 
         VMSTATE_END_OF_LIST()
     },
-    .subsections = (const VMStateDescription * []) {
+    .subsections = (const VMStateDescription * const []) {
         &vmstate_pmp,
         &vmstate_hyper,
         &vmstate_vector,