Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1110232pxb; Wed, 6 Apr 2022 08:58:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+jAKn0k29HIEoqS72yWzCny8aLT4gMVkk0BrV5EDyQLM4AZs4gMcZA/BkXN0zZ8f7tqF3 X-Received: by 2002:a17:902:b684:b0:156:80b4:db03 with SMTP id c4-20020a170902b68400b0015680b4db03mr9479194pls.16.1649260732472; Wed, 06 Apr 2022 08:58:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649260732; cv=none; d=google.com; s=arc-20160816; b=hU/xkWjSpXU15dvXLftfFGbtaQxbN/Hf55iksBT8N1G7sCiOVfuoeeZe+jHrDzHrcj J5s3npE4L1Ma9O5oB9Tk9/+P4NVJ+h3T+g3AJAmIXyk/lXcGOLbAtu4cAKR/DkHvHFZ/ ZH+B32vwROORf3HbfqRbXQFw8T6CmvAcIAZHmqWHz+BM2JxZkQOfvSz3hYuiI/fuHNEQ WDwWI1n9gCFxzI5GYYZxM1q2aIsYwNmz9Hi/aNN53ZGFDUVK+qstvKg7J3RZfxORznD+ y5S7+Wtg68xyvYK8FS9COcsOzWUrSzhCqL9IRTsJBRyeHd018McH9po9z6LRSJD0SkTs V5aA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=R8ZlO0VauIu1u6RvxqV5Szsexi27VynyC33g+KbYM1A=; b=rwt9gVQBWw2XYKQFlWd8bYDtPaht51FBxIytbay6E1YC3yNsbvJKg5/wfPxiGPlozq aWCqEiaZT0hqAS3YCLIF1E4xzVLzytnUBXssfxWUU3bRGF1tr/+u/MmFLNZiAlpOtuLE kT0PkT+nA4Zb6cVgJlPfP1biTXZ8roThGrahf6TWlKQis3twymxHPe6PPx5VF0wbG4TG Lwh98tonmYBIHqNuV+xA8tQ7ZQIrnkAmtv5XptunGHoIq+kmOvw4pxN21d2yKRcbZDlB 2EDlxFQ9EN5N43RTUzmlbei5EfOl4eDuyEww4ByhWpDAOyCPTB2R/gWcDKGRWJ8JyYou /IGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 123-20020a620581000000b004fa3a8e0039si15063921pff.240.2022.04.06.08.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 08:58:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 C5E4131E1C4; Wed, 6 Apr 2022 07:21:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234582AbiDFOXw (ORCPT + 99 others); Wed, 6 Apr 2022 10:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234619AbiDFOXc (ORCPT ); Wed, 6 Apr 2022 10:23:32 -0400 Received: from nksmu.kylinos.cn (mailgw.kylinos.cn [123.150.8.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96A74469EEC; Wed, 6 Apr 2022 03:29:46 -0700 (PDT) X-UUID: 7cb7a6c9f74e49218faa4d6d707341fe-20220406 X-UUID: 7cb7a6c9f74e49218faa4d6d707341fe-20220406 Received: from cs2c.com.cn [(172.17.111.24)] by nksmu.kylinos.cn (envelope-from ) (Generic MTA) with ESMTP id 1654346570; Wed, 06 Apr 2022 18:07:45 +0800 X-ns-mid: postfix-624D66AF-3551519497 Received: from localhost.localdomain (unknown [172.20.12.156]) by cs2c.com.cn (NSMail) with ESMTPA id 2D0F63848672; Wed, 6 Apr 2022 10:08:47 +0000 (UTC) From: Zongmin Zhou To: zackr@vmware.com, 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: [RESEND PATCH] input/vmmouse: Add vmmouse_reset() function to disable vmmouse before entering suspend mode Date: Wed, 6 Apr 2022 18:08:38 +0800 Message-Id: <20220406100838.610519-1-zhouzongmin@kylinos.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220322021046.1087954-1-zhouzongmin@kylinos.cn> References: <20220322021046.1087954-1-zhouzongmin@kylinos.cn> MIME-Version: 1.0 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: 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