@@ -365,6 +365,19 @@ int vmmouse_detect(struct psmouse *psmouse, bool set_properties)
return 0;
}
+/**
+ * vmmouse_reset - Disable vmmouse and reset
+ *
+ * @psmouse: Pointer to the psmouse struct
+ *
+ * Tries to disable vmmouse mode before enter suspend.
+ */
+static void vmmouse_reset(struct psmouse *psmouse)
+{
+ vmmouse_disable(psmouse);
+ psmouse_reset(psmouse);
+}
+
/**
* vmmouse_disconnect - Take down vmmouse driver
*
@@ -472,6 +485,7 @@ int vmmouse_init(struct psmouse *psmouse)
psmouse->protocol_handler = vmmouse_process_byte;
psmouse->disconnect = vmmouse_disconnect;
psmouse->reconnect = vmmouse_reconnect;
+ psmouse->cleanup = vmmouse_reset;
return 0;
Details: When I use VirtualPS/2 VMMouse on virtual machine, There will be an error message after resume from suspend mode. like below: vmmouse: Unable to re-enable mouse when reconnecting, err: -6 And vmmouse will be unusable,so have to do full rescan to find a another driver to use for the port. This error is due to QEMU still generate PS2 events to notify kernel driver to read from queue, but kernel can't process the data in suspend mode, resulting a surge of s->nb_queue value, which ultimately led to an error getting VMMOUSE_VERSION_ID after resume. Test scenario: 1)virtual machine started with qemu command "vmport=on", it will use VirtualPS/2 VMMouse. 2)click suspend botton to enter suspend mode. 3)resume and will get the error message from dmesg. Fixed by: Disabling the vmmouse in its reset handler, It will notify qemu to stop vmmouse and remove handler. Signed-off-by: Zongmin Zhou<zhouzongmin@kylinos.cn> --- drivers/input/mouse/vmmouse.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)