[8.0.0] Broken icount support on RISC-V Description of problem: After https://gitlab.com/qemu-project/qemu/-/commit/5a4ae64cac49564354cd6f17598840e4af70e4f5 was merged, RISC-V VMs no longer run with -icount 1 specified in the QEMU arguments. Reverting this commit resolves the issue. Steps to reproduce: 1. Download preinstalled Ubuntu 22.04.2 image from [here](https://cdimage.ubuntu.com/releases/22.04.2/release/ubuntu-22.04.2-preinstalled-server-riscv64+unmatched.img.xz) 2. Download uboot from [here](http://security.ubuntu.com/ubuntu/pool/main/u/u-boot/u-boot-qemu_2022.01+dfsg-2ubuntu2.3_all.deb) 3. Extract both. 4. Run with the command-line specified above. Additional information: Reading Ubuntu wiki describing how to run RISC-V VMs can help: https://wiki.ubuntu.com/RISC-V/QEMU Full output: ``` % qemu-system-riscv64 \ -machine virt -nographic -m 2048 -smp 4 \ -kernel u-boot/qemu-riscv64_smode/uboot.elf \ -device virtio-net-device,netdev=eth0 -netdev user,id=eth0 \ -drive file=ubuntu-22.04.2-preinstalled-server-riscv64+unmatched.img,format=raw,if=virtio -icount 1 OpenSBI v1.2 ____ _____ ____ _____ / __ \ / ____| _ \_ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ \___ \| _ < | | | |__| | |_) | __/ | | |____) | |_) || |_ \____/| .__/ \___|_| |_|_____/|____/_____| | | |_| Platform Name : riscv-virtio,qemu Platform Features : medeleg Platform HART Count : 4 Platform IPI Device : aclint-mswi Platform Timer Device : aclint-mtimer @ 10000000Hz Platform Console Device : uart8250 Platform HSM Device : --- Platform PMU Device : --- Platform Reboot Device : sifive_test Platform Shutdown Device : sifive_test Firmware Base : 0x80000000 Firmware Size : 236 KB Runtime SBI Version : 1.0 Domain0 Name : root Domain0 Boot HART : 0 Domain0 HARTs : 0*,1*,2*,3* Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I) Domain0 Region01 : 0x0000000080000000-0x000000008003ffff () Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X) Domain0 Next Address : 0x0000000080200000 Domain0 Next Arg1 : 0x00000000bfe00000 Domain0 Next Mode : S-mode Domain0 SysReset : yes Boot HART ID : 0 Boot HART Domain : root Boot HART Priv Version : v1.12 Boot HART Base ISA : rv64imafdch Boot HART ISA Extensions : time,sstc Boot HART PMP Count : 16 Boot HART PMP Granularity : 4 Boot HART PMP Address Bits: 54 Boot HART MHPM Count : 16 Boot HART MIDELEG : 0x0000000000001666 Boot HART MEDELEG : 0x0000000000f0b509 qemu-system-riscv64: Bad icount read ```