On Fri, 24 Oct 2025 at 17:17, Daniel Henrique Barboza
<[email protected]> wrote:
>
>
>
> On 10/24/25 10:43 AM, Peter Maydell wrote:
> > On Mon, 19 May 2025 at 05:25, <[email protected]> wrote:
> >>
> >> From: Daniel Henrique Barboza <[email protected]>
> >>
> >> Add support for the scounteren KVM CSR. Note that env->scounteren is a
> >> 32 bit and all KVM CSRs are target_ulong, so scounteren will be capped
> >> to 32 bits read/writes.
> >>
> >> Reported-by: Andrew Jones <[email protected]>
> >> Signed-off-by: Daniel Henrique Barboza <[email protected]>
> >> Reviewed-by: Andrew Jones <[email protected]>
> >> Reviewed-by: Alistair Francis <[email protected]>
> >> Message-ID: <[email protected]>
> >> Signed-off-by: Alistair Francis <[email protected]>
> >> ---
> >>   target/riscv/kvm/kvm-cpu.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/target/riscv/kvm/kvm-cpu.c b/target/riscv/kvm/kvm-cpu.c
> >> index ca171d5457..82f9728636 100644
> >> --- a/target/riscv/kvm/kvm-cpu.c
> >> +++ b/target/riscv/kvm/kvm-cpu.c
> >> @@ -251,6 +251,7 @@ static KVMCPUConfig kvm_csr_cfgs[] = {
> >>       KVM_CSR_CFG("stval",      stval,      RISCV_CSR_REG(stval)),
> >>       KVM_CSR_CFG("sip",        mip,        RISCV_CSR_REG(sip)),
> >>       KVM_CSR_CFG("satp",       satp,       RISCV_CSR_REG(satp)),
> >> +    KVM_CSR_CFG("scounteren", scounteren, RISCV_CSR_REG(scounteren)),
> >>       KVM_CSR_CFG("senvcfg",    senvcfg,    RISCV_CSR_REG(senvcfg)),
> >>   };
> >>
> >> @@ -701,6 +702,7 @@ static void kvm_riscv_reset_regs_csr(CPURISCVState 
> >> *env)
> >>       env->stval = 0;
> >>       env->mip = 0;
> >>       env->satp = 0;
> >> +    env->scounteren = 0;
> >>       env->senvcfg = 0;
> >>   }
> >
> > Hi -- this came up in a conversation on IRC. Does this new
> > CPU state field need migration support adding in machine.c ?
>
>
> Hmm, I believe it already has, doesn't it?
>
> target/riscv/machine.c:

>         VMSTATE_UINT32(env.scounteren, RISCVCPU),  <-------

So it does. I'm not sure how I missed that in my grep.
Sorry for the noise.

-- PMM

Reply via email to