From patchwork Mon Jul 12 13:34:57 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: 473346 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=ham 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 34A57C07E99 for ; Mon, 12 Jul 2021 13:35:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E893601FA for ; Mon, 12 Jul 2021 13:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234290AbhGLNh5 (ORCPT ); Mon, 12 Jul 2021 09:37:57 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:59298 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234153AbhGLNh4 (ORCPT ); Mon, 12 Jul 2021 09:37:56 -0400 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-1.canonical.com (Postfix) with ESMTPSA id F408D40325; Mon, 12 Jul 2021 13:35:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626096906; bh=wPRu7NWwQMf97Gb7KzQ3v7mTH8FGJGWMqE4KG+HRscU=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=XAUDQllqtT1gHhlA5AA5BuokS6u5KXIfbqPUePiJ1t1LkPdfuGXAUBcc9EvuLSHUw ln05CWNoQJurvJLtXz0vU/JcJiZR7S1is/a56bqfj8+HNvYoB+EKvAq507lAUofU5c AqXuvMeS53Rek83L3KL5z+zjqQAVslQTSM8K/6IET2awfb7Z6tfcbtVWTOd/1+r7ot EgcgvuMwlu1gX45QP1upLVV7oPaj7D4yGAuvoR3Q5gpuDUDm11r3hLvlSaavnF0J4b kVYPJmESb3kz34S0OEctMJkf7tK1ORnKTNvMx5ChjjpF8NPa+zqltwSoA/Th6TfSIG XVcK2etrEsVWg== 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 1/3] e1000e: Separate TGP from SPT Date: Mon, 12 Jul 2021 21:34:57 +0800 Message-Id: <20210712133500.1126371-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Separate TGP from SPT so we can apply specific quirks to TGP. Signed-off-by: Kai-Heng Feng --- drivers/net/ethernet/intel/e1000e/e1000.h | 4 +++- drivers/net/ethernet/intel/e1000e/ich8lan.c | 20 ++++++++++++++++++++ drivers/net/ethernet/intel/e1000e/netdev.c | 13 +++++++------ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h index 5b2143f4b1f8..3178efd98006 100644 --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h @@ -113,7 +113,8 @@ enum e1000_boards { board_pch2lan, board_pch_lpt, board_pch_spt, - board_pch_cnp + board_pch_cnp, + board_pch_tgp }; struct e1000_ps_page { @@ -499,6 +500,7 @@ extern const struct e1000_info e1000_pch2_info; extern const struct e1000_info e1000_pch_lpt_info; extern const struct e1000_info e1000_pch_spt_info; extern const struct e1000_info e1000_pch_cnp_info; +extern const struct e1000_info e1000_pch_tgp_info; extern const struct e1000_info e1000_es2_info; void e1000e_ptp_init(struct e1000_adapter *adapter); diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index cf7b3887da1d..654dbe798e55 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -5967,3 +5967,23 @@ const struct e1000_info e1000_pch_cnp_info = { .phy_ops = &ich8_phy_ops, .nvm_ops = &spt_nvm_ops, }; + +const struct e1000_info e1000_pch_tgp_info = { + .mac = e1000_pch_tgp, + .flags = FLAG_IS_ICH + | FLAG_HAS_WOL + | FLAG_HAS_HW_TIMESTAMP + | FLAG_HAS_CTRLEXT_ON_LOAD + | FLAG_HAS_AMT + | FLAG_HAS_FLASH + | FLAG_HAS_JUMBO_FRAMES + | FLAG_APME_IN_WUC, + .flags2 = FLAG2_HAS_PHY_STATS + | FLAG2_HAS_EEE, + .pba = 26, + .max_hw_frame_size = 9022, + .get_variants = e1000_get_variants_ich8lan, + .mac_ops = &ich8_mac_ops, + .phy_ops = &ich8_phy_ops, + .nvm_ops = &spt_nvm_ops, +}; diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index d150dade06cf..5835d6cf2f51 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -51,6 +51,7 @@ static const struct e1000_info *e1000_info_tbl[] = { [board_pch_lpt] = &e1000_pch_lpt_info, [board_pch_spt] = &e1000_pch_spt_info, [board_pch_cnp] = &e1000_pch_cnp_info, + [board_pch_tgp] = &e1000_pch_tgp_info, }; struct e1000_reg_info { @@ -7843,12 +7844,12 @@ static const struct pci_device_id e1000_pci_tbl[] = { { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_V11), board_pch_cnp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_LM12), board_pch_spt }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_CMP_I219_V12), board_pch_spt }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM13), board_pch_cnp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V13), board_pch_cnp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM14), board_pch_cnp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_cnp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_cnp }, - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_cnp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM13), board_pch_tgp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V13), board_pch_tgp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM14), board_pch_tgp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V14), board_pch_tgp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_LM15), board_pch_tgp }, + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_TGP_I219_V15), board_pch_tgp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM16), board_pch_cnp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V16), board_pch_cnp }, { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM17), board_pch_cnp }, 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: 473345 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 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); }