Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2415712pxp; Mon, 21 Mar 2022 19:43:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvhV7OIkbuHoStwfxFutG3R933/mtF/iyRJfB+owYU8oy9inhib0P0YNG5Y41f937T2As1 X-Received: by 2002:a17:902:e845:b0:153:aa16:d74f with SMTP id t5-20020a170902e84500b00153aa16d74fmr16132428plg.18.1647917022321; Mon, 21 Mar 2022 19:43:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647917022; cv=none; d=google.com; s=arc-20160816; b=SFrXDnbDPmf//RHNWi8xtlvy74wMvXl2ViAshqvRsLPFJOJoplw/NOc14tYkJRqSSr ByX9CCgJHtzDb5HDLTdzFA5qp7B8nzGvDS5K4IudVPH3xpQQVr2fAsNsee2XfDzjiOaK d9t6GHInqBQ248Jm9h0/JzoxQ4565PlcuovtES10KAPxXiiDwG2FWaarei2Nwi/Mlf2Z GLUq018b86krbdwRRVN7R5SFvJXHMY47VolPQMVV1nFB8vydMfqvg7fScTZCyMPptgpt MzNI8GCycyAMCD2i3w2wRcqTMenvtakLJJUB5EatmIgoUdjUv1AzXIHCnimwWrYjL/2M vshg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PcCnBsH5JYyImcgT/PhKNan35xujZxMdyPZQJ8Yvmb0=; b=JqZjf501EXyZlUv78QZeeww/KX2dgY+tJQ2fEzguOFd+wlJcEN/JQY80wBC/U060s+ 6OBriawwvZWvqahfvESgtixu1V8imfIaKoyEIyr5/0Fd1wl7+0ndpvG87ku4tfmBedWp +LGmGJscaDkBvSWth2tgCXpLH8iwD8Q9rT1MIhj6kGdy5crd3OstHdUGUxu/habWWRTH jbcd8SgYTPW8ahvhI/e/PatV9HeaLMWS8SaljssZLI1lsRszCY5mavwzwCQKd3ts/fEE UXl/2pI+HGzMdN7ON1nXJTvcL1F5MVijz/2ZvN06ABW6tJ6SdfgN/y2Q6cOxi+WPt8Gf mprg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a1-20020a656041000000b003822d7cda53si11714902pgp.519.2022.03.21.19.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 19:43:42 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5092527CF3; Mon, 21 Mar 2022 19:15:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235325AbiCVCNA (ORCPT + 99 others); Mon, 21 Mar 2022 22:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235422AbiCVCM4 (ORCPT ); Mon, 21 Mar 2022 22:12:56 -0400 Received: from nksmu.kylinos.cn (mailgw.kylinos.cn [123.150.8.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C60431D0F9; Mon, 21 Mar 2022 19:11:16 -0700 (PDT) X-UUID: dd3f82672986463ea90bc96c9671ccc3-20220322 X-UUID: dd3f82672986463ea90bc96c9671ccc3-20220322 Received: from cs2c.com.cn [(172.17.111.24)] by nksmu.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1776092599; Tue, 22 Mar 2022 10:10:26 +0800 X-ns-mid: postfix-6239303C-8089562461 Received: from localhost.localdomain (unknown [172.20.12.156]) by cs2c.com.cn (NSMail) with ESMTPA id A2351383C640; Tue, 22 Mar 2022 02:11:08 +0000 (UTC) From: Zongmin Zhou To: linux-graphics-maintainer@vmware.com, pv-drivers@vmware.com, dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, zhouzongmin@kylinos.cn Subject: [PATCH] input/vmmouse: Add vmmouse_reset() function to disable vmmouse before entering suspend mode Date: Tue, 22 Mar 2022 10:10:46 +0800 Message-Id: <20220322021046.1087954-1-zhouzongmin@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Details: When I use VirtualPS/2 VMMouse on virtual machine,There will be an error message after resume from suspend mode. like below: psmouse serio1: 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 --- drivers/input/mouse/vmmouse.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index 42443ffba7c4..ea9eff7c8099 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c @@ -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; -- 2.25.1