]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/riscv/kvm: read/write KVM regs via env size
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>
Tue, 29 Apr 2025 12:44:20 +0000 (09:44 -0300)
committerAlistair Francis <alistair.francis@wdc.com>
Mon, 19 May 2025 03:42:47 +0000 (13:42 +1000)
commit775ac57e0a54b9127bd2ad005675772870cd1932
tree4bd0899dbf1106d019a33f4f711b7ec818378b36
parent86b8c3821496898cd3bd8eaa1bac71f5c784a2db
target/riscv/kvm: read/write KVM regs via env size

We're going to add support for scounteren in the next patch. KVM defines
as a target_ulong CSR, while QEMU defines env->scounteren as a 32 bit
field. This will cause the current code to read/write a 64 bit CSR in a
32 bit field when running in a 64 bit CPU.

To prevent that, change the current logic to honor the size of the QEMU
storage instead of the KVM CSR reg.

Suggested-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Message-ID: <20250429124421.223883-9-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/kvm/kvm-cpu.c