Hi, This series contains fixes to address a problem reported by Andrea in [1]. We're now handling CSRs like regular KVM extensions, i.e. we'll verify if the CSR is available before attempting to read/write it.
A considerable amount of boilerplate had to be added, but as a reward we've automated the process to a point where new CSRs can be added by just adding them in an static array, and everything else is taken care of. Patch 6 re-introduces scounteren and senvcfg KVM CSRs, the patch that we've reverted during the 10.0 cycle. We're ready to deal with older kernels that don't know about them, so reintroduce it. Patch 7 is a fix for an issue I've found with scounteren during testing. It is a kernel issue at heart but QEMU must be able to deal with it due to older kernels in the wild. Andrea, if you could take these patches and test it with your setup that would be terrific. Patches based on alistair/riscv-to-apply.next. [1] https://lore.kernel.org/qemu-riscv/CABJz62OfUDHYkQ0T3rGHStQprf1c7_E0qBLbLKhfv=+jb0s...@mail.gmail.com/ Daniel Henrique Barboza (7): target/riscv/kvm: minor fixes/tweaks target/riscv/kvm: turn u32/u64 reg functions in macros target/riscv/kvm: turn kvm_riscv_reg_id_ulong() in a macro target/riscv/kvm: add kvm_csr_cfgs[] target/riscv/kvm: do not read unavailable CSRs target/riscv/kvm: add missing KVM CSRs target/riscv/kvm: reset 'scounteren' with host val target/riscv/cpu.h | 1 + target/riscv/kvm/kvm-cpu.c | 366 +++++++++++++++++++++++++------------ 2 files changed, 247 insertions(+), 120 deletions(-) -- 2.49.0