From 96f2c6d05edb296c372d1b86dfd4b9e2fc0c0b35 Mon Sep 17 00:00:00 2001 From: Koba Ko Date: Mon, 20 Nov 2023 16:27:54 +0000 Subject: [PATCH] UBUNTU: SAUCE: r8169: Add quirks to enable ASPM on Dell platforms 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 Signed-off-by: Andrea Righi --- 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 dd73df6b17b0..3e630ab0a4bb 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 @@ -5164,11 +5165,87 @@ done: 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;