target/riscv: Reorder Smrnmi CPU fields above CPU reset line
PATCH 1/1 target/riscv: Reorder Smrnmi CPU fields above CPU reset line
From: Frank Chang <[email protected]>
Smrnmi CPU fields introduced by commit: #5db557f should be reset when the CPU resets, so move these fields above the CPU reset line.
Signed-off-by Frank Chang <[email protected]>
--- target/riscv/cpu.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
target/riscv/cpu.h +9 -9
@@ -491,6 +491,15 @@ struct CPUArchState {uint64_t hstateen[SMSTATEEN_MAX_COUNT ];uint64_t sstateen[SMSTATEEN_MAX_COUNT ];uint64_t henvcfg; + +/* RNMI */ +uint64_t mnscratch; +uint64_t mnepc; +uint64_t mncause;/* mncause without bit XLEN-1 set to 1 */ +uint64_t mnstatus; +uint64_t rnmip; +uint64_t rnmi_irqvec; +uint64_t rnmi_excpvec;#endif /* Fields from here on are preserved across CPU reset. */
@@ -509,15 +518,6 @@ struct CPUArchState {uint64_t kvm_timer_state;uint64_t kvm_timer_frequency;#endif /* CONFIG_KVM */ - -/* RNMI */ -uint64_t mnscratch; -uint64_t mnepc; -uint64_t mncause;/* mncause without bit XLEN-1 set to 1 */ -uint64_t mnstatus; -uint64_t rnmip; -uint64_t rnmi_irqvec; -uint64_t rnmi_excpvec; };/*
Signature · 1 line
2.43.0
Quoted 7 lines · On Thu, May 28, 2026 at 4:01 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Smrnmi CPU fields introduced by commit: #5db557f should be reset when the CPU resets, so move these fields above the CPU reset line.
Signed-off-by Frank Chang <[email protected]>
Reviewed-by Alistair Francis <[email protected]>
Alistair
Quoted 44 lines
--- target/riscv/cpu.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)target/riscv/cpu.h +9
-10@@ -491,6 +491,15 @@ struct CPUArchState {uint64_t hstateen[SMSTATEEN_MAX_COUNT ];uint64_t sstateen[SMSTATEEN_MAX_COUNT ];uint64_t henvcfg; + +/* RNMI */ +uint64_t mnscratch; +uint64_t mnepc; +uint64_t mncause;/* mncause without bit XLEN-1 set to 1 */ +uint64_t mnstatus; +uint64_t rnmip; +uint64_t rnmi_irqvec; +uint64_t rnmi_excpvec;#endif /* Fields from here on are preserved across CPU reset. */ @@ -509,15 +518,6 @@ struct CPUArchState {uint64_t kvm_timer_state;uint64_t kvm_timer_frequency;#endif /* CONFIG_KVM */ - -/* RNMI */ -uint64_t mnscratch; -uint64_t mnepc; -uint64_t mncause;/* mncause without bit XLEN-1 set to 1 */ -uint64_t mnstatus; -uint64_t rnmip; -uint64_t rnmi_irqvec; -uint64_t rnmi_excpvec; };/* -- 2.43.0
Alistair Francis
AppliedQuoted 7 lines · On Thu, May 28, 2026 at 4:01 PM <[email protected]> wrote:
From: Frank Chang <[email protected]>
Smrnmi CPU fields introduced by commit: #5db557f should be reset when the CPU resets, so move these fields above the CPU reset line.
Signed-off-by Frank Chang <[email protected]>
Fixes 5db557f82bff ("target/riscv: Add Smrnmi CSRs")
Thanks!
Applied to riscv-to-apply.next
Alistair
Quoted 44 lines
--- target/riscv/cpu.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)target/riscv/cpu.h +9
-10@@ -491,6 +491,15 @@ struct CPUArchState {uint64_t hstateen[SMSTATEEN_MAX_COUNT ];uint64_t sstateen[SMSTATEEN_MAX_COUNT ];uint64_t henvcfg; + +/* RNMI */ +uint64_t mnscratch; +uint64_t mnepc; +uint64_t mncause;/* mncause without bit XLEN-1 set to 1 */ +uint64_t mnstatus; +uint64_t rnmip; +uint64_t rnmi_irqvec; +uint64_t rnmi_excpvec;#endif /* Fields from here on are preserved across CPU reset. */ @@ -509,15 +518,6 @@ struct CPUArchState {uint64_t kvm_timer_state;uint64_t kvm_timer_frequency;#endif /* CONFIG_KVM */ - -/* RNMI */ -uint64_t mnscratch; -uint64_t mnepc; -uint64_t mncause;/* mncause without bit XLEN-1 set to 1 */ -uint64_t mnstatus; -uint64_t rnmip; -uint64_t rnmi_irqvec; -uint64_t rnmi_excpvec; };/* -- 2.43.0