Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp2024255rwl; Mon, 26 Dec 2022 07:54:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXsWsy1DYSwIHGNUNfJtyTfKum457ot39Y9hVasF33HN8F97A3ZDV2tz0qUxLMFUFntiGS7h X-Received: by 2002:a17:907:c516:b0:7c1:e78:11ed with SMTP id tq22-20020a170907c51600b007c10e7811edmr16736598ejc.0.1672070087068; Mon, 26 Dec 2022 07:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672070087; cv=none; d=google.com; s=arc-20160816; b=PWbKUqAn4UfJ8bLGsv/r8uhVb9LjxsT1kVqgZ3y/N88wQroLg+q8fnWfbHw7kP3P/p mJ/wuly8j2QcYKEoLVUQujRfz2SX/dXQbKRwlvnB2HyIuUh/uD7U37QlbekGguwE5lxM W72sVsQHgBlz1Dc1BtCj0qQkh0zA7RC966HlkOcriAEBnhZdbKbyQmu5omkwQiR/3nrl Rt25Lc1n+MOVoYb6015LG3UVuWBtW+fuhQUdMt97rye0U/nOJe5LTh3XaJdxd7sp/+uj H9t65T+V/XrmYNqjOWbaN5cG4WXtXlc1KgByRVYoAad4pczYqHFFIL5TiYnZa/uPfgDD dsHg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=0MdCug5jtApVxCbACAza5eayqP2DubrBGd6UD6PDHQU=; b=xrNdGeZtRrg/XXmDCceAMmCH7k3x4Qz6oQn4KHQ5sZun445YzxWamYRYW594Xq3MTq fPloFWbUQdXamWhaan6ZoL7igYLMZd15zLOl21ejpJmJ3hAqw7wkohbKs6Pt5ajpuHdi Y/4MuukYYba5+s0zLTCVvCq0Bbm2+oU7bLBAzmYIpK3SrlPDJ2Q5Ui8g8ll6beZ2bG0Y 6FBMgYz7W087kZtBqI3OuOyJQjgdkIGI/PHNeAggLKAEfLEUWJpQfTacIQ6RyiId0yZS e2RSQeYzGdo7AXdzCybFatgXvBFjfCroIYK4fckWjOWTRq5ZB1aYNWPzK9lSgl3gVq6H +83Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=l2Js2VpT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb6-20020a170907070600b00773db351c39si8860515ejb.64.2022.12.26.07.54.31; Mon, 26 Dec 2022 07:54:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=l2Js2VpT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232050AbiLZPbm (ORCPT + 66 others); Mon, 26 Dec 2022 10:31:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbiLZPbk (ORCPT ); Mon, 26 Dec 2022 10:31:40 -0500 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7372135; Mon, 26 Dec 2022 07:31:38 -0800 (PST) Received: from localhost.localdomain (unknown [10.101.196.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 9281E42832; Mon, 26 Dec 2022 15:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1672068697; bh=0MdCug5jtApVxCbACAza5eayqP2DubrBGd6UD6PDHQU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=l2Js2VpTmoMTGvjnbPFLWivfBUPBu2r/d4McFVg49MR6NpOCUJ1qkdwm3n51ExOkf dzi3vJI1lHc2Ma2FnBgQTZKhmyOfKVn5a6aD1LBDfxHWRs+xUJQ3Rl/AhX3+iqYB/J CC6h9sB4zp933VItC20tE/xhsk9JU9Lrmg9RPqFlJtgRSgUF7G8WwXHxxMxKiZCgtg JHdp4WyfUBCcWIE67i3aklMSzCr87Rp/NYTGNLhC++aOg2lMO/Ju17sPbq3wuceK+9 +r7EenhFLjksUR9qSh8ORprA5ZXNOWsG4xK96a4Mkqtgo7cQXE1OD8fM0LQ+BeYbnm xjvxedttKn1Gw== From: Kai-Heng Feng To: bhelgaas@google.com Cc: Kai-Heng Feng , Mario Limonciello , Mika Westerberg , Keith Busch , Kuppuswamy Sathyanarayanan , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Stefan Roese , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PCI/portdrv: Avoid enabling AER on Thunderbolt devices Date: Mon, 26 Dec 2022 23:30:31 +0800 Message-Id: <20221226153048.1208359-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 We are seeing igc ethernet device on Thunderbolt dock stops working after S3 resume because of AER error, or even make S3 resume freeze: pcieport 0000:00:1d.0: AER: Multiple Corrected error received: 0000:00:1d.0 pcieport 0000:00:1d.0: PCIe Bus Error: severity=Corrected, type=Transaction Layer, (Receiver ID) pcieport 0000:00:1d.0: device [8086:7ab0] error status/mask=00008000/00002000 pcieport 0000:00:1d.0: [15] HeaderOF pcieport 0000:00:1d.0: AER: Multiple Uncorrected (Non-Fatal) error received: 0000:00:1d.0 pcieport 0000:00:1d.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Requester ID) pcieport 0000:00:1d.0: device [8086:7ab0] error status/mask=00100000/00004000 pcieport 0000:00:1d.0: [20] UnsupReq (First) pcieport 0000:00:1d.0: AER: TLP Header: 34000000 0a000052 00000000 00000000 pcieport 0000:00:1d.0: AER: Error of this Agent is reported first pcieport 0000:04:01.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, (Requester ID) pcieport 0000:04:01.0: device [8086:1136] error status/mask=00300000/00000000 pcieport 0000:04:01.0: [20] UnsupReq (First) pcieport 0000:04:01.0: [21] ACSViol pcieport 0000:04:01.0: AER: TLP Header: 34000000 04000052 00000000 00000000 thunderbolt 0000:05:00.0: AER: can't recover (no error_detected callback) This supposedly should be fixed by commit c01163dbd1b8 ("PCI/PM: Always disable PTM for all devices during suspend"), but somehow it doesn't work for this case. By dumping the PCI_PTM_CTRL register on resume, it turns out PTM is already flipped on by either the Thunderbolt dock firmware or the host BIOS. Writing 0 to PCI_PTM_CTRL yields the same result. Windows is however not affected by this issue, by using WinDbg's !pci command, it shows that AER is not enabled for devices connected via Thunderbolt port, and that's the reason why Windows doesn't exhibit the issue. So turn a blind eye on external Thunderbolt devices like Windows does by disabling AER. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216850 Cc: Mario Limonciello Cc: Mika Westerberg Signed-off-by: Kai-Heng Feng --- drivers/pci/pcie/portdrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c index 2cc2e60bcb396..59d00e20e57bf 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c @@ -237,7 +237,8 @@ static int get_port_device_capability(struct pci_dev *dev) if ((pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC) && dev->aer_cap && pci_aer_available() && - (pcie_ports_native || host->native_aer)) + (pcie_ports_native || host->native_aer) && + !dev_is_removable(&dev->dev)) services |= PCIE_PORT_SERVICE_AER; #endif -- 2.34.1