Hi, This is a follow-up of the work done in [1] after review comments made in the rva22u64 profile support review [2].
zicntr and zihpm are already implemented by QEMU before they were added as discrete extensions by RVI. This puts QEMU in a weird spot because it has enabled default extensions that aren't togglable on/off via user flags and aren't reported in riscv,isa as present. There's no reason to no treat both zicntr and zihpm as regular extensions, reporting their existence in riscv,isa DT and allowing users to disable them. This will also benefit us in the incoming profile support, since disabling a profile should disable all its mandatory extensions, and for the rva22u64 profile this means that both zicntr and zihpm should be disabled as well. Let's add user flags and disable support for both in all accelerators (TCG and KVM). FWIW Linux boot doesn't seem to care about the lack of both zicntr and zihpm when running TCG, although attempting to use the timers will result in SIGILL. [1] https://lore.kernel.org/qemu-riscv/20230717215419.124258-1-dbarb...@ventanamicro.com/ [2] https://lore.kernel.org/qemu-riscv/20231017-e7a4712137165b59844499e3@orel/T/#m3bb0e3c9b00d9edd168da9f7de0bc26df4f7d6ab Daniel Henrique Barboza (6): target/riscv/cpu.c: add zicntr extension flag target/riscv/tcg: add ext_zicntr disable support target/riscv/kvm: add zicntr reg target/riscv/cpu.c: add zihpm extension flag target/riscv/tcg: add ext_zihpm disable support target/riscv/kvm: add zihpm reg target/riscv/cpu.c | 15 +++++++++++++++ target/riscv/cpu_cfg.h | 2 ++ target/riscv/csr.c | 4 ++++ target/riscv/kvm/kvm-cpu.c | 2 ++ target/riscv/tcg/tcg-cpu.c | 21 +++++++++++++++++++++ 5 files changed, 44 insertions(+) -- 2.41.0