From patchwork Mon Sep 11 09:06:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1832212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=nGEBgNjE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rkgpk0z9xz1yj0 for ; Mon, 11 Sep 2023 19:07:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qfctJ-0003LU-BU; Mon, 11 Sep 2023 09:07:33 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qfct9-0003JA-AI for kernel-team@lists.ubuntu.com; Mon, 11 Sep 2023 09:07:23 +0000 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (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-internal-0.canonical.com (Postfix) with ESMTPS id 2882F3F182 for ; Mon, 11 Sep 2023 09:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1694423243; bh=TSZVIuwbfrXQOuOEyLTdJoP9dvtpo29LuanTafrBpGc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nGEBgNjEphmc2qcfo3HsHpOoJQ4HlVEvOVkCbptw8/RM0hv+wQzVkh+Xt+0A2EYD5 EoAU8MKH2moXK+H5xhaq/w1UhXBnkgYPF/QkHznTif4xXhp0qHOYaGAdWFtXzEspxU opZmgl7PdNn6S54wbXbRpV/xRP8zGbm/60QnQ8x26/ZAHVCbc4DWC1Vw4/exp+nHbp B4pEEApuDX93PfLbWAESF5xYdw8kD3M9iy2Noq/MgG4S1JJCUcpA3OnPOwfyJFEchq pV8hvxwA+tzjsqEy2POYtzluC6dnn79xRYn5QhtQ7WHimf8sIFi5Cd6c1JYS2qWYlA BnoPYk6o5mSEw== Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4020645b2a2so29955665e9.2 for ; Mon, 11 Sep 2023 02:07:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694423242; x=1695028042; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TSZVIuwbfrXQOuOEyLTdJoP9dvtpo29LuanTafrBpGc=; b=FIc5oiuCPxzY7zySIG8AJm9rcwHEL1TatkBF/HUbdK9F8UluDx2odyDFIOImjl3Yf6 tnihjVXb7OmsHngrQcNcRHec5CXTq4dovbF3CW0fyaDFumBaLC+mQUxJKuYRJzj7igeM g66I0ynxrp06D22OVxBvWz5lnoW2g+5lb+4ZJTVg/ENMPboGsat+gO33SG1VzbTvvG8t VL3X6Fm66nX9+xY/fnbQ4I0gGylkyjno8LKcw84EYKgSr7wzYkyQl30W+gc8cfPBW4jM xEfpyuCrp6n5fMv9+/WkSlPxcAQHLe9io9FL1W0kXpbL/nywo+yn2JVI/sbhFvEYmjYI ZxNA== X-Gm-Message-State: AOJu0YxCoX7rkG3VYqtsYKq8N78l3QfsKaaQ2YKXNT8VJdQfWHJMAkWy MSFtL4ZQt80HUIfHraPIgODDgsUaL+ORpNrL+sp6S/Z39vDNIi/8hdYvqObmEn3WiMu6BXW97SH XS2sp5Gf5Wsh6+CSryiCxjy0oFSHX4ZQa4hSIDEEvJU8msh81WQ== X-Received: by 2002:a7b:c414:0:b0:3fd:2e89:31bd with SMTP id k20-20020a7bc414000000b003fd2e8931bdmr8677539wmi.14.1694423242781; Mon, 11 Sep 2023 02:07:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhoGLOYIPUD2RVW3BdOtWwwYUHdNtQoQORBolldunfcohRr0FohElr838S4UxsYxm994Ia7w== X-Received: by 2002:a7b:c414:0:b0:3fd:2e89:31bd with SMTP id k20-20020a7bc414000000b003fd2e8931bdmr8677528wmi.14.1694423242543; Mon, 11 Sep 2023 02:07:22 -0700 (PDT) Received: from localhost ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id s1-20020a5d69c1000000b0031aef72a021sm9419121wrw.86.2023.09.11.02.07.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 02:07:22 -0700 (PDT) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [SRU][L][PATCH 2/4] r8169: revert 2ab19de62d67 ("r8169: remove ASPM restrictions now that ASPM is disabled during NAPI poll") Date: Mon, 11 Sep 2023 11:06:59 +0200 Message-Id: <20230911090701.41518-3-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230911090701.41518-1-juerg.haefliger@canonical.com> References: <20230911090701.41518-1-juerg.haefliger@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Heiner Kallweit There have been reports that on a number of systems this change breaks network connectivity. Therefore effectively revert it. Mainly affected seem to be systems where BIOS denies ASPM access to OS. Due to later changes we can't do a direct revert. Fixes: 2ab19de62d67 ("r8169: remove ASPM restrictions now that ASPM is disabled during NAPI poll") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/netdev/e47bac0d-e802-65e1-b311-6acb26d5cf10@freenet.de/T/ Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217596 Signed-off-by: Heiner Kallweit Link: https://lore.kernel.org/r/57f13ec0-b216-d5d8-363d-5b05528ec5fb@gmail.com Signed-off-by: Jakub Kicinski BugLink: https://bugs.launchpad.net/bugs/2031537 (cherry picked from commit cf2ffdea0839398cb0551762af7f5efb0a6e0fea) Signed-off-by: Juerg Haefliger --- drivers/net/ethernet/realtek/r8169_main.c | 27 ++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index b222c295c8cb..9e4092187e73 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -619,6 +619,7 @@ struct rtl8169_private { int cfg9346_usage_count; unsigned supports_gmii:1; + unsigned aspm_manageable:1; dma_addr_t counters_phys_addr; struct rtl8169_counters *counters; struct rtl8169_tc_offsets tc_offset; @@ -2742,7 +2743,8 @@ static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable) if (tp->mac_version < RTL_GIGA_MAC_VER_32) return; - if (enable) { + /* Don't enable ASPM in the chip if OS can't control ASPM */ + if (enable && tp->aspm_manageable) { /* On these chip versions ASPM can even harm * bus communication of other PCI devices. */ @@ -5205,6 +5207,16 @@ static void rtl_init_mac_address(struct rtl8169_private *tp) rtl_rar_set(tp, mac_addr); } +/* register is set if system vendor successfully tested ASPM 1.2 */ +static bool rtl_aspm_is_safe(struct rtl8169_private *tp) +{ + if (tp->mac_version >= RTL_GIGA_MAC_VER_61 && + r8168_mac_ocp_read(tp, 0xc0b2) & 0xf) + return true; + + return false; +} + static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) { struct rtl8169_private *tp; @@ -5276,6 +5288,19 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) tp->mac_version = chipset; + /* Disable ASPM L1 as that cause random device stop working + * problems as well as full system hangs for some PCIe devices users. + * Chips from RTL8168h partially have issues with L1.2, but seem + * to work fine with L1 and L1.1. + */ + if (rtl_aspm_is_safe(tp)) + rc = 0; + else if (tp->mac_version >= RTL_GIGA_MAC_VER_46) + rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2); + else + rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1); + tp->aspm_manageable = !rc; + tp->dash_type = rtl_check_dash(tp); tp->cp_cmd = RTL_R16(tp, CPlusCmd) & CPCMD_MASK;