Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2164577ybz; Thu, 30 Apr 2020 12:01:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLuTFdk5bw7jsU8My6ST4GXauGuvLVp1/kEQr1w06IN0TFjxSoWBVdEeeyMq9ih6HgLiUse X-Received: by 2002:a17:906:4dc8:: with SMTP id f8mr4224549ejw.23.1588273319299; Thu, 30 Apr 2020 12:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588273319; cv=none; d=google.com; s=arc-20160816; b=HNS9G2HdugYy2BFTK7DLPSNoAhx9LSROw4iJU/tTHp+4ORi7+PDxS1zcr4xL0cQE1j KjR7eNBi4mMgglnomSvITCZOvt/X6KaC+ItIh/VDHPru52NQsJJqg64KjpC+4X1nKSJU 9DYrtdkwPN5MAq3L+rNGBPiaQhiQmxi0R5DEZcvY5MZ7UcDvE2GPkxWyEClXhL1CfaUV I9Qez4sKGfwD6I223L4vKBbXqaHbNQXJzCTM8sfgAT/r43P0lmrF2daD3iFj6zAfVbAP +0xWLTcWpSibQsRG3hnpNh2MEMg+puUVqyARFlIxCD+GJQYbaZMYGVlrffPZrLVthliN +yVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=0QwcvHhH6gi4Y74Vbabi7PcLpA6aYXIyYldSjX6rVXU=; b=iImfAsLhmyCchRHdarZSO5BLcTSqSo4QIRzCFWXbASBHST8tRrBMgJ5yxJzWE+dCxS mdUvE8vdDqHm9364clbZzgK9dkyhlO3wsilf/4ug34gDvgGCUpUu4z7pE70okI98U4Sn QfPNpxMbxZE7WeD9WbO2rRT7pY+IqqyHIydV+/IwnfrHQ5wKRVQ1f6JdW4nHEMawzMpq UBGk64IrtA6EF2gCO7KxU471HUjhOGRqS05vA3tI276pfAV6F4qJxEaH3J9MYfGVZMYP JlZ5SxnKsBI2bSC5goMrIclae+6ce5miuUwtALQqS2OY+xp4giaekQLhP0nmWyuKb4IF wvPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si288817edr.444.2020.04.30.12.01.35; Thu, 30 Apr 2020 12:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726774AbgD3S7k (ORCPT + 99 others); Thu, 30 Apr 2020 14:59:40 -0400 Received: from mga12.intel.com ([192.55.52.136]:41232 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbgD3S7j (ORCPT ); Thu, 30 Apr 2020 14:59:39 -0400 IronPort-SDR: iK43XeTadTuU2G1WX+2mVIxrfOq1IYLXCYsz8ShB72Y3MLc3R1UwXaOYj/DNqzUXvrY/z8L656 QlYdWleMrmdg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Apr 2020 11:59:38 -0700 IronPort-SDR: Ed+FWXPB3/MF2qsCgTd4joebR2FBMhxVdTEyzI/OAOvXfeDcNp7KT2BZTm4cXqjJfPT7ZdCKVg OutbuaWtcmcw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,336,1583222400"; d="scan'208";a="303360005" Received: from unknown (HELO nsgsw-wilsonpoint.lm.intel.com) ([10.232.116.102]) by FMSMGA003.fm.intel.com with ESMTP; 30 Apr 2020 11:59:37 -0700 From: Jon Derrick To: Bjorn Helgaas Cc: , Jon Derrick , Russell Currey , Sam Bobroff , "Oliver O'Halloran" , Bjorn Helgaas , Kuppuswamy Sathyanarayanan , Andy Shevchenko , Frederick Lawler , Rajat Jain , "Patel, Mayurkumar" , Olof Johansson , "Rafael J. Wysocki" , Mika Westerberg , Alex Williamson , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/2] PCI/ERR: Allow Native AER/DPC using _OSC Date: Thu, 30 Apr 2020 12:46:07 -0600 Message-Id: <1588272369-2145-1-git-send-email-jonathan.derrick@intel.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bjorn & Kuppuswamy, I see a problem in the DPC ECN [1] to _OSC in that it doesn't give us a way to determine if firmware supports _OSC DPC negotation, and therefore how to handle DPC. Here is the wording of the ECN that implies that Firmware without _OSC DPC negotiation support should have the OSPM rely on _OSC AER negotiation when determining DPC control: PCIe Base Specification suggests that Downstream Port Containment may be controlled either by the Firmware or the Operating System. It also suggests that the Firmware retain ownership of Downstream Port Containment if it also owns AER. When the Firmware owns Downstream Port Containment, it is expected to use the new "Error Disconnect Recover" notification to alert OSPM of a Downstream Port Containment event. In legacy platforms, as bits in _OSC are reserved prior to implementation, ACPI Root Bus enumeration will mark these Host Bridges as without Native DPC support, even though the specification implies it's expected that AER _OSC negotiation determines DPC control for these platforms. There seems to be a need for a way to determine if the DPC control bit in _OSC is supported and fallback on AER otherwise. Currently portdrv assumes DPC control if the port has Native AER services: static int get_port_device_capability(struct pci_dev *dev) ... if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) && pci_aer_available() && (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER))) services |= PCIE_PORT_SERVICE_DPC; Newer firmware may not grant OSPM DPC control, if for instance, it expects to use Error Disconnect Recovery. However it looks like ACPI will use DPC services via the EDR driver, without binding the full DPC port service driver. If we change portdrv to probe based on host->native_dpc and not AER, then we break instances with legacy firmware where OSPM will clear host->native_dpc solely due to _OSC bits being reserved: struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, ... if (!(root->osc_control_set & OSC_PCI_EXPRESS_DPC_CONTROL)) host_bridge->native_dpc = 0; So my assumption instead is that host->native_dpc can be 0 and expect Native DPC services if AER is used. In other words, if and only if DPC probe is invoked from portdrv, then it needs to rely on the AER dependency. Otherwise it should be assumed that ACPI set up DPC via EDR. This covers legacy firmware. However it seems like that could be trouble with newer firmware that might give OSPM control of AER but not DPC, and would result in both Native DPC and EDR being in effect. Anyways here are two patches that give control of AER and DPC on the results of _OSC. They don't mess with the HEST parser as I expect those to be removed at some point. I need these for VMD support which doesn't even rely on _OSC, but I suspect this won't be the last effort as we detangle Firmware First. [1] https://members.pcisig.com/wg/PCI-SIG/document/12888 Jon Derrick (2): PCI/AER: Use _OSC to determine Firmware First before HEST PCI/DPC: Use _OSC to determine DPC support drivers/pci/pcie/aer.c | 3 +++ drivers/pci/pcie/dpc.c | 3 --- drivers/pci/pcie/portdrv_core.c | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) -- 1.8.3.1