linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Longfang Liu <liulongfang@huawei.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, <yisen.zhuang@huawei.com>,
	<tanxiaofei@huawei.com>
Subject: [RFC PATCH] USB: xhci: Enable HCE event reset function
Date: Wed, 18 Nov 2020 11:36:13 +0800	[thread overview]
Message-ID: <1605670573-949-1-git-send-email-liulongfang@huawei.com> (raw)

The HCE(Host Controller Error) event has been defined in
the XHCI driver but has not been used. If we want to use
the HCE event to reset the controller, can we implement
it in the interrupt function as follows:

xhci_irq()
    |----xhci_halt()
    |----xhci_shutdown()
    |----xhci_start()
    |----xhci_run()

Signed-off-by: Longfang Liu <liulongfang@huawei.com>
---
 drivers/usb/host/xhci-ring.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 2c255d0..87b3a40 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2857,6 +2857,16 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
 		goto out;
 	}
 
+	if (status & STS_HCE) {
+		xhci_warn(xhci, "WARNING: Host Controller Error\n");
+		xhci_halt(xhci);
+		xhci_shutdown(hcd);
+		xhci_start(xhci);
+		xhci_run(hcd);
+		ret = IRQ_HANDLED;
+		goto out;
+	}
+
 	/*
 	 * Clear the op reg interrupt status first,
 	 * so we can receive interrupts from other MSI-X interrupters.
-- 
2.8.1


             reply	other threads:[~2020-11-18  3:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18  3:36 Longfang Liu [this message]
2020-11-18  7:02 ` [RFC PATCH] USB: xhci: Enable HCE event reset function Greg KH
2020-11-18  9:04   ` liulongfang
2020-11-18  9:14     ` Greg KH
2020-11-18 16:21       ` Mathias Nyman
2020-11-19  1:50         ` liulongfang
2020-11-19  6:09           ` Greg KH
2020-11-19 13:13             ` liulongfang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1605670573-949-1-git-send-email-liulongfang@huawei.com \
    --to=liulongfang@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=tanxiaofei@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).