Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1146843pxf; Fri, 26 Mar 2021 01:59:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6GQW0JYPpOcgpn0zdGwOUOLZcG14gyMhOPAZmfR6SmSIsTWIYc7+wWZvoEZLbU9o7A02b X-Received: by 2002:a17:906:82c5:: with SMTP id a5mr14412327ejy.232.1616749169712; Fri, 26 Mar 2021 01:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616749169; cv=none; d=google.com; s=arc-20160816; b=vAvy3UONDlDXVYYkqsJJ1I4EmB2SKbSaUekFytLBq9d+hSA/fo5HCwny1vWMIGYx9t bDyAxDLrdSuOaAcPdfjsskUzIqNp4WsbGQpqd8bxo8UWeuOl2HUz5cGB/G/11bZA2OIE XLKjocyJ1UncKJNm5DFMmRjsDPatDOqvAZxzaR9UEwQQNDRG35M0kcUa/s60nTzI5Qdt c2YDKe73YoUDQkLhwzUbKjjB+utUhvYJD3TpcIz4hXo57Fqh5mJupQHGAeVx6xhnurre 3I4Aw4RKhzN9Srv6t1WGWPjOBQMAgDejCyK1bUAst+sy3n73caqyoGohcg5MLDGKOxLK xa3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=uRpnkjnyEiFCuUGW15XjIOFPb0CfiWm5js+bOp7LXns=; b=l6l0W9hPFLKDBR7p+L7ux1iSNP/eFqstRVUgtZnY4tqTvJkk31G4IfpPQoQxe5uSjD cVJka5+m1J1qt0J2PgCZjqKRC49jZu3EWDo43x41pT9CVfbyLknE1rQpezimwIOze9uo Gks3eIKut6OE0M76vGnRGvVyCVPsJD7jV2QiH41LBcbONnEkXDtT+0J/QwPIpx7PkD+n 9iD38aplDRDuRbkIUw9jd4udO3d2+iVvLfVd/6l4LpXei2wGK0X74R2hWbRYfbdFbWui mC2kxn6c2IvVxhZdYbZTrmP+4n1ldTmv5/SIay2w2h48hhxPsQ9Nbr7Rdsq8N/F5Lwa5 SkLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw21si6103309edb.344.2021.03.26.01.59.06; Fri, 26 Mar 2021 01:59:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbhCZI6K (ORCPT + 99 others); Fri, 26 Mar 2021 04:58:10 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:14490 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229474AbhCZI5p (ORCPT ); Fri, 26 Mar 2021 04:57:45 -0400 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4F6G5c3HSJzrbDW; Fri, 26 Mar 2021 16:55:32 +0800 (CST) Received: from huawei.com (10.67.165.24) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.498.0; Fri, 26 Mar 2021 16:57:22 +0800 From: Longfang Liu To: , , CC: , , , , , Subject: [RFC PATCH] USB:ohci:fix ohci interruption problem Date: Fri, 26 Mar 2021 16:54:56 +0800 Message-ID: <1616748896-9415-1-git-send-email-liulongfang@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When OHCI enters the S4 sleep state, the USB sleep process will call check_root_hub_suspend() and ohci_bus_suspend() instead of ohci_suspend() and ohci_bus_suspend(), this causes the OHCI interrupt to not be closed. At this time, if just one device interrupt is reported. Since rh_state has been changed to OHCI_RH_SUSPENDED after ohci_bus_suspend(), the driver will not process and close this device interrupt. It will cause the entire system to be stuck during sleep, causing the device to fail to respond. When the abnormal interruption reaches 100,000 times, the system will forcibly close the interruption and make the device unusable. Since the problem is that the interrupt is not closed, we copied the interrupt shutdown operation of ohci_suspend() into ohci_bus_suspend() during the S4 sleep period. We found that this method can solve this problem. At present, we hope to be able to call ohci_suspend() directly during the sleep process of S4. Do you have any suggestions for this modification? Signed-off-by: Longfang Liu --- drivers/usb/host/ohci-hub.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 634f3c7..d468cef 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c @@ -315,6 +315,14 @@ static int ohci_bus_suspend (struct usb_hcd *hcd) del_timer_sync(&ohci->io_watchdog); ohci->prev_frame_no = IO_WATCHDOG_OFF; } + + spin_lock_irqsave(&ohci->lock, flags); + ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); + (void)ohci_readl(ohci, &ohci->regs->intrdisable); + + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + spin_unlock_irqrestore(&ohci->lock, flags); + return rc; } @@ -326,7 +334,10 @@ static int ohci_bus_resume (struct usb_hcd *hcd) if (time_before (jiffies, ohci->next_statechange)) msleep(5); - spin_lock_irq (&ohci->lock); + spin_lock_irq(&ohci->lock); + set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); + ohci_readl(ohci, &ohci->regs->intrenable); if (unlikely(!HCD_HW_ACCESSIBLE(hcd))) rc = -ESHUTDOWN; -- 2.8.1