[PATCH 4.14 59/63] ipmi:pci: Blacklist a Realtek "IPMI" device

From: Greg Kroah-Hartman
Date: Thu Jan 24 2019 - 15:02:04 EST


4.14-stable review patch. If anyone has any objections, please let me know.

------------------

From: Corey Minyard <cminyard@xxxxxxxxxx>

commit bc48fa1b9d3b04106055b27078da824cd209865a upstream.

Realtek has some sort of "Virtual" IPMI device on the PCI bus as a
KCS controller, but whatever it is, it's not one. Ignore it if seen.

[ Commit 13d0b35c (ipmi_si: Move PCI setup to another file) from Linux
4.15-rc1 has not been back ported, so the PCI code is still in
`drivers/char/ipmi/ipmi_si_intf.c`, requiring to apply the commit
manually.

This fixes a 100 s boot delay on the HP EliteDesk 705 G4 MT with Linux
4.14.94. ]

Reported-by: Chris Chiu <chiu@xxxxxxxxxxxx>
Signed-off-by: Corey Minyard <cminyard@xxxxxxxxxx>
Tested-by: Daniel Drake <drake@xxxxxxxxxxxx>
Signed-off-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/char/ipmi/ipmi_si_intf.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -2447,6 +2447,15 @@ static int ipmi_pci_probe_regspacing(str
return DEFAULT_REGSPACING;
}

+static struct pci_device_id ipmi_pci_blacklist[] = {
+ /*
+ * This is a "Virtual IPMI device", whatever that is. It appears
+ * as a KCS device by the class, but it is not one.
+ */
+ { PCI_VDEVICE(REALTEK, 0x816c) },
+ { 0, }
+};
+
static int ipmi_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -2454,6 +2463,9 @@ static int ipmi_pci_probe(struct pci_dev
int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK;
struct smi_info *info;

+ if (pci_match_id(ipmi_pci_blacklist, pdev))
+ return -ENODEV;
+
info = smi_info_alloc();
if (!info)
return -ENOMEM;