From patchwork Mon Jul 12 13:34:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 12371209 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21BFEC07E9A for ; Mon, 12 Jul 2021 13:42:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 055B261042 for ; Mon, 12 Jul 2021 13:42:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234770AbhGLNpV (ORCPT ); Mon, 12 Jul 2021 09:45:21 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:54222 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234638AbhGLNpT (ORCPT ); Mon, 12 Jul 2021 09:45:19 -0400 X-Greylist: delayed 438 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Jul 2021 09:45:19 EDT Received: from localhost (1.general.khfeng.us.vpn [10.172.68.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 537044061A; Mon, 12 Jul 2021 13:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626096917; bh=LGxqAkOoOm8w+lN//0OhPBiSVWFP77FniFSghw2+jBI=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=WfL2fbkya76HeKTJFQj5gPuZN/mcJPgwf6A8Gi6FcwKhiP6snnQcuSs5NVfQGn4JD DWUaFe53uuwHYTsaDZsUI+ttrmNFtqTO5PNWx7tM3bh2P/VJdaGG8feKh05cO5dQT4 YZXGHD9ItRJRRzsngbZOhdJfFQF3vlgmB6VOqpfh0ZttxBUaXW6o0JPfBWeRGczP3M v4TgPMO+OsUfs8CHiar8j3KXcH+D0w90GsFzVrIdBW8GirCjzxBV2IP6zJ2CMywJwl O2/7JFTrijYirOw4yDzkdqD6yMiAS8IXBQGMulCkB0UBSY/vDFNv9qrBXzr3FxXQQj YHJF8qAgijL4Q== From: Kai-Heng Feng To: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com Cc: acelan.kao@canonical.com, Kai-Heng Feng , "David S. Miller" , Jakub Kicinski , intel-wired-lan@lists.osuosl.org (moderated list:INTEL ETHERNET DRIVERS), netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] e1000e: Serialize TGP e1000e PM ops Date: Mon, 12 Jul 2021 21:34:59 +0800 Message-Id: <20210712133500.1126371-3-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712133500.1126371-1-kai.heng.feng@canonical.com> References: <20210712133500.1126371-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org On TGL systems, PCI_COMMAND may randomly flip to 0 on system resume. This is devastating to drivers that use pci_set_master(), like NVMe and xHCI, to enable DMA in their resume routine, as pci_set_master() can inadvertently disable PCI_COMMAND_IO and PCI_COMMAND_MEMORY, making resources inaccessible. The issue is reproducible on all kernel releases, but the situation is exacerbated by commit 6cecf02e77ab ("Revert "e1000e: disable s0ix entry and exit flows for ME systems""). Seems like ME can do many things to other PCI devices until it's finally out of ULP polling. So ensure e1000e PM ops are serialized by enforcing suspend/resume order to workaround the issue. Of course this will make system suspend and resume a bit slower, but we probably need to settle on this workaround until ME is fully supported. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212039 Signed-off-by: Kai-Heng Feng --- drivers/net/ethernet/intel/e1000e/netdev.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e63445a8ce12..0244d3dd90a3 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -7319,7 +7319,8 @@ static const struct net_device_ops e1000e_netdev_ops = { static void e1000e_create_device_links(struct pci_dev *pdev) { - struct pci_dev *tgp_mei_me; + struct pci_bus *bus = pdev->bus; + struct pci_dev *tgp_mei_me, *p; /* Find TGP mei_me devices and make e1000e power depend on mei_me */ tgp_mei_me = pci_get_device(PCI_VENDOR_ID_INTEL, 0xa0e0, NULL); @@ -7335,6 +7336,17 @@ static void e1000e_create_device_links(struct pci_dev *pdev) pci_info(pdev, "System and runtime PM depends on %s\n", pci_name(tgp_mei_me)); + /* Find other devices in the SoC and make them depend on e1000e */ + list_for_each_entry(p, &bus->devices, bus_list) { + if (&p->dev == &pdev->dev || &p->dev == &tgp_mei_me->dev) + continue; + + if (device_link_add(&p->dev, &pdev->dev, + DL_FLAG_AUTOREMOVE_SUPPLIER)) + pci_info(p, "System PM depends on %s\n", + pci_name(pdev)); + } + pci_dev_put(tgp_mei_me); }