From patchwork Fri Oct 14 08:56:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1689969 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) 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=wcjQhbF5; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (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 4MpgHc5cQqz23k1 for ; Fri, 14 Oct 2022 19:57:00 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ojGUu-0007cG-TH; Fri, 14 Oct 2022 08:56:52 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ojGUt-0007bj-AO for kernel-team@lists.ubuntu.com; Fri, 14 Oct 2022 08:56:51 +0000 Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) (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-1.canonical.com (Postfix) with ESMTPS id 153453F472 for ; Fri, 14 Oct 2022 08:56:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1665737811; bh=z6XaT6FVywAiEcIx5d8nxWJ1MWn8Z5dI44GZQ5mYNLo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=wcjQhbF5KODwU/4p2/Ep67TSpyJu6XoTvTJ33oiUNMT+FkoY9HfKV/B2WJsCabNTI nDWC85T/Q/gOfFFacj3JG2nEC+znJ6KL/LF845IGIrB5n7DzucE8q5fZpkFq8R6KMQ GFyy9B6fyqakYmOsjGESBYfzmEz2jC+bDfu+XWZ/hGspViFWFpO7rKvdLX0QsqV9/u td+LC/6as5ZTbDnsVRDZSIkjQntuudg/Svwq24eFkx56jzYLdEChFn60sqvoU+jOhg F5ci8MDSKQyyI0ppWjAJXFY0ULvHCNA4Bo8aqUOKSQVGTw/mrezj9bUsQSCHbU0gbL uBohxlKBjDzvw== Received: by mail-pf1-f200.google.com with SMTP id cv12-20020a056a0044cc00b00562f6351e09so2595506pfb.3 for ; Fri, 14 Oct 2022 01:56:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=z6XaT6FVywAiEcIx5d8nxWJ1MWn8Z5dI44GZQ5mYNLo=; b=wMNvWOvXjWqasXgDr/QKQXgznR/EWsjmougZi3GeliBPZLolpf13zTQ/4QeRq0WoMF ZP28ANUwtuanNOnd0AJyZ7WD2eUix5GampGpU4al2EC2VUtW2qJQKTiRKojXkh8typBH jiem/DeCjQnJQDorDy9mSsmmOSuuAJXEnVy2fUTdMr6YZXZQzbiKnebCUX2wFMByCg+M 1X9Hufg0UUWGYmTDvLQfgF/3wJvtsqIwvmLVJ8bNBi0hxHQGr6u+xeCgV46SxQBzIczK 3uCPZ6Oq/73XuKfsw8cUhbpwuvWtzbAW4wzgWZ4mGzzKCSuzgXrirsD+lgpeGf56GO1x By8w== X-Gm-Message-State: ACrzQf25IFubQk4FYe/zM2ynT2X8Hwo3hKQKiOFSKL/l4QwuBBosTzT6 vczJHMvMLxZ+mMg5cyhJdY8WCBcxBVIPkpmJ3c63vxQkZsYu7j5WrzH3fhPRwKzMX0sIvsDxlxx mDcL6F8tIEP/4VJrquO/fNshOgp0VqMHLJQlraWCdyQ== X-Received: by 2002:a17:902:db0f:b0:176:e70f:6277 with SMTP id m15-20020a170902db0f00b00176e70f6277mr4248231plx.13.1665737809481; Fri, 14 Oct 2022 01:56:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Nu2bt7aqYA4kyiYxVwnnu+OxMOvcykI0aKOwQ7ZE/IPIGHskYzCQd6NxkrtyNpP7K7YXFdA== X-Received: by 2002:a17:902:db0f:b0:176:e70f:6277 with SMTP id m15-20020a170902db0f00b00176e70f6277mr4248213plx.13.1665737809121; Fri, 14 Oct 2022 01:56:49 -0700 (PDT) Received: from canonical.com (2001-b011-3815-55ff-14f3-5026-35ff-19e0.dynamic-ip6.hinet.net. [2001:b011:3815:55ff:14f3:5026:35ff:19e0]) by smtp.gmail.com with ESMTPSA id a11-20020aa7970b000000b00562664d5027sm1122128pfg.61.2022.10.14.01.56.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 01:56:48 -0700 (PDT) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3 V3][SRU][OEM-5.17] UBUNTU: SAUCE: r8169: Enable chip-specific ASPM regardless of PCIe ASPM status Date: Fri, 14 Oct 2022 16:56:43 +0800 Message-Id: <20221014085645.1793722-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221014085645.1793722-1-koba.ko@canonical.com> References: <20221014085645.1793722-1-koba.ko@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: Kai-Heng Feng BugLink: https://bugs.launchpad.net/bugs/1946433 To really enable ASPM on r8169 NICs, both standard PCIe ASPM and chip-specific ASPM have to be enabled at the same time. Since PCIe ASPM can be enabled or disabled vis sysfs and there's no mechanism to notify driver about ASPM change, unconditionally enable chip-specific ASPM to make ASPM really take into effect. Signed-off-by: Kai-Heng Feng (cherry picked from https://patchwork.kernel.org/project/netdevbpf/patch/20211016075442.650311-5-kai.heng.feng@canonical.com/) Signed-off-by: Koba Ko --- drivers/net/ethernet/realtek/r8169_main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 6b2d71517eaa6..f1ce367f85a23 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -624,7 +624,6 @@ struct rtl8169_private { } wk; unsigned supports_gmii:1; - unsigned aspm_manageable:1; dma_addr_t counters_phys_addr; struct rtl8169_counters *counters; struct rtl8169_tc_offsets tc_offset; @@ -2680,8 +2679,13 @@ static void rtl_enable_exit_l1(struct rtl8169_private *tp) static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable) { - /* Don't enable ASPM in the chip if OS can't control ASPM */ - if (enable && tp->aspm_manageable) { + struct pci_dev *pdev = tp->pci_dev; + + /* Skip if PCIe ASPM isn't possible */ + if (!pcie_aspm_support_enabled() || !pcie_aspm_capable(pdev)) + return; + + if (enable) { RTL_W8(tp, Config5, RTL_R8(tp, Config5) | ASPM_en); RTL_W8(tp, Config2, RTL_R8(tp, Config2) | ClkReqEn); } else { @@ -5335,10 +5339,9 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) * to work fine with L1 and L1.1. */ if (tp->mac_version >= RTL_GIGA_MAC_VER_45) - rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L1_2); + 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; + pci_disable_link_state(pdev, PCIE_LINK_STATE_L1); tp->dash_type = rtl_check_dash(tp);