From nobody Fri Dec 19 17:38:51 2025 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 DF57BC3DA79 for ; Mon, 26 Dec 2022 15:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232058AbiLZPbn (ORCPT ); Mon, 26 Dec 2022 10:31:43 -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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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=3DCorrected, type=3DTransac= tion Layer, (Receiver ID) pcieport 0000:00:1d.0: device [8086:7ab0] error status/mask=3D00008000/00= 002000 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=3DUncorrected (Non-Fatal), = type=3DTransaction Layer, (Requester ID) pcieport 0000:00:1d.0: device [8086:7ab0] error status/mask=3D00100000/00= 004000 pcieport 0000:00:1d.0: [20] UnsupReq (First) pcieport 0000:00:1d.0: AER: TLP Header: 34000000 0a000052 00000000 000000= 00 pcieport 0000:00:1d.0: AER: Error of this Agent is reported first pcieport 0000:04:01.0: PCIe Bus Error: severity=3DUncorrected (Non-Fatal), = type=3DTransaction Layer, (Requester ID) pcieport 0000:04:01.0: device [8086:1136] error status/mask=3D00300000/00= 000000 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 000000= 00 thunderbolt 0000:05:00.0: AER: can't recover (no error_detected callback) This supposedly should be fixed by commit c01163dbd1b8 ("PCI/PM: Always dis= able 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=3D216850 Cc: Mario Limonciello Cc: Mika Westerberg Signed-off-by: Kai-Heng Feng Reported-by: Pengyu Ma --- 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 *d= ev) if ((pci_pcie_type(dev) =3D=3D PCI_EXP_TYPE_ROOT_PORT || pci_pcie_type(dev) =3D=3D 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 |=3D PCIE_PORT_SERVICE_AER; #endif =20 --=20 2.34.1