This sounds like the PS/2 driver/emulated hardware controller gets itself in knots. PS/2 isn't hot plug, so if something goes wrong it's generally stuffed until a reboot, which sounds like your issue.
One common option is to use Synergy, which passes the keyboard and mouse over the network, you set up the synergy service running on the Linux host, with it configured to map an edge of the screen to your Windows VM, then when the Windows VM is running and the synergy client connects you can move the mouse over that edge of the screen and it will appear on Windows (if you have multiple monitors this looks like the mouse seamlessly goes from one screen to the other).
Keyboard focus follows whatever system the mouse is active on. To pass the mouse back just take it back off the same screen edge. The edge->target machine relationship is programmable so you can have all edges go to the same machine, or some go to different machines, etc.
Not ideal, but maybe this could be an acceptable workaround?
It's probably also worth someone investigating the PS/2 code in KVM/QEMU, if you feel like compiling it yourself then you could investigate yourself where the mouse gets dropped.
> from https://urldefense.
> -----Original Message-----
> From: vfio-users-bounces redhat com [mailto:vfio-users-
> bounces redhat com] On Behalf Of Patrick O'Callaghan
> Sent: 25 April 2017 12:35
> To: Daimon Wang <daimon_swang yahoo com>; vfio-users redhat com
> Subject: Re: [vfio-users] VM loses mouse
> On Tue, 2017-04-25 at 09:07 +0000, Daimon Wang wrote:
> > I can't imagine how it works.
> Not sure what you don't understand, but to be explicit:
> * The host runs on the IGP with HDMI output
> * The guest runs on the 2nd GPU with HDMI output
> * Both HDMI cables go through a HDMI switch to my single monitor
> * I run KVM/QEMU via virt-manager, which shows a window on my host
> Linux desktop
> * To access the guest I click in the virt-manager window and hit the
> HDMI switch. This takes me to Windows.
> * To go back to the host I hit the HDMI switch, which returns the
> monitor to the virt-manager window, then Ctrl-Alt releases the mouse
> This works reliably, even when the bug occurs, i.e. the bug only affects
> mouse control in Windows. It doesn't affect my switching back and forth in
> any way. Toggling back and forth between host and guest does not correct
> the bug and reactivate the mouse. The only solution so far is to forcibly
> reboot the guest from virt-manager.
> > But maybe you can try the following.1. Set the VM mouse type to usb
> tablet. The default is PS/2. I'm not sure how to edit this in libvirt, but qemu
> option should be "-usbdevice tablet"2. Install the vdagent
> 5Yv7XIsqE&e= . You may only install the agent related component.
> virt-manager had no options for the default mouse, i.e. it's a PS/2 mouse or
> nothing. I could add an additional mouse I guess.
> @everyone, is there any way to freely switch mouse between the host and
> the VM with VGA pass-through? I remember there's a thread discussing this
> and the final solution is using ssh to execute some script, which is too
> I've seen several references about this kind of thing, including something
> called Synchronicity (?). All they did was make me waste a lot of time when I
> first tried setting this up. I think part of the problem is that people have
> different use cases and hence different assumptions about what one is
> trying to do e.g. many of them implicitly assume one has several monitors, or
> even several keyboards and/or mice, which I would suspect is actually the
> minority. This complicates the discussion.
> vfio-users mailing list
> vfio-users redhat com
vfio-users mailing list
vfio-users redhat com