summary refs log tree commit diff stats
path: root/scripts/qapi/backend.py
diff options
context:
space:
mode:
authorDaniel Henrique Barboza <dbarboza@ventanamicro.com>2025-04-29 09:44:17 -0300
committerAlistair Francis <alistair.francis@wdc.com>2025-05-19 13:42:18 +1000
commitd3b6f1742c36e3a3c1e74cb60646ee98a4e39ea3 (patch)
tree8b2d100230d7d7322cab1883af5dae3049762aa4 /scripts/qapi/backend.py
parent11766e17616a5a4181d4a63f88adf67ac52c553b (diff)
downloadfocaccia-qemu-d3b6f1742c36e3a3c1e74cb60646ee98a4e39ea3.tar.gz
focaccia-qemu-d3b6f1742c36e3a3c1e74cb60646ee98a4e39ea3.zip
target/riscv/kvm: add kvm_csr_cfgs[]
At this moment we're not checking if the host has support for any
specific CSR before doing get/put regs. This will cause problems if the
host KVM doesn't support it (see [1] as an example).

We'll use the same approach done with the CPU extensions: read all known
KVM CSRs during init() to check for availability, then read/write them
if they are present. This will be made by either using get-reglist or by
directly reading the CSRs.

For now we'll just convert the CSRs to use a kvm_csr_cfg[] array,
reusing the same KVMCPUConfig abstraction we use for extensions, and use
the array in (get|put)_csr_regs() instead of manually listing them. A
lot of boilerplate will be added but at least we'll automate the get/put
procedure for CSRs, i.e. adding a new CSR in the future will be a matter
of adding it in kvm_csr_regs[] and everything else will be taken care
of.

Despite all the code changes no behavioral change is made.

[1] https://lore.kernel.org/qemu-riscv/CABJz62OfUDHYkQ0T3rGHStQprf1c7_E0qBLbLKhfv=+jb0SYAw@mail.gmail.com/

Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20250429124421.223883-6-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Cc: qemu-stable@nongnu.org
Diffstat (limited to 'scripts/qapi/backend.py')
0 files changed, 0 insertions, 0 deletions