From: Andreas Noever <andreas.noever@gmail.com>
To: Steven Noonan <steven@uplinklabs.net>
Cc: Andreas Noever <andreas.noever@gmail.com>,
Greg KH <greg@kroah.com>,
Linux Kernel mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Thunderbolt driver hotplug not working correctly
Date: Thu, 14 Aug 2014 01:05:43 +0200 [thread overview]
Message-ID: <1407971143-2928-1-git-send-email-andreas.noever@gmail.com> (raw)
In-Reply-To: <CAMxnaaXjtk1LB9LA_H9UOKX2-XUBM=RP1p=9ctxsnDpMsr6f3w@mail.gmail.com>
Hello Steven,
I think that there are two problems:
- The Kernel does not notice that the device is gone.
- The first hotplug operation, after removing a coldplugged device fails.
For the first one could you check whether thie pciehp (sub)-driver is loaded?
(dmesg | grep pciehp should show something, the config option is
CONFIG_HOTPLUG_PCI_PCIE).
I was able reproduce the second problem on my machine. Could you test whether
this patch fixes the problem?
Thanks,
Andreas
---
drivers/thunderbolt/path.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/path.c b/drivers/thunderbolt/path.c
index 8fcf8a7..9562cd0 100644
--- a/drivers/thunderbolt/path.c
+++ b/drivers/thunderbolt/path.c
@@ -150,7 +150,26 @@ int tb_path_activate(struct tb_path *path)
/* Activate hops. */
for (i = path->path_length - 1; i >= 0; i--) {
- struct tb_regs_hop hop;
+ struct tb_regs_hop hop = { 0 };
+
+ /*
+ * We do (currently) not tear down paths setup by the firmeware.
+ * If a firmware device is unplugged and plugged in again then
+ * it can happen that we reuse some of the hops from the (now
+ * defunct) firmeware path. This causes the hotplug operation to
+ * fail (the pci device does not show up). Clearing the hop
+ * before overwriting it fixes the problem.
+ *
+ * Should be removed once we discover and tear down firmeware
+ * paths.
+ */
+ res = tb_port_write(path->hops[i].in_port, &hop, TB_CFG_HOPS,
+ 2 * path->hops[i].in_hop_index, 2);
+ if (res) {
+ __tb_path_deactivate_hops(path, i);
+ __tb_path_deallocate_nfc(path, 0);
+ goto err;
+ }
/* dword 0 */
hop.next_hop = path->hops[i].next_hop_index;
--
2.0.4
next prev parent reply other threads:[~2014-08-13 23:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 9:01 Thunderbolt driver hotplug not working correctly Steven Noonan
2014-08-12 9:05 ` Greg KH
2014-08-12 22:55 ` Andreas Noever
2014-08-13 23:05 ` Andreas Noever [this message]
2014-08-15 11:19 ` Steven Noonan
[not found] <6486222925419988442@unknownmsgid>
2014-08-15 11:24 ` Steven Noonan
[not found] ` <CAMxnaaXwY1oyaws-SG3=DzO0qo12bT0-6V9mti7fO11--sp7Zw@mail.gmail.com>
[not found] ` <CAKbGBLivQ1cP_EN=maQ0fHAUKfmpWyEY1T5frqv4nAqTdXw5GQ@mail.gmail.com>
[not found] ` <CAMxnaaXwrgh4XVUEhEVDfUJ=9n+OWD3Ncj-=FOHUQ1Jw5xwSvw@mail.gmail.com>
[not found] ` <20140815173539.GA2012@twoflower.us-west-2.compute.internal>
2014-08-15 21:14 ` Andreas Noever
2014-08-26 15:58 ` Andreas Noever
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=1407971143-2928-1-git-send-email-andreas.noever@gmail.com \
--to=andreas.noever@gmail.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=steven@uplinklabs.net \
/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