Crazy mouse movement when passing `-M pc,vmport=off -accel kvm -vga virtio` at the same time
Host environment
- Operating system: Arch Linux
- OS/kernel version: Linux Knecht 6.2.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 18 Mar 2023 01:06:36 +0000 x86_64 GNU/Linux
- Architecture: x86
- QEMU flavor: qemu-system-x86_64
- QEMU version: 8.0rc0
- QEMU command line:
qemu-system-x86_64 -m 2G -M pc,vmport=off -accel kvm -vga virtio -cdrom manjaro-xfce-22.0.5-230316-linux61.iso
Emulated/Virtualized environment
- Operating system: Manjaro
- OS/kernel version: Linux manjaro 6.1.19-1-MANJARO #1 SMP PREEMNT_DYNAMIC Mon Mar 13 12:59:35 UTC 2023 x86_64 GNU/Linux
- Architecture: x86
Description of problem
The mouse cursor is unusable in an x86 guest (disappears, jumps around like crazy) in a graphical environment when -M pc,vmport=off -accel kvm -vga virtio is given at the same time.
Steps to reproduce
- Download https://download.manjaro.org/xfce/22.0.5/manjaro-xfce-22.0.5-230316-linux61.iso
- Start above command
- Wait until the graphical desktop appears
- Click inside the window and move the mouse
-> Mouse cursor disappears or jumps around like crazy
Additional information
If vmport=off is not passed, at some point during startup (before graphical login manager appears) the guest switches to use vmmouse from PS/2 mouse. There it also requests usage of absolute input coordinates (VMMOUSE_REQUEST_ABSOLUTE). This code path works normal. Therefore the culprit might be in the guest.
Another way to reproduce the issue is to use -accel whpx under Windows host (no need to pass vmport=off there). It can be observed that the same guest doesn't attempt to switch to vmmouse there, just like passing vmport=off under Linux.
The problem does not exist on Linux host when -accel tcg is used in which case the guest doesn't attempt to switch to vmmouse.