All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew W Carlis <mattc@purestorage.com>
To: helgaas@kernel.org, bhelgaas@google.com,
	sathyanarayanan.kuppuswamy@linux.intel.com,
	linux-pci@vger.kernel.org, mika.westerberg@linux.intel.com
Cc: Matthew W Carlis <mattc@purestorage.com>
Subject: [PATCH 1/1] PCI/portdrv: Allow DPC if the OS controls AER natively.
Date: Sat, 23 Dec 2023 14:22:35 -0700	[thread overview]
Message-ID: <20231223212235.34293-2-mattc@purestorage.com> (raw)
In-Reply-To: <20231223212235.34293-1-mattc@purestorage.com>

This change ensures the kernel will use DPC on a supporting device if
the kernel will also control AER on the Root Ports & RCECs.

The rules around controlling DPC/AER are somewhat clear in PCIe/ACPI
specifications. It is recommended to always link control of both to the
same entity, being the OS or system firmware. The kernel wants to be
flexible by first having a default policy, but also by providing command
line parameters to enable us all to do what we want even if it might
violate the recommendations.

The following mentioned patch brought the kernels default behavior
more in line with the specification around AER, but changed its behavior
around DPC on PCIe Downstream Switch Ports; preventing the kernel from
controlling DPC on them unless using pcie_ports=dpc-native.
    * "PCI/portdrv: Allow AER service only for Root Ports & RCECs"
After this change the behavior around using DPC on PCIe switch ports
and Root Ports should be as it was before.

Signed-off-by: Matthew W Carlis <mattc@purestorage.com>
---
 drivers/pci/pcie/portdrv.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 14a4b89a3b83..8e023aa97672 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -257,12 +257,19 @@ static int get_port_device_capability(struct pci_dev *dev)
 	}
 
 	/*
+	 * _OSC AER Control is required by the OS & requires OS to control AER,
+	 * but _OSC DPC Control isn't required by the OS to control DPC; however
+	 * it does require the OS to control DPC. _OSC DPC Control also requres
+	 * _OSC EDR Control (Error Disconnect Recovery) (PCI Firmware - DPC ECN rev3.2)
+	 * PCI_Express_Base 6.1, 6.2.11 Determination of DPC Control recommends
+	 * platform fw or OS always link control of DPC to AER.
+	 *
 	 * With dpc-native, allow Linux to use DPC even if it doesn't have
 	 * permission to use AER.
 	 */
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
-	    pci_aer_available() &&
-	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
+	    pci_aer_available() && (pcie_ports_dpc_native ||
+	    (dev->aer_cap && host->native_aer)))
 		services |= PCIE_PORT_SERVICE_DPC;
 
 	if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM ||
-- 
2.17.1


  reply	other threads:[~2023-12-23 21:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-23 21:22 [PATCH 1/1] PCI/portdrv: Allow DPC if the OS controls AER natively Matthew W Carlis
2023-12-23 21:22 ` Matthew W Carlis [this message]
2023-12-25 17:53   ` kernel test robot
2023-12-25 20:36   ` kernel test robot
2023-12-26  0:02     ` Matthew W Carlis
2023-12-28 21:23   ` Bjorn Helgaas
2024-01-02 15:41     ` Kuppuswamy Sathyanarayanan
2024-01-08 19:46       ` Matthew W Carlis
2024-01-08 19:53         ` Kuppuswamy Sathyanarayanan
2024-01-09  0:15           ` Matthew W Carlis
2024-01-10 16:41             ` Kuppuswamy Sathyanarayanan
2024-01-10 17:13               ` Kuppuswamy Sathyanarayanan
2024-01-10 20:01                 ` Matthew W Carlis
2024-01-10 19:59               ` Matthew W Carlis
2024-01-22 19:32             ` Bjorn Helgaas
2024-01-23  2:37               ` Kuppuswamy Sathyanarayanan
2024-01-23 15:59                 ` Bjorn Helgaas
2024-01-23 23:18                   ` Matthew W Carlis
2024-01-24 20:29                     ` Bjorn Helgaas
2024-02-21 23:11                   ` Bjorn Helgaas
2024-02-21 23:33                     ` Bjorn Helgaas
2024-02-21 23:33                       ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231223212235.34293-2-mattc@purestorage.com \
    --to=mattc@purestorage.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.