Skip to contentSkip to conversation

PCI/VPD: Disable VPD for Lenovo Realtek RTL8111xP devices

PATCH Superseded Qiang Ma 2 participants 2 messages May 21 PCI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Qiang Ma

author
#0 lore raw

PATCH 1/1 PCI/VPD: Disable VPD for Lenovo Realtek RTL8111xP devices

The Lenovo 17aa:507e RTL8111xP multi-function device exposes a VPD capability on all functions, but the VPD storage is not usable. Function 0 returns an invalid first tag and functions 1-4 never complete VPD transactions.

This produces noisy dmesg output when userspace reads the VPD sysfs attribute, including:

[   16.654155] r8169 0000:02:00.0: invalid VPD tag 0x00 (size 0) at offset 0; assume missing optional EEPROM
[   16.790913] serial 0000:02:00.1: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update
[   16.931963] serial 0000:02:00.2: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update
[   17.071445] pci 0000:02:00.3: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update
[   17.210910] ehci-pci 0000:02:00.4: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update

VPD is optional. Disable VPD for this exact subsystem and revision so the PCI core does not expose a broken VPD sysfs file that cannot be read.

---
 drivers/pci/vpd.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/pci/vpd.c +26 -0
index 153394a652d3..492e0d669ea8 100644
@@ -597,6 +597,32 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID, quirk_blacklist_vpd
 DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031,
 			       PCI_CLASS_BRIDGE_PCI, 8, quirk_blacklist_vpd);
 
+/*
+ * The Lenovo 17aa:507e RTL8111xP multi-function device advertises VPD
+ * on all functions, but the VPD data is not usable.  Function 0 returns
+ * an invalid first tag and functions 1-4 never complete VPD accesses.
+ */
+static void quirk_lenovo_realtek_rtl8111xp_no_vpd(struct pci_dev *dev)
+{
+	if (dev->revision != 0x0e ||
+	    dev->subsystem_vendor != PCI_VENDOR_ID_LENOVO ||
+	    dev->subsystem_device != 0x507e)
+		return;
+
+	dev->vpd.len = PCI_VPD_SZ_INVALID;
+	pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n");
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x8168,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816a,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816b,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816c,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816d,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+
 static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 {
 	int chip = (dev->device & 0xf000) >> 12;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 4 lines · Qiang Ma

The Lenovo 17aa:507e RTL8111xP multi-function device exposes a VPD capability on all functions, but the VPD storage is not usable. Function 0 returns an invalid first tag and functions 1-4 never complete VPD transactions.

"Lenovo 17aa:507e" suggests that this affects Vendor ID Lenovo and Device ID 0x507e, but those are actually the *Subsystem* IDs.

It seems likely that the problem is with the way the device is integrated into Lenovo systems, but the primary hook here is the PCI_VENDOR_ID_REALTEK and 0x8168 etc., so I think we should say something like:

When integrated into some Lenovo systems, the Realtek RTL8111xP multi-function device advertises invalid VPD Capabilities.

Quoted 8 lines

This produces noisy dmesg output when userspace reads the VPD sysfs attribute, including:

[   16.654155] r8169 0000:02:00.0: invalid VPD tag 0x00 (size 0) at offset 0; assume missing optional EEPROM
[   16.790913] serial 0000:02:00.1: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update
[   16.931963] serial 0000:02:00.2: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update
[   17.071445] pci 0000:02:00.3: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update
[   17.210910] ehci-pci 0000:02:00.4: VPD access failed.  This is likely a firmware bug on this device.  Contact the card vendor for a firmware update

Timestamps are pointless distraction here. Drop them and indent the quoted material two spaces. Two lines is probably enough.

Quoted 13 lines

VPD is optional. Disable VPD for this exact subsystem and revision so the PCI core does not expose a broken VPD sysfs file that cannot be read.

---
 drivers/pci/vpd.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/pci/vpd.c +0 -0
index 153394a652d3..492e0d669ea8 100644

drivers/pci/vpd.c DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID, quirk_blacklist_vpd · line 603

Quoted 7 lines
drivers/pci/vpd.c +4 -0
@@ -597,6 +597,32 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID, quirk_blacklist_vpd
 DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031,
 			       PCI_CLASS_BRIDGE_PCI, 8, quirk_blacklist_vpd);
 
+/*
+ * The Lenovo 17aa:507e RTL8111xP multi-function device advertises VPD
+ * on all functions, but the VPD data is not usable.  Function 0 returns
+ * an invalid first tag and functions 1-4 never complete VPD accesses.

Same here. It's a Realtek device that happens to be integrated into some Lenovo platforms.

Quoted 28 lines
drivers/pci/vpd.c +22 -0
+ */
+static void quirk_lenovo_realtek_rtl8111xp_no_vpd(struct pci_dev *dev)
+{
+	if (dev->revision != 0x0e ||
+	    dev->subsystem_vendor != PCI_VENDOR_ID_LENOVO ||
+	    dev->subsystem_device != 0x507e)
+		return;
+
+	dev->vpd.len = PCI_VPD_SZ_INVALID;
+	pci_warn(dev, FW_BUG "disabling VPD access (can't determine size of non-standard VPD format)\n");
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x8168,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816a,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816b,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816c,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_REALTEK, 0x816d,
+			 quirk_lenovo_realtek_rtl8111xp_no_vpd);
+
 static void quirk_chelsio_extend_vpd(struct pci_dev *dev)
 {
 	int chip = (dev->device & 0xf000) >> 12;
Signature · 1 line
2.20.1