From patchwork Tue Aug 16 10:40:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 12944702 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1E02C32789 for ; Tue, 16 Aug 2022 11:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232657AbiHPL0W (ORCPT ); Tue, 16 Aug 2022 07:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbiHPLZt (ORCPT ); Tue, 16 Aug 2022 07:25:49 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 305C63DBD8 for ; Tue, 16 Aug 2022 03:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660646449; x=1692182449; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=quHjxeEytV85JkCY9Ooohw8ukzLZgiWMuGKF3jXsWck=; b=c/zWRrdYsVyjijeWaScxGSPH/+s8wXQTQoMZ6MOFJ+qdUmColhkuxcLi Tp6L33vvlQlYV23i6qbBhPQu/4YCu/QiDgg1BENgMpwhUY+0BH/MZofnq mDugUY8GcuaxQK/sSD3fubveEmN5s8pKCDWMpJkieyO1+82mcoJTBk8P7 bftHxTFwqMdRgKL0P5sN/FPeJKXUlLWIU2sSBNfl/xRqZRn4xrxBhIC6g c2EuOfbGla92rJ96GuSNyzAZ95lcMwR61RzxRUt6WDO+YiEsPopy7BttN rpuZeEHviAdKIT+cgn/IKBQXxNMvnNE0IaLNrF1ih0RSN0TLIXwhgoIXw w==; X-IronPort-AV: E=McAfee;i="6400,9594,10440"; a="275238690" X-IronPort-AV: E=Sophos;i="5.93,240,1654585200"; d="scan'208";a="275238690" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 03:40:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,240,1654585200"; d="scan'208";a="610219060" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 16 Aug 2022 03:40:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id 9B1BF2F6; Tue, 16 Aug 2022 13:40:59 +0300 (EEST) From: Mika Westerberg To: linux-usb@vger.kernel.org Cc: Yehezkel Bernat , Michael Jamet , Lukas Wunner , Andreas Noever , Mika Westerberg Subject: [PATCH 1/2] thunderbolt: Use the actual buffer in tb_async_error() Date: Tue, 16 Aug 2022 13:40:58 +0300 Message-Id: <20220816104059.71844-1-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The received notification packet is held in pkg->buffer and not in pkg itself. Fix this by using the correct buffer. Fixes: 81a54b5e1986 ("thunderbolt: Let the connection manager handle all notifications") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg --- drivers/thunderbolt/ctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thunderbolt/ctl.c b/drivers/thunderbolt/ctl.c index e5ede5debfb0..0c661a706160 100644 --- a/drivers/thunderbolt/ctl.c +++ b/drivers/thunderbolt/ctl.c @@ -407,7 +407,7 @@ static void tb_ctl_rx_submit(struct ctl_pkg *pkg) static int tb_async_error(const struct ctl_pkg *pkg) { - const struct cfg_error_pkg *error = (const struct cfg_error_pkg *)pkg; + const struct cfg_error_pkg *error = pkg->buffer; if (pkg->frame.eof != TB_CFG_PKG_ERROR) return false; From patchwork Tue Aug 16 10:40:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 12944703 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C654C32792 for ; Tue, 16 Aug 2022 11:26:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233181AbiHPL0Y (ORCPT ); Tue, 16 Aug 2022 07:26:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231877AbiHPLZt (ORCPT ); Tue, 16 Aug 2022 07:25:49 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D966E696D7 for ; Tue, 16 Aug 2022 03:40:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660646448; x=1692182448; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Sk18p/HzGVgjYCkN5lbVZwUWPoKixzovFDCLm679drc=; b=g0WqKtUgQ9SfcpN0p5BEaxKyhn4fIcxYaR01VVTrSlHg/VyyZKLXqmwD DLdSFgdsdXSg/gms4o/MCx2qBJJ9iKgwcAgRPen+08k3nnSU0g6InXkTk yWZrSSJR+6Up480rObAC3asY3kF33FBeILKWHta0U5zCQMrwRfreIwAGl UGyIyEk+E0s0XHNZfB4zmGc768vctdqtIAsVbR8fgKjvUttjgK71E2eLs lPNEtEmen2IZmT+7ta5UAk+I3iRd8Ucs3CBAvVTSs0Yt4/NA8CF+a2xUx jsWD+YCI7ASrA3/f3qZZ9AAXLOOkM1MXnsAB8MBOmkip0Mjf1kvrDhRWe g==; X-IronPort-AV: E=McAfee;i="6400,9594,10440"; a="272576805" X-IronPort-AV: E=Sophos;i="5.93,240,1654585200"; d="scan'208";a="272576805" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2022 03:40:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,240,1654585200"; d="scan'208";a="557648814" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 16 Aug 2022 03:40:46 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id A9FF92D5; Tue, 16 Aug 2022 13:40:59 +0300 (EEST) From: Mika Westerberg To: linux-usb@vger.kernel.org Cc: Yehezkel Bernat , Michael Jamet , Lukas Wunner , Andreas Noever , Mika Westerberg Subject: [PATCH 2/2] thunderbolt: Check router generation before connecting xHCI Date: Tue, 16 Aug 2022 13:40:59 +0300 Message-Id: <20220816104059.71844-2-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220816104059.71844-1-mika.westerberg@linux.intel.com> References: <20220816104059.71844-1-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Only Thunderbolt 3 routers need the xHCI connection flow. This also ensures the router actually has both lane adapters (1 and 3). While there move declaration of the boolean variables inside the block where they are being used. Fixes: 30a4eca69b76 ("thunderbolt: Add internal xHCI connect flows for Thunderbolt 3 devices") Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg --- drivers/thunderbolt/switch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 244f8cd38b25..c63c1f4ff9dc 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -3786,14 +3786,18 @@ int tb_switch_pcie_l1_enable(struct tb_switch *sw) */ int tb_switch_xhci_connect(struct tb_switch *sw) { - bool usb_port1, usb_port3, xhci_port1, xhci_port3; struct tb_port *port1, *port3; int ret; + if (sw->generation != 3) + return 0; + port1 = &sw->ports[1]; port3 = &sw->ports[3]; if (tb_switch_is_alpine_ridge(sw)) { + bool usb_port1, usb_port3, xhci_port1, xhci_port3; + usb_port1 = tb_lc_is_usb_plugged(port1); usb_port3 = tb_lc_is_usb_plugged(port3); xhci_port1 = tb_lc_is_xhci_connected(port1);