From patchwork Fri Oct 25 19:00:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stuart hayes X-Patchwork-Id: 11212975 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCBFB14ED for ; Fri, 25 Oct 2019 19:01:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9A5F222D1 for ; Fri, 25 Oct 2019 19:01:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PJR6qPoJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729556AbfJYTBJ (ORCPT ); Fri, 25 Oct 2019 15:01:09 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:46478 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbfJYTBA (ORCPT ); Fri, 25 Oct 2019 15:01:00 -0400 Received: by mail-ot1-f65.google.com with SMTP id 89so2727741oth.13; Fri, 25 Oct 2019 12:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r5z1PSBgdgyQOytDnCk9ConnRnIEa9FCO7qAX4IBOjg=; b=PJR6qPoJhGzD2iY34kYY2aCojvTvVyGGQ50jdgZUn3ZWdcE6A+Bq4nxX1ey0iQOvCm k1IiGP8UVGMbLRj09YCC5P+gVcMmVd8qVz9iSY3AbeUYby2k5RLVBrWGtelp6g0wuk7L caXzDPXA4dfUvqHq67kHVLK/mgVYsWGU0YCwIlf06jOr1DUVKE3J+XbLQPSawV80U70o bmXOfpRE83yNsvYpDXP87ID8C7c2EtvOX/cQyu2ufMITPsehwrs510mM63N6ddfjJaTb ExOUWHfz4wrxGXmdYoVyeyqhjvCtutqI9CtyLFlkngyu7PxZdwTj+iGsezzx36otsmiM aiZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r5z1PSBgdgyQOytDnCk9ConnRnIEa9FCO7qAX4IBOjg=; b=nO9mtlf3xsXTQ/wvmIDVYjsZWmZqtvn4NDShCAD8kJh0cQ1bmLTWvewZoL/Fec2Fft nHxlYWpmpuIFfhn4tk9p8RSPzeteaQPzjKziwyFsRGLEyjfyFu30rB6GUVwhBeOgEDRv pokHVg24KD5l/AtWOkMcID1AbCoe3fRyETv0c9XNG/Vz7PIzBMCke0CgwF3ZKJsJGWqD j+9Ucg673cEALkGlcnj2juivOIE0sb9jfijm0mmY+O27QAYLTnZRuFmfiGZuflWna/a6 Tj27KroNMo+mPz3yOvlidTzzHHhVyUj1qcOAZw+l9s02rTJ2DohbLW0px+3zptHSdEfd IKBg== X-Gm-Message-State: APjAAAV5YnNCgzlc4tmYvwBoHriAcJ7ywBt1XHHdt0qFFdxzF4gQrUFe zHloZLs+b78XcoJzMSj5ZDw= X-Google-Smtp-Source: APXvYqyYI2FCmpbwrV8en3o5cAVW75P2iFcW/IIx9WlZoL3aDgy86caMX+nc0W8oCfX0RavqTYMGvw== X-Received: by 2002:a05:6830:18f7:: with SMTP id d23mr4022608otf.205.1572030058176; Fri, 25 Oct 2019 12:00:58 -0700 (PDT) Received: from localhost.localdomain ([143.166.81.254]) by smtp.gmail.com with ESMTPSA id 21sm748039oix.31.2019.10.25.12.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 12:00:57 -0700 (PDT) From: Stuart Hayes To: Bjorn Helgaas Cc: Austin Bolen , keith.busch@intel.com, Alexandru Gagniuc , "Rafael J . Wysocki" , Mika Westerberg , Andy Shevchenko , "Gustavo A . R . Silva" , Sinan Kaya , Oza Pawandeep , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, lukas@wunner.de Subject: [PATCH v4 1/3] PCI: pciehp: Add support for disabling in-band presence Date: Fri, 25 Oct 2019 15:00:45 -0400 Message-Id: <20191025190047.38130-2-stuart.w.hayes@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20191025190047.38130-1-stuart.w.hayes@gmail.com> References: <20191025190047.38130-1-stuart.w.hayes@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Alexandru Gagniuc The presence detect state (PDS) is normally a logical or of in-band and out-of-band presence. As of PCIe 4.0, there is the option to disable in-band presence so that the PDS bit always reflects the state of the out-of-band presence. The recommendation of the PCIe spec is to disable in-band presence whenever supported. Signed-off-by: Alexandru Gagniuc Reviewed-by: Andy Shevchenko --- drivers/pci/hotplug/pciehp.h | 1 + drivers/pci/hotplug/pciehp_hpc.c | 9 ++++++++- include/uapi/linux/pci_regs.h | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 654c972b8ea0..27e4cd6529b0 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -83,6 +83,7 @@ struct controller { struct pcie_device *pcie; u32 slot_cap; /* capabilities and quirks */ + unsigned int inband_presence_disabled:1; u16 slot_ctrl; /* control register access */ struct mutex ctrl_lock; diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 1a522c1c4177..dc109d521f30 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -811,7 +811,7 @@ static inline void dbg_ctrl(struct controller *ctrl) struct controller *pcie_init(struct pcie_device *dev) { struct controller *ctrl; - u32 slot_cap, link_cap; + u32 slot_cap, slot_cap2, link_cap; u8 poweron; struct pci_dev *pdev = dev->port; struct pci_bus *subordinate = pdev->subordinate; @@ -869,6 +869,13 @@ struct controller *pcie_init(struct pcie_device *dev) FLAG(link_cap, PCI_EXP_LNKCAP_DLLLARC), pdev->broken_cmd_compl ? " (with Cmd Compl erratum)" : ""); + pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP2, &slot_cap2); + if (slot_cap2 & PCI_EXP_SLTCAP2_IBPD) { + pcie_write_cmd_nowait(ctrl, PCI_EXP_SLTCTL_IBPD_DISABLE, + PCI_EXP_SLTCTL_IBPD_DISABLE); + ctrl->inband_presence_disabled = 1; + } + /* * If empty slot's power status is on, turn power off. The IRQ isn't * requested yet, so avoid triggering a notification with this command. diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 29d6e93fd15e..ea1cf9546e4d 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -604,6 +604,7 @@ #define PCI_EXP_SLTCTL_PWR_OFF 0x0400 /* Power Off */ #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */ #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */ +#define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000 /* In-band PD disable */ #define PCI_EXP_SLTSTA 26 /* Slot Status */ #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */ #define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */ @@ -676,6 +677,7 @@ #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */ #define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */ +#define PCI_EXP_SLTCAP2_IBPD 0x0001 /* In-band PD Disable Supported */ #define PCI_EXP_SLTCTL2 56 /* Slot Control 2 */ #define PCI_EXP_SLTSTA2 58 /* Slot Status 2 */ From patchwork Fri Oct 25 19:00:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stuart hayes X-Patchwork-Id: 11212973 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 722D0112C for ; Fri, 25 Oct 2019 19:01:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EF29222C1 for ; Fri, 25 Oct 2019 19:01:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pARAWLm0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727328AbfJYTBA (ORCPT ); Fri, 25 Oct 2019 15:01:00 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:46481 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbfJYTBA (ORCPT ); Fri, 25 Oct 2019 15:01:00 -0400 Received: by mail-ot1-f67.google.com with SMTP id 89so2727793oth.13; Fri, 25 Oct 2019 12:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HEsox1ODtKv8Vrlc6BNsE12nHs0ccD3hxpe8yokF4wM=; b=pARAWLm0M5sQSPyXpSBp1aKJpaYGYmgBgBiNGp//Z+eBRlbEF6ZOsz5efNozGt7Ox9 Y4vNw21HdlHGzUJFugvx3xHDkayLdB94JjFB8QJ6fXYV9SbhaQPJlwTzazk6qC6JzH1a /KKKiJLf/JAa3oCEMYkyUQ11bLMO476uW9Nz4++Oc4Ke5iz6bFQmYQosU6HF5Z+aaAvS 9S4a64ctgIvStJPjsGZPPZJF0Vaa4HPSg2L+I5BuIYoVCAmWb89tzO3E42oP9WM2kgLT EP76XzizBBxZZxn6TxvhjbmPcTkclcqDR5wAGmiMH6MJQ+9YkpZn5GwxnnZW5aeJ92qd ePOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HEsox1ODtKv8Vrlc6BNsE12nHs0ccD3hxpe8yokF4wM=; b=qX1gBOg8i1tsLgpH8ZzfQOedIJq1kmVh+EjdPgU11SUjxDx+RkZbmm1pGR25gr1ZMz RbIOGfe4UP9AubORZ2bCfYGvop86SK/EFNxHvxD1ER3lmWT9oerSYASJL2yKfQ7Sbqw1 WcZpOxRTwW42Z/PTg+1nySvM5idwfiU0Q8Kc+c9CAFW4EavghJAuE3RE3ziHYgsuPJvo aWRnx8b0VuAq+UGxR8zX2TPWTxHxx3RAHUROgN0P7K2IOjfLDbns/sCxr/3j/dgO7pUE NfH9hPXtaJbY+A865AlfE8FHiwL69CpC5K/Wk6eu3DrTAiNhnD6mzAXvmejt+GgfJzGR NA9A== X-Gm-Message-State: APjAAAURBHLj/0/j0smqrpd94vDVK9cQ1KbPge0wWvJHw4CvMltg8hXd Or41GmLxAAW46QBejnzDSA8= X-Google-Smtp-Source: APXvYqwraZgeHx1X/HB9iDZhvDY9EzbRyTobcWAcgN3Fds1pc5DwTgwdnk1aw6tiESlm9gY1KxVCAg== X-Received: by 2002:a9d:7a46:: with SMTP id z6mr4096899otm.40.1572030059367; Fri, 25 Oct 2019 12:00:59 -0700 (PDT) Received: from localhost.localdomain ([143.166.81.254]) by smtp.gmail.com with ESMTPSA id 21sm748039oix.31.2019.10.25.12.00.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 12:00:58 -0700 (PDT) From: Stuart Hayes To: Bjorn Helgaas Cc: Austin Bolen , keith.busch@intel.com, Alexandru Gagniuc , "Rafael J . Wysocki" , Mika Westerberg , Andy Shevchenko , "Gustavo A . R . Silva" , Sinan Kaya , Oza Pawandeep , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, lukas@wunner.de, Stuart Hayes Subject: [PATCH v4 2/3] PCI: pciehp: Wait for PDS if in-band presence is disabled Date: Fri, 25 Oct 2019 15:00:46 -0400 Message-Id: <20191025190047.38130-3-stuart.w.hayes@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20191025190047.38130-1-stuart.w.hayes@gmail.com> References: <20191025190047.38130-1-stuart.w.hayes@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Alexandru Gagniuc When inband presence is disabled, PDS may come up at any time, or not at all. PDS being low may indicate that the card is still mating, and we could expect contact bounce to bring down the link as well. It is reasonable to assume that most cards will mate in a hotplug slot in about a second. Thus, when we know PDS only reflects out-of-band presence, it's worthwhile to wait the extra second or so to make sure the card is properly mated before loading the driver, and to prevent the hotplug code from disabling a device if the presence detect change goes active after the device is enabled. Signed-off-by: Alexandru Gagniuc Signed-off-by: Stuart Hayes Reviewed-by: Andy Shevchenko --- v2: replace while(true) loop with do...while v3 remove unused variable declaration (pds) modify text of warning message v4 remove "!!" boolean conversion from "if" condition for readability drivers/pci/hotplug/pciehp_hpc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index dc109d521f30..02d95ab27a12 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -242,6 +242,22 @@ static bool pci_bus_check_dev(struct pci_bus *bus, int devfn) return found; } +static void pcie_wait_for_presence(struct pci_dev *pdev) +{ + int timeout = 1250; + u16 slot_status; + + do { + pcie_capability_read_word(pdev, PCI_EXP_SLTSTA, &slot_status); + if (slot_status & PCI_EXP_SLTSTA_PDS) + return; + msleep(10); + timeout -= 10; + } while (timeout > 0); + + pci_info(pdev, "Timeout waiting for Presence Detect state to be set\n"); +} + int pciehp_check_link_status(struct controller *ctrl) { struct pci_dev *pdev = ctrl_dev(ctrl); @@ -251,6 +267,9 @@ int pciehp_check_link_status(struct controller *ctrl) if (!pcie_wait_for_link(pdev, true)) return -1; + if (ctrl->inband_presence_disabled) + pcie_wait_for_presence(pdev); + found = pci_bus_check_dev(ctrl->pcie->port->subordinate, PCI_DEVFN(0, 0)); From patchwork Fri Oct 25 19:00:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stuart hayes X-Patchwork-Id: 11212971 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 075EC112C for ; Fri, 25 Oct 2019 19:01:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D854F21E6F for ; Fri, 25 Oct 2019 19:01:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TD84hYL8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729353AbfJYTBC (ORCPT ); Fri, 25 Oct 2019 15:01:02 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:42309 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725865AbfJYTBB (ORCPT ); Fri, 25 Oct 2019 15:01:01 -0400 Received: by mail-oi1-f196.google.com with SMTP id i185so2288571oif.9; Fri, 25 Oct 2019 12:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZGAwrWZgsty9clvwOGUkdUA2YOhaXXaSo85YzV6o32E=; b=TD84hYL8dXownyhIRGQ6Lz4qNy9OtOmSZU+TYDoXgBajq4NuVqDdXxeFw0SBNFEers Kcl3RScDT239I30Ii+h9a5rpckGd5FkRFVvI000RC83BlNy+Tqfo/h0p71VMPlceqNp5 uIZYP2GDPePDXaL4Z+D8oyZM5qeJFbIGliYlh+meiR/rpSIzQU1NbhuPW9YSnSRZV96L j6iBYDZtqXze0vk9LGIQsDkodL/uM41qLWFX8+ksCy9dTaB4yu+QJY2MTi2+4GggqGcw 5MUsgXScor/zbCIrveB+Nblwt1ScpJAFZ+dnAvpHH6l898AjgREfH1f+YsE7t8LF/kgq 470Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZGAwrWZgsty9clvwOGUkdUA2YOhaXXaSo85YzV6o32E=; b=jFT7RJtlH6ml6869lcdWApd6++LyHkZqJ7I6sK9LuWGlQwVHXQGdCzTEMTZrE9xo5+ TGwk43BKZLhf3QVoCGD8HuwwlCEOmyrJfMYVlxn/X69xV47kobbDOtnWdqxVbpdjjxjL zZEWo55g4y7mVn7dOEv2uPoKUNHWR3Wc8MVmtOca+W6ppnDVtHKX8yA5hAMGXQNwR4hj XGxREk7ETMOA5/roilv3y5z1n8xovxZtjgwKk+EdRlxK850JwJcl4UmZ2oxT1AporsD1 c/szV3rgGRhk9PlsCRc1WihAL+7g0JyK21aJxQ360jeKSnpWd9diX/KDUFcl62nWDxJa 54PQ== X-Gm-Message-State: APjAAAXw9ZVj2a88G3jxzm7EtQw4wObHnCm6pKWonEkEexwmc7PzzVrw CsDA6h6UCv6HvUQ2/PWIWxM= X-Google-Smtp-Source: APXvYqzQV+Rvxn24G4NO3C5hZVxdhp0q8NHAZF7HdWtQFO78njICcIHmjC7vdG6Gdfq0CorQDTreRw== X-Received: by 2002:aca:3305:: with SMTP id z5mr4393147oiz.68.1572030060624; Fri, 25 Oct 2019 12:01:00 -0700 (PDT) Received: from localhost.localdomain ([143.166.81.254]) by smtp.gmail.com with ESMTPSA id 21sm748039oix.31.2019.10.25.12.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 12:01:00 -0700 (PDT) From: Stuart Hayes To: Bjorn Helgaas Cc: Austin Bolen , keith.busch@intel.com, Alexandru Gagniuc , "Rafael J . Wysocki" , Mika Westerberg , Andy Shevchenko , "Gustavo A . R . Silva" , Sinan Kaya , Oza Pawandeep , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, lukas@wunner.de, Stuart Hayes Subject: [PATCH v4 3/3] PCI: pciehp: Add dmi table for in-band presence disabled Date: Fri, 25 Oct 2019 15:00:47 -0400 Message-Id: <20191025190047.38130-4-stuart.w.hayes@gmail.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20191025190047.38130-1-stuart.w.hayes@gmail.com> References: <20191025190047.38130-1-stuart.w.hayes@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Some systems have in-band presence detection disabled for hot-plug PCI slots, but do not report this in the slot capabilities 2 (SLTCAP2) register. On these systems, presence detect can become active well after the link is reported to be active, which can cause the slots to be disabled after a device is connected. Add a dmi table to flag these systems as having in-band presence disabled. Signed-off-by: Stuart Hayes Reviewed-by: Andy Shevchenko --- v4 add comment to dmi table drivers/pci/hotplug/pciehp_hpc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 02d95ab27a12..9541735bd0aa 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -14,6 +14,7 @@ #define dev_fmt(fmt) "pciehp: " fmt +#include #include #include #include @@ -26,6 +27,24 @@ #include "../pci.h" #include "pciehp.h" +static const struct dmi_system_id inband_presence_disabled_dmi_table[] = { + /* + * Match all Dell systems, as some Dell systems have inband + * presence disabled on NVMe slots (but don't support the bit to + * report it). Setting inband presence disabled should have no + * negative effect, except on broken hotplug slots that never + * assert presence detect--and those will still work, they will + * just have a bit of extra delay before being probed. + */ + { + .ident = "Dell System", + .matches = { + DMI_MATCH(DMI_OEM_STRING, "Dell System"), + }, + }, + {} +}; + static inline struct pci_dev *ctrl_dev(struct controller *ctrl) { return ctrl->pcie->port; @@ -895,6 +914,9 @@ struct controller *pcie_init(struct pcie_device *dev) ctrl->inband_presence_disabled = 1; } + if (dmi_first_match(inband_presence_disabled_dmi_table)) + ctrl->inband_presence_disabled = 1; + /* * If empty slot's power status is on, turn power off. The IRQ isn't * requested yet, so avoid triggering a notification with this command.