From patchwork Mon Nov 20 16:27:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koba Ko X-Patchwork-Id: 1866153 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=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 4SYtGs1dK5z1yRg for ; Tue, 21 Nov 2023 03:28:20 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1r5789-0000hb-I8; Mon, 20 Nov 2023 16:28:13 +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 1r5782-0000g9-GB for kernel-team@lists.ubuntu.com; Mon, 20 Nov 2023 16:28:06 +0000 Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (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 4056C3F88A for ; Mon, 20 Nov 2023 16:28:06 +0000 (UTC) Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6d315cd0e77so4908727a34.1 for ; Mon, 20 Nov 2023 08:28:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700497684; x=1701102484; 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=yW/TSSQDSRC84CiRA+qg+0HawZHUcgjDSJ8VDZlMklk=; b=pTr40WcAhhebgGzPWIPhNmVkmzLyyQD/kgMdHyklz6NyZbsQ4zfW+XCNLhmmV34dT5 3ixcj2SiI7gTUpzEydbXLltCcsz8nKkCIl59SMsOdmNlw3qPkYZqaQql07fBOtuSJkHX pXqrEMevjcKw0RYN/UPB+mLauOTqhBjsgKK4WLHusBizpq09Q8Zzu1upd5XS9NN19+jn bVrSY7EE8wz8hzhf6nnxHKw9HPtfHTjt94eDx2/BnuCv+s1gXJ5QgpXnjJNxplltT0wL 2LvRLuOFS1zWkGmowa9iEPK3/NhbKAKafq5eorrcHF43K6n2QsOBW4cLOiSj6sL+Rhzl YyMw== X-Gm-Message-State: AOJu0YzBwvCbGRlnZB+7ZAyHzjjyzpc9xMVXLHXik3xCP38dVOqznVYU U41R5ZVstzJf2MmvoceuqFCH8/yzRjws+xjx8dXOXD+4az2zLYbCDDKnS/USOnxc3/bhQdx5On0 PFRnnL0tVoxGDVXKzAuGoQT6e+XN5S0oA9KutjDvYDEM2aRaSZKdV+Ac= X-Received: by 2002:a05:6830:1157:b0:6c4:897a:31d0 with SMTP id x23-20020a056830115700b006c4897a31d0mr2378481otq.24.1700497684461; Mon, 20 Nov 2023 08:28:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPIR4zw+p8nwR1VoiWGfZz3trIHC2vX/jdIxyX1z5DVAyEvRCJNlqLyzDkRoTHv2T1aA0Fdg== X-Received: by 2002:a05:6830:1157:b0:6c4:897a:31d0 with SMTP id x23-20020a056830115700b006c4897a31d0mr2378464otq.24.1700497684114; Mon, 20 Nov 2023 08:28:04 -0800 (PST) Received: from canonical.com ([2001:67c:1560:8007::aac:c176]) by smtp.gmail.com with ESMTPSA id l10-20020a056214028a00b00655ec7bbfd0sm3028610qvv.7.2023.11.20.08.28.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 08:28:03 -0800 (PST) From: Koba Ko To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][SRU][U] UBUNTU: SAUCE: r8169: Add quirks to enable ASPM on Dell platforms Date: Mon, 20 Nov 2023 16:27:54 +0000 Message-Id: <20231120162754.83810-2-koba.ko@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231120162754.83810-1-koba.ko@canonical.com> References: <20231120162754.83810-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" BugLink: https://bugs.launchpad.net/bugs/2042385 Some non-Dell platforms equipped with r8168h/r8111 have issue on ASPM, It's very hard to fix all known issues in a short time and r8168h/r8111 is not a brand new NIC chip, so introduce the quirk for Dell platfroms. It's also easier to track the Dell platform and ask Realtek's effort. Ref. https://bugzilla.kernel.org/show_bug.cgi?id=217814 Signed-off-by: Koba Ko Signed-off-by: Timo Aaltonen --- drivers/net/ethernet/realtek/r8169_main.c | 79 ++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 361b90007148..99e1bcce4e4f 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -5158,11 +5159,87 @@ static void rtl_init_mac_address(struct rtl8169_private *tp) rtl_rar_set(tp, mac_addr); } +static bool rtl_aspm_dell_workaround(struct rtl8169_private *tp) +{ + static const struct dmi_system_id sysids[] = { + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 16 5640"), + DMI_MATCH(DMI_PRODUCT_SKU, "0CA0"), + }, + }, + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 14 3440"), + DMI_MATCH(DMI_PRODUCT_SKU, "0CA5"), + }, + }, + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 14 3440"), + DMI_MATCH(DMI_PRODUCT_SKU, "0CA6"), + }, + }, + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 3450"), + DMI_MATCH(DMI_PRODUCT_SKU, "0C99"), + }, + }, + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 3450"), + DMI_MATCH(DMI_PRODUCT_SKU, "0C97"), + }, + }, + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 3550"), + DMI_MATCH(DMI_PRODUCT_SKU, "0C9A"), + }, + }, + { + .ident = "Dell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Latitude 3550"), + DMI_MATCH(DMI_PRODUCT_SKU, "0C98"), + }, + }, + {} + }; + + if (tp->mac_version == RTL_GIGA_MAC_VER_46 && dmi_check_system(sysids)) + return true; + + return false; +} + /* register is set if system vendor successfully tested ASPM 1.2 */ static bool rtl_aspm_is_safe(struct rtl8169_private *tp) { + /* definition of 0xc0b2, + * 0: L1 + * 1: ASPM L1.0 + * 2: ASPM L0s + * 3: CLKEREQ + * 4-7: Reserved + */ if (tp->mac_version >= RTL_GIGA_MAC_VER_61 && - r8168_mac_ocp_read(tp, 0xc0b2) & 0xf) + r8168_mac_ocp_read(tp, 0xc0b2) & 0xf || + rtl_aspm_dell_workaround(tp)) return true; return false;